codec/h264/h264dec: simplified logic where there are things applicable to non-IDRs, which we don't handle yet.

This commit is contained in:
Saxon 2019-09-16 22:07:57 +09:30
parent 5939db6f1b
commit 117a75ae55
1 changed files with 7 additions and 12 deletions

View File

@ -122,12 +122,12 @@ func decodePicOrderCntType1(vid *VideoStream, ctx *SliceContext) (topFieldOrderC
// TODO: this will be prevFrameNum when we do frames other than IDR. // TODO: this will be prevFrameNum when we do frames other than IDR.
_ = vid.priorPic.FrameNum _ = vid.priorPic.FrameNum
if vid.idrPicFlag { if !vid.idrPicFlag {
vid.frameNumOffset = 0
} else {
panic("not implemented") panic("not implemented")
} }
vid.frameNumOffset = 0
absFrameNum := 0 absFrameNum := 0
if ctx.NumRefFramesInPicOrderCntCycle != 0 { if ctx.NumRefFramesInPicOrderCntCycle != 0 {
absFrameNum = vid.frameNumOffset + ctx.FrameNum 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. // TODO: this will be prevFrameNum when we do frames other than IDR.
_ = vid.priorPic.FrameNum _ = vid.priorPic.FrameNum
if vid.idrPicFlag { if !vid.idrPicFlag {
vid.frameNumOffset = 0
} else {
panic("not implemented") panic("not implemented")
} }
vid.frameNumOffset = 0
tempPicOrderCnt := 2 * (vid.frameNumOffset + ctx.FrameNum) // TODO: handle tempPicOrderCnt calculation for when not IDR.
if vid.idrPicFlag { var tempPicOrderCnt int
tempPicOrderCnt = 0
} else if ctx.RefIdc == 0 {
tempPicOrderCnt = 2*(vid.frameNumOffset+ctx.FrameNum) - 1
}
if !ctx.FieldPic { if !ctx.FieldPic {
topFieldOrderCnt = tempPicOrderCnt topFieldOrderCnt = tempPicOrderCnt