View Full Version : Frame lifetimes in DPB
Dust Signs
1st November 2010, 21:06
Hi,
I'm currently dealing with the lifetime of frames in both the DPB and the reference lists (L0 and L1) respectively. Assuming a constant number of B frames and reference frames, no scene cuts, IDR frames (besides the very first) or long term references, is it possible to determine the lifetime of a frame (in processed frames) or at least give an overestimation of it? I currently assume that the maximum lifetime of a frame in the DPB is limited by the number of B frames and the sizes of both L0 and L1, but summing up those three yields a lifetime which is an underestimation for some frames, especially when using a high number of B frames. I'm aware that a formula which is 100% exact is hard to determine here, but an overestimation of some sort would be nice to have. Any hints concerning a correction of my thoughts mentioned above or new ideas would be appreciated. Any suggestions?
Thanks in advance,
Best regards,
Dust Signs
Dark Shikari
1st November 2010, 21:20
You'd have to assume no MMCO, too.
Dust Signs
1st November 2010, 21:31
@Dark Shikari: of course, you're right. If I didn't overlook anything, it should nonetheless be possible if MMCO is limited to removing frames (p.e. B frames which are no longer used as references at a certain point). This would reduce the lifetime of the frames being removed and prolong the lifetime of those frames not being deleted (in the B frame case mentioned above this would be the P frames for example). An estimation including this limited form of MMCO would of course be nice, but a first estimation disregarding MMCO would be nice too :).
Dust Signs
Dark Shikari
1st November 2010, 21:43
@Dark Shikari: of course, you're right. If I didn't overlook anything, it should nonetheless be possible if MMCO is limited to removing frames (p.e. B frames which are no longer used as references at a certain point). This would reduce the lifetime of the frames being removed and prolong the lifetime of those frames not being deleted (in the B frame case mentioned above this would be the P frames for example). An estimation including this limited form of MMCO would of course be nice, but a first estimation disregarding MMCO would be nice too :).
Dust SignsRemoving frames means the DPB doesn't fill up as fast, so other (older) frames don't get removed, AFAIK.
Dust Signs
1st November 2010, 21:55
Indeed, this makes the frames which are not removed live longer. Assuming that all B frames will be discarded eventually, is it true that the P frames would live for a maximum of (number of B frames) * (size of DPB)? If B frames are kept as references, the lifetime of the P frames would be shorter of course as the B frames would occupy some "slots" in the DPB too. But what about an individual B frame? Is there a possibility to decide how long it will stay in the DPB before it will be removed (either by MMCO (complex case) or by the limited size of the DPB when other frames are pushed into it (simpler case))?
Dust Signs
Trahald
1st November 2010, 23:32
Referring to your OP, remember that there is only one dpb and there is only one order for it. L0 and L1 are just lists and can have less frames referenced in them than the dpb has actual frames. a frame can stay in the dpb until you hit an IDR or a MMCO command 5 if it is marked for Long term reference or mmco is killing the other frames (and probably other random reasons i cant think of atm). I dont really think there is a way to estimate this... you have to 'virtually' keep track of the dpb. You can have your software halt if it hits a stream with those things.
Manao
2nd November 2010, 06:38
Without MMCOs, a reference frame stays until you have put num_ref_frames reference frames into the DPB. So with X bframes in a row, without pyramid, a reference frame may stay during X * num_ref_frames frames in the DPB. As soon as you consider MMCOs (which are almost mandatory for pyramid), it becomes too complicated and the only way is to track DPB operations.
Dust Signs
2nd November 2010, 08:37
Thanks for your answers. My current view of the maximum frame lifetimes is now the following (please correct me if I'm wrong):
If B frames are not kept as references and removed via MMCO when the next P frame "arrives":
* B frames have a maximum lifetime equal to the number of B frames used as they will all be deleted from the DPB when a P frame "arrives"; if one knows how many B frames in coding order follow a given B frame, one can also estimate its lifetime with (number of subsequent B frames)
* I and P frames have a maximum lifetime of (number of B frames) * (size of DPB). As some of the previous P frames will drop out earlier due to the B frames which are put into the DPB, the actual lifetime will be shorter; if I'm not wrong, it should be (number of B frames) * ((size of DPB) - (number of B frames))
If B frames are kept as references:
* Both I, P and B frames will live for a maximum of (size of DPB)
Any further suggestions? Is it possible to further optimize these formulae, i.e. calculate them less conservatively, but still overestimating the lifetimes?
Thanks in advance,
Regards,
Dust Signs
Dust Signs
6th November 2010, 12:16
No further comments? I'm currently trying to expand the formulae for more general use cases to be able to estimate a maximum life time. Are there any suggestions concerning the formulae in my above post (flaws, possible "optimizations")? It would be helpful for me if I knew whether these formulae are correct. A more precise life time calculation would be nice, but currently it is more important to me to be sure that there are no flaws in my current assumptions.
Thanks in advance for your help,
Best regards,
Dust Signs
Manao
8th November 2010, 10:26
Your assumptions are correct provided there are no MMCOs. Sadly, since MMCOs are almost mandatory as soon as there are B reference, ignoring MMCOs isn't a good idea.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.