[Ffmpeg-devel] Fix for overflow issue in mpegvideo.c

Michael Niedermayer michaelni
Tue Jul 26 18:39:32 CEST 2005


On Tuesday 26 July 2005 16:15, Martin Boehme wrote:
> Michael Niedermayer wrote:
> > On Tuesday 26 July 2005 13:19, Martin Boehme wrote:
> >>Michael Niedermayer wrote:
> >>>btw i dont think buf_size=width*height*1.5 is enough, try random 255/0
> >>>sample values at qp=1, btw2 if you actually try this i would be
> >>>interrested in the results
> >>
> >>Tried it, with MPEG-4 I get about width*height*3.63 bytes per frame...
> >>ouch. So I now use width*height*4... ;-) under the assumption that the
> >>above is just about the worst case... (BTW, is that true?)
> >
> > probably not
> Hm, my feeling, too... any chance of computing an upper limit on the
> amount of data the encoder can spit out? (I'm not necessarily advocating
> doing this... just interested...)

1 bit modb
1 bit modb2
2bit mb_type
6bit cbp
2bit dquant
1bit interlaced dct
1bit mv type
4bit field select
2*2*2*20bit motion vectors
6*64*30bit dct coefficoents (YV12! otherwise its more)
47bit video packet header

-> 11745 bits per MB -> ~width*height*5.735

but note, if width and height are small then the size of the various headers 
must be considered too ...


More information about the ffmpeg-devel mailing list