[x265] [PATCH] rdcost: weight chroma distortion only for 444 formats

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Mon Jan 11 10:35:08 CET 2016


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1452495287 -19800
#      Mon Jan 11 12:24:47 2016 +0530
# Branch stable
# Node ID 81ff6d47262fe42697ba3f2043e665efb00aac33
# Parent  7593a5bbb07d9db31c7bf9535ec24dd2cf4bcd4a
rdcost: weight chroma distortion only for 444 formats

diff -r 7593a5bbb07d -r 81ff6d47262f source/encoder/rdcost.h
--- a/source/encoder/rdcost.h	Mon Jan 11 11:06:12 2016 +0530
+++ b/source/encoder/rdcost.h	Mon Jan 11 12:24:47 2016 +0530
@@ -74,13 +74,18 @@
             qpCr = x265_clip3(QP_MIN, QP_MAX_SPEC, qp + slice.m_pps->chromaQpOffset[1]);
         }
 
-        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;
+        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;
 
-        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;
+            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;
     }
 
     void setLambda(double lambda2, double lambda)


More information about the x265-devel mailing list