[FFmpeg-devel] [PATCH] get_bits_left()

Michael Niedermayer michaelni
Tue Nov 10 00:05:22 CET 2009


On Mon, Nov 09, 2009 at 05:14:02PM -0500, Ronald S. Bultje wrote:
> Hi,
> 
> On Mon, Nov 9, 2009 at 1:21 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Mon, Nov 09, 2009 at 10:29:07AM -0500, Ronald S. Bultje wrote:
> [..]
> >> 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
> 
> Thanks, applied.
> 
> Now, as for:
> 
> > On Mon, Nov 09, 2009 at 10:29:07AM -0500, Ronald S. Bultje wrote:
> >> 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));
> >> 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) {
> >> 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)){
> >> mpeg12.c:                int left= s->gb.size_in_bits - 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:                const int left= s->gb.size_in_bits -
> >> get_bits_count(&s->gb);
> >> 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);
> 
> Can I fix all of the above (I cut the non-obvious ones out) without
> further patches?

you can replace the "s->gb.size_in_bits - get_bits_count(&s->gb)" stuff

if the variables are different like
input_buffer_size * 8 - get_bits_count(&alac->gb)
then obviously i need to see the surrounding code and ill postpone that
until you checked that things still work after the change

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- 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/20091110/c17275a3/attachment.pgp>



More information about the ffmpeg-devel mailing list