History

Add CLIP3 and using ASSERT_FALSE macros

Haibo Zhu committed 12 years ago

Commit 04c2a7a1 parent 27a21ed1 file · +35 −59Browse files

Showing the changes to test/decoder/DecUT_DeblockCommon.cpp (1 of 1 file). Show all

Unified · Split

test/decoder/DecUT_DeblockCommon.cpp+35−59
@@ -24,7 +24,7 @@ if (iNum==0) { \ · 23 unmodified lines
2424 iTc[0] = iTc[1] = iTc[2] = iTc[3] = 25; \
2525 pBase[0] = pRef[0] = 128; \
2626 for (int i = 1; i < iWidth*iWidth; i++) { \
27− pBase[i] = pRef[i] = CLIP3(0, 255, pBase[i-1] -16 + rand()%32); \
27+ pBase[i] = pRef[i] = CLIP3( pBase[i-1] -16 + rand()%32, 0, 255); \
2828 } \
2929 } else if (iNum==1) { \
3030 iAlpha = 4; \
@@ -32,7 +32,7 @@ if (iNum==0) { \ · 1 unmodified line
3232 iTc[0] = iTc[1] = iTc[2] = iTc[3] = 9; \
3333 pBase[0] = pRef[0] = 128; \
3434 for (int i = 1; i < iWidth*iWidth; i++) { \
35− pBase[i] = pRef[i] = CLIP3(0, 255, pBase[i-1] -4 + rand()%8); \
35+ pBase[i] = pRef[i] = CLIP3( pBase[i-1] -4 + rand()%8, 0, 255); \
3636 } \
3737 } else { \
3838 iAlpha = rand() % 256; \
@@ -41,7 +41,7 @@ if (iNum==0) { \ · 2 unmodified lines
4141 iTc[i] = rand() % 26; \
4242 } \
4343 for (int i = 0; i < iWidth*iWidth; i++) { \
44− pBase[i] = pRef[i] = rand() % 256; \
44+ pBase[i] = pRef[i] = rand() % 200; \
4545 } \
4646 }
4747
@@ -69,14 +69,14 @@ void anchor_DeblockingLumaNormal (uint8_t* pPix, int32_t iStrideX, int32_t iStri · 21 unmodified lines
6969 if (abs (p[0] - q[0]) < iAlpha && abs (p[1] - p[0]) < iBeta && abs (q[1] - q[0]) < iBeta) {
7070 // 8-470
7171 if (abs (p[2] - p[0]) < iBeta) {
72− pPix[iStrideX * -2] = p[1] + CLIP3 (((p[2] + ((p[0] + q[0] + 1) >> 1) - (p[1] << 1)) >> 1), -1 * pTc[iIndexTc],
73− pTc[iIndexTc]);
72+ pPix[iStrideX * -2] = CLIP3 (p[1] + CLIP3 (((p[2] + ((p[0] + q[0] + 1) >> 1) - (p[1] << 1)) >> 1), -1 * pTc[iIndexTc],
73+ pTc[iIndexTc]), 0, 255);
7474 iTc++;
7575 }
7676 // 8-472
7777 if (abs (q[2] - q[0]) < iBeta) {
78− pPix[iStrideX * 1] = q[1] + CLIP3 (((q[2] + ((p[0] + q[0] + 1) >> 1) - (q[1] << 1)) >> 1), -1 * pTc[iIndexTc],
79− pTc[iIndexTc]);
78+ pPix[iStrideX * 1] = CLIP3 (q[1] + CLIP3 (((q[2] + ((p[0] + q[0] + 1) >> 1) - (q[1] << 1)) >> 1), -1 * pTc[iIndexTc],
79+ pTc[iIndexTc]), 0, 255);
8080 iTc++;
8181 }
8282 // 8-467,468,469
@@ -224,9 +224,7 @@ TEST (DeblockingCommon, DeblockLumaLt4_c) { · 141 unmodified lines
224224
225225 ENFORCE_STACK_ALIGN_1D (int8_t, iTc, 4, 16);
226226
227− bool bEqual = true;
228−
229− for (int iNum = 0; bEqual && iNum < TEST_CYCLE; iNum++) {
227+ for (int iNum = 0; iNum < TEST_CYCLE; iNum++) {
230228 /* Horizontal */
231229 GENERATE_DATA_DEBLOCKING (iPixBase, iPixRef, 16)
232230
@@ -234,10 +232,8 @@ TEST (DeblockingCommon, DeblockLumaLt4_c) { · 1 unmodified line
234232 DeblockLumaLt4_c (&iPixRef[8 * 1], 1, 16, iAlpha, iBeta, iTc);
235233
236234 for (int i = 0; i < 16 * 16; i++) {
237− if (iPixBase[i] != iPixRef[i]) {
238− bEqual = false;
239− break;
240− }
235+ ASSERT_FALSE (iPixBase[i] != iPixRef[i]) << "Horizontal Error, (Pos, Base, Ref)-(" << i << "," <<
236+ (uint32_t)iPixBase[i] << "," << (uint32_t)iPixRef[i] << ")";
241237 }
242238
243239 /* Vertical */
@@ -247,14 +243,10 @@ TEST (DeblockingCommon, DeblockLumaLt4_c) { · 3 unmodified lines
247243 DeblockLumaLt4_c (&iPixRef[8 * 16], 16, 1, iAlpha, iBeta, iTc);
248244
249245 for (int i = 0; i < 16 * 16; i++) {
250− if (iPixBase[i] != iPixRef[i]) {
251− bEqual = false;
252− break;
253− }
246+ ASSERT_FALSE (iPixBase[i] != iPixRef[i]) << "Vertical Error, (Pos, Base, Ref)-(" << i << "," <<
247+ (uint32_t)iPixBase[i] << "," << (uint32_t)iPixRef[i] << ")";
254248 }
255249 }
256−
257− EXPECT_TRUE (bEqual);
258250 }
259251 TEST (DeblockingCommon, DeblockLumaEq4_c) {
260252 //void DeblockLumaEq4_c (uint8_t* pPix, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, int32_t iBeta)
@@ -267,9 +259,7 @@ TEST (DeblockingCommon, DeblockLumaEq4_c) { · 6 unmodified lines
267259 /* NOT used here */
268260 ENFORCE_STACK_ALIGN_1D (int8_t, iTc, 4, 16);
269261
270− bool bEqual = true;
271−
272− for (int iNum = 0; bEqual && iNum < TEST_CYCLE; iNum++) {
262+ for (int iNum = 0; iNum < TEST_CYCLE; iNum++) {
273263 /* Horizontal */
274264 GENERATE_DATA_DEBLOCKING (iPixBase, iPixRef, 16)
275265
@@ -277,10 +267,8 @@ TEST (DeblockingCommon, DeblockLumaEq4_c) { · 1 unmodified line
277267 DeblockLumaEq4_c (&iPixRef[8 * 1], 1, 16, iAlpha, iBeta);
278268
279269 for (int i = 0; i < 16 * 16; i++) {
280− if (iPixBase[i] != iPixRef[i]) {
281− bEqual = false;
282− break;
283− }
270+ ASSERT_FALSE (iPixBase[i] != iPixRef[i]) << "Horizontal Error, (Pos, Base, Ref)-(" << i << "," <<
271+ (uint32_t)iPixBase[i] << "," << (uint32_t)iPixRef[i] << ")";
284272 }
285273
286274 /* Vertical */
@@ -290,14 +278,10 @@ TEST (DeblockingCommon, DeblockLumaEq4_c) { · 3 unmodified lines
290278 DeblockLumaEq4_c (&iPixRef[8 * 16], 16, 1, iAlpha, iBeta);
291279
292280 for (int i = 0; i < 16 * 16; i++) {
293− if (iPixBase[i] != iPixRef[i]) {
294− bEqual = false;
295− break;
296− }
281+ ASSERT_FALSE (iPixBase[i] != iPixRef[i]) << "Vertical Error, (Pos, Base, Ref)-(" << i << "," <<
282+ (uint32_t)iPixBase[i] << "," << (uint32_t)iPixRef[i] << ")";
297283 }
298284 }
299−
300− EXPECT_TRUE (bEqual);
301285 }
302286
303287 TEST (DeblockingCommon, DeblockChromaLt4_c) {
@@ -312,9 +296,7 @@ TEST (DeblockingCommon, DeblockChromaLt4_c) { · 8 unmodified lines
312296
313297 ENFORCE_STACK_ALIGN_1D (int8_t, iTc, 4, 16);
314298
315− bool bEqual = true;
316−
317− for (int iNum = 0; bEqual && iNum < TEST_CYCLE; iNum++) {
299+ for (int iNum = 0; iNum < TEST_CYCLE; iNum++) {
318300 /* Horizontal */
319301 GENERATE_DATA_DEBLOCKING (iPixCbBase, iPixCbRef, 8)
320302 GENERATE_DATA_DEBLOCKING (iPixCrBase, iPixCrRef, 8)
@@ -323,10 +305,10 @@ TEST (DeblockingCommon, DeblockChromaLt4_c) { · 2 unmodified lines
323305 DeblockChromaLt4_c (&iPixCbRef[4 * 1], &iPixCrRef[4 * 1], 1, 8, iAlpha, iBeta, iTc);
324306
325307 for (int i = 0; i < 8 * 8; i++) {
326− if (iPixCbBase[i] != iPixCbRef[i] || iPixCrBase[i] != iPixCrRef[i]) {
327− bEqual = false;
328− break;
329− }
308+ ASSERT_FALSE (iPixCbBase[i] != iPixCbRef[i]
309+ || iPixCrBase[i] != iPixCrRef[i]) << "Horizontal Error, (pos, CbBase, CbRef, CrBase, CrRef)-(" << i << "," <<
310+ (uint32_t)iPixCbBase[i] << "," << (uint32_t)iPixCbRef[i] << "," << (uint32_t)iPixCrBase[i] << "," <<
311+ (uint32_t)iPixCrRef[i] << ")";
330312 }
331313
332314 /* Vertical */
@@ -337,14 +319,12 @@ TEST (DeblockingCommon, DeblockChromaLt4_c) { · 4 unmodified lines
337319 DeblockChromaLt4_c (&iPixCbRef[4 * 8], &iPixCrRef[4 * 8], 8, 1, iAlpha, iBeta, iTc);
338320
339321 for (int i = 0; i < 8 * 8; i++) {
340− if (iPixCbBase[i] != iPixCbRef[i] || iPixCrBase[i] != iPixCrRef[i]) {
341− bEqual = false;
342− break;
343− }
322+ ASSERT_FALSE (iPixCbBase[i] != iPixCbRef[i]
323+ || iPixCrBase[i] != iPixCrRef[i]) << "Vertical Error, (pos, CbBase, CbRef, CrBase, CrRef)-(" << i << "," <<
324+ (uint32_t)iPixCbBase[i] << "," << (uint32_t)iPixCbRef[i] << "," << (uint32_t)iPixCrBase[i] << "," <<
325+ (uint32_t)iPixCrRef[i] << ")";
344326 }
345327 }
346−
347− EXPECT_TRUE (bEqual);
348328 }
349329
350330 TEST (DeblockingCommon, DeblockChromaEq4_c) {
@@ -360,9 +340,7 @@ TEST (DeblockingCommon, DeblockChromaEq4_c) { · 9 unmodified lines
360340 /* NOT used here*/
361341 ENFORCE_STACK_ALIGN_1D (int8_t, iTc, 4, 16);
362342
363− bool bEqual = true;
364−
365− for (int iNum = 0; bEqual && iNum < TEST_CYCLE; iNum++) {
343+ for (int iNum = 0; iNum < TEST_CYCLE; iNum++) {
366344 /* Horizontal */
367345 GENERATE_DATA_DEBLOCKING (iPixCbBase, iPixCbRef, 8)
368346 GENERATE_DATA_DEBLOCKING (iPixCrBase, iPixCrRef, 8)
@@ -371,10 +349,10 @@ TEST (DeblockingCommon, DeblockChromaEq4_c) { · 2 unmodified lines
371349 DeblockChromaEq4_c (&iPixCbRef[4 * 1], &iPixCrRef[4 * 1], 1, 8, iAlpha, iBeta);
372350
373351 for (int i = 0; i < 8 * 8; i++) {
374− if (iPixCbBase[i] != iPixCbRef[i] || iPixCrBase[i] != iPixCrRef[i]) {
375− bEqual = false;
376− break;
377− }
352+ ASSERT_FALSE (iPixCbBase[i] != iPixCbRef[i]
353+ || iPixCrBase[i] != iPixCrRef[i]) << "Horizontal Error, (pos, CbBase, CbRef, CrBase, CrRef)-(" << i << "," <<
354+ (uint32_t)iPixCbBase[i] << "," << (uint32_t)iPixCbRef[i] << "," << (uint32_t)iPixCrBase[i] << "," <<
355+ (uint32_t)iPixCrRef[i] << ")";
378356 }
379357
380358 /* Vertical */
@@ -385,12 +363,10 @@ TEST (DeblockingCommon, DeblockChromaEq4_c) { · 4 unmodified lines
385363 DeblockChromaEq4_c (&iPixCbRef[4 * 8], &iPixCrRef[4 * 8], 8, 1, iAlpha, iBeta);
386364
387365 for (int i = 0; i < 8 * 8; i++) {
388− if (iPixCbBase[i] != iPixCbRef[i] || iPixCrBase[i] != iPixCrRef[i]) {
389− bEqual = false;
390− break;
391− }
366+ ASSERT_FALSE (iPixCbBase[i] != iPixCbRef[i]
367+ || iPixCrBase[i] != iPixCrRef[i]) << "Vertical Error, (pos, CbBase, CbRef, CrBase, CrRef)-(" << i << "," <<
368+ (uint32_t)iPixCbBase[i] << "," << (uint32_t)iPixCbRef[i] << "," << (uint32_t)iPixCrBase[i] << "," <<
369+ (uint32_t)iPixCrRef[i] << ")";
392370 }
393371 }
394−
395− EXPECT_TRUE (bEqual);
396372 }

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