When using a macro, the macro parameters get evaluated multiple times, which means that the rand() value compared actually isn't the same that is used as return value. This makes sure that clipping works as intended for the random tests.
Showing the changes to test/decoder/DecUT_DeblockCommon.cpp (1 of 3 files). Show all
Unified · Split
| @@ -26,7 +26,7 @@ if (iNum==0) { \ · 25 unmodified lines | ||
| 26 | 26 | iTc[0] = iTc[1] = iTc[2] = iTc[3] = 25; \ |
| 27 | 27 | pBase[0] = pRef[0] = 128; \ |
| 28 | 28 | for (int i = 1; i < iWidth*iWidth; i++) { \ |
| 29 | − pBase[i] = pRef[i] = WELS_CLIP3( pBase[i-1] -16 + rand()%32, 0, 255 ); \ | |
| 29 | + pBase[i] = pRef[i] = WelsClip3( pBase[i-1] -16 + rand()%32, 0, 255 ); \ | |
| 30 | 30 | } \ |
| 31 | 31 | } else if (iNum==1) { \ |
| 32 | 32 | iAlpha = 4; \ |
| @@ -34,7 +34,7 @@ if (iNum==0) { \ · 1 unmodified line | ||
| 34 | 34 | iTc[0] = iTc[1] = iTc[2] = iTc[3] = 9; \ |
| 35 | 35 | pBase[0] = pRef[0] = 128; \ |
| 36 | 36 | for (int i = 1; i < iWidth*iWidth; i++) { \ |
| 37 | − pBase[i] = pRef[i] = WELS_CLIP3( pBase[i-1] -4 + rand()%8, 0, 255 ); \ | |
| 37 | + pBase[i] = pRef[i] = WelsClip3( pBase[i-1] -4 + rand()%8, 0, 255 ); \ | |
| 38 | 38 | } \ |
| 39 | 39 | } else { \ |
| 40 | 40 | iAlpha = rand() % 256; \ |