The existing unit tests assumes that the weight_sp function's input
data is in the range [SMIN, SMAX]. However running real encodings
show that values outside of this range can be input values.
Set the tested value range to [SHORT_MIN, SHORT_MAX].
Change-Id: If83bfacb4232dacf53dacbf52ee874a53415bd59
---
source/test/pixelharness.cpp | 9 ++++++---
source/test/pixelharness.h | 1 +
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/source/test/pixelharness.cpp b/source/test/pixelharness.cpp
index e37ae3cb7..c396623ef 100644
--- a/source/test/pixelharness.cpp
+++ b/source/test/pixelharness.cpp
@@ -39,6 +39,7 @@ PixelHarness::PixelHarness()
short_test_buff[0][i] = (rand() % (2 * SMAX + 1)) - SMAX - 1; //
max(SHORT_MIN, min(rand(), SMAX));
short_test_buff1[0][i] = rand() & PIXEL_MAX; // For
block copy only
short_test_buff2[0][i] = rand() % 16383; // for
addAvg
+ short_test_buff3[0][i] = rand() % SHORT_MAX; // for
weight_sp
int_test_buff[0][i] = rand() % SHORT_MAX;
ushort_test_buff[0][i] = rand() % ((1 << 16) - 1);
uchar_test_buff[0][i] = rand() % ((1 << 8) - 1);
@@ -48,6 +49,7 @@ PixelHarness::PixelHarness()
short_test_buff[1][i] = (int16_t)SMIN;
short_test_buff1[1][i] = PIXEL_MIN;
short_test_buff2[1][i] = -16384;
+ short_test_buff3[1][i] = SHORT_MIN;
int_test_buff[1][i] = SHORT_MIN;
ushort_test_buff[1][i] = PIXEL_MIN;
uchar_test_buff[1][i] = PIXEL_MIN;
@@ -58,6 +60,7 @@ PixelHarness::PixelHarness()
short_test_buff[2][i] = SMAX;
short_test_buff1[2][i] = PIXEL_MAX;
short_test_buff2[2][i] = 16383;
+ short_test_buff3[2][i] = SHORT_MAX;
int_test_buff[2][i] = SHORT_MAX;
ushort_test_buff[2][i] = ((1 << 16) - 1);
uchar_test_buff[2][i] = 255;
@@ -308,12 +311,12 @@ bool PixelHarness::check_weightp(weightp_sp_t ref,
weightp_sp_t opt)
for (int i = 0; i < ITERS; i++)
{
int index = i % TEST_CASES;
- checked(opt, short_test_buff[index] + j, opt_dest, stride, stride + 1,
width, height, w0, round << correction, shift + correction, offset);
- ref(short_test_buff[index] + j, ref_dest, stride, stride + 1, width,
height, w0, round << correction, shift + correction, offset);
+ checked(opt, short_test_buff3[index] + j, opt_dest, stride, stride +
1, width, height, w0, round << correction, shift + correction, offset);
+ ref(short_test_buff3[index] + j, ref_dest, stride, stride + 1, width,
height, w0, round << correction, shift + correction, offset);
if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
{
- opt(short_test_buff[index] + j, opt_dest, stride, stride + 1,
width, height, w0, round << correction, shift + correction, offset);
+ opt(short_test_buff3[index] + j, opt_dest, stride, stride + 1,
width, height, w0, round << correction, shift + correction, offset);
return false;
}
diff --git a/source/test/pixelharness.h b/source/test/pixelharness.h
index 5dd354029..1067bf774 100644
--- a/source/test/pixelharness.h
+++ b/source/test/pixelharness.h
@@ -63,6 +63,7 @@ protected:
ALIGN_VAR_64(int16_t, short_test_buff[TEST_CASES][BUFFSIZE]);
ALIGN_VAR_64(int16_t, short_test_buff1[TEST_CASES][BUFFSIZE]);
ALIGN_VAR_64(int16_t, short_test_buff2[TEST_CASES][BUFFSIZE]);
+ ALIGN_VAR_64(int16_t, short_test_buff3[TEST_CASES][BUFFSIZE]);
ALIGN_VAR_64(int, int_test_buff[TEST_CASES][BUFFSIZE]);
ALIGN_VAR_64(uint16_t, ushort_test_buff[TEST_CASES][BUFFSIZE]);
ALIGN_VAR_64(uint8_t, uchar_test_buff[TEST_CASES][BUFFSIZE]);
--
2.39.5 (Apple Git-154)
>From ab57fd8df883cb73a464592738fef0da114f4719 Mon Sep 17 00:00:00 2001
Message-Id:
<ab57fd8df883cb73a464592738fef0da114f4719.1752060897.git.gerdazsejke.m...@arm.com>
In-Reply-To: <[email protected]>
References: <[email protected]>
From: Gerda Zsejke More <[email protected]>
Date: Wed, 2 Jul 2025 09:53:47 +0200
Subject: [PATCH 3/3] testbench: Fix pixel harness weight_sp function input
value range
The existing unit tests assumes that the weight_sp function's input
data is in the range [SMIN, SMAX]. However running real encodings
show that values outside of this range can be input values.
Set the tested value range to [SHORT_MIN, SHORT_MAX].
Change-Id: If83bfacb4232dacf53dacbf52ee874a53415bd59
---
source/test/pixelharness.cpp | 9 ++++++---
source/test/pixelharness.h | 1 +
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/source/test/pixelharness.cpp b/source/test/pixelharness.cpp
index e37ae3cb7..c396623ef 100644
--- a/source/test/pixelharness.cpp
+++ b/source/test/pixelharness.cpp
@@ -39,6 +39,7 @@ PixelHarness::PixelHarness()
short_test_buff[0][i] = (rand() % (2 * SMAX + 1)) - SMAX - 1; //
max(SHORT_MIN, min(rand(), SMAX));
short_test_buff1[0][i] = rand() & PIXEL_MAX; // For
block copy only
short_test_buff2[0][i] = rand() % 16383; // for
addAvg
+ short_test_buff3[0][i] = rand() % SHORT_MAX; // for
weight_sp
int_test_buff[0][i] = rand() % SHORT_MAX;
ushort_test_buff[0][i] = rand() % ((1 << 16) - 1);
uchar_test_buff[0][i] = rand() % ((1 << 8) - 1);
@@ -48,6 +49,7 @@ PixelHarness::PixelHarness()
short_test_buff[1][i] = (int16_t)SMIN;
short_test_buff1[1][i] = PIXEL_MIN;
short_test_buff2[1][i] = -16384;
+ short_test_buff3[1][i] = SHORT_MIN;
int_test_buff[1][i] = SHORT_MIN;
ushort_test_buff[1][i] = PIXEL_MIN;
uchar_test_buff[1][i] = PIXEL_MIN;
@@ -58,6 +60,7 @@ PixelHarness::PixelHarness()
short_test_buff[2][i] = SMAX;
short_test_buff1[2][i] = PIXEL_MAX;
short_test_buff2[2][i] = 16383;
+ short_test_buff3[2][i] = SHORT_MAX;
int_test_buff[2][i] = SHORT_MAX;
ushort_test_buff[2][i] = ((1 << 16) - 1);
uchar_test_buff[2][i] = 255;
@@ -308,12 +311,12 @@ bool PixelHarness::check_weightp(weightp_sp_t ref,
weightp_sp_t opt)
for (int i = 0; i < ITERS; i++)
{
int index = i % TEST_CASES;
- checked(opt, short_test_buff[index] + j, opt_dest, stride, stride + 1,
width, height, w0, round << correction, shift + correction, offset);
- ref(short_test_buff[index] + j, ref_dest, stride, stride + 1, width,
height, w0, round << correction, shift + correction, offset);
+ checked(opt, short_test_buff3[index] + j, opt_dest, stride, stride +
1, width, height, w0, round << correction, shift + correction, offset);
+ ref(short_test_buff3[index] + j, ref_dest, stride, stride + 1, width,
height, w0, round << correction, shift + correction, offset);
if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
{
- opt(short_test_buff[index] + j, opt_dest, stride, stride + 1,
width, height, w0, round << correction, shift + correction, offset);
+ opt(short_test_buff3[index] + j, opt_dest, stride, stride + 1,
width, height, w0, round << correction, shift + correction, offset);
return false;
}
diff --git a/source/test/pixelharness.h b/source/test/pixelharness.h
index 5dd354029..1067bf774 100644
--- a/source/test/pixelharness.h
+++ b/source/test/pixelharness.h
@@ -63,6 +63,7 @@ protected:
ALIGN_VAR_64(int16_t, short_test_buff[TEST_CASES][BUFFSIZE]);
ALIGN_VAR_64(int16_t, short_test_buff1[TEST_CASES][BUFFSIZE]);
ALIGN_VAR_64(int16_t, short_test_buff2[TEST_CASES][BUFFSIZE]);
+ ALIGN_VAR_64(int16_t, short_test_buff3[TEST_CASES][BUFFSIZE]);
ALIGN_VAR_64(int, int_test_buff[TEST_CASES][BUFFSIZE]);
ALIGN_VAR_64(uint16_t, ushort_test_buff[TEST_CASES][BUFFSIZE]);
ALIGN_VAR_64(uint8_t, uchar_test_buff[TEST_CASES][BUFFSIZE]);
--
2.39.5 (Apple Git-154)
_______________________________________________
x265-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/x265-devel