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