Commit c172f591 authored by stefano's avatar stefano

Make read_line() do not depend on put_bits.h and speed up it.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18653 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 7daaac76
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <inttypes.h> #include <inttypes.h>
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "get_bits.h"
typedef struct AVComponentDescriptor{ typedef struct AVComponentDescriptor{
uint16_t plane :2; ///< which of the 4 planes contains the component uint16_t plane :2; ///< which of the 4 planes contains the component
...@@ -114,15 +113,17 @@ static inline void read_line(uint16_t *dst, const uint8_t *data[4], const int li ...@@ -114,15 +113,17 @@ static inline void read_line(uint16_t *dst, const uint8_t *data[4], const int li
int flags= desc->flags; int flags= desc->flags;
if (flags & PIX_FMT_BITSTREAM){ if (flags & PIX_FMT_BITSTREAM){
GetBitContext gb; int skip = x*step + comp.offset_plus1-1;
init_get_bits(&gb, data[plane] + y*linesize[plane], linesize[plane]*8); const uint8_t *p = data[plane] + y*linesize[plane] + (skip>>3);
skip_bits_long(&gb, x*step + comp.offset_plus1-1); int shift = 8 - depth - (skip&7);
while(w--){ while(w--){
int val = show_bits(&gb, depth); int val = (*p >> shift) & mask;
if(read_pal_component) if(read_pal_component)
val= data[1][4*val + c]; val= data[1][4*val + c];
skip_bits(&gb, step); shift -= step;
p -= shift>>3;
shift &= 7;
*dst++= val; *dst++= val;
} }
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment