Test: Fix big endian
Vicki Pfau vi@endrift.com
Fri, 14 Aug 2020 20:50:57 -0700
1 files changed,
21 insertions(+),
0 deletions(-)
jump to
M
src/platform/test/cinema-main.c
→
src/platform/test/cinema-main.c
@@ -792,12 +792,21 @@ for (y = 0; y < image->height; ++y) {
for (x = 0; x < image->width; ++x) { size_t pix = expected->stride * y + x; size_t tpix = image->stride * y + x; +#ifndef __BIG_ENDIAN__ int testR = testPixels[tpix * 4 + 0]; int testG = testPixels[tpix * 4 + 1]; int testB = testPixels[tpix * 4 + 2]; int expectR = expectPixels[pix * 4 + 0]; int expectG = expectPixels[pix * 4 + 1]; int expectB = expectPixels[pix * 4 + 2]; +#else + int testB = testPixels[tpix * 4 + 1]; + int testG = testPixels[tpix * 4 + 2]; + int testR = testPixels[tpix * 4 + 3]; + int expectB = expectPixels[pix * 4 + 1]; + int expectG = expectPixels[pix * 4 + 2]; + int expectR = expectPixels[pix * 4 + 3]; +#endif int r = expectR - testR; int g = expectG - testG; int b = expectB - testB;@@ -828,9 +837,15 @@ }
if (b > *max) { *max = b; } +#ifndef __BIG_ENDIAN__ diff[pix * 4 + 0] = r; diff[pix * 4 + 1] = g; diff[pix * 4 + 2] = b; +#else + diff[pix * 4 + 1] = b; + diff[pix * 4 + 2] = g; + diff[pix * 4 + 3] = r; +#endif } if (test) {@@ -864,9 +879,15 @@ size_t y;
for (y = 0; y < outdiff.height; ++y) { for (x = 0; x < outdiff.width; ++x) { size_t pix = outdiff.stride * y + x; +#ifndef __BIG_ENDIAN__ diff[pix * 4 + 0] = diff[pix * 4 + 0] * 255 / max; diff[pix * 4 + 1] = diff[pix * 4 + 1] * 255 / max; diff[pix * 4 + 2] = diff[pix * 4 + 2] * 255 / max; +#else + diff[pix * 4 + 1] = diff[pix * 4 + 1] * 255 / max; + diff[pix * 4 + 2] = diff[pix * 4 + 2] * 255 / max; + diff[pix * 4 + 3] = diff[pix * 4 + 3] * 255 / max; +#endif } } if (xfail) {