[FFmpeg-devel] [PATCH] get_bits_left()

Michael Niedermayer michaelni
Mon Nov 9 19:21:29 CET 2009


On Mon, Nov 09, 2009 at 10:29:07AM -0500, Ronald S. Bultje wrote:
> Hi,
> 
> dv.c contains a get_bits_left().
> 
> $ grep -- "- get_bits_count" *.c
> alac.c:    if (input_buffer_size * 8 - get_bits_count(&alac->gb) > 8)
> alac.c:        av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n",
> input_buffer_size * 8 - get_bits_count(&alac->gb));
> cook.c:    bits_left =  p->bits_per_subpacket - get_bits_count(&q->gb);
> h261dec.c:        left= s->gb.size_in_bits - get_bits_count(&s->gb);
> h261dec.c:    for(i= s->gb.size_in_bits - get_bits_count(&s->gb); i>24; i-=1){
> h263.c:    left= s->gb.size_in_bits - get_bits_count(&s->gb);
> h263.c:    left= s->gb.size_in_bits - get_bits_count(&s->gb);
> h263.c://printf("%06X %d\n", show_bits(&s->gb, 24), s->gb.size_in_bits
> - get_bits_count(&s->gb));
> h263.c:    for(i= s->gb.size_in_bits - get_bits_count(&s->gb); i>24; i-=8) {
> h263.c:                    skip_bits_long(gb, pos - get_bits_count(gb));
> h263.c:                    skip_bits_long(gb, pos - get_bits_count(gb));
> h263dec.c://printf("%d %d %d %06X\n", s->mb_x, s->mb_y, s->gb.size*8 -
> get_bits_count(&s->gb), show_bits(&s->gb, 24));
> h263dec.c:       &&    s->gb.size_in_bits - get_bits_count(&s->gb) >=0
> h263dec.c:       &&    s->gb.size_in_bits - get_bits_count(&s->gb) < 48
> h263dec.c:        int left= s->gb.size_in_bits - get_bits_count(&s->gb);
> h263dec.c:            s->gb.size_in_bits - get_bits_count(&s->gb),
> h264.c:                               ( s->gb.size_in_bits -
> get_bits_count(&s->gb) + 7)/8);
> huffyuv.c:    if(count >= (s->gb.size_in_bits - get_bits_count(&s->gb))/(31*4)){
> huffyuv.c:    if(count >= (s->gb.size_in_bits - get_bits_count(&s->gb))/(31*2)){
> imc.c:    if(bit_allocation (q, stream_format_code, 512 - bitscount -
> get_bits_count(&q->gb), flag) < 0) {
> mlpdec.c:        if (substream_data_len[substr] * 8 -
> get_bits_count(&gb) >= 32) {
> mlpdec.c:            if (substream_data_len[substr] * 8 -
> get_bits_count(&gb) != 16)
> mpeg12.c:                int left= s->gb.size_in_bits - get_bits_count(&s->gb);
> mpegaudiodec.c:    bits_left = end_pos2 - get_bits_count(&s->gb);
> mpegaudiodec.c:            i= (s->gb.size_in_bits - get_bits_count(&s->gb))>>3;
> mpegaudiodec.c:        i= (s->gb.size_in_bits - get_bits_count(&s->gb))>>3;
> msmpeg4.c:    int left= buf_size*8 - get_bits_count(&s->gb);
> msmpeg4.c:                const int left= s->gb.size_in_bits -
> get_bits_count(&s->gb);
> qdm2.c:#define BITS_LEFT(length,gb) ((length) - get_bits_count ((gb)))
> qdm2.c:    packet_bytes = (q->compressed_size - get_bits_count(&gb) / 8);
> rv34.c:    bits = r->bits - get_bits_count(&s->gb);
> svq3.c:                skip_bits(&s->gb, h->next_slice_index -
> get_bits_count(&s->gb));
> vc1dec.c:        count = avctx->extradata_size*8 - get_bits_count(&gb);
> vp3.c:        av_log(avctx, AV_LOG_WARNING, "%d bits left in packet
> %X\n", 8*header_len[i] - get_bits_count(&gb), ptype);
> wavpack.c:        const int left_bits = s->gb_extra_bits.size_in_bits
> - get_bits_count(&s->gb_extra_bits);
> wavpack.c:        const int size = s->gb_extra_bits.size_in_bits -
> get_bits_count(&s->gb_extra_bits);
> 
> Let's move that somewhere sane so we can fix this travesty, see
> attached. I'm using it also in my decoder, hence my interest.

i was always a little against this but as its recurring and a lot of
people seem to like it, well, patch ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091109/0ef7094d/attachment.pgp>



More information about the ffmpeg-devel mailing list