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") panic("not implemented")
} }
var tempPicOrderCnt int tempPicOrderCnt := 2 * (vid.frameNumOffset + ctx.FrameNum)
switch { if vid.idrPicFlag {
case vid.idrPicFlag:
tempPicOrderCnt = 0 tempPicOrderCnt = 0
case ctx.RefIdc == 0: } else if ctx.RefIdc == 0 {
tempPicOrderCnt = 2*(vid.frameNumOffset+ctx.FrameNum) - 1 tempPicOrderCnt = 2*(vid.frameNumOffset+ctx.FrameNum) - 1
default:
tempPicOrderCnt = 2 * (vid.frameNumOffset + ctx.FrameNum)
} }
switch { if !ctx.FieldPic {
case ctx.FieldPic:
topFieldOrderCnt = tempPicOrderCnt topFieldOrderCnt = tempPicOrderCnt
bottomFieldOrderCnt = tempPicOrderCnt bottomFieldOrderCnt = tempPicOrderCnt
case ctx.BottomField: } else if ctx.BottomField {
bottomFieldOrderCnt = tempPicOrderCnt bottomFieldOrderCnt = tempPicOrderCnt
default: } else {
topFieldOrderCnt = tempPicOrderCnt topFieldOrderCnt = tempPicOrderCnt
} }
return return
} }