codec/h264/h264dec/decode.go: slightly simplified if-else statements regarding BottomField and FieldPic

This commit is contained in:
Saxon 2019-09-18 19:41:32 +09:30
parent 117a75ae55
commit 4c7f36ee36
1 changed files with 6 additions and 8 deletions

View File

@ -102,12 +102,10 @@ func decodePicOrderCntType0(vid *VideoStream, ctx *SliceContext) (topFieldOrderC
if !ctx.BottomField {
topFieldOrderCnt = vid.picOrderCntMsb + ctx.PicOrderCntLsb
} else if ctx.FieldPic {
bottomFieldOrderCnt = vid.picOrderCntMsb + ctx.PicOrderCntLsb
} else {
if !ctx.FieldPic {
bottomFieldOrderCnt = topFieldOrderCnt + ctx.DeltaPicOrderCntBottom
} else {
bottomFieldOrderCnt = vid.picOrderCntMsb + ctx.PicOrderCntLsb
}
bottomFieldOrderCnt = topFieldOrderCnt + ctx.DeltaPicOrderCntBottom
}
return
}
@ -154,10 +152,10 @@ func decodePicOrderCntType1(vid *VideoStream, ctx *SliceContext) (topFieldOrderC
if !ctx.FieldPic {
topFieldOrderCnt = expectedPicOrderCnt + ctx.DeltaPicOrderCnt[0]
bottomFieldOrderCnt = topFieldOrderCnt + int(ctx.OffsetForTopToBottomField) + ctx.DeltaPicOrderCnt[1]
} else if !ctx.BottomField {
topFieldOrderCnt = expectedPicOrderCnt + ctx.DeltaPicOrderCnt[0]
} else {
} else if ctx.BottomField {
bottomFieldOrderCnt = expectedPicOrderCnt + int(ctx.OffsetForTopToBottomField) + ctx.DeltaPicOrderCnt[0]
} else {
topFieldOrderCnt = expectedPicOrderCnt + ctx.DeltaPicOrderCnt[0]
}
return
}