History

Use an inline function instead of a macro for clipping which contains rand()

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.

Martin Storsjö committed 11 years ago

Commit 59fefbe1 parent a9c2e1b3 files · +17 −9Browse files

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

Unified · Split

test/decoder/DecUT_DeblockCommon.cpp+2−2
@@ -26,7 +26,7 @@ if (iNum==0) { \ · 25 unmodified lines
2626 iTc[0] = iTc[1] = iTc[2] = iTc[3] = 25; \
2727 pBase[0] = pRef[0] = 128; \
2828 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 ); \
3030 } \
3131 } else if (iNum==1) { \
3232 iAlpha = 4; \
@@ -34,7 +34,7 @@ if (iNum==0) { \ · 1 unmodified line
3434 iTc[0] = iTc[1] = iTc[2] = iTc[3] = 9; \
3535 pBase[0] = pRef[0] = 128; \
3636 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 ); \
3838 } \
3939 } else { \
4040 iAlpha = rand() % 256; \

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