Mercurial > libavcodec.hg
diff mpeg12.c @ 520:19a5e2a81e1a libavcodec
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
| author | michaelni |
|---|---|
| date | Tue, 09 Jul 2002 10:35:10 +0000 |
| parents | 0b4450c15067 |
| children | 3c07cf9595de |
line wrap: on
line diff
--- a/mpeg12.c Sun Jul 07 08:34:46 2002 +0000 +++ b/mpeg12.c Tue Jul 09 10:35:10 2002 +0000 @@ -961,21 +961,20 @@ 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 @@ 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 */
