On 9 January 2012 05:24, Ronald S. Bultje <[email protected]> wrote: > Hi, > > On Sun, Jan 8, 2012 at 6:52 PM, Laurentiu Ion > <[email protected]> wrote: >> -#define kmvc_init_getbits(bb, src) bb.bits = 7; bb.bitbuf = *src++; >> +#define kmvc_init_getbits(bb) bb.bits = 7; bb.bitbuf = >> bytestream2_get_byte(&g); >> >> -#define kmvc_getbit(bb, src, src_end, res) {\ >> +#define kmvc_getbit(bb, res) {\ >> res = 0; \ >> if (bb.bitbuf & (1 << bb.bits)) res = 1; \ >> bb.bits--; \ >> if(bb.bits == -1) { \ >> - if (src >= src_end) { \ >> + if (!bytestream2_get_bytes_left(&g)) { \ >> av_log(ctx->avctx, AV_LOG_ERROR, "Data overrun\n"); \ >> return AVERROR_INVALIDDATA; \ >> } \ >> - bb.bitbuf = *src++; \ >> + bb.bitbuf = bytestream2_get_byte(&g); \ >> bb.bits = 7; \ >> } \ >> } > > You're making the macro not self-contained here, I think 'g' should be > an argument to both functions. > > Also, Kostya, can't we emulate this kind of bit reading behaviour by > doing manual CACHE_UPDATE() calls and then using the regular > bitreader?
Maybe we can but it would be much uglier and less understandable. Even if you got second hammer, there are still objects here that are not nails or thumbs. _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
