codec/h264/h264dec/decode.go: using if else structures for topFieldOrderCnt/bottomFieldOrderCnt value derivations in decodePicOrderCntType2

This commit is contained in:
Saxon 2019-09-10 12:12:08 +09:30
parent 40fa50d4f0
commit 5939db6f1b
1 changed files with 7 additions and 10 deletions

View File

@ -178,24 +178,21 @@ func decodePicOrderCntType2(vid *VideoStream, ctx *SliceContext) (topFieldOrderC
panic("not implemented")
}
var tempPicOrderCnt int
switch {
case vid.idrPicFlag:
tempPicOrderCnt := 2 * (vid.frameNumOffset + ctx.FrameNum)
if vid.idrPicFlag {
tempPicOrderCnt = 0
case ctx.RefIdc == 0:
} else if ctx.RefIdc == 0 {
tempPicOrderCnt = 2*(vid.frameNumOffset+ctx.FrameNum) - 1
default:
tempPicOrderCnt = 2 * (vid.frameNumOffset + ctx.FrameNum)
}
switch {
case ctx.FieldPic:
if !ctx.FieldPic {
topFieldOrderCnt = tempPicOrderCnt
bottomFieldOrderCnt = tempPicOrderCnt
case ctx.BottomField:
} else if ctx.BottomField {
bottomFieldOrderCnt = tempPicOrderCnt
default:
} else {
topFieldOrderCnt = tempPicOrderCnt
}
return
}