codec/h264/h264dec/decode.go: using else if structure instead of switch to derive value of vid.picOrderCntMsb

This commit is contained in:
Saxon 2019-09-10 11:32:46 +09:30
parent 31179205b9
commit 0df182018a
1 changed files with 3 additions and 5 deletions

View File

@ -93,13 +93,11 @@ func decodePicOrderCntType0(vid *VideoStream, ctx *SliceContext) (topFieldOrderC
panic("not implemented") panic("not implemented")
} }
switch {
case (ctx.PicOrderCntLsb < prevPicOrderCntLsb) && ((prevPicOrderCntLsb - ctx.PicOrderCntLsb) >= (vid.maxPicOrderCntLsb / 2)):
vid.picOrderCntMsb = prevPicOrderCntMsb + vid.maxPicOrderCntLsb
case (ctx.PicOrderCntLsb > prevPicOrderCntLsb) && ((ctx.PicOrderCntLsb - prevPicOrderCntLsb) > (vid.maxPicOrderCntLsb / 2)):
vid.picOrderCntMsb = prevPicOrderCntMsb - vid.maxPicOrderCntLsb
default:
vid.picOrderCntMsb = prevPicOrderCntMsb vid.picOrderCntMsb = prevPicOrderCntMsb
if ctx.PicOrderCntLsb < prevPicOrderCntLsb && (prevPicOrderCntLsb-ctx.PicOrderCntLsb) >= (vid.maxPicOrderCntLsb/2) {
vid.picOrderCntMsb = prevPicOrderCntMsb + vid.maxPicOrderCntLsb
} else if ctx.PicOrderCntLsb > prevPicOrderCntLsb && (ctx.PicOrderCntLsb-prevPicOrderCntLsb) > (vid.maxPicOrderCntLsb/2) {
vid.picOrderCntMsb = prevPicOrderCntMsb - vid.maxPicOrderCntLsb
} }
if !ctx.BottomField { if !ctx.BottomField {