[x265] [PATCH] Fix chroma qp offsets for non-YUV444 inputs

Kirithika Kalirathnam kirithika at multicorewareinc.com
Mon Mar 30 07:32:25 UTC 2026


Hi,
It looks like the patch files weren’t included. Could you please provide the changes as an attached patch as well.
Thanks,
Kirithika
________________________________
From: x265-devel <x265-devel-bounces at videolan.org> on behalf of Richard <ccc7922 at foxmail.com>
Sent: Saturday, March 28, 2026 6:31 AM
To: x265-devel at videolan.org <x265-devel at videolan.org>
Subject: [x265] [PATCH] Fix chroma qp offsets for non-YUV444 inputs

From: Mr-Z-2697 <74594146+Mr-Z-2697 at users.noreply.github.com>

This reverts commit 2d01af69c4757b5087274e36e27b660b08244010
and removes the m_psyRd ternary check.

The removal of the m_psyRd check diverges from the x264 code, but if the check is in place, the offsets seem to be broken when psy-rd=0 (x264 doesn't have this issue).
When psy-rd=0, the offsets have stronger effect than x264, but is more close to "6 in QP is double/half the quality/bitrate".
---
 source/encoder/rdcost.h | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/source/encoder/rdcost.h b/source/encoder/rdcost.h
index 1bd4dd696..acdbb3e01 100644
--- a/source/encoder/rdcost.h
+++ b/source/encoder/rdcost.h
@@ -76,18 +76,13 @@ public:
             qpCr = x265_clip3(QP_MIN, QP_MAX_SPEC, qp + slice.m_pps->chromaQpOffset[1] + slice.m_chromaQpOffset[1]);
         }

-        if (slice.m_sps->chromaFormatIdc == X265_CSP_I444)
-        {
-            int chroma_offset_idx = X265_MIN(qp - qpCb + 12, MAX_CHROMA_LAMBDA_OFFSET);
-            uint16_t lambdaOffset = m_psyRd ? x265_chroma_lambda2_offset_tab[chroma_offset_idx] : 256;
-            m_chromaDistWeight[0] = lambdaOffset;
+        int chroma_offset_idx = X265_MIN(qp - qpCb + 12, MAX_CHROMA_LAMBDA_OFFSET);
+        uint16_t lambdaOffset = x265_chroma_lambda2_offset_tab[chroma_offset_idx];
+        m_chromaDistWeight[0] = lambdaOffset;

-            chroma_offset_idx = X265_MIN(qp - qpCr + 12, MAX_CHROMA_LAMBDA_OFFSET);
-            lambdaOffset = m_psyRd ? x265_chroma_lambda2_offset_tab[chroma_offset_idx] : 256;
-            m_chromaDistWeight[1] = lambdaOffset;
-        }
-        else
-            m_chromaDistWeight[0] = m_chromaDistWeight[1] = 256;
+        chroma_offset_idx = X265_MIN(qp - qpCr + 12, MAX_CHROMA_LAMBDA_OFFSET);
+        lambdaOffset = x265_chroma_lambda2_offset_tab[chroma_offset_idx];
+        m_chromaDistWeight[1] = lambdaOffset;
     }

     void setLambda(double lambda2, double lambda)
--
2.53.0.windows.2

_______________________________________________
x265-devel mailing list
x265-devel at videolan.org
https://ind01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.videolan.org%2Flistinfo%2Fx265-devel&data=05%7C02%7Ckirithika%40multicorewareinc.com%7C882f880a133f4a2e02a708de8c65b154%7Cffc5e88b3fa24d69a468344b6b766e7d%7C0%7C0%7C639102565634302575%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=M9W3279RbKDvy8A3RFOTfqxBpeq6F5s2k6tavgregpE%3D&reserved=0<https://mailman.videolan.org/listinfo/x265-devel>
⚠️ External Email Warning: This message originated from outside the organization (McW).
Be cautious - Never share passwords or click unexpected links/attachments.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20260330/bd365219/attachment.htm>


More information about the x265-devel mailing list