On Fri, Jun 10, 2016 at 10:25:38AM +0200, Anton Khirnov wrote: > Quoting Anton Khirnov (2016-06-10 10:16:00) > > Quoting Diego Biurrun (2016-06-09 17:11:46) > > > From: Alexandra Hájková <[email protected]> > > > --- a/libavcodec/eamad.c > > > +++ b/libavcodec/eamad.c > > > @@ -51,7 +52,7 @@ typedef struct MadContext { > > > BswapDSPContext bbdsp; > > > IDCTDSPContext idsp; > > > AVFrame *last_frame; > > > - GetBitContext gb; > > > + BitstreamContext bc; > > > void *bitstream_buf; > > > unsigned int bitstream_buf_size; > > > DECLARE_ALIGNED(16, int16_t, block)[64]; > > > @@ -129,17 +130,15 @@ static inline void decode_block_intra(MadContext > > > *s, int16_t * block) > > > const uint8_t *scantable = s->scantable.permutated; > > > int16_t *quant_matrix = s->quant_matrix; > > > > > > - block[0] = (128 + get_sbits(&s->gb, 8)) * quant_matrix[0]; > > > + block[0] = (128 + bitstream_read_signed(&s->bc, 8)) * > > > quant_matrix[0]; > > > > > > /* The RL decoder is derived from mpeg1_decode_block_intra; > > > Escaped level and run values a decoded differently */ > > > i = 0; > > > { > > > - OPEN_READER(re, &s->gb); > > > /* now quantify & encode AC coefficients */ > > > for (;;) { > > > - UPDATE_CACHE(re, &s->gb); > > > - GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], > > > TEX_VLC_BITS, 2, 0); > > > + BITSTREAM_RL_VLC(level, run, &s->bc, rl->rl_vlc[0], > > > TEX_VLC_BITS, 2); > > > > > > if (level == 127) { > > > break; > > > @@ -153,15 +152,13 @@ static inline void decode_block_intra(MadContext > > > *s, int16_t * block) > > > j = scantable[i]; > > > level = (level*quant_matrix[j]) >> 4; > > > level = (level-1)|1; > > > - level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - > > > SHOW_SBITS(re, &s->gb, 1); > > > - LAST_SKIP_BITS(re, &s->gb, 1); > > > + level = (level ^ bitstream_peek_signed(&s->bc, 1)) - > > > bitstream_peek_signed(&s->bc, 1); > > > + bitstream_skip(&s->bc, 1); > > > > This looks rather awkward. Isn't it identical to: > > int sign = bitstream_read(&s->bc, 1); > ^^^^ > read_signed of course
You're probably right, but your suggestion seems to go beyond the scope of this patch. Diego _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
