- Masks can only be -1 or 0 based on Deblock::edgeFilterChroma. - Also fix the input buffer offsets of Chroma and LumaStrong in the speedup calculation. --- source/test/pixelharness.cpp | 109 +++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 42 deletions(-)
diff --git a/source/test/pixelharness.cpp b/source/test/pixelharness.cpp index 311985d83..f3d68238a 100644 --- a/source/test/pixelharness.cpp +++ b/source/test/pixelharness.cpp @@ -1749,7 +1749,6 @@ bool PixelHarness::check_scanPosLast(scanPosLast_t ref, scanPosLast_t opt) { ref_src[32 * 32 + i] = 0x1234; } - memset(ref_coeffNum, 0xCD, sizeof(ref_coeffNum)); memset(ref_coeffSign, 0xCD, sizeof(ref_coeffSign)); @@ -2096,7 +2095,7 @@ bool PixelHarness::check_pelFilterLumaStrong_H(pelFilterLumaStrong_t ref, pelFil { intptr_t srcStep = 1, offset = 64; int32_t tcP, tcQ, maskP, maskQ, tc; - int j = 0; + intptr_t j = 0; pixel pixel_test_buff1[TEST_CASES][BUFFSIZE]; for (int i = 0; i < TEST_CASES; i++) @@ -2112,7 +2111,7 @@ bool PixelHarness::check_pelFilterLumaStrong_H(pelFilterLumaStrong_t ref, pelFil int index = rand() % 3; - ref(pixel_test_buff[index] + 4 * offset + j, srcStep, offset, tcP, tcQ); + ref(pixel_test_buff[index] + 4 * offset + j, srcStep, offset, tcP, tcQ); checked(opt, pixel_test_buff1[index] + 4 * offset + j, srcStep, offset, tcP, tcQ); if (memcmp(pixel_test_buff[index], pixel_test_buff1[index], sizeof(pixel) * BUFFSIZE)) @@ -2129,7 +2128,7 @@ bool PixelHarness::check_pelFilterLumaStrong_V(pelFilterLumaStrong_t ref, pelFil { intptr_t srcStep = 64, offset = 1; int32_t tcP, tcQ, maskP, maskQ, tc; - int j = 0; + intptr_t j = 0; pixel pixel_test_buff1[TEST_CASES][BUFFSIZE]; for (int i = 0; i < TEST_CASES; i++) @@ -2145,8 +2144,8 @@ bool PixelHarness::check_pelFilterLumaStrong_V(pelFilterLumaStrong_t ref, pelFil int index = rand() % 3; - ref(pixel_test_buff[index] + 4 + j, srcStep, offset, tcP, tcQ); - checked(opt, pixel_test_buff1[index] + 4 + j, srcStep, offset, tcP, tcQ); + ref(pixel_test_buff[index] + 4 * offset + j, srcStep, offset, tcP, tcQ); + checked(opt, pixel_test_buff1[index] + 4 * offset + j, srcStep, offset, tcP, tcQ); if (memcmp(pixel_test_buff[index], pixel_test_buff1[index], sizeof(pixel) * BUFFSIZE)) return false; @@ -2162,28 +2161,35 @@ bool PixelHarness::check_pelFilterChroma_H(pelFilterChroma_t ref, pelFilterChrom { intptr_t srcStep = 1, offset = 64; int32_t maskP, maskQ, tc; - int j = 0; + intptr_t j = 0; + const int NUM_MASKS = 3; pixel pixel_test_buff1[TEST_CASES][BUFFSIZE]; for (int i = 0; i < TEST_CASES; i++) memcpy(pixel_test_buff1[i], pixel_test_buff[i], sizeof(pixel)* BUFFSIZE); - for (int i = 0; i < ITERS; i++) + int32_t masks[NUM_MASKS][2] = {{-1, -1}, {-1, 0}, {0, -1}}; + + for (int i = 0; i < NUM_MASKS; i++) { - tc = rand() % PIXEL_MAX; - maskP = (rand() % PIXEL_MAX) - 1; - maskQ = (rand() % PIXEL_MAX) - 1; + int32_t maskP = masks[i][0]; + int32_t maskQ = masks[i][1]; - int index = rand() % 3; + for (int i = 0; i < ITERS; i++) + { + tc = rand() % PIXEL_MAX; - ref(pixel_test_buff[index] + 4 * offset + j, srcStep, offset, tc, maskP, maskQ); - checked(opt, pixel_test_buff1[index] + 4 * offset + j, srcStep, offset, tc, maskP, maskQ); + int index = rand() % 3; - if (memcmp(pixel_test_buff[index], pixel_test_buff1[index], sizeof(pixel)* BUFFSIZE)) - return false; + ref(pixel_test_buff[index] + 2 * offset + j, srcStep, offset, tc, maskP, maskQ); + checked(opt, pixel_test_buff1[index] + 2 * offset + j, srcStep, offset, tc, maskP, maskQ); - reportfail() - j += INCR; + if (memcmp(pixel_test_buff[index], pixel_test_buff1[index], sizeof(pixel) * BUFFSIZE)) + return false; + + reportfail() + j += INCR; + } } return true; @@ -2193,28 +2199,35 @@ bool PixelHarness::check_pelFilterChroma_V(pelFilterChroma_t ref, pelFilterChrom { intptr_t srcStep = 64, offset = 1; int32_t maskP, maskQ, tc; - int j = 0; + intptr_t j = 0; + const int NUM_MASKS = 3; pixel pixel_test_buff1[TEST_CASES][BUFFSIZE]; for (int i = 0; i < TEST_CASES; i++) memcpy(pixel_test_buff1[i], pixel_test_buff[i], sizeof(pixel)* BUFFSIZE); - for (int i = 0; i < ITERS; i++) + int32_t masks[NUM_MASKS][2] = {{-1, -1}, {-1, 0}, {0, -1}}; + + for (int i = 0; i < NUM_MASKS; i++) { - tc = rand() % PIXEL_MAX; - maskP = (rand() % PIXEL_MAX) - 1; - maskQ = (rand() % PIXEL_MAX) - 1; + int32_t maskP = masks[i][0]; + int32_t maskQ = masks[i][1]; - int index = rand() % 3; + for (int i = 0; i < ITERS; i++) + { + tc = rand() % PIXEL_MAX; - ref(pixel_test_buff[index] + 4 + j, srcStep, offset, tc, maskP, maskQ); - checked(opt, pixel_test_buff1[index] + 4 + j, srcStep, offset, tc, maskP, maskQ); + int index = rand() % 3; - if (memcmp(pixel_test_buff[index], pixel_test_buff1[index], sizeof(pixel)* BUFFSIZE)) - return false; + ref(pixel_test_buff[index] + 2 * offset + j, srcStep, offset, tc, maskP, maskQ); + checked(opt, pixel_test_buff1[index] + 2 * offset + j, srcStep, offset, tc, maskP, maskQ); - reportfail() - j += INCR; + if (memcmp(pixel_test_buff[index], pixel_test_buff1[index], sizeof(pixel) * BUFFSIZE)) + return false; + + reportfail() + j += INCR; + } } return true; @@ -3085,7 +3098,6 @@ bool PixelHarness::testCorrectness(const EncoderPrimitives& ref, const EncoderPr return false; } } - if (opt.pelFilterLumaStrong[0]) { @@ -3152,7 +3164,6 @@ bool PixelHarness::testCorrectness(const EncoderPrimitives& ref, const EncoderPr } } - for (int k = 0; k < NUM_INTEGRAL_SIZE; k++) { if (opt.integral_inith[k] && !check_integral_inith(ref.integral_inith[k], opt.integral_inith[k])) @@ -3749,7 +3760,8 @@ void PixelHarness::measureSpeed(const EncoderPrimitives& ref, const EncoderPrimi int32_t tcP = (rand() % PIXEL_MAX) - 1; int32_t tcQ = (rand() % PIXEL_MAX) - 1; HEADER0("pelFilterLumaStrong_Vertical"); - REPORT_SPEEDUP(opt.pelFilterLumaStrong[0], ref.pelFilterLumaStrong[0], pbuf1, STRIDE, 1, tcP, tcQ); + REPORT_SPEEDUP(opt.pelFilterLumaStrong[0], ref.pelFilterLumaStrong[0], pbuf1 + 4, + STRIDE, 1, tcP, tcQ); } if (opt.pelFilterLumaStrong[1]) @@ -3757,25 +3769,38 @@ void PixelHarness::measureSpeed(const EncoderPrimitives& ref, const EncoderPrimi int32_t tcP = (rand() % PIXEL_MAX) - 1; int32_t tcQ = (rand() % PIXEL_MAX) - 1; HEADER0("pelFilterLumaStrong_Horizontal"); - REPORT_SPEEDUP(opt.pelFilterLumaStrong[1], ref.pelFilterLumaStrong[1], pbuf1, 1, STRIDE, tcP, tcQ); + REPORT_SPEEDUP(opt.pelFilterLumaStrong[1], ref.pelFilterLumaStrong[1], pbuf1 + 4 * STRIDE, + 1, STRIDE, tcP, tcQ); } if (opt.pelFilterChroma[0]) { + const int NUM_MASKS = 3; + int32_t masks[NUM_MASKS][2] = {{-1, -1}, {-1, 0}, {0, -1}}; int32_t tc = (rand() % PIXEL_MAX); - int32_t maskP = (rand() % PIXEL_MAX) - 1; - int32_t maskQ = (rand() % PIXEL_MAX) - 1; - HEADER0("pelFilterChroma_Vertical"); - REPORT_SPEEDUP(opt.pelFilterChroma[0], ref.pelFilterChroma[0], pbuf1, STRIDE, 1, tc, maskP, maskQ); + for (int i = 0; i < NUM_MASKS; i++) + { + int32_t maskP = masks[i][0]; + int32_t maskQ = masks[i][1]; + HEADER("pelFilterChroma_Vertical[MaskP: %d, MaskQ: %d]", maskP, maskQ); + REPORT_SPEEDUP(opt.pelFilterChroma[0], ref.pelFilterChroma[0], pbuf1 + 2, + STRIDE, 1, tc, maskP, maskQ); + } } if (opt.pelFilterChroma[1]) { + const int NUM_MASKS = 3; + int32_t masks[NUM_MASKS][2] = {{-1, -1}, {-1, 0}, {0, -1}}; int32_t tc = (rand() % PIXEL_MAX); - int32_t maskP = (rand() % PIXEL_MAX) - 1; - int32_t maskQ = (rand() % PIXEL_MAX) - 1; - HEADER0("pelFilterChroma_Horizontal"); - REPORT_SPEEDUP(opt.pelFilterChroma[1], ref.pelFilterChroma[1], pbuf1, 1, STRIDE, tc, maskP, maskQ); + for (int i = 0; i < NUM_MASKS; i++) + { + int32_t maskP = masks[i][0]; + int32_t maskQ = masks[i][1]; + HEADER("pelFilterChroma_Horizontal[MaskP: %d, MaskQ: %d]", maskP, maskQ); + REPORT_SPEEDUP(opt.pelFilterChroma[1], ref.pelFilterChroma[1], pbuf1 + 2 * STRIDE, + 1, STRIDE, tc, maskP, maskQ); + } } for (int k = 0; k < NUM_INTEGRAL_SIZE; k++) -- 2.34.1
>From cde8fd021e7dd2d805b648ddf65609391172defd Mon Sep 17 00:00:00 2001 Message-Id: <cde8fd021e7dd2d805b648ddf65609391172defd.1739282617.git.microdaryl.rob...@arm.com> In-Reply-To: <cover.1739282617.git.microdaryl.rob...@arm.com> References: <cover.1739282617.git.microdaryl.rob...@arm.com> From: Micro Daryl Robles <microdaryl.rob...@arm.com> Date: Thu, 22 Aug 2024 16:49:17 +0100 Subject: [PATCH 3/5] Change the test conditions for pelFilterChroma in PixelHarness - Masks can only be -1 or 0 based on Deblock::edgeFilterChroma. - Also fix the input buffer offsets of Chroma and LumaStrong in the speedup calculation. --- source/test/pixelharness.cpp | 109 +++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 42 deletions(-) diff --git a/source/test/pixelharness.cpp b/source/test/pixelharness.cpp index 311985d83..f3d68238a 100644 --- a/source/test/pixelharness.cpp +++ b/source/test/pixelharness.cpp @@ -1749,7 +1749,6 @@ bool PixelHarness::check_scanPosLast(scanPosLast_t ref, scanPosLast_t opt) { ref_src[32 * 32 + i] = 0x1234; } - memset(ref_coeffNum, 0xCD, sizeof(ref_coeffNum)); memset(ref_coeffSign, 0xCD, sizeof(ref_coeffSign)); @@ -2096,7 +2095,7 @@ bool PixelHarness::check_pelFilterLumaStrong_H(pelFilterLumaStrong_t ref, pelFil { intptr_t srcStep = 1, offset = 64; int32_t tcP, tcQ, maskP, maskQ, tc; - int j = 0; + intptr_t j = 0; pixel pixel_test_buff1[TEST_CASES][BUFFSIZE]; for (int i = 0; i < TEST_CASES; i++) @@ -2112,7 +2111,7 @@ bool PixelHarness::check_pelFilterLumaStrong_H(pelFilterLumaStrong_t ref, pelFil int index = rand() % 3; - ref(pixel_test_buff[index] + 4 * offset + j, srcStep, offset, tcP, tcQ); + ref(pixel_test_buff[index] + 4 * offset + j, srcStep, offset, tcP, tcQ); checked(opt, pixel_test_buff1[index] + 4 * offset + j, srcStep, offset, tcP, tcQ); if (memcmp(pixel_test_buff[index], pixel_test_buff1[index], sizeof(pixel) * BUFFSIZE)) @@ -2129,7 +2128,7 @@ bool PixelHarness::check_pelFilterLumaStrong_V(pelFilterLumaStrong_t ref, pelFil { intptr_t srcStep = 64, offset = 1; int32_t tcP, tcQ, maskP, maskQ, tc; - int j = 0; + intptr_t j = 0; pixel pixel_test_buff1[TEST_CASES][BUFFSIZE]; for (int i = 0; i < TEST_CASES; i++) @@ -2145,8 +2144,8 @@ bool PixelHarness::check_pelFilterLumaStrong_V(pelFilterLumaStrong_t ref, pelFil int index = rand() % 3; - ref(pixel_test_buff[index] + 4 + j, srcStep, offset, tcP, tcQ); - checked(opt, pixel_test_buff1[index] + 4 + j, srcStep, offset, tcP, tcQ); + ref(pixel_test_buff[index] + 4 * offset + j, srcStep, offset, tcP, tcQ); + checked(opt, pixel_test_buff1[index] + 4 * offset + j, srcStep, offset, tcP, tcQ); if (memcmp(pixel_test_buff[index], pixel_test_buff1[index], sizeof(pixel) * BUFFSIZE)) return false; @@ -2162,28 +2161,35 @@ bool PixelHarness::check_pelFilterChroma_H(pelFilterChroma_t ref, pelFilterChrom { intptr_t srcStep = 1, offset = 64; int32_t maskP, maskQ, tc; - int j = 0; + intptr_t j = 0; + const int NUM_MASKS = 3; pixel pixel_test_buff1[TEST_CASES][BUFFSIZE]; for (int i = 0; i < TEST_CASES; i++) memcpy(pixel_test_buff1[i], pixel_test_buff[i], sizeof(pixel)* BUFFSIZE); - for (int i = 0; i < ITERS; i++) + int32_t masks[NUM_MASKS][2] = {{-1, -1}, {-1, 0}, {0, -1}}; + + for (int i = 0; i < NUM_MASKS; i++) { - tc = rand() % PIXEL_MAX; - maskP = (rand() % PIXEL_MAX) - 1; - maskQ = (rand() % PIXEL_MAX) - 1; + int32_t maskP = masks[i][0]; + int32_t maskQ = masks[i][1]; - int index = rand() % 3; + for (int i = 0; i < ITERS; i++) + { + tc = rand() % PIXEL_MAX; - ref(pixel_test_buff[index] + 4 * offset + j, srcStep, offset, tc, maskP, maskQ); - checked(opt, pixel_test_buff1[index] + 4 * offset + j, srcStep, offset, tc, maskP, maskQ); + int index = rand() % 3; - if (memcmp(pixel_test_buff[index], pixel_test_buff1[index], sizeof(pixel)* BUFFSIZE)) - return false; + ref(pixel_test_buff[index] + 2 * offset + j, srcStep, offset, tc, maskP, maskQ); + checked(opt, pixel_test_buff1[index] + 2 * offset + j, srcStep, offset, tc, maskP, maskQ); - reportfail() - j += INCR; + if (memcmp(pixel_test_buff[index], pixel_test_buff1[index], sizeof(pixel) * BUFFSIZE)) + return false; + + reportfail() + j += INCR; + } } return true; @@ -2193,28 +2199,35 @@ bool PixelHarness::check_pelFilterChroma_V(pelFilterChroma_t ref, pelFilterChrom { intptr_t srcStep = 64, offset = 1; int32_t maskP, maskQ, tc; - int j = 0; + intptr_t j = 0; + const int NUM_MASKS = 3; pixel pixel_test_buff1[TEST_CASES][BUFFSIZE]; for (int i = 0; i < TEST_CASES; i++) memcpy(pixel_test_buff1[i], pixel_test_buff[i], sizeof(pixel)* BUFFSIZE); - for (int i = 0; i < ITERS; i++) + int32_t masks[NUM_MASKS][2] = {{-1, -1}, {-1, 0}, {0, -1}}; + + for (int i = 0; i < NUM_MASKS; i++) { - tc = rand() % PIXEL_MAX; - maskP = (rand() % PIXEL_MAX) - 1; - maskQ = (rand() % PIXEL_MAX) - 1; + int32_t maskP = masks[i][0]; + int32_t maskQ = masks[i][1]; - int index = rand() % 3; + for (int i = 0; i < ITERS; i++) + { + tc = rand() % PIXEL_MAX; - ref(pixel_test_buff[index] + 4 + j, srcStep, offset, tc, maskP, maskQ); - checked(opt, pixel_test_buff1[index] + 4 + j, srcStep, offset, tc, maskP, maskQ); + int index = rand() % 3; - if (memcmp(pixel_test_buff[index], pixel_test_buff1[index], sizeof(pixel)* BUFFSIZE)) - return false; + ref(pixel_test_buff[index] + 2 * offset + j, srcStep, offset, tc, maskP, maskQ); + checked(opt, pixel_test_buff1[index] + 2 * offset + j, srcStep, offset, tc, maskP, maskQ); - reportfail() - j += INCR; + if (memcmp(pixel_test_buff[index], pixel_test_buff1[index], sizeof(pixel) * BUFFSIZE)) + return false; + + reportfail() + j += INCR; + } } return true; @@ -3085,7 +3098,6 @@ bool PixelHarness::testCorrectness(const EncoderPrimitives& ref, const EncoderPr return false; } } - if (opt.pelFilterLumaStrong[0]) { @@ -3152,7 +3164,6 @@ bool PixelHarness::testCorrectness(const EncoderPrimitives& ref, const EncoderPr } } - for (int k = 0; k < NUM_INTEGRAL_SIZE; k++) { if (opt.integral_inith[k] && !check_integral_inith(ref.integral_inith[k], opt.integral_inith[k])) @@ -3749,7 +3760,8 @@ void PixelHarness::measureSpeed(const EncoderPrimitives& ref, const EncoderPrimi int32_t tcP = (rand() % PIXEL_MAX) - 1; int32_t tcQ = (rand() % PIXEL_MAX) - 1; HEADER0("pelFilterLumaStrong_Vertical"); - REPORT_SPEEDUP(opt.pelFilterLumaStrong[0], ref.pelFilterLumaStrong[0], pbuf1, STRIDE, 1, tcP, tcQ); + REPORT_SPEEDUP(opt.pelFilterLumaStrong[0], ref.pelFilterLumaStrong[0], pbuf1 + 4, + STRIDE, 1, tcP, tcQ); } if (opt.pelFilterLumaStrong[1]) @@ -3757,25 +3769,38 @@ void PixelHarness::measureSpeed(const EncoderPrimitives& ref, const EncoderPrimi int32_t tcP = (rand() % PIXEL_MAX) - 1; int32_t tcQ = (rand() % PIXEL_MAX) - 1; HEADER0("pelFilterLumaStrong_Horizontal"); - REPORT_SPEEDUP(opt.pelFilterLumaStrong[1], ref.pelFilterLumaStrong[1], pbuf1, 1, STRIDE, tcP, tcQ); + REPORT_SPEEDUP(opt.pelFilterLumaStrong[1], ref.pelFilterLumaStrong[1], pbuf1 + 4 * STRIDE, + 1, STRIDE, tcP, tcQ); } if (opt.pelFilterChroma[0]) { + const int NUM_MASKS = 3; + int32_t masks[NUM_MASKS][2] = {{-1, -1}, {-1, 0}, {0, -1}}; int32_t tc = (rand() % PIXEL_MAX); - int32_t maskP = (rand() % PIXEL_MAX) - 1; - int32_t maskQ = (rand() % PIXEL_MAX) - 1; - HEADER0("pelFilterChroma_Vertical"); - REPORT_SPEEDUP(opt.pelFilterChroma[0], ref.pelFilterChroma[0], pbuf1, STRIDE, 1, tc, maskP, maskQ); + for (int i = 0; i < NUM_MASKS; i++) + { + int32_t maskP = masks[i][0]; + int32_t maskQ = masks[i][1]; + HEADER("pelFilterChroma_Vertical[MaskP: %d, MaskQ: %d]", maskP, maskQ); + REPORT_SPEEDUP(opt.pelFilterChroma[0], ref.pelFilterChroma[0], pbuf1 + 2, + STRIDE, 1, tc, maskP, maskQ); + } } if (opt.pelFilterChroma[1]) { + const int NUM_MASKS = 3; + int32_t masks[NUM_MASKS][2] = {{-1, -1}, {-1, 0}, {0, -1}}; int32_t tc = (rand() % PIXEL_MAX); - int32_t maskP = (rand() % PIXEL_MAX) - 1; - int32_t maskQ = (rand() % PIXEL_MAX) - 1; - HEADER0("pelFilterChroma_Horizontal"); - REPORT_SPEEDUP(opt.pelFilterChroma[1], ref.pelFilterChroma[1], pbuf1, 1, STRIDE, tc, maskP, maskQ); + for (int i = 0; i < NUM_MASKS; i++) + { + int32_t maskP = masks[i][0]; + int32_t maskQ = masks[i][1]; + HEADER("pelFilterChroma_Horizontal[MaskP: %d, MaskQ: %d]", maskP, maskQ); + REPORT_SPEEDUP(opt.pelFilterChroma[1], ref.pelFilterChroma[1], pbuf1 + 2 * STRIDE, + 1, STRIDE, tc, maskP, maskQ); + } } for (int k = 0; k < NUM_INTEGRAL_SIZE; k++) -- 2.34.1
_______________________________________________ x265-devel mailing list x265-devel@videolan.org https://mailman.videolan.org/listinfo/x265-devel