[x265] [PATCH] fix the chroma offset computation for HDR/WCG content

gopi.satykrishna at multicorewareinc.com gopi.satykrishna at multicorewareinc.com
Thu Feb 16 14:33:47 CET 2017


# HG changeset patch
# User Gopi Satykrishna Akisetty <gopi.satykrishna at multicorewareinc.com>
# Date 1487246003 -19800
#      Thu Feb 16 17:23:23 2017 +0530
# Node ID c15f8bce9f4b27d28af43dbbbbb3001e4f36f42d
# Parent  db913efb1a5999a75569628b8a4675e1b6b9e066
fix the chroma offset computation for HDR/WCG content

diff -r db913efb1a59 -r c15f8bce9f4b source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Wed Feb 01 17:01:29 2017 +0530
+++ b/source/encoder/frameencoder.cpp	Thu Feb 16 17:23:23 2017 +0530
@@ -485,8 +485,8 @@
     slice->m_sliceQp = x265_clip3(-QP_BD_OFFSET, QP_MAX_SPEC, qp);
     if (m_param->bHDROpt)
     {
-        int qpCb = x265_clip3(-12, 0, (int)round(m_top->m_cB * ((-.46) * qp + 9.26)));
-        int qpCr = x265_clip3(-12, 0, (int)round(m_top->m_cR * ((-.46) * qp + 9.26)));
+        int qpCb = x265_clip3(-12, 0, (int)floor((m_top->m_cB * ((-.46) * qp + 9.26)) + 0.5 ));
+        int qpCr = x265_clip3(-12, 0, (int)floor((m_top->m_cR * ((-.46) * qp + 9.26)) + 0.5 ));
         slice->m_chromaQpOffset[0] = slice->m_pps->chromaQpOffset[0] + qpCb < -12 ? (qpCb + (-12 - (slice->m_pps->chromaQpOffset[0] + qpCb))) : qpCb;
         slice->m_chromaQpOffset[1] = slice->m_pps->chromaQpOffset[1] + qpCr < -12 ? (qpCr + (-12 - (slice->m_pps->chromaQpOffset[1] + qpCr))) : qpCr;
     }


More information about the x265-devel mailing list