PDA

View Full Version : Maximum frame size in bits for level 4.1?


codimahi
2nd August 2006, 15:30
Hi all,

Does any body an have idea about the maximum frame size for all the levels or in specific level 4.1 in h.264?. I am only able to find the maximum frame size in terms of number of macro blocks.

Thanks

sysKin
2nd August 2006, 15:42
Maximum *encoded* frame size? It's likely to be not defined, since decoding is progressive and you don't need to keep full frame in decoder's memory at any given time.

codimahi
2nd August 2006, 16:12
Maximum *encoded* frame size? It's likely to be not defined, since decoding is progressive and you don't need to keep full frame in decoder's memory at any given time.

There should be some limit on encoded picture buffer. Let's say the bit rate is 50Mbits/sec, then it does not mean the size is (50MB/30frames) 1.5 Mbits/sec. At the same time I can not take assume 20 Mbits/sec for one frame and 30MB for all the remaining 30 frames, which is unrealistic.

This is bit confusing for me.

Atleast I would be interested in knowing the realistic encoded frame size.

I checked the encoded frame size of some of the CIF formats. It was around 500kbits. But still I can not conclude that its size will not exceed this.

codimahi
2nd August 2006, 17:47
Recently I came accross this formula to compute maximum encoded frame size base on the levels in the standards:

(#pixels) x (8 bits) / (minimum compression ratio) = max-frame-size(in bits)

For : (level 4.1, FORMAT 4:2:0, 8 bits per pixel)
We will have 3 M pixels. 1M pixels for chroma and 2M pixels for luma.Minimum compression ratio is given in the standard as 2 (for level-4.1)

So max-frame-size will be

3 Mpixels x 8 / 2= 12 Mbits

So a encoded-frame-size can not be more than 12 Mbits in any case for this FORMAT.

Can anybody tell me, if my calculation is correct or not.

sysKin
2nd August 2006, 18:18
At the same time I can not take assume 20 Mbits/sec for one frame and 30MB for all the remaining 30 frames, which is unrealistic.
What you wrote doesn't make sense, 20mbps vs 30mbps is not a contrast is it?

Did you mean to say that one frame takes 20mbits and the remaining frames are 30mbps? That's very realistic and happens very often - one keyframe/I-frame/IDR-frame is huge, remaining frames are nil.

As long as other VBV constraints are satisfied, this is perfectly acceptable.

This is bit confusing for me.
From your second post I see you have completely confused encoded frame size VS decoded frame size. What is your question again?
So max-frame-size will be

3 Mpixels x 8 / 2= 12 Mbits

So a encoded-frame-size can not be more than 12 Mbits in any case for this FORMAT.

Can anybody tell me, if my calculation is correct or not.
Incorrect, because you used *output* format information (resolution, bits per pixel) and somehow related it to *bitstream* information. They are completely unrelated.

akupenguin
2nd August 2006, 18:52
Incorrect, because you used *output* format information (resolution, bits per pixel) and somehow related it to *bitstream* information. They are completely unrelated.
Nevertheless, there is a "Min compression ratio" field in the levels constraints, and this is exactly what it means.
Granted, x264 completely ignores it. So just because you ask for level 4.1 and x264 doesn't print any errors, doesn't mean that all your frames are actually smaller than the limit calculated this way.

codimahi
3rd August 2006, 12:27
Granted, x264 completely ignores it. So just because you ask for level 4.1 and x264 doesn't print any errors, doesn't mean that all your frames are actually smaller than the limit calculated this way.

Then conforming to the standard, can I assume that all frames are compressed more than "Min-compression-ratio".

1.
Or do I need to take the whole encoded stream output.

2
Or there is a limit for any macroblock.

For eg: Format 4:2:0 there are 384 pixels per macro-block

384 x 8 bits = 3072 bits per macroblock.
This macroblock has to be compressed at least 2 time(as
per level 4.1).

So a macroblock will have maximum of 3072/2 = 1536 bits.

akupenguin
3rd August 2006, 21:59
The limit listed in the levels tables is per-frame.
There is a separate limit per macroblock: no more than 385 bytes per macroblock, i.e. header + no compression. x264 ignores this limit too.

Selur
4th August 2006, 08:55
Is there a list somewhere which states which level invokes which limitations? (Sorry, if it was posted somewhere and I missed it)

Cu Selur

sysKin
4th August 2006, 09:32
Nevertheless, there is a "Min compression ratio" field in the levels constraints, and this is exactly what it means.
Very interesting. Not because that limit exists (I didn't think so but didn't rule it out either), but because the limit is relative to current resolution, not maximum possible resolution. Funny :)

kwtc
4th August 2006, 14:03
Is there a list somewhere which states which level invokes which limitations?
Cu Selur

Well, there is the H.264 standard, annex A.

codimahi
4th August 2006, 14:41
Thank u all for clearing my doubts.

Zero1
6th August 2006, 13:31
I cobbled this together some time ago, it may or may not be of use to you.

http://img122.imageshack.us/img122/983/h264levelsob0.png