On Thu, Jan 26, 2017 at 11:10 AM, Diego Biurrun <di...@biurrun.de> wrote: > From: Alexandra Hájková <alexan...@khirnov.net> > > --- > libavcodec/jpeglsdec.c | 48 +++++----- > libavcodec/jpeglsenc.c | 14 +-- > libavcodec/mjpegbdec.c | 44 ++++----- > libavcodec/mjpegdec.c | 242 > +++++++++++++++++++++---------------------------- > libavcodec/mjpegdec.h | 5 +- > libavcodec/mxpegdec.c | 9 +- > 6 files changed, 165 insertions(+), 197 deletions(-)
This is hardly a fringe codec ;) > @@ -542,26 +533,14 @@ static int decode_block_progressive(MJpegDecodeContext > *s, int16_t *block, > return 0; > } > > - { > - OPEN_READER(re, &s->gb); > for (i = ss; ; i++) { > - UPDATE_CACHE(re, &s->gb); > - GET_VLC(code, re, &s->gb, s->vlcs[2][ac_index].table, 9, 2); > + code = bitstream_read_vlc(&s->bc, s->vlcs[2][ac_index].table, 9, > 2); > > run = ((unsigned) code) >> 4; > code &= 0xF; > if (code) { > i += run; > - if (code > MIN_CACHE_BITS - 16) > - UPDATE_CACHE(re, &s->gb); > - > - { > - int cache = GET_CACHE(re, &s->gb); > - int sign = (~cache) >> 31; > - level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign; > - } > - > - LAST_SKIP_BITS(re, &s->gb, code); > + level = bitstream_read_xbits(&s->bc, code); > > if (i >= se) { > if (i == se) { > @@ -584,17 +563,13 @@ static int decode_block_progressive(MJpegDecodeContext > *s, int16_t *block, > } else { > val = (1 << run); > if (run) { > - UPDATE_CACHE(re, &s->gb); > - val += NEG_USR32(GET_CACHE(re, &s->gb), run); > - LAST_SKIP_BITS(re, &s->gb, run); > + val += NEG_USR32(bitstream_read(&s->bc, 32), run); > } > *EOBRUN = val - 1; > break; > } > } > } > - CLOSE_READER(re, &s->gb); > - } > > if (i > *last_nnz) > *last_nnz = i; This chunk will be oddly indented after the patch, I would leave the {} around it (and then realign optionally, or not since there are a lot of places like that) seems ok otherwise -- Vittorio _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel