I’m trying to rearrange captioning and need the frame number / picture order count or really any way to figure out the order of the frames with the cuvidparser on the HandlePictureDecode callback that only exposes CUVIDPICPARAMS. H264 exposes PoC but MPEG2 doesn’t appear to. While a state machine for IPBBP -> IBBP would work for perfect video, dropped/lost frames are problematic to detect.
I noticed that CUVIDMPEG2PICPARAMS has the following params:
int ForwardRefIdx; // Picture index of forward reference (P/B-frames)
int BackwardRefIdx; // Picture index of backward reference (B-frames)
I can’t make heads or tails of what these numbers mean while stepping through each frame. Can anyone shed any light on what exactly these parameters refer to? I basically need some way to identify what frame was passed to HandlePictureDecode. I even tried looking at pBitstreamData but it seems (?) the MPEG2 Picture Header is not included so I can’t parse for the TSN.
TSN | FRAME TYPE | ForwardRefIdx | BackwardRefIdx 0 | I | -1 | -1 3 | P | 0 | -1 1 | B | 0 | 1 2 | B | 0 | 1 6 | P | 1| -1 4 | B | 1 | 4 5 | B | 1 | 4 9 | P | 4 | -1 7 | B | 4 | 7 8 | B | 4 | 7 12 | P | 7 | -1