<div data-ntes="ntes_mail_body_root" style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div id="spnEditorContent"><p style="margin: 0;">Hi ,</p><p style="margin: 0;"><br></p><p style="margin: 0;">This patch looks incorrect.</p><p style="margin: 0;">In the HEVC specification, the value of pixel clips to bitDepth</p><p style="margin: 0;"><br></p><p style="margin: 0;"><i>pbSamples[ x ][ y ] = Clip3( 0, ( 1 << bitDepth ) − 1,</i> </p><p style="margin: 0;"><br></p><p style="margin: 0;">Regards,<br>Chen</p></div><pre>At 2025-07-09 19:48:58, "Gerda Zsejke More" <gerdazsejke.more@arm.com> wrote:
>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)
>
</pre></div>