diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2002-07-09 10:35:10 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-07-09 10:35:10 +0000 |
commit | 8db1a1dde0f61f98e9e69707eb10601e42ad3a34 (patch) | |
tree | 4ce7ff2694e026aebb4965d9fad403639e786282 /libavcodec/mpeg12.c | |
parent | 436483c2ec856a7e63dd57ec5fe963831bc059cd (diff) | |
download | ffmpeg-8db1a1dde0f61f98e9e69707eb10601e42ad3a34.tar.gz |
new bitstream reader API (old get_bits() based one is emulated and will still be supported in the future cuz its simpler)
minor optimizations to get_vlc
Originally committed as revision 725 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r-- | libavcodec/mpeg12.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 9b917ce270..53c4e32668 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -961,21 +961,20 @@ static int mpeg1_decode_block(MpegEncContext *s, dprintf("dc=%d diff=%d\n", dc, diff); i = 1; } else { - int bit_cnt, v; - UINT32 bit_buf; - UINT8 *buf_ptr; + int v; + OPEN_READER(re, &s->gb); i = 0; /* special case for the first coef. no need to add a second vlc table */ - SAVE_BITS(&s->gb); - SHOW_BITS(&s->gb, v, 2); + UPDATE_CACHE(re, &s->gb); + v= SHOW_UBITS(re, &s->gb, 2); if (v & 2) { run = 0; level = 1 - ((v & 1) << 1); - FLUSH_BITS(2); - RESTORE_BITS(&s->gb); + SKIP_BITS(re, &s->gb, 2); + CLOSE_READER(re, &s->gb); goto add_coef; } - RESTORE_BITS(&s->gb); + CLOSE_READER(re, &s->gb); } /* now quantify & encode AC coefs */ @@ -1035,26 +1034,25 @@ static int mpeg2_decode_block_non_intra(MpegEncContext *s, mismatch = 1; { - int bit_cnt, v; - UINT32 bit_buf; - UINT8 *buf_ptr; + int v; + OPEN_READER(re, &s->gb); i = 0; - if (n < 4) + if (n < 4) matrix = s->inter_matrix; else matrix = s->chroma_inter_matrix; - + /* special case for the first coef. no need to add a second vlc table */ - SAVE_BITS(&s->gb); - SHOW_BITS(&s->gb, v, 2); + UPDATE_CACHE(re, &s->gb); + v= SHOW_UBITS(re, &s->gb, 2); if (v & 2) { run = 0; level = 1 - ((v & 1) << 1); - FLUSH_BITS(2); - RESTORE_BITS(&s->gb); + SKIP_BITS(re, &s->gb, 2); + CLOSE_READER(re, &s->gb); goto add_coef; } - RESTORE_BITS(&s->gb); + CLOSE_READER(re, &s->gb); } /* now quantify & encode AC coefs */ |