From 4c7f36ee364ff49af8188ed72adee20374889ef5 Mon Sep 17 00:00:00 2001 From: Saxon Date: Wed, 18 Sep 2019 19:41:32 +0930 Subject: [PATCH] codec/h264/h264dec/decode.go: slightly simplified if-else statements regarding BottomField and FieldPic --- codec/h264/h264dec/decode.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/codec/h264/h264dec/decode.go b/codec/h264/h264dec/decode.go index ac4ee928..d4d929e2 100644 --- a/codec/h264/h264dec/decode.go +++ b/codec/h264/h264dec/decode.go @@ -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 }