[x265] [PATCH 3/4] Test: Update values used in check_nquant_primitive
Hari Limaye
hari.limaye at arm.com
Mon Aug 12 21:16:04 UTC 2024
Change the calculation of the `qBits` parameter in
check_nquant_primitive to be more similar to the calling code in
quant.cpp, rather than using `rand() % 32` to generate a value. The
changes are based on the generation of qBits in check_quant_primitive.
This ensures that the `qBits` parameter in the test is always non-zero,
in order to allow use of non-saturating narrowing instructions in
optimised nquant implementations.
---
source/test/mbdstharness.cpp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/source/test/mbdstharness.cpp b/source/test/mbdstharness.cpp
index ba85ad420..cceadd833 100644
--- a/source/test/mbdstharness.cpp
+++ b/source/test/mbdstharness.cpp
@@ -260,8 +260,14 @@ bool MBDstHarness::check_nquant_primitive(nquant_t ref, nquant_t opt)
uint32_t optReturnValue = 0;
uint32_t refReturnValue = 0;
- int bits = rand() % 32;
- int valueToAdd = rand() % (1 << bits);
+ int log2TrSize = rand() % 4 + 2;
+ const int qp = rand() % (QP_MAX_SPEC + QP_BD_OFFSET + 1);
+ const int per = qp / 6;
+ const int transformShift = MAX_TR_DYNAMIC_RANGE - X265_DEPTH - log2TrSize;
+
+ /* Right shift of non-RDOQ quantizer level = (coeff*Q + offset)>>q_bits */
+ int bits = QUANT_SHIFT + per + transformShift;
+ int valueToAdd = (1 << (bits - 1));
int cmp_size = sizeof(short) * height * width;
int numCoeff = height * width;
--
2.42.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Test-Update-values-used-in-check_nquant_primitive.patch
Type: text/x-patch
Size: 1901 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20240812/3961a7b1/attachment.bin>
More information about the x265-devel
mailing list