[primitives,yuv] fix compiler warnings

This commit is contained in:
akallabeth
2025-01-10 10:44:05 +01:00
parent 61c049b2e6
commit 6f8a852a7b
3 changed files with 33 additions and 21 deletions

View File

@@ -357,11 +357,11 @@ general_YUV444ToRGB_DOUBLE_ROW(BYTE* WINPR_RESTRICT pRGB[2], UINT32 DstFormat,
{
const INT32 subU = (INT32)pU[0][x + 1] + pU[1][x] + pU[1][x + 1];
const INT32 avgU = ((4 * u) - subU);
u = CONDITIONAL_CLIP(avgU, u);
u = CONDITIONAL_CLIP(avgU, WINPR_ASSERTING_INT_CAST(BYTE, u));
const INT32 subV = (INT32)pV[0][x + 1] + pV[1][x] + pV[1][x + 1];
const INT32 avgV = ((4 * v) - subV);
v = CONDITIONAL_CLIP(avgV, v);
v = CONDITIONAL_CLIP(avgV, WINPR_ASSERTING_INT_CAST(BYTE, v));
}
const BYTE r = YUV2R(y, u, v);
const BYTE g = YUV2G(y, u, v);
@@ -1063,7 +1063,7 @@ void general_RGBToAVC444YUV_BGRX_DOUBLE_ROW(size_t offset, const BYTE* WINPR_RES
BYTE* WINPR_RESTRICT b6, BYTE* WINPR_RESTRICT b7,
UINT32 width)
{
for (UINT32 x = offset; x < width; x += 2)
for (size_t x = offset; x < width; x += 2)
{
const BYTE* srcEven = &pSrcEven[4ULL * x];
const BYTE* srcOdd = &pSrcOdd[4ULL * x];
@@ -1813,7 +1813,7 @@ static INLINE pstatus_t general_RGBToAVC444YUVv2_ANY(
return PRIMITIVES_SUCCESS;
}
inline void general_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW(
void general_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW(
size_t offset, const BYTE* WINPR_RESTRICT pSrcEven, const BYTE* WINPR_RESTRICT pSrcOdd,
BYTE* WINPR_RESTRICT yLumaDstEven, BYTE* WINPR_RESTRICT yLumaDstOdd,
BYTE* WINPR_RESTRICT uLumaDst, BYTE* WINPR_RESTRICT vLumaDst,
@@ -1822,7 +1822,7 @@ inline void general_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW(
BYTE* WINPR_RESTRICT uChromaDst1, BYTE* WINPR_RESTRICT uChromaDst2,
BYTE* WINPR_RESTRICT vChromaDst1, BYTE* WINPR_RESTRICT vChromaDst2, UINT32 width)
{
for (UINT32 x = offset; x < width; x += 2)
for (size_t x = offset; x < width; x += 2)
{
const BYTE* srcEven = &pSrcEven[4ULL * x];
const BYTE* srcOdd = &pSrcOdd[4ULL * x];

View File

@@ -421,5 +421,7 @@ const char* primitives_avc444_frame_type_str(avc444_frame_type type)
return "AVC444_CHROMAv1";
case AVC444_CHROMAv2:
return "AVC444_CHROMAv2";
default:
return "INVALID_FRAME_TYPE";
}
}

View File

@@ -6,6 +6,8 @@
#include "prim_test.h"
#include <winpr/print.h>
#include <winpr/wlog.h>
#include <winpr/crypto.h>
#include <freerdp/primitives.h>
@@ -1002,7 +1004,6 @@ static BOOL yuv444_to_rgb(BYTE* rgb, size_t stride, const BYTE* yuv[3], const UI
/* Check the result of generic matches the optimized routine.
*
*/
#include <winpr/print.h>
static BOOL compare_yuv444_to_rgb(prim_size_t roi, DWORD type)
{
BOOL rc = FALSE;
@@ -1051,10 +1052,14 @@ static BOOL compare_yuv444_to_rgb(prim_size_t roi, DWORD type)
const UINT32 color1 = FreeRDPReadColor(&line1[x * 4], format);
const UINT32 color2 = FreeRDPReadColor(&line2[x * 4], format);
BYTE r1, g1, b1;
BYTE r1 = 0;
BYTE g1 = 0;
BYTE b1 = 0;
FreeRDPSplitColor(color1, format, &r1, &g1, &b1, NULL, NULL);
BYTE r2, g2, b2;
BYTE r2 = 0;
BYTE g2 = 0;
BYTE b2 = 0;
FreeRDPSplitColor(color2, format, &r2, &g2, &b2, NULL, NULL);
const int dr12 = abs(r1 - r2);
@@ -1071,12 +1076,12 @@ static BOOL compare_yuv444_to_rgb(prim_size_t roi, DWORD type)
if ((dr12 > 0) || (dg12 > 0) || (db12 > 0))
{
fprintf(stderr,
"[%" PRIuz "x%" PRIuz "] generic and optimized data mismatch: r[0x%" PRIx8
"|0x%" PRIx8 "] g[0x%" PRIx8 "|0x%" PRIx8 "] b[0x%" PRIx8 "|0x%" PRIx8
"]\n",
x, y, r1, r2, g1, g2, b1, b2);
fprintf(stderr, "roi: %dx%d\n", roi.width, roi.height);
(void)fprintf(stderr,
"[%" PRIuz "x%" PRIuz
"] generic and optimized data mismatch: r[0x%" PRIx8 "|0x%" PRIx8
"] g[0x%" PRIx8 "|0x%" PRIx8 "] b[0x%" PRIx8 "|0x%" PRIx8 "]\n",
x, y, r1, r2, g1, g2, b1, b2);
(void)fprintf(stderr, "roi: %dx%d\n", roi.width, roi.height);
winpr_HexDump("y0", WLOG_INFO, &yline[0][x], 16);
winpr_HexDump("y1", WLOG_INFO, &yline[0][x + roi.width], 16);
winpr_HexDump("u0", WLOG_INFO, &yline[1][x], 16);
@@ -1151,7 +1156,7 @@ static BOOL compare_rgb_to_yuv444(prim_size_t roi, DWORD type)
{
if (memcmp(yline1[x], yline2[x], yuvStep[x]) != 0)
{
fprintf(stderr, "[%s] compare failed in line %" PRIuz, __func__, x);
(void)fprintf(stderr, "[%s] compare failed in line %" PRIuz, __func__, x);
goto fail;
}
}
@@ -1218,10 +1223,14 @@ static BOOL compare_yuv420_to_rgb(prim_size_t roi, DWORD type)
const UINT32 color1 = FreeRDPReadColor(&line1[x * 4], format);
const UINT32 color2 = FreeRDPReadColor(&line2[x * 4], format);
BYTE r1, g1, b1;
BYTE r1 = 0;
BYTE g1 = 0;
BYTE b1 = 0;
FreeRDPSplitColor(color1, format, &r1, &g1, &b1, NULL, NULL);
BYTE r2, g2, b2;
BYTE r2 = 0;
BYTE g2 = 0;
BYTE b2 = 0;
FreeRDPSplitColor(color2, format, &r2, &g2, &b2, NULL, NULL);
const int dr12 = abs(r1 - r2);
@@ -1348,10 +1357,11 @@ static BOOL compare_rgb_to_yuv420(prim_size_t roi, DWORD type)
{
if (similarY(yline1[x], yline2[x], yuvStep[x], x) != 0)
{
fprintf(stderr, "[%s] compare failed in component %" PRIuz ", line %" PRIuz "\n",
__func__, x, y);
fprintf(stderr, "[%s] roi %" PRIu32 "x%" PRIu32 "\n", __func__, roi.width,
roi.height);
(void)fprintf(stderr,
"[%s] compare failed in component %" PRIuz ", line %" PRIuz "\n",
__func__, x, y);
(void)fprintf(stderr, "[%s] roi %" PRIu32 "x%" PRIu32 "\n", __func__, roi.width,
roi.height);
winpr_HexDump(TAG, WLOG_WARN, yline1[x], yuvStep[x]);
winpr_HexDump(TAG, WLOG_WARN, yline2[x], yuvStep[x]);
winpr_HexDump(TAG, WLOG_WARN, &rgb[y * stride], stride);