From 117a75ae554e5ffcdb3f97c0d9c0d3584eb1008a Mon Sep 17 00:00:00 2001 From: Saxon Date: Mon, 16 Sep 2019 22:07:57 +0930 Subject: [PATCH] codec/h264/h264dec: simplified logic where there are things applicable to non-IDRs, which we don't handle yet. --- codec/h264/h264dec/decode.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/codec/h264/h264dec/decode.go b/codec/h264/h264dec/decode.go index bd686efc..ac4ee928 100644 --- a/codec/h264/h264dec/decode.go +++ b/codec/h264/h264dec/decode.go @@ -122,12 +122,12 @@ func decodePicOrderCntType1(vid *VideoStream, ctx *SliceContext) (topFieldOrderC // TODO: this will be prevFrameNum when we do frames other than IDR. _ = vid.priorPic.FrameNum - if vid.idrPicFlag { - vid.frameNumOffset = 0 - } else { + if !vid.idrPicFlag { panic("not implemented") } + vid.frameNumOffset = 0 + absFrameNum := 0 if ctx.NumRefFramesInPicOrderCntCycle != 0 { absFrameNum = vid.frameNumOffset + ctx.FrameNum @@ -172,18 +172,13 @@ func decodePicOrderCntType2(vid *VideoStream, ctx *SliceContext) (topFieldOrderC // TODO: this will be prevFrameNum when we do frames other than IDR. _ = vid.priorPic.FrameNum - if vid.idrPicFlag { - vid.frameNumOffset = 0 - } else { + if !vid.idrPicFlag { panic("not implemented") } + vid.frameNumOffset = 0 - tempPicOrderCnt := 2 * (vid.frameNumOffset + ctx.FrameNum) - if vid.idrPicFlag { - tempPicOrderCnt = 0 - } else if ctx.RefIdc == 0 { - tempPicOrderCnt = 2*(vid.frameNumOffset+ctx.FrameNum) - 1 - } + // TODO: handle tempPicOrderCnt calculation for when not IDR. + var tempPicOrderCnt int if !ctx.FieldPic { topFieldOrderCnt = tempPicOrderCnt