# HG changeset patch # User stefano # Date 1240358657 0 # Node ID 717f799077ad3402d7c10f700b08ddf332f11266 # Parent b724134599eb597c412adc533a4af628241a89da Make read_line() do not depend on put_bits.h and speed up it. diff -r b724134599eb -r 717f799077ad pixdesc.h --- a/pixdesc.h Tue Apr 21 22:53:46 2009 +0000 +++ b/pixdesc.h Wed Apr 22 00:04:17 2009 +0000 @@ -25,7 +25,6 @@ #include #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 @@ 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 {