Use pixel_test_buff matrix to test intrapred functions as this matrix
is set up with minimum and maximum pixel values instead of only random
values.
---
 source/test/intrapredharness.cpp | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/source/test/intrapredharness.cpp b/source/test/intrapredharness.cpp
index 94090f773..41a029f69 100644
--- a/source/test/intrapredharness.cpp
+++ b/source/test/intrapredharness.cpp
@@ -55,12 +55,13 @@ bool IntraPredHarness::check_dc_primitive(intra_pred_t ref, 
intra_pred_t opt, in
 
     for (int i = 0; i <= 100; i++)
     {
+        int index = rand() % TEST_CASES;
         int rand_filter = rand() & 1;
         if (width > 16)
             rand_filter = 0;
 
-        ref(pixel_out_c, stride, pixel_buff + j - Predict::ADI_BUF_STRIDE, 0, 
rand_filter);
-        checked(opt, pixel_out_vec, stride, pixel_buff + j - 
Predict::ADI_BUF_STRIDE, 0, rand_filter);
+        ref(pixel_out_c, stride, pixel_test_buff[index] + j - 
Predict::ADI_BUF_STRIDE, 0, rand_filter);
+        checked(opt, pixel_out_vec, stride, pixel_test_buff[index] + j - 
Predict::ADI_BUF_STRIDE, 0, rand_filter);
 
         for (int k = 0; k < width; k++)
         {
@@ -87,8 +88,10 @@ bool IntraPredHarness::check_planar_primitive(intra_pred_t 
ref, intra_pred_t opt
 
     for (int i = 0; i <= 100; i++)
     {
-        ref(pixel_out_c, stride, pixel_buff + j - Predict::ADI_BUF_STRIDE, 0, 
0);
-        checked(opt, pixel_out_vec, stride, pixel_buff + j - 
Predict::ADI_BUF_STRIDE, 0, 0);
+        int index = rand() % TEST_CASES;
+
+        ref(pixel_out_c, stride, pixel_test_buff[index] + j - 
Predict::ADI_BUF_STRIDE, 0, 0);
+        checked(opt, pixel_out_vec, stride, pixel_test_buff[index] + j - 
Predict::ADI_BUF_STRIDE, 0, 0);
 
         for (int k = 0; k < width; k++)
         {
@@ -119,19 +122,20 @@ bool IntraPredHarness::check_angular_primitive(const 
intra_pred_t ref[], const i
         int bFilter = (width <= 16) && (rand() % 2);
         for (int pmode = 2; pmode <= 34; pmode++)
         {
+            int index = rand() % TEST_CASES;
             if (!opt[pmode])
                 continue;
 
-            checked(opt[pmode], pixel_out_vec, stride, pixel_buff + j, pmode, 
bFilter);
-            ref[pmode](pixel_out_c, stride, pixel_buff + j, pmode, bFilter);
+            checked(opt[pmode], pixel_out_vec, stride, pixel_test_buff[index] 
+ j, pmode, bFilter);
+            ref[pmode](pixel_out_c, stride, pixel_test_buff[index] + j, pmode, 
bFilter);
 
             for (int k = 0; k < width; k++)
             {
                 if (memcmp(pixel_out_vec + k * FENC_STRIDE, pixel_out_c + k * 
FENC_STRIDE, width * sizeof(pixel)))
                 {
                     printf("ang_%dx%d, Mode = %d, Row = %d failed !!\n", 
width, width, pmode, k);
-                    ref[pmode](pixel_out_c, stride, pixel_buff + j, pmode, 
bFilter);
-                    opt[pmode](pixel_out_vec, stride, pixel_buff + j, pmode, 
bFilter);
+                    ref[pmode](pixel_out_c, stride, pixel_test_buff[index] + 
j, pmode, bFilter);
+                    opt[pmode](pixel_out_vec, stride, pixel_test_buff[index] + 
j, pmode, bFilter);
                     return false;
                 }
             }
@@ -159,9 +163,10 @@ bool IntraPredHarness::check_allangs_primitive(const 
intra_allangs_t ref, const
 
     for (int i = 0; i <= 100; i++)
     {
+        int index = rand() % TEST_CASES;
         isLuma = (width <= 16) ? true : false;  // bFilter is true for 4x4, 
8x8, 16x16 and false for 32x32
 
-        pixel * refAbove0 = pixel_buff + j + 3 * FENC_STRIDE;   // keep this 
offset, since vector code may broken input buffer range [-(width-1), 0];
+        pixel * refAbove0 = pixel_test_buff[index] + j + 3 * FENC_STRIDE;   // 
keep this offset, since vector code may broken input buffer range [-(width-1), 
0];
         pixel * refLeft0 = refAbove0 + 3 * width + FENC_STRIDE;
 
         refLeft0[0] = refAbove0[0];
-- 
2.39.5 (Apple Git-154)

>From d4f373c6d1aaa8603adadaea6e972e0b5e1a1480 Mon Sep 17 00:00:00 2001
Message-Id: 
<d4f373c6d1aaa8603adadaea6e972e0b5e1a1480.1752060897.git.gerdazsejke.m...@arm.com>
In-Reply-To: <[email protected]>
References: <[email protected]>
From: Gerda Zsejke More <[email protected]>
Date: Wed, 14 May 2025 10:35:15 +0100
Subject: [PATCH 1/3] testbench: Add testing for MIN/MAX values in intrapred
 harness

Use pixel_test_buff matrix to test intrapred functions as this matrix
is set up with minimum and maximum pixel values instead of only random
values.
---
 source/test/intrapredharness.cpp | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/source/test/intrapredharness.cpp b/source/test/intrapredharness.cpp
index 94090f773..41a029f69 100644
--- a/source/test/intrapredharness.cpp
+++ b/source/test/intrapredharness.cpp
@@ -55,12 +55,13 @@ bool IntraPredHarness::check_dc_primitive(intra_pred_t ref, 
intra_pred_t opt, in
 
     for (int i = 0; i <= 100; i++)
     {
+        int index = rand() % TEST_CASES;
         int rand_filter = rand() & 1;
         if (width > 16)
             rand_filter = 0;
 
-        ref(pixel_out_c, stride, pixel_buff + j - Predict::ADI_BUF_STRIDE, 0, 
rand_filter);
-        checked(opt, pixel_out_vec, stride, pixel_buff + j - 
Predict::ADI_BUF_STRIDE, 0, rand_filter);
+        ref(pixel_out_c, stride, pixel_test_buff[index] + j - 
Predict::ADI_BUF_STRIDE, 0, rand_filter);
+        checked(opt, pixel_out_vec, stride, pixel_test_buff[index] + j - 
Predict::ADI_BUF_STRIDE, 0, rand_filter);
 
         for (int k = 0; k < width; k++)
         {
@@ -87,8 +88,10 @@ bool IntraPredHarness::check_planar_primitive(intra_pred_t 
ref, intra_pred_t opt
 
     for (int i = 0; i <= 100; i++)
     {
-        ref(pixel_out_c, stride, pixel_buff + j - Predict::ADI_BUF_STRIDE, 0, 
0);
-        checked(opt, pixel_out_vec, stride, pixel_buff + j - 
Predict::ADI_BUF_STRIDE, 0, 0);
+        int index = rand() % TEST_CASES;
+
+        ref(pixel_out_c, stride, pixel_test_buff[index] + j - 
Predict::ADI_BUF_STRIDE, 0, 0);
+        checked(opt, pixel_out_vec, stride, pixel_test_buff[index] + j - 
Predict::ADI_BUF_STRIDE, 0, 0);
 
         for (int k = 0; k < width; k++)
         {
@@ -119,19 +122,20 @@ bool IntraPredHarness::check_angular_primitive(const 
intra_pred_t ref[], const i
         int bFilter = (width <= 16) && (rand() % 2);
         for (int pmode = 2; pmode <= 34; pmode++)
         {
+            int index = rand() % TEST_CASES;
             if (!opt[pmode])
                 continue;
 
-            checked(opt[pmode], pixel_out_vec, stride, pixel_buff + j, pmode, 
bFilter);
-            ref[pmode](pixel_out_c, stride, pixel_buff + j, pmode, bFilter);
+            checked(opt[pmode], pixel_out_vec, stride, pixel_test_buff[index] 
+ j, pmode, bFilter);
+            ref[pmode](pixel_out_c, stride, pixel_test_buff[index] + j, pmode, 
bFilter);
 
             for (int k = 0; k < width; k++)
             {
                 if (memcmp(pixel_out_vec + k * FENC_STRIDE, pixel_out_c + k * 
FENC_STRIDE, width * sizeof(pixel)))
                 {
                     printf("ang_%dx%d, Mode = %d, Row = %d failed !!\n", 
width, width, pmode, k);
-                    ref[pmode](pixel_out_c, stride, pixel_buff + j, pmode, 
bFilter);
-                    opt[pmode](pixel_out_vec, stride, pixel_buff + j, pmode, 
bFilter);
+                    ref[pmode](pixel_out_c, stride, pixel_test_buff[index] + 
j, pmode, bFilter);
+                    opt[pmode](pixel_out_vec, stride, pixel_test_buff[index] + 
j, pmode, bFilter);
                     return false;
                 }
             }
@@ -159,9 +163,10 @@ bool IntraPredHarness::check_allangs_primitive(const 
intra_allangs_t ref, const
 
     for (int i = 0; i <= 100; i++)
     {
+        int index = rand() % TEST_CASES;
         isLuma = (width <= 16) ? true : false;  // bFilter is true for 4x4, 
8x8, 16x16 and false for 32x32
 
-        pixel * refAbove0 = pixel_buff + j + 3 * FENC_STRIDE;   // keep this 
offset, since vector code may broken input buffer range [-(width-1), 0];
+        pixel * refAbove0 = pixel_test_buff[index] + j + 3 * FENC_STRIDE;   // 
keep this offset, since vector code may broken input buffer range [-(width-1), 
0];
         pixel * refLeft0 = refAbove0 + 3 * width + FENC_STRIDE;
 
         refLeft0[0] = refAbove0[0];
-- 
2.39.5 (Apple Git-154)

_______________________________________________
x265-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/x265-devel

Reply via email to