mirror of https://bitbucket.org/ausocean/av.git
codec/h264/h264dec/cabac.go: added binarization process for coded block pattern
This commit is contained in:
parent
517ba1926e
commit
132059d26e
|
@ -28,6 +28,7 @@ package h264dec
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
||||
|
@ -220,3 +221,23 @@ func subMbTypeBinString(v, slice int) ([]int, error) {
|
|||
return nil, errBadSubMbSliceType
|
||||
}
|
||||
}
|
||||
|
||||
// codedBlockPatternBinString returns the binarization for the syntax element
|
||||
// coded_block_pattern as defined by section 9.3.2.6 in specifications.
|
||||
func codedBlockPatternBinString(luma, chroma, arrayType int) ([]int, error) {
|
||||
p, err := fixedLenBinString(luma, 15)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("fixed length binarization failed with error: %v", err)
|
||||
}
|
||||
|
||||
if arrayType == 0 || arrayType == 3 {
|
||||
return p, nil
|
||||
}
|
||||
|
||||
s, err := truncUnaryBinString(chroma, 2)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("truncated unary binarization failed with error: %v", err)
|
||||
}
|
||||
|
||||
return append(p, s...), nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue