mirror of https://bitbucket.org/ausocean/av.git
Merged in coded-block-binarization (pull request #236)
codec/h264/h264dec/cabacenc.go: added coded block pattern binary string process
This commit is contained in:
commit
5ab8deb8a3
|
@ -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