Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
29th August 2007, 10:54 | #1 | Link |
Registered User
Join Date: Aug 2005
Posts: 29
|
A rookie question regarding on B frame in AVC
Hello guys, I have a rookie question on B frame coding in AVC, please help me clarify this, thanks in advance.
In AVC, the parameter NumberOfReferenceFrames defines the maximum number of reference frames an inter frame can use for prediction. But what is the maximum number of reference frames for a B frame? Is it still NumberOfReferenceFrames or 2*NumberOfReferenceFrames? Since I'm trying to allocate memory pool for reference frames, so this is very important for me. Thank you very much for your kindly answers! |
29th August 2007, 12:08 | #3 | Link |
Registered User
Join Date: Aug 2005
Posts: 29
|
Thank you for clarifying me that.
There is another thing that's confusing me now. How to control play flow of a H.264 bit-stream. For example, If I have a bit-stream of format I P B1 B2 B3 P, then I know that after decoding I frame, it can be displayed. Then the P frame is gonna wait there until next P frame decoded for display. But the display order of B frame is not such a clear case. So along with the decoding flow, how can I control the display flow to display the video in the correct order? Thank you guys a lot for everything. These are all basic questions, hope you guys don't mind me asking these things here. |
29th August 2007, 20:03 | #5 | Link | |
Registered User
Join Date: Dec 2004
Location: Tomsk, Russia
Posts: 366
|
Quote:
|
|
30th August 2007, 09:34 | #7 | Link |
Registered User
Join Date: Aug 2005
Posts: 29
|
Wait, I still have one more problem.....
In JM software, there is a parameter:"BReferencePictures", which indicates whether B frames can be used as a reference frame or not. But surprisingly, this info is not written to the bit-stream. Then how can I know on the decoder side that whether I should keep decoded B frames in the decoded picture buffer as a reference frame? Thanks again! |
30th August 2007, 10:04 | #8 | Link |
x264 developer
Join Date: Sep 2004
Posts: 2,392
|
There is no "whether B frames can be used as a reference frame or not". Each individual frame can be referenced or not, indicated by the NAL priority. "disposable" = not referenced, the other 3 possible settings are all referenced. Also look at "memory control operations" which can manipulate the DPB beyond just choosing which pictures get added.
Last edited by akupenguin; 30th August 2007 at 10:07. |
30th August 2007, 11:21 | #9 | Link | |
Registered User
Join Date: Aug 2005
Posts: 29
|
Quote:
|
|
31st August 2007, 09:01 | #12 | Link |
Registered User
Join Date: Aug 2005
Posts: 29
|
As the AVC player process goes on, more rookie questions are on my way. First I would like to thank your patience to let me keep throwing these stuff to your guys. Thank you very much for this.
This time, my question is that if I have a sequence decoded in the following order: I1 P5 B3 B2 B4, the number indicate the display order of the frame. But for B3, the frame is marked disposable. By my earlier questions, this frame should be decoded and discarded not using as a reference frame. But I can't really discard it right? I need to hold the decoded B3 frame a little bit longer to wait for B2 get decoded and displayed. Then I can display B3 and release the memory it occupies. Thus, by defining a frame disposable, it only means that I'll not use it for reference but I can't give the frame up until until it is displayed for as long as it takes. Am I right about this? Or there is no such way to generate a sequence I described above. To my best memory, SVC has sequences like this I believe. I don't know what about how this thing is in the main profile AVC. Thank you very much for the help! |
31st August 2007, 09:14 | #13 | Link | |
Registered User
Join Date: Dec 2004
Location: Tomsk, Russia
Posts: 366
|
Quote:
In case B3 isn't used for reference, but there is a gap between P5 and B3 in pic_order_cnt, you should store this non reference B-frame in DPB until it's time to display will come. [edit] oops, sorry - gap between I1 and B3, not between P5 and B3 |
|
31st August 2007, 09:46 | #14 | Link | |
Registered User
Join Date: Aug 2005
Posts: 29
|
Quote:
So I am right about having to keep disposable frames in some certain circumstances then. This will lead to other issue. If there is a lot of B frames between I/P frames and they are coded in pyramaid pattern. But the weird thing is that they are all disposable frames. How much memory I have to allocate to deal with this situation? Since we only keep the buffer for display not for reference, so I guess that the more B frames we have in a row, the more buffer we need. This will definitely make the hardware solution harder right? Especially for hardware with limited RAM. Then how can we avoid this thing form happening? Thanks! |
|
31st August 2007, 10:35 | #15 | Link |
x264 developer
Join Date: Sep 2004
Posts: 2,392
|
See num_reorder_frames which is an optional field in the SPS header. If it is not present, the standard gives a rule to infer an upper bound. And in any case it will never be more than 16 frames.
It's not directly related to disposability: Even if all frames are referenced, they could still be nontrivially reordered. |
31st August 2007, 13:13 | #17 | Link |
x264 developer
Join Date: Sep 2004
Posts: 2,392
|
Up to 16 frames total, and at any given time some of them will be referenced or in the reorder buffer or both.
The main factor that determines the bound is Level. Each of the Levels puts an upper bound on the amount of memory you have to allocate to decoded frames. So higher resolution means fewer frames at a given Level. Last edited by akupenguin; 31st August 2007 at 13:16. |
Thread Tools | Search this Thread |
Display Modes | |
|
|