#define TAG __FILE__
+#define PADDING_FILL_VALUE 0x37
+
/* YUV to RGB conversion is lossy, so consider every value only
* differing by less than 2 abs equal. */
static BOOL similar(const BYTE* src, const BYTE* dst, size_t size)
return TRUE;
}
-static BOOL similarRGB(const BYTE* src, const BYTE* dst, size_t size, UINT32 format)
+static BOOL similarRGB(const BYTE* src, const BYTE* dst, size_t size, UINT32 format, BOOL use444)
{
size_t x;
const UINT32 bpp = GetBytesPerPixel(format);
+ BYTE fill = PADDING_FILL_VALUE;
+ if (!ColorHasAlpha(format))
+ fill = 0xFF;
for (x = 0; x < size; x++)
{
{
fprintf(
stderr,
- "Color value mismatch R[%02X %02X], G[%02X %02X], B[%02X %02X] at position %lu",
+ "Color value mismatch R[%02X %02X], G[%02X %02X], B[%02X %02X] at position %lu\n",
sR, dR, sG, dG, sA, dA, x);
return FALSE;
}
- if (dA != 0xFF)
+ if (dA != fill)
{
- fprintf(stderr, "Invalid destination alpha value %02X at position %lu", dA, x);
+ fprintf(stderr, "[%s] Invalid destination alpha value %02X at position %lu\n",
+ use444 ? "AVC444" : "AVC420", dA, x);
return FALSE;
}
}
return NULL;
memset(&src[0], 'A', halfPad);
- memset(&src[halfPad], 0, size);
+ memset(&src[halfPad], PADDING_FILL_VALUE, size);
memset(&src[halfPad + size], 'A', halfPad);
psrc = &src[halfPad];
pstatus_t rc;
const UINT32 DstFormat = formats[x];
printf("Testing destination color format %s\n", FreeRDPGetColorFormatName(DstFormat));
+ memset(rgb_dst, PADDING_FILL_VALUE, size * sizeof(UINT32));
+
PROFILER_CREATE(rgbToYUV420, "RGBToYUV420")
PROFILER_CREATE(rgbToYUV444, "RGBToYUV444")
PROFILER_CREATE(yuv420ToRGB, "YUV420ToRGB")
BYTE* srgb = &rgb[y * stride];
BYTE* drgb = &rgb_dst[y * stride];
- if (!similarRGB(srgb, drgb, roi.width, DstFormat))
+ if (!similarRGB(srgb, drgb, roi.width, DstFormat, use444))
goto fail;
}