<div dir="ltr">This is missing the constants table for HIGH_BIT_DEPTH.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 5, 2014 at 12:23 PM, <span dir="ltr"><<a href="mailto:aarthi@multicorewareinc.com" target="_blank">aarthi@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Aarthi Thirumalai<br>
# Date 1417675781 -19800<br>
# Thu Dec 04 12:19:41 2014 +0530<br>
# Node ID 97f0f0e5d7efd1f883283617f657875340f381a8<br>
# Parent 511dde5ac1deee96a0105bb87e14670ef5ed72a6<br>
rc: fix chroma qp and chroma lambda derivations.<br>
<br>
fix the chroma qp values for Main10 profile, derive chroma qp from luma qp values<br>
according to the HEVC spec.<br>
improves quality at high qps.<br>
<br>
diff -r 511dde5ac1de -r 97f0f0e5d7ef source/encoder/rdcost.h<br>
--- a/source/encoder/rdcost.h Thu Dec 04 12:43:06 2014 +0530<br>
+++ b/source/encoder/rdcost.h Thu Dec 04 12:19:41 2014 +0530<br>
@@ -50,19 +50,24 @@<br>
void setQP(const Slice& slice, int qp)<br>
{<br>
m_qp = qp;<br>
-<br>
+ int qpCb, qpCr;<br>
/* Scale PSY RD factor by a slice type factor */<br>
static const uint32_t psyScaleFix8[3] = { 300, 256, 96 }; /* B, P, I */<br>
m_psyRd = (m_psyRdBase * psyScaleFix8[slice.m_sliceType]) >> 8;<br>
<br>
setLambda(x265_lambda2_tab[qp], x265_lambda_tab[qp]);<br>
-<br>
- int qpCb = Clip3(QP_MIN, QP_MAX_MAX, qp + slice.m_pps->chromaQpOffset[0]);<br>
+ if (slice.m_sps->chromaFormatIdc == X265_CSP_I420)<br>
+ qpCb = Clip3(QP_MIN, QP_MAX_MAX, (int)g_chromaScale[qp + slice.m_pps->chromaQpOffset[0]]);<br>
+ else<br>
+ qpCb = X265_MIN(qp + slice.m_pps->chromaQpOffset[0], QP_MAX_SPEC);<br>
int chroma_offset_idx = X265_MIN(qp - qpCb + 12, MAX_CHROMA_LAMBDA_OFFSET);<br>
uint16_t lambdaOffset = m_psyRd ? x265_chroma_lambda2_offset_tab[chroma_offset_idx] : 256;<br>
setCbDistortionWeight(lambdaOffset);<br>
<br>
- int qpCr = Clip3(QP_MIN, QP_MAX_MAX, qp + slice.m_pps->chromaQpOffset[1]);<br>
+ if (slice.m_sps->chromaFormatIdc == X265_CSP_I420)<br>
+ qpCr = Clip3(QP_MIN, QP_MAX_MAX, (int)g_chromaScale[qp + slice.m_pps->chromaQpOffset[0]]);<br>
+ else<br>
+ qpCr = X265_MIN(qp + slice.m_pps->chromaQpOffset[0], QP_MAX_SPEC);<br>
chroma_offset_idx = X265_MIN(qp - qpCr + 12, MAX_CHROMA_LAMBDA_OFFSET);<br>
lambdaOffset = m_psyRd ? x265_chroma_lambda2_offset_tab[chroma_offset_idx] : 256;<br>
setCrDistortionWeight(lambdaOffset);<br>
diff -r 511dde5ac1de -r 97f0f0e5d7ef source/encoder/sao.cpp<br>
--- a/source/encoder/sao.cpp Thu Dec 04 12:43:06 2014 +0530<br>
+++ b/source/encoder/sao.cpp Thu Dec 04 12:19:41 2014 +0530<br>
@@ -176,8 +176,11 @@<br>
void SAO::startSlice(Frame* frame, Entropy& initState, int qp)<br>
{<br>
Slice* slice = frame->m_encData->m_slice;<br>
-<br>
- int qpCb = Clip3(0, QP_MAX_MAX, qp + slice->m_pps->chromaQpOffset[0]);<br>
+ int qpCb = qp;<br>
+ if (m_param->internalCsp == X265_CSP_I420)<br>
+ qpCb = Clip3(QP_MIN, QP_MAX_MAX, (int)g_chromaScale[qp + slice->m_pps->chromaQpOffset[0]]);<br>
+ else<br>
+ qpCb = X265_MIN(qp + slice->m_pps->chromaQpOffset[0], QP_MAX_SPEC);<br>
m_lumaLambda = x265_lambda2_tab[qp];<br>
m_chromaLambda = x265_lambda2_tab[qpCb]; // Use Cb QP for SAO chroma<br>
m_frame = frame;<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br></div>