codec/h264/h264dec/cavlc.go: added process to comgine level and run information

This commit is contained in:
Saxon 2019-09-08 12:53:25 +09:30
parent 614f42ec2c
commit 445649311b
1 changed files with 18 additions and 0 deletions

View File

@ -127,3 +127,21 @@ func parseLevelInformation(br *bits.BitReader, totalCoeff, trailingOnes int) ([]
}
return levelVal, nil
}
// combineLevelRunInfo combines the level and run information obtained prior
// using the process defined in section 9.2.4 of the specifications and returns
// the corresponding coeffLevel list.
func combineLevelRunInfo(levelVal, runVal []int, totalCoeff int) []int {
coeffNum := -1
i := totalCoeff - 1
var coeffLevel []int
for j := 0; j < totalCoeff; j++ {
coeffNum += runVal[i] + 1
if coeffNum >= len(coeffLevel) {
coeffLevel = append(coeffLevel, make([]int, (coeffNum+1)-len(coeffLevel))...)
}
coeffLevel[coeffNum] = levelVal[i]
i++
}
return coeffLevel
}