[XviD-devel] Min. FrameSize II

Michael Niedermayer xvid-devel@xvid.org
Sun, 15 Sep 2002 14:44:36 +0200


Hi

On Sunday 15 September 2002 12:54, Dirk Knop wrote:
> Hi,
>
> i feel dumb, somehow my mathematics basics have left the building... ;)
>
> Here some results:
>
> Resolution | MBs | Minsize frame bytes
> -----------+-----+---------------------
>   320x240  | 300 |  48 (kf:  855 bytes)
>   352x288  | 396 |  60 (kf: 1119 bytes)
>   480x576  |1080 | 146 (kf: 3000 bytes)
>   640x272  | 680 |  96 (kf: 1900 bytes)
>   640x352  | 880 | 121 (kf: 2450 bytes)
>   720x576  |1620 | 213 (kf: 4485 bytes)
>
> All tests done at 1pass const. quant. 1, pure black image sequence.
>
> I don't find the propper relation, I assume there is an avi frame
> overhead involved. The rest of the formula should look like this:
>
> MBs / X + Y * Z + 24 = MinSize
>
> Can someone give me a hand with this? Dan tried and offered to look into
> the sources, but maybe someone here has the magic numbers at hand ;)
for P frames the minimum bitstream size is: (headerSize + MBnum + 8)/8

the headerSize is not constant though (the timestamps for example can be 
stored with differnt number of bits and need 1 extra bit every sec ...) 

for I Frames: (IHeaderSize + firstMB + (MBnum-1)*MBSize + 8)/8

firstMB depends upon the color/brightness & quantizer for the frame, gray is 
smallest (firstMB == MBSize than)  

MBSize= 4*3(lumDC) + 2*2(chromaDC) + 1(acpred-bit) + 1(mbtype) + 4(cbpy)= 22

[...]

Michael