Quoting Diego Biurrun (2016-06-09 17:12:14) > From: Alexandra Hájková <[email protected]> > > --- > libavcodec/escape124.c | 83 > +++++++++++++++++++++++++------------------------- > 1 file changed, 42 insertions(+), 41 deletions(-) > > diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c > index 6d1b487..c9edca4 100644 > --- a/libavcodec/escape124.c > +++ b/libavcodec/escape124.c > @@ -21,7 +21,7 @@ > > #define BITSTREAM_READER_LE > #include "avcodec.h" > -#include "get_bits.h" > +#include "bitstream.h" > #include "internal.h" > > typedef union MacroBlock { > @@ -48,8 +48,9 @@ typedef struct Escape124Context { > CodeBook codebooks[3]; > } Escape124Context; > > -static int can_safely_read(GetBitContext* gb, int bits) { > - return get_bits_left(gb) >= bits; > +static int can_safely_read(BitstreamContext *bc, int bits) > +{ > + return bitstream_bits_left(bc) >= bits; > } > > /** > @@ -86,13 +87,13 @@ static av_cold int escape124_decode_close(AVCodecContext > *avctx) > return 0; > } > > -static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth, > +static CodeBook unpack_codebook(BitstreamContext *bc, unsigned depth, > unsigned size) > { > unsigned i, j; > CodeBook cb = { 0 }; > > - if (!can_safely_read(gb, size * 34)) > + if (!can_safely_read(bc, size * 34)) > return cb; > > if (size >= INT_MAX / sizeof(MacroBlock)) > @@ -104,9 +105,9 @@ static CodeBook unpack_codebook(GetBitContext* gb, > unsigned depth, > cb.depth = depth; > cb.size = size; > for (i = 0; i < size; i++) { > - unsigned mask_bits = get_bits(gb, 4); > - unsigned color0 = get_bits(gb, 15); > - unsigned color1 = get_bits(gb, 15); > + unsigned mask_bits = bitstream_read(bc, 4); > + unsigned color0 = bitstream_read(bc, 15); > + unsigned color1 = bitstream_read(bc, 15); > > for (j = 0; j < 4; j++) { > if (mask_bits & (1 << j)) > @@ -118,47 +119,47 @@ static CodeBook unpack_codebook(GetBitContext* gb, > unsigned depth, > return cb; > } > > -static unsigned decode_skip_count(GetBitContext* gb) > +static unsigned decode_skip_count(BitstreamContext *bc) > { > unsigned value; > // This function reads a maximum of 23 bits, > // which is within the padding space > - if (!can_safely_read(gb, 1)) > + if (!can_safely_read(bc, 1)) > return -1; > - value = get_bits1(gb); > + value = bitstream_read_bit(bc); > if (!value) > return value; > > - value += get_bits(gb, 3); > + value += bitstream_read(bc, 3); > if (value != (1 + ((1 << 3) - 1))) > return value; > > - value += get_bits(gb, 7); > + value += bitstream_read(bc, 7); > if (value != (1 + ((1 << 3) - 1)) + ((1 << 7) - 1)) > return value; > > - return value + get_bits(gb, 12); > + return value + bitstream_read(bc, 12); > } > > -static MacroBlock decode_macroblock(Escape124Context* s, GetBitContext* gb, > - int* codebook_index, int > superblock_index) > +static MacroBlock decode_macroblock(Escape124Context *s, BitstreamContext > *bc, > + int *codebook_index, int > superblock_index) > { > // This function reads a maximum of 22 bits; the callers > // guard this function appropriately > unsigned block_index, depth; > - int value = get_bits1(gb); > + int value = bitstream_read_bit(bc); > if (value) { > static const char transitions[3][2] = { {2, 1}, {0, 2}, {1, 0} }; > - value = get_bits1(gb); > + value = bitstream_read_bit(bc); > *codebook_index = transitions[*codebook_index][value]; > } > > depth = s->codebooks[*codebook_index].depth; > > // depth = 0 means that this shouldn't read any bits; > - // in theory, this is the same as get_bits(gb, 0), but > + // in theory, this is the same as bitstream_read(bc, 0), but > // that doesn't actually work.
The comment does not apply anymore. Otherwise looks ok. -- Anton Khirnov _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
