MCPcopy Create free account
hub / github.com/cisco/openh264 / TestQuant

Function TestQuant

test/encoder/EncUT_EncoderMb.cpp:119–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117#define ThValue 2
118
119void TestQuant (uint32_t qp, uint8_t* pSrc, uint8_t* pPred, int16_t* pDct,
120 int16_t* pDctCompare, int16_t iWidth, int16_t iHeight) {
121 const int16_t* pMf = g_kiQuantMF[qp];
122 const int16_t* pFfCompareI = g_kiQuantInterFFCompare[52 + qp];
123 const int16_t* pFfCompareP = g_kiQuantInterFFCompare[qp];
124 const int16_t* pFfI = g_kiQuantInterFF[6 + qp];
125 const int16_t* pFfP = g_kiQuantInterFF[qp];
126 //quant4x4 Intra MB
127 RandomPixelDataGenerator (pSrc, iWidth, iHeight, iWidth);
128 RandomPixelDataGenerator (pPred, iWidth, iHeight, iWidth);
129
130 for (int16_t i = 0; i < 16; i++) {
131 pDct[i] = pSrc[i] - pPred[i];
132 pDctCompare[i] = pSrc[i] - pPred[i];
133 }
134
135 WelsQuant4x4_c (pDct, pFfI, pMf);
136 WelsQuant4x4_c (pDctCompare, pFfCompareI, pMf);
137
138 for (int16_t i = 0; i < 16; i++) {
139 int16_t iDeta = WELS_ABS (pDct[i] - pDctCompare[i]);
140 iDeta = (iDeta < ThValue) ? 0 : iDeta;
141 EXPECT_EQ (iDeta, 0);
142 }
143
144 //quant4x4 DC
145 RandomPixelDataGenerator (pSrc, iWidth, iHeight, iWidth);
146 RandomPixelDataGenerator (pPred, iWidth, iHeight, iWidth);
147
148 for (int16_t i = 0; i < 16; i++) {
149 pDct[i] = pSrc[i] - pPred[i];
150 pDctCompare[i] = pSrc[i] - pPred[i];
151 }
152
153 WelsQuant4x4Dc_c (pDct, pFfI[0] << 1, pMf[0]>>1);
154 WelsQuant4x4Dc_c (pDctCompare, pFfCompareI[0] << 1, pMf[0]>>1);
155
156 for (int16_t i = 0; i < 16; i++) {
157 int16_t iDeta = WELS_ABS (pDct[i] - pDctCompare[i]);
158 iDeta = (iDeta < ThValue) ? 0 : iDeta;
159 EXPECT_EQ (iDeta, 0);
160 }
161
162 //quant4x4 Inter MB
163 RandomPixelDataGenerator (pSrc, iWidth, iHeight, iWidth);
164 RandomPixelDataGenerator (pPred, iWidth, iHeight, iWidth);
165
166 for (int16_t i = 0; i < 64; i++) {
167 pDct[i] = pSrc[i] - pPred[i];
168 pDctCompare[i] = pSrc[i] - pPred[i];
169 }
170
171 WelsQuantFour4x4_c (pDct, pFfP, pMf);
172 WelsQuantFour4x4_c (pDctCompare, pFfCompareP, pMf);
173
174 for (int16_t i = 0; i < 64; i++) {
175 int16_t iDeta = WELS_ABS (pDct[i] - pDctCompare[i]);
176 iDeta = (iDeta < ThValue) ? 0 : iDeta;

Callers 1

TESTFunction · 0.85

Calls 4

RandomPixelDataGeneratorFunction · 0.85
WelsQuant4x4_cFunction · 0.85
WelsQuant4x4Dc_cFunction · 0.85
WelsQuantFour4x4_cFunction · 0.85

Tested by

no test coverage detected