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 }