mirror of https://bitbucket.org/ausocean/av.git
codec/h264/h264dec/decode.go: added picOrderCntType2 to derive topfieldOrderCnt and bottomFieldOrderCnt for when picOrderCntType == 2
This commit is contained in:
parent
43118814fb
commit
c0be9b1910
|
@ -108,3 +108,41 @@ func picOrderCntType1(vid VideoStream, ctx SliceContext) (topFieldOrderCnt, bott
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
// picOrderCntType2 is used to return topFieldOrderCnt and bottomFieldOrderCnt
|
||||
// when vic.PicOrderCntType == 1 according to logic defined in section 8.2.1.3
|
||||
// of the specifications. If topFieldOrderCnt or bottomFieldOrderCnt are -1,
|
||||
// then they are considered unset.
|
||||
func picOrderCntType2(vid VideoStream, ctx SliceContext) (topFieldOrderCnt, bottomFieldOrderCnt int) {
|
||||
topFieldOrderCnt, bottomFieldOrderCnt = -1, -1
|
||||
|
||||
// TODO: this will be prevFrameNum when we do frames other than IDR.
|
||||
_ = vid.priorPic.FrameNum
|
||||
|
||||
if vid.idrPicFlag {
|
||||
vid.frameNumOffset = 0
|
||||
} else {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
var tempPicOrderCnt int
|
||||
switch {
|
||||
case vid.idrPicFlag:
|
||||
tempPicOrderCnt = 0
|
||||
case ctx.RefIdc == 0:
|
||||
tempPicOrderCnt = 2*(vid.frameNumOffset+ctx.FrameNum) - 1
|
||||
default:
|
||||
tempPicOrderCnt = 2 * (vid.frameNumOffset + ctx.FrameNum)
|
||||
}
|
||||
|
||||
switch {
|
||||
case ctx.FieldPic:
|
||||
topFieldOrderCnt = tempPicOrderCnt
|
||||
bottomFieldOrderCnt = tempPicOrderCnt
|
||||
case ctx.BottomField:
|
||||
bottomFieldOrderCnt = tempPicOrderCnt
|
||||
default:
|
||||
topFieldOrderCnt = tempPicOrderCnt
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue