diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2009-04-22 04:04:17 +0400 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2009-04-22 04:04:17 +0400 |
commit | 297b5a3f99d7da6307f164973d0d6d375ea3fbb7 (patch) | |
tree | aea8901f42dfb9593fbf20c6938942c3d0d94088 | |
parent | 9145021d681346b6a1fcf8081e7241cec5635d9f (diff) |
Make read_line() do not depend on put_bits.h and speed up it.
Originally committed as revision 18653 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/pixdesc.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/pixdesc.h b/libavcodec/pixdesc.h index a8ca48454c..6660ea1710 100644 --- a/libavcodec/pixdesc.h +++ b/libavcodec/pixdesc.h @@ -25,7 +25,6 @@ #include <inttypes.h> #include "libavutil/intreadwrite.h" -#include "get_bits.h" typedef struct AVComponentDescriptor{ 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 int flags= desc->flags; if (flags & PIX_FMT_BITSTREAM){ - GetBitContext gb; - init_get_bits(&gb, data[plane] + y*linesize[plane], linesize[plane]*8); - skip_bits_long(&gb, x*step + comp.offset_plus1-1); + int skip = x*step + comp.offset_plus1-1; + const uint8_t *p = data[plane] + y*linesize[plane] + (skip>>3); + int shift = 8 - depth - (skip&7); while(w--){ - int val = show_bits(&gb, depth); + int val = (*p >> shift) & mask; if(read_pal_component) val= data[1][4*val + c]; - skip_bits(&gb, step); + shift -= step; + p -= shift>>3; + shift &= 7; *dst++= val; } } else { |