From 40fa50d4f044e456221d6e6289fb20b830fa7b61 Mon Sep 17 00:00:00 2001 From: Saxon Date: Tue, 10 Sep 2019 12:06:35 +0930 Subject: [PATCH] codec/h264/h264dec/decode.go: using if else structure for derivation of topFieldOrderCnt and bottomFieldOrderCnt in decodePicOrderCntType1 function --- codec/h264/h264dec/decode.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/codec/h264/h264dec/decode.go b/codec/h264/h264dec/decode.go index 25c81c75..a777c73f 100644 --- a/codec/h264/h264dec/decode.go +++ b/codec/h264/h264dec/decode.go @@ -151,13 +151,12 @@ func decodePicOrderCntType1(vid *VideoStream, ctx *SliceContext) (topFieldOrderC expectedPicOrderCnt = expectedPicOrderCnt + int(ctx.OffsetForNonRefPic) } - switch { - case !ctx.FieldPic: + if !ctx.FieldPic { topFieldOrderCnt = expectedPicOrderCnt + ctx.DeltaPicOrderCnt[0] bottomFieldOrderCnt = topFieldOrderCnt + int(ctx.OffsetForTopToBottomField) + ctx.DeltaPicOrderCnt[1] - case !ctx.BottomField: + } else if !ctx.BottomField { topFieldOrderCnt = expectedPicOrderCnt + ctx.DeltaPicOrderCnt[0] - default: + } else { bottomFieldOrderCnt = expectedPicOrderCnt + int(ctx.OffsetForTopToBottomField) + ctx.DeltaPicOrderCnt[0] } return