History

Add ARM64 Code and UnitTest for reconstruction

dongzhang committed 12 years ago

Commit d88b83d1 parent 5a60d0f9 files · +1513 −1Browse files

Showing the changes to test/encoder/EncUT_Reconstruct.cpp (1 of 9 files). Show all

Unified · Split

test/encoder/EncUT_Reconstruct.cpp+492−0
@@ -0,0 +1,492 @@
1+#include<gtest/gtest.h>
2+#include<math.h>
3+#include<stdlib.h>
4+#include<time.h>
5+
6+#include "cpu_core.h"
7+#include "cpu.h"
8+#include "macros.h"
9+#include "encode_mb_aux.h"
10+#include "decode_mb_aux.h"
11+#include "wels_func_ptr_def.h"
12+
13+using namespace WelsSVCEnc;
14+#define RECONTEST_NUM 1000
15+static void FillWithRandomData (uint8_t* p, int32_t Len) {
16+ for (int32_t i = 0; i < Len; i++) {
17+ p[i] = rand() % 256;
18+ }
19+}
20+
21+TEST (ReconstructionFunTest, WelsIDctRecI16x16Dc) {
22+ ENFORCE_STACK_ALIGN_2D (uint8_t, pRec, 2, 16 * 16, 16)
23+ ENFORCE_STACK_ALIGN_1D (uint8_t, pPred, 32 * 16, 16)
24+ ENFORCE_STACK_ALIGN_1D (int16_t, pDct, 16, 16)
25+ int32_t iCpuCores = 0;
26+ SWelsFuncPtrList sFuncPtrList;
27+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
28+ WelsInitReconstructionFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
29+
30+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
31+ FillWithRandomData (pPred, 32 * 16);
32+ FillWithRandomData ((uint8_t*)pDct, 16 * 2);
33+ for (int32_t i = 0 ; i < 16; i++) {
34+ pDct[i] = WELS_CLIP3 (pDct[i], -4080, 4080);
35+ }
36+ WelsIDctRecI16x16Dc_c (pRec[0], 16, pPred, 32, pDct);
37+ sFuncPtrList.pfIDctI16x16Dc (pRec[1], 16, pPred, 32, pDct);
38+
39+ for (int32_t j = 0 ; j < 16; j++) {
40+ for (int32_t i = 0 ; i < 16; i++) {
41+ ASSERT_EQ (pRec[0][i + j * 16], pRec[1][i + j * 16]);
42+ }
43+ }
44+ }
45+
46+}
47+
48+TEST (ReconstructionFunTest, WelsGetNoneZeroCount) {
49+ ENFORCE_STACK_ALIGN_1D (int16_t, pInput, 64, 16)
50+ int32_t iZeroCount[2];
51+ int32_t iCpuCores = 0;
52+ SWelsFuncPtrList sFuncPtrList;
53+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
54+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
55+
56+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
57+ FillWithRandomData ((uint8_t*)pInput, 128);
58+ iZeroCount[0] = WelsGetNoneZeroCount_c (pInput);
59+ iZeroCount[1] = sFuncPtrList.pfGetNoneZeroCount (pInput);
60+ ASSERT_EQ (iZeroCount[0], iZeroCount[1]);
61+ }
62+
63+}
64+
65+TEST (ReconstructionFunTest, WelsHadamardT4Dc) {
66+ ENFORCE_STACK_ALIGN_1D (int16_t, pDct, 16 * 16, 16)
67+ ENFORCE_STACK_ALIGN_2D (int16_t, pLumaDc, 2, 16, 16)
68+ int32_t iCpuCores = 0;
69+ SWelsFuncPtrList sFuncPtrList;
70+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
71+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
72+
73+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
74+ FillWithRandomData ((uint8_t*)pDct, 16 * 16 * 2);
75+ for (int32_t j = 0 ; j < 16; j++) {
76+ for (int32_t i = 0 ; i < 16; i++) {
77+ pDct[i + j * 16] = WELS_CLIP3 (pDct[i + j * 16], -4080, 4080);
78+ }
79+ }
80+ WelsHadamardT4Dc_c (pLumaDc[0], pDct);
81+ sFuncPtrList.pfTransformHadamard4x4Dc (pLumaDc[1], pDct);
82+ for (int32_t i = 0 ; i < 16; i++) {
83+ ASSERT_EQ (pLumaDc[0][i], pLumaDc[1][i]);
84+ }
85+ }
86+
87+
88+}
89+
90+TEST (ReconstructionFunTest, WelsDctT4) {
91+ ENFORCE_STACK_ALIGN_1D (uint8_t, pInput1, 16 * 4, 16)
92+ ENFORCE_STACK_ALIGN_1D (uint8_t, pInput2, 32 * 4, 16)
93+ ENFORCE_STACK_ALIGN_2D (int16_t, pOut, 2, 16, 16)
94+
95+ int32_t iCpuCores = 0;
96+ SWelsFuncPtrList sFuncPtrList;
97+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
98+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
99+
100+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
101+ FillWithRandomData (pInput1, 16 * 4);
102+ FillWithRandomData (pInput2, 32 * 4);
103+ WelsDctT4_c (pOut[0], pInput1, 16, pInput2, 32);
104+ sFuncPtrList.pfDctT4 (pOut[1], pInput1, 16, pInput2, 32);
105+ for (int32_t i = 0 ; i < 16; i++) {
106+ ASSERT_EQ (pOut[0][i], pOut[1][i]);
107+ }
108+ }
109+
110+
111+ memset (pInput1, 255, 16 * 4);
112+ memset (pInput2, 0, 32 * 4);
113+ WelsDctT4_c (pOut[0], pInput1, 16, pInput2, 32);
114+ sFuncPtrList.pfDctT4 (pOut[1], pInput1, 16, pInput2, 32);
115+ for (int32_t i = 0 ; i < 16; i++) {
116+ ASSERT_EQ (pOut[0][i], pOut[1][i]);
117+ }
118+
119+ memset (pInput1, 0, 16 * 4);
120+ memset (pInput2, 255, 32 * 4);
121+ WelsDctT4_c (pOut[0], pInput1, 16, pInput2, 32);
122+ sFuncPtrList.pfDctT4 (pOut[1], pInput1, 16, pInput2, 32);
123+ for (int32_t i = 0 ; i < 16; i++) {
124+ ASSERT_EQ (pOut[0][i], pOut[1][i]);
125+ }
126+}
127+
128+TEST (ReconstructionFunTest, WelsDctFourT4) {
129+ ENFORCE_STACK_ALIGN_1D (uint8_t, pInput1, 16 * 8, 16)
130+ ENFORCE_STACK_ALIGN_1D (uint8_t, pInput2, 32 * 8, 16)
131+ ENFORCE_STACK_ALIGN_2D (int16_t, pOut, 2, 64, 16)
132+ int32_t iCpuCores = 0;
133+ SWelsFuncPtrList sFuncPtrList;
134+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
135+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
136+
137+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
138+ FillWithRandomData (pInput1, 16 * 8);
139+ FillWithRandomData (pInput2, 32 * 8);
140+ WelsDctFourT4_c (pOut[0], pInput1, 16, pInput2, 32);
141+ sFuncPtrList.pfDctFourT4 (pOut[1], pInput1, 16, pInput2, 32);
142+ for (int32_t i = 0 ; i < 64; i++) {
143+ ASSERT_EQ (pOut[0][i], pOut[1][i]);
144+ }
145+ }
146+
147+}
148+
149+TEST (ReconstructionFunTest, WelsIDctT4Rec) {
150+ ENFORCE_STACK_ALIGN_2D (int16_t, pDct, 2, 16, 16)
151+ ENFORCE_STACK_ALIGN_1D (uint8_t, pPred, 32 * 4, 16)
152+ ENFORCE_STACK_ALIGN_2D (uint8_t, pRec, 2, 16 * 4, 16)
153+ ENFORCE_STACK_ALIGN_1D (uint8_t, pInput1, 16 * 4, 16)
154+ ENFORCE_STACK_ALIGN_1D (uint8_t, pInput2, 32 * 4, 16)
155+ int32_t iCpuCores = 0;
156+ SWelsFuncPtrList sFuncPtrList;
157+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
158+ WelsInitReconstructionFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
159+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
160+
161+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
162+ FillWithRandomData (pPred, 32 * 4);
163+ FillWithRandomData (pInput1, 16 * 4);
164+ FillWithRandomData (pInput2, 32 * 4);
165+ WelsDctT4_c (pDct[0], pInput1, 16, pInput2, 32);
166+ sFuncPtrList.pfDctT4 (pDct[1], pInput1, 16, pInput2, 32);
167+ WelsIDctT4Rec_c (pRec[0], 16, pPred, 32, pDct[0]);
168+ sFuncPtrList.pfIDctT4 (pRec[1], 16, pPred, 32, pDct[1]);
169+
170+ for (int32_t j = 0 ; j < 4; j++) {
171+ for (int32_t i = 0 ; i < 4; i++) {
172+ ASSERT_EQ (pRec[0][i + j * 16], pRec[1][i + j * 16]);
173+ }
174+ }
175+ }
176+
177+
178+ memset (pPred, 255, 32 * 4);
179+ memset (pInput1, 255, 16 * 4);
180+ memset (pInput2, 0, 32 * 4);
181+ WelsDctT4_c (pDct[0], pInput1, 16, pInput2, 32);
182+ sFuncPtrList.pfDctT4 (pDct[1], pInput1, 16, pInput2, 32);
183+ WelsIDctT4Rec_c (pRec[0], 16, pPred, 32, pDct[0]);
184+ sFuncPtrList.pfIDctT4 (pRec[1], 16, pPred, 32, pDct[1]);
185+
186+ for (int32_t j = 0 ; j < 4; j++) {
187+ for (int32_t i = 0 ; i < 4; i++) {
188+ ASSERT_EQ (pRec[0][i + j * 16], pRec[1][i + j * 16]);
189+ }
190+ }
191+
192+ memset (pPred, 255, 32 * 4);
193+ memset (pInput1, 0, 16 * 4);
194+ memset (pInput2, 255, 32 * 4);
195+ WelsDctT4_c (pDct[0], pInput1, 16, pInput2, 32);
196+ sFuncPtrList.pfDctT4 (pDct[1], pInput1, 16, pInput2, 32);
197+ WelsIDctT4Rec_c (pRec[0], 16, pPred, 32, pDct[0]);
198+ sFuncPtrList.pfIDctT4 (pRec[1], 16, pPred, 32, pDct[1]);
199+
200+ for (int32_t j = 0 ; j < 4; j++) {
201+ for (int32_t i = 0 ; i < 4; i++) {
202+ ASSERT_EQ (pRec[0][i + j * 16], pRec[1][i + j * 16]);
203+ }
204+ }
205+
206+}
207+
208+
209+TEST (ReconstructionFunTest, WelsIDctFourT4Rec) {
210+ ENFORCE_STACK_ALIGN_2D (int16_t, pDct, 2, 64, 16)
211+ ENFORCE_STACK_ALIGN_1D (uint8_t, pPred, 32 * 8, 16)
212+ ENFORCE_STACK_ALIGN_2D (uint8_t, pRec, 2, 16 * 8, 16)
213+ ENFORCE_STACK_ALIGN_1D (uint8_t, pInput1, 16 * 8, 16)
214+ ENFORCE_STACK_ALIGN_1D (uint8_t, pInput2, 32 * 8, 16)
215+ int32_t iCpuCores = 0;
216+ SWelsFuncPtrList sFuncPtrList;
217+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
218+ WelsInitReconstructionFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
219+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
220+
221+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
222+ FillWithRandomData (pInput1, 16 * 8);
223+ FillWithRandomData (pInput2, 32 * 8);
224+ FillWithRandomData (pPred, 32 * 8);
225+ WelsDctFourT4_c (pDct[0], pInput1, 16, pInput2, 32);
226+ sFuncPtrList.pfDctFourT4 (pDct[1], pInput1, 16, pInput2, 32);
227+ WelsIDctFourT4Rec_c (pRec[0], 16, pPred, 32, pDct[0]);
228+ sFuncPtrList.pfIDctFourT4 (pRec[1], 16, pPred, 32, pDct[1]);
229+ for (int32_t j = 0 ; j < 8; j++) {
230+ for (int32_t i = 0 ; i < 8; i++) {
231+ ASSERT_EQ (pRec[0][i + j * 16], pRec[1][i + j * 16]);
232+ }
233+ }
234+ }
235+
236+}
237+
238+
239+TEST (ReconstructionFunTest, WelsDequant4x4) {
240+ ENFORCE_STACK_ALIGN_2D (int16_t, pInput, 2, 16, 16)
241+ int32_t iCpuCores = 0;
242+ SWelsFuncPtrList sFuncPtrList;
243+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
244+ WelsInitReconstructionFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
245+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
246+
247+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
248+ uint8_t uiQp = rand() % 52;
249+ FillWithRandomData ((uint8_t*)pInput[0], 32);
250+ for (int32_t i = 0 ; i < 16; i++) {
251+ pInput[0][i] = WELS_CLIP3 (pInput[0][i], -32640, 32640);
252+ }
253+ memcpy ((uint8_t*)pInput[1], (uint8_t*)pInput[0], 32);
254+
255+ const int16_t* pMF = g_kiQuantMF[uiQp];
256+ const int16_t* pFF = g_iQuantIntraFF[uiQp];
257+ WelsQuant4x4_c (pInput[0], pFF, pMF);
258+ sFuncPtrList.pfQuantization4x4 (pInput[1], pFF, pMF);
259+
260+ WelsDequant4x4_c (pInput[0], g_kuiDequantCoeff[uiQp]);
261+ sFuncPtrList.pfDequantization4x4 (pInput[1], g_kuiDequantCoeff[uiQp]);
262+ for (int32_t i = 0 ; i < 16; i++) {
263+ ASSERT_EQ (pInput[0][i], pInput[1][i]);
264+ }
265+ }
266+
267+}
268+
269+TEST (ReconstructionFunTest, WelsDequantIHadamard4x4) {
270+ ENFORCE_STACK_ALIGN_2D (int16_t, pInput, 2, 16, 16)
271+ int32_t iCpuCores = 0;
272+ SWelsFuncPtrList sFuncPtrList;
273+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
274+ WelsInitReconstructionFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
275+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
276+
277+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
278+ uint8_t uiQp = rand() % 52;
279+ FillWithRandomData ((uint8_t*)pInput[0], 32);
280+ for (int32_t i = 0 ; i < 16; i++) {
281+ pInput[0][i] = WELS_CLIP3 (pInput[0][i], -32640, 32640);
282+ }
283+ memcpy ((uint8_t*)pInput[1], (uint8_t*)pInput[0], 32);
284+
285+ const int16_t* pMF = g_kiQuantMF[uiQp];
286+ const int16_t* pFF = g_iQuantIntraFF[uiQp];
287+ WelsQuant4x4_c (pInput[0], pFF, pMF);
288+ sFuncPtrList.pfQuantization4x4 (pInput[1], pFF, pMF);
289+
290+ WelsDequantIHadamard4x4_c (pInput[0], g_kuiDequantCoeff[uiQp][0]);
291+ sFuncPtrList.pfDequantizationIHadamard4x4 (pInput[1], g_kuiDequantCoeff[uiQp][0]);
292+ for (int32_t i = 0 ; i < 16; i++) {
293+ ASSERT_EQ (pInput[0][i], pInput[1][i]);
294+ }
295+ }
296+
297+}
298+
299+TEST (ReconstructionFunTest, WelsQuant4x4) {
300+ ENFORCE_STACK_ALIGN_2D (int16_t, pInput, 2, 16, 16)
301+ int32_t iCpuCores = 0;
302+ SWelsFuncPtrList sFuncPtrList;
303+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
304+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
305+
306+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
307+ uint8_t uiQp = rand() % 52;
308+ FillWithRandomData ((uint8_t*)pInput[0], 32);
309+ for (int32_t i = 0 ; i < 16; i++) {
310+ pInput[0][i] = WELS_CLIP3 (pInput[0][i], -32640, 32640);
311+ }
312+ memcpy ((uint8_t*)pInput[1], (uint8_t*)pInput[0], 32);
313+
314+ const int16_t* pMF = g_kiQuantMF[uiQp];
315+ const int16_t* pFF = g_iQuantIntraFF[uiQp];
316+ WelsQuant4x4_c (pInput[0], pFF, pMF);
317+ sFuncPtrList.pfQuantization4x4 (pInput[1], pFF, pMF);
318+ for (int32_t i = 0 ; i < 16; i++) {
319+ ASSERT_EQ (pInput[0][i], pInput[1][i]);
320+ }
321+ }
322+
323+}
324+
325+
326+TEST (ReconstructionFunTest, WelsQuant4x4Dc) {
327+ ENFORCE_STACK_ALIGN_2D (int16_t, pInput, 2, 16, 16)
328+ int32_t iCpuCores = 0;
329+ SWelsFuncPtrList sFuncPtrList;
330+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
331+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
332+
333+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
334+ uint8_t uiQp = rand() % 52;
335+ FillWithRandomData ((uint8_t*)pInput[0], 32);
336+ for (int32_t i = 0 ; i < 16; i++) {
337+ pInput[0][i] = WELS_CLIP3 (pInput[0][i], -32640, 32640);
338+ }
339+ memcpy ((uint8_t*)pInput[1], (uint8_t*)pInput[0], 32);
340+
341+ const int16_t* pMF = g_kiQuantMF[uiQp];
342+ const int16_t* pFF = g_iQuantIntraFF[uiQp];
343+ WelsQuant4x4Dc_c (pInput[0], pFF[0], pMF[0]);
344+ sFuncPtrList.pfQuantizationDc4x4 (pInput[1], pFF[0], pMF[0]);
345+ for (int32_t i = 0 ; i < 16; i++) {
346+ ASSERT_EQ (pInput[0][i], pInput[1][i]);
347+ }
348+ }
349+
350+}
351+
352+TEST (ReconstructionFunTest, WelsQuantFour4x4) {
353+ ENFORCE_STACK_ALIGN_2D (int16_t, pInput, 2, 64, 16)
354+ int32_t iCpuCores = 0;
355+ SWelsFuncPtrList sFuncPtrList;
356+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
357+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
358+
359+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
360+ uint8_t uiQp = rand() % 52;
361+ FillWithRandomData ((uint8_t*)pInput[0], 128);
362+ for (int32_t i = 0 ; i < 64; i++) {
363+ pInput[0][i] = WELS_CLIP3 (pInput[0][i], -32640, 32640);
364+ }
365+ memcpy ((uint8_t*)pInput[1], (uint8_t*)pInput[0], 128);
366+
367+ const int16_t* pMF = g_kiQuantMF[uiQp];
368+ const int16_t* pFF = g_iQuantIntraFF[uiQp];
369+ WelsQuantFour4x4_c (pInput[0], pFF, pMF);
370+ sFuncPtrList.pfQuantizationFour4x4 (pInput[1], pFF, pMF);
371+ for (int32_t i = 0 ; i < 64; i++) {
372+ ASSERT_EQ (pInput[0][i], pInput[1][i]);
373+ }
374+ }
375+
376+}
377+
378+TEST (ReconstructionFunTest, WelsQuantFour4x4Max) {
379+ ENFORCE_STACK_ALIGN_2D (int16_t, pInput, 2, 64, 16)
380+ int32_t iCpuCores = 0;
381+ SWelsFuncPtrList sFuncPtrList;
382+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
383+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
384+
385+ int16_t pMax[2][4];
386+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
387+ uint8_t uiQp = rand() % 52;
388+ FillWithRandomData ((uint8_t*)pInput[0], 128);
389+ for (int32_t i = 0 ; i < 64; i++) {
390+ pInput[0][i] = WELS_CLIP3 (pInput[0][i], -32640, 32640);
391+ }
392+ memcpy ((uint8_t*)pInput[1], (uint8_t*)pInput[0], 128);
393+
394+ const int16_t* pMF = g_kiQuantMF[uiQp];
395+ const int16_t* pFF = g_iQuantIntraFF[uiQp];
396+ WelsQuantFour4x4Max_c (pInput[0], pFF, pMF, pMax[0]);
397+ sFuncPtrList.pfQuantizationFour4x4Max (pInput[1], pFF, pMF, pMax[1]);
398+ for (int32_t i = 0 ; i < 64; i++) {
399+ ASSERT_EQ (pInput[0][i], pInput[1][i]);
400+ ASSERT_EQ (pMax[0][i >> 4], pMax[1][i >> 4]);
401+ }
402+ }
403+}
404+
405+TEST (ReconstructionFunTest, WelsDeQuantFour4x4) {
406+ ENFORCE_STACK_ALIGN_2D (int16_t, pInput, 2, 64, 16)
407+ int32_t iCpuCores = 0;
408+ SWelsFuncPtrList sFuncPtrList;
409+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
410+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
411+ WelsInitReconstructionFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
412+
413+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
414+ uint8_t uiQp = rand() % 52;
415+ FillWithRandomData ((uint8_t*)pInput[0], 128);
416+ for (int32_t i = 0 ; i < 64; i++) {
417+ pInput[0][i] = WELS_CLIP3 (pInput[0][i], -32640, 32640);
418+ }
419+ memcpy ((uint8_t*)pInput[1], (uint8_t*)pInput[0], 128);
420+
421+ const int16_t* pMF = g_kiQuantMF[uiQp];
422+ const int16_t* pFF = g_iQuantIntraFF[uiQp];
423+ WelsQuantFour4x4_c (pInput[0], pFF, pMF);
424+ sFuncPtrList.pfQuantizationFour4x4 (pInput[1], pFF, pMF);
425+
426+ WelsDequantFour4x4_c (pInput[0], g_kuiDequantCoeff[uiQp]);
427+ sFuncPtrList.pfDequantizationFour4x4 (pInput[1], g_kuiDequantCoeff[uiQp]);
428+ for (int32_t i = 0 ; i < 64; i++) {
429+ ASSERT_EQ (pInput[0][i], pInput[1][i]);
430+ }
431+ }
432+}
433+
434+TEST (ReconstructionFunTest, WelsHadamardQuant2x2Skip) {
435+ ENFORCE_STACK_ALIGN_2D (int16_t, pInput, 2, 64, 16)
436+ int32_t iCpuCores = 0;
437+ SWelsFuncPtrList sFuncPtrList;
438+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
439+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
440+
441+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
442+ uint8_t uiQp = rand() % 52;
443+ FillWithRandomData ((uint8_t*)pInput[0], 128);
444+ for (int32_t i = 0 ; i < 64; i++) {
445+ pInput[0][i] = WELS_CLIP3 (pInput[0][i], -4080, 4080);
446+ }
447+ memcpy ((uint8_t*)pInput[1], (uint8_t*)pInput[0], 128);
448+
449+ const int16_t* pMF = g_kiQuantMF[uiQp];
450+ const int16_t* pFF = g_iQuantIntraFF[uiQp];
451+ int32_t iSkip_c = WelsHadamardQuant2x2Skip_c (pInput[0], pFF[0], pMF[0]);
452+ int32_t iSkip_test = sFuncPtrList.pfQuantizationHadamard2x2Skip (pInput[1], pFF[0], pMF[0]);
453+
454+ ASSERT_EQ ((iSkip_test != 0), (iSkip_c != 0));
455+ }
456+
457+}
458+
459+TEST (ReconstructionFunTest, WelsHadamardQuant2x2) {
460+ ENFORCE_STACK_ALIGN_2D (int16_t, pInput, 2, 64, 16)
461+ ENFORCE_STACK_ALIGN_2D (int16_t, pDct, 2, 4, 16)
462+ ENFORCE_STACK_ALIGN_2D (int16_t, pBlock, 2, 4, 16)
463+ int32_t iCpuCores = 0;
464+ SWelsFuncPtrList sFuncPtrList;
465+ uint32_t m_uiCpuFeatureFlag = WelsCPUFeatureDetect (&iCpuCores);
466+ WelsInitEncodingFuncs (&sFuncPtrList, m_uiCpuFeatureFlag);
467+
468+ for (int32_t k = 0; k < RECONTEST_NUM; k++) {
469+ uint8_t uiQp = rand() % 52;
470+ FillWithRandomData ((uint8_t*)pInput[0], 128);
471+ for (int32_t i = 0 ; i < 64; i++) {
472+ pInput[0][i] = WELS_CLIP3 (pInput[0][i], -4080, 4080);
473+ }
474+ memcpy ((uint8_t*)pInput[1], (uint8_t*)pInput[0], 128);
475+
476+ const int16_t* pMF = g_kiQuantMF[uiQp];
477+ const int16_t* pFF = g_iQuantIntraFF[uiQp];
478+ int32_t iSkip_c = WelsHadamardQuant2x2_c (pInput[0], pFF[0], pMF[0], pDct[0], pBlock[0]);
479+ int32_t iSkip_test = sFuncPtrList.pfQuantizationHadamard2x2 (pInput[1], pFF[0], pMF[0], pDct[1], pBlock[1]);
480+
481+ ASSERT_EQ ((iSkip_test != 0), (iSkip_c != 0));
482+ for (int32_t i = 0 ; i < 64; i++) {
483+ ASSERT_EQ (pInput[0][i], pInput[1][i]);
484+ }
485+ for (int32_t i = 0 ; i < 4; i++) {
486+ ASSERT_EQ (pDct[0][i], pDct[1][i]);
487+ ASSERT_EQ (pBlock[0][i], pBlock[1][i]);
488+ }
489+ }
490+
491+}
492+

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t