Video Compression

VideoNerd

Frames with negative POCs (do not confuse with pic_order_cnt_lsb ) in AVC/H.264 are allowed, it’s not nonsense.

To explain how a frame with negative POC can occur in AVC/H.264 stream, let’s introduce a new conception of Leading Frames (actually the notion of leading pictures is taken from HEVC/H.265) :

           Leading pictures – pictures following a IDR frame in decoding order but preceding it in presentation order.

POC for each frame is calculated as POC = PocMsb + pic_order_cnt_lsb,  where pic_order_cnt_lsb is signaled in the slice header. The formula for updating PocMsb is slightly tricky (although in most of cases PocMsb is incremented by the magnitude equal to MaxPicOrderCntLsb each time pic_order_cnt_lsb wrapped around):

If  pic_order_cnt_lsb < prevPicOrderCntLsb AND  (prevPicOrderCntLsb − pic_order_cnt_lsb)  >= MaxPicOrderCntLsb / 2

               PicOrderCntMsb = prevPicOrderCntMsb + MaxPicOrderCntLsb { pic_order_cnt_lsb wrapped around }

Else if pic_order_cnt_lsb > prevPicOrderCntLsb  AND  (pic_order_cnt_lsb − prevPicOrderCntLsb) > MaxPicOrderCntLsb / 2 

             PicOrderCntMsb = prevPicOrderCntMsb − MaxPicOrderCntLsb   { here negative POC might occur }

Else

                         PicOrderCntMsb = prevPicOrderCntMsb

 

Notice that MaxPicOrderCntLsb is derived from SPS parameter – log2_max_pic_order_cnt_lsb and equal to MaxPicOrderCntLsb = 1<< log2_max_pic_order_cnt_lsb.

Let’s suppose we have s stream beginning with IDR-frame and MaxPicOrderCntLsb = 64 (log2_max_pic_order_cnt_lsb=6), let’s also suppose that the second frame in the stream has pic_order_cnt_lsb = 60 then POC of the second frame is derived as -4 (notice that prevPicOrderCntMsb=0 and prevPicOrderCntLsb=0 for each IDR-frame).

For a player a frame with a negative POC following after the IDR-frame means that this frame is displayed before the IDR frame. The player can discard this frame if it starts playback from this IDR.  

 

11 Responses

  1. Hello, Neat post. There is an issue with your web site in web explorer, might check this?K IE still is the market leader and a huge component to other folks will pass over your fantastic writing due to this problem.

  2. I found your weblog site on google and examine a couple of of your early posts. Continue to maintain up the excellent operate. I just additional up your RSS feed to my MSN News Reader. In search of ahead to studying more from you in a while!…

  3. Hmm it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I too am an aspiring blog writer but I’m still new to everything. Do you have any tips for beginner blog writers? I’d genuinely appreciate it.

  4. What i do not realize is in fact how you’re not really a lot more well-favored than you may be right now. You’re very intelligent. You know therefore significantly in terms of this topic, produced me in my opinion imagine it from numerous varied angles. Its like women and men don’t seem to be interested except it’s something to accomplish with Lady gaga! Your own stuffs nice. At all times maintain it up!

Leave a Reply

Your email address will not be published. Required fields are marked *