| 10 | namespace { |
| 11 | |
| 12 | int32_t CavlcParamCal_ref (int16_t* pCoffLevel, uint8_t* pRun, int16_t* pLevel, int32_t* pTotalCoeff, |
| 13 | int32_t iLastIndex) { |
| 14 | int32_t iTotalZeros = 0; |
| 15 | int32_t iTotalCoeffs = 0; |
| 16 | |
| 17 | while (iLastIndex >= 0 && pCoffLevel[iLastIndex] == 0) { |
| 18 | -- iLastIndex; |
| 19 | } |
| 20 | |
| 21 | while (iLastIndex >= 0) { |
| 22 | int32_t iCountZero = 0; |
| 23 | pLevel[iTotalCoeffs] = pCoffLevel[iLastIndex--]; |
| 24 | |
| 25 | while (iLastIndex >= 0 && pCoffLevel[iLastIndex] == 0) { |
| 26 | ++ iCountZero; |
| 27 | -- iLastIndex; |
| 28 | } |
| 29 | iTotalZeros += iCountZero; |
| 30 | pRun[iTotalCoeffs++] = iCountZero; |
| 31 | } |
| 32 | *pTotalCoeff = iTotalCoeffs; |
| 33 | return iTotalZeros; |
| 34 | } |
| 35 | |
| 36 | void TestCavlcParamCalWithEndIdx (PCavlcParamCalFunc func, int endIdx, bool allZero, bool allNonZero) { |
| 37 | ENFORCE_STACK_ALIGN_1D (int16_t, coeffLevel, 16, 16); |