Merged in combine-information (pull request #246)

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

Approved-by: Alan Noble <anoble@gmail.com>
This commit is contained in:
Saxon Milton 2019-09-10 01:45:12 +00:00
commit 2f6649b1f3
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
}