[x265] [PATCH] rc: fix chroma qp and chroma lambda derivations
Deepthi Nandakumar
deepthi at multicorewareinc.com
Thu Dec 4 12:23:52 CET 2014
Is there an if (csp == I420) wrapper specified though? For some reason,
deblock/quant have this.
On Thu, Dec 4, 2014 at 4:50 PM, Deepthi Nandakumar <
deepthi at multicorewareinc.com> wrote:
> This looks like a Main bug where rdcost was not looking at g_chromaScale
> at all.
>
>
>
> On Thu, Dec 4, 2014 at 4:36 PM, <aarthi at multicorewareinc.com> wrote:
>
>> # HG changeset patch
>> # User Aarthi Thirumalai
>> # Date 1417675781 -19800
>> # Thu Dec 04 12:19:41 2014 +0530
>> # Node ID 23061220a5fe287cac893320d8ee0a782d6767c0
>> # Parent 511dde5ac1deee96a0105bb87e14670ef5ed72a6
>> rc: fix chroma qp and chroma lambda derivations.
>>
>> fix the chroma qp values for Main10 profile, derive chroma qp from luma
>> qp values
>> according to the HEVC spec.
>> improves quality at high qps.
>>
>> diff -r 511dde5ac1de -r 23061220a5fe source/common/constants.cpp
>> --- a/source/common/constants.cpp Thu Dec 04 12:43:06 2014 +0530
>> +++ b/source/common/constants.cpp Thu Dec 04 12:19:41 2014 +0530
>> @@ -289,11 +289,21 @@
>> { 4, -13, 22, -31, 38, -46, 54, -61, 67, -73, 78, -82, 85, -88, 90,
>> -90, 90, -90, 88, -85, 82, -78, 73, -67, 61, -54, 46, -38, 31, -22, 13, -4 }
>> };
>>
>> +
>> +#if HIGH_BIT_DEPTH
>> +const uint8_t g_chromaScale[ChromaQPMappingTableSize] =
>> +{
>> + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
>> 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
>> 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
>> + 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
>> 51
>> +};
>> +
>> +#else
>> const uint8_t g_chromaScale[ChromaQPMappingTableSize] =
>> {
>> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
>> 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 33, 34, 34,
>> 35, 35, 36, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
>> 51,
>> 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51
>> -};
>> +};
>> +#endif
>>
>> const uint8_t
>> g_chroma422IntraAngleMappingTable[AngleMapping422TableSize] =
>> { 0, 1, 2, 2, 2, 2, 3, 5, 7, 8, 10, 12, 13, 15, 17, 18, 19, 20, 21, 22,
>> 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31, DM_CHROMA_IDX };
>> diff -r 511dde5ac1de -r 23061220a5fe source/encoder/rdcost.h
>> --- a/source/encoder/rdcost.h Thu Dec 04 12:43:06 2014 +0530
>> +++ b/source/encoder/rdcost.h Thu Dec 04 12:19:41 2014 +0530
>> @@ -57,12 +57,12 @@
>>
>> setLambda(x265_lambda2_tab[qp], x265_lambda_tab[qp]);
>>
>> - int qpCb = Clip3(QP_MIN, QP_MAX_MAX, qp +
>> slice.m_pps->chromaQpOffset[0]);
>> + int qpCb = Clip3(QP_MIN, QP_MAX_MAX, (int)g_chromaScale[qp +
>> slice.m_pps->chromaQpOffset[0]]);
>> 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;
>> setCbDistortionWeight(lambdaOffset);
>>
>> - int qpCr = Clip3(QP_MIN, QP_MAX_MAX, qp +
>> slice.m_pps->chromaQpOffset[1]);
>> + int qpCr = Clip3(QP_MIN, QP_MAX_MAX, (int)g_chromaScale[qp +
>> slice.m_pps->chromaQpOffset[0]]);
>> chroma_offset_idx = X265_MIN(qp - qpCr + 12,
>> MAX_CHROMA_LAMBDA_OFFSET);
>> lambdaOffset = m_psyRd ?
>> x265_chroma_lambda2_offset_tab[chroma_offset_idx] : 256;
>> setCrDistortionWeight(lambdaOffset);
>> diff -r 511dde5ac1de -r 23061220a5fe source/encoder/sao.cpp
>> --- a/source/encoder/sao.cpp Thu Dec 04 12:43:06 2014 +0530
>> +++ b/source/encoder/sao.cpp Thu Dec 04 12:19:41 2014 +0530
>> @@ -177,7 +177,7 @@
>> {
>> Slice* slice = frame->m_encData->m_slice;
>>
>> - int qpCb = Clip3(0, QP_MAX_MAX, qp +
>> slice->m_pps->chromaQpOffset[0]);
>> + int qpCb = Clip3(QP_MIN, QP_MAX_MAX, (int)g_chromaScale[qp +
>> slice->m_pps->chromaQpOffset[0]]);
>> m_lumaLambda = x265_lambda2_tab[qp];
>> m_chromaLambda = x265_lambda2_tab[qpCb]; // Use Cb QP for SAO chroma
>> m_frame = frame;
>> _______________________________________________
>> x265-devel mailing list
>> x265-devel at videolan.org
>> https://mailman.videolan.org/listinfo/x265-devel
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20141204/d0726d47/attachment-0001.html>
More information about the x265-devel
mailing list