<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 9, 2017 at 5:22 PM, <span dir="ltr"><<a href="mailto:gopi.satykrishna@multicorewareinc.com" target="_blank">gopi.satykrishna@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 Gopi Satykrishna Akisetty <<a href="mailto:gopi.satykrishna@multicorewareinc.com">gopi.satykrishna@<wbr>multicorewareinc.com</a>><br>
# Date 1497000305 -19800<br>
# Fri Jun 09 14:55:05 2017 +0530<br>
# Node ID 7d2ddd4c43e6424d5f234786751e6c<wbr>cebf2368fd<br>
# Parent e75d5f5eeae3413057437af9f7d3ba<wbr>9bc10fa3fa<br>
add support for hdr-opt even when aq-mode is disabled<br></blockquote><div><br></div><div>Pushed to default branch</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff -r e75d5f5eeae3 -r 7d2ddd4c43e6 doc/reST/cli.rst<br>
--- a/doc/reST/cli.rst Mon Jun 05 15:20:44 2017 +0530<br>
+++ b/doc/reST/cli.rst Fri Jun 09 14:55:05 2017 +0530<br>
@@ -1966,6 +1966,7 @@<br>
<br>
Add luma and chroma offsets for HDR/WCG content.<br>
Input video should be 10 bit 4:2:0. Applicable for HDR content.<br>
+ It is recommended to use this feature along with AQ mode.<br>
Default disabled. **Experimental Feature**<br>
<br>
.. option:: --dhdr10-info <filename><br>
diff -r e75d5f5eeae3 -r 7d2ddd4c43e6 source/common/frame.cpp<br>
--- a/source/common/frame.cpp Mon Jun 05 15:20:44 2017 +0530<br>
+++ b/source/common/frame.cpp Fri Jun 09 14:55:05 2017 +0530<br>
@@ -78,7 +78,7 @@<br>
}<br>
<br>
if (m_fencPic->create(param-><wbr>sourceWidth, param->sourceHeight, param->internalCsp) &&<br>
- m_lowres.create(m_fencPic, param->bframes, !!param->rc.aqMode || !!param->bAQMotion, param->rc.qgSize))<br>
+ m_lowres.create(m_fencPic, param->bframes, !!param->rc.aqMode || !!param->bAQMotion || !!param->bHDROpt, param->rc.qgSize))<br>
{<br>
X265_CHECK((m_reconColCount == NULL), "m_reconColCount was initialized");<br>
m_numRows = (m_fencPic->m_picHeight + g_maxCUSize - 1) / g_maxCUSize;<br>
diff -r e75d5f5eeae3 -r 7d2ddd4c43e6 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp Mon Jun 05 15:20:44 2017 +0530<br>
+++ b/source/encoder/encoder.cpp Fri Jun 09 14:55:05 2017 +0530<br>
@@ -2066,7 +2066,7 @@<br>
{<br>
bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;<br>
<br>
- if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv || m_param->bAQMotion))<br>
+ if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv || m_param->bAQMotion || m_param->bHDROpt))<br>
{<br>
pps->bUseDQP = true;<br>
pps->maxCuDQPDepth = g_log2Size[m_param->maxCUSize] - g_log2Size[m_param->rc.qgSize]<wbr>;<br>
@@ -2446,7 +2446,7 @@<br>
x265_log(p, X265_LOG_WARNING, "limit-tu disabled, requires tu-inter-depth > 1\n");<br>
}<br>
bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;<br>
- if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv || m_param->bAQMotion))<br>
+ if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv || m_param->bAQMotion || m_param->bHDROpt))<br>
{<br>
if (p->rc.qgSize < X265_MAX(8, p->minCUSize))<br>
{<br>
diff -r e75d5f5eeae3 -r 7d2ddd4c43e6 source/encoder/ratecontrol.cpp<br>
--- a/source/encoder/ratecontrol.<wbr>cpp Mon Jun 05 15:20:44 2017 +0530<br>
+++ b/source/encoder/ratecontrol.<wbr>cpp Fri Jun 09 14:55:05 2017 +0530<br>
@@ -2592,7 +2592,7 @@<br>
int64_t actualBits = bits;<br>
Slice *slice = curEncData.m_slice;<br>
<br>
- if (m_param->rc.aqMode || m_isVbv || m_param->bAQMotion)<br>
+ if (m_param->rc.aqMode || m_isVbv || m_param->bAQMotion || m_param->bHDROpt)<br>
{<br>
if (m_isVbv && !(m_2pass && m_param->rc.rateControlMode == X265_RC_CRF))<br>
{<br>
@@ -2606,7 +2606,7 @@<br>
rce->qpaRc = curEncData.m_avgQpRc;<br>
}<br>
<br>
- if (m_param->rc.aqMode || m_param->bAQMotion)<br>
+ if (m_param->rc.aqMode || m_param->bAQMotion || m_param->bHDROpt)<br>
{<br>
double avgQpAq = 0;<br>
/* determine actual avg encoded QP, after AQ/cutree adjustments */<br>
diff -r e75d5f5eeae3 -r 7d2ddd4c43e6 source/encoder/slicetype.cpp<br>
--- a/source/encoder/slicetype.cpp Mon Jun 05 15:20:44 2017 +0530<br>
+++ b/source/encoder/slicetype.cpp Fri Jun 09 14:55:05 2017 +0530<br>
@@ -243,29 +243,6 @@<br>
qp_adj = strength * (X265_LOG2(X265_MAX(energy, 1)) - (modeOneConst + 2 * (X265_DEPTH - 8)));<br>
}<br>
<br>
- if (param->bHDROpt)<br>
- {<br>
- uint32_t sum = lumaSumCu(curFrame, blockX, blockY, param->rc.qgSize);<br>
- uint32_t lumaAvg = sum / (loopIncr * loopIncr);<br>
- if (lumaAvg < 301)<br>
- qp_adj += 3;<br>
- else if (lumaAvg >= 301 && lumaAvg < 367)<br>
- qp_adj += 2;<br>
- else if (lumaAvg >= 367 && lumaAvg < 434)<br>
- qp_adj += 1;<br>
- else if (lumaAvg >= 501 && lumaAvg < 567)<br>
- qp_adj -= 1;<br>
- else if (lumaAvg >= 567 && lumaAvg < 634)<br>
- qp_adj -= 2;<br>
- else if (lumaAvg >= 634 && lumaAvg < 701)<br>
- qp_adj -= 3;<br>
- else if (lumaAvg >= 701 && lumaAvg < 767)<br>
- qp_adj -= 4;<br>
- else if (lumaAvg >= 767 && lumaAvg < 834)<br>
- qp_adj -= 5;<br>
- else if (lumaAvg >= 834)<br>
- qp_adj -= 6;<br>
- }<br>
if (quantOffsets != NULL)<br>
qp_adj += quantOffsets[blockXY];<br>
curFrame->m_lowres.qpAqOffset[<wbr>blockXY] = qp_adj;<br>
@@ -276,6 +253,43 @@<br>
}<br>
}<br>
<br>
+ if (param->bHDROpt)<br>
+ {<br>
+ double qp_adj;<br>
+ blockXY = 0;<br>
+ for (blockY = 0; blockY < maxRow; blockY += loopIncr)<br>
+ {<br>
+ for (blockX = 0; blockX < maxCol; blockX += loopIncr)<br>
+ {<br>
+ qp_adj = 0;<br>
+ uint32_t sum = lumaSumCu(curFrame, blockX, blockY, param->rc.qgSize);<br>
+ uint32_t lumaAvg = sum / (loopIncr * loopIncr);<br>
+ if (lumaAvg < 301)<br>
+ qp_adj = 3;<br>
+ else if (lumaAvg >= 301 && lumaAvg < 367)<br>
+ qp_adj = 2;<br>
+ else if (lumaAvg >= 367 && lumaAvg < 434)<br>
+ qp_adj = 1;<br>
+ else if (lumaAvg >= 501 && lumaAvg < 567)<br>
+ qp_adj = -1;<br>
+ else if (lumaAvg >= 567 && lumaAvg < 634)<br>
+ qp_adj = -2;<br>
+ else if (lumaAvg >= 634 && lumaAvg < 701)<br>
+ qp_adj = -3;<br>
+ else if (lumaAvg >= 701 && lumaAvg < 767)<br>
+ qp_adj = -4;<br>
+ else if (lumaAvg >= 767 && lumaAvg < 834)<br>
+ qp_adj = -5;<br>
+ else if (lumaAvg >= 834)<br>
+ qp_adj = -6;<br>
+ curFrame->m_lowres.qpAqOffset[<wbr>blockXY] += qp_adj;<br>
+ curFrame->m_lowres.<wbr>qpCuTreeOffset[blockXY] += qp_adj;<br>
+ curFrame->m_lowres.<wbr>invQscaleFactor[blockXY] = x265_exp2fix8(curFrame->m_<wbr>lowres.qpAqOffset[blockXY]);<br>
+ blockXY++;<br>
+ }<br>
+ }<br>
+ }<br>
+<br>
if (param->rc.qgSize == 8)<br>
{<br>
for (int cuY = 0; cuY < heightInCU; cuY++)<br>
@@ -602,7 +616,7 @@<br>
m_lastKeyframe = -m_param->keyframeMax;<br>
m_sliceTypeBusy = false;<br>
m_fullQueueSize = X265_MAX(1, m_param->lookaheadDepth);<br>
- m_bAdaptiveQuant = m_param->rc.aqMode || m_param->bEnableWeightedPred || m_param->bEnableWeightedBiPred || m_param->bAQMotion;<br>
+ m_bAdaptiveQuant = m_param->rc.aqMode || m_param->bEnableWeightedPred || m_param->bEnableWeightedBiPred || m_param->bAQMotion || m_param->bHDROpt;<br>
<br>
/* If we have a thread pool and are using --b-adapt 2, it is generally<br>
* preferable to perform all motion searches for each lowres frame in large<br>
@@ -911,7 +925,7 @@<br>
uint32_t widthInLowresCu = (uint32_t)m_8x8Width, heightInLowresCu = (uint32_t)m_8x8Height;<br>
double *qp_offset = 0;<br>
/* Factor in qpoffsets based on Aq/Cutree in CU costs */<br>
- if (m_param->rc.aqMode || m_param->bAQMotion)<br>
+ if (m_param->rc.aqMode || m_param->bAQMotion || m_param->bHDROpt)<br>
qp_offset = (frames[b]->sliceType == X265_TYPE_B || !m_param->rc.cuTree) ? frames[b]->qpAqOffset : frames[b]->qpCuTreeOffset;<br>
<br>
for (uint32_t row = 0; row < numCuInHeight; row++)<br>
@@ -1305,7 +1319,7 @@<br>
CostEstimateGroup estGroup(*this, frames);<br>
int64_t cost = estGroup.singleCost(p0, p1, b);<br>
<br>
- if (m_param->rc.aqMode || m_param->bAQMotion)<br>
+ if (m_param->rc.aqMode || m_param->bAQMotion || m_param->bHDROpt)<br>
{<br>
if (m_param->rc.cuTree)<br>
return frameCostRecalculate(frames, p0, p1, b);<br>
diff -r e75d5f5eeae3 -r 7d2ddd4c43e6 source/x265cli.h<br>
--- a/source/x265cli.h Mon Jun 05 15:20:44 2017 +0530<br>
+++ b/source/x265cli.h Fri Jun 09 14:55:05 2017 +0530<br>
@@ -502,7 +502,7 @@<br>
H0(" format: G(x,y)B(x,y)R(x,y)WP(x,y)L(<wbr>max,min)\n");<br>
H0(" --max-cll <string> Emit content light level info SEI as \"cll,fall\" (HDR)\n");<br>
H0(" --[no-]hdr Control dumping of HDR SEI packet. If max-cll or master-display has non-zero values, this is enabled. Default %s\n", OPT(param->bEmitHDRSEI));<br>
- H0(" --[no-]hdr-opt Add luma and chroma offsets for HDR/WCG content. Default %s\n", OPT(param->bHDROpt));<br>
+ H0(" --[no-]hdr-opt Add luma and chroma offsets for HDR/WCG content. Recommended to use this along with AQ Mode. Default %s\n", OPT(param->bHDROpt));<br>
H0(" --min-luma <integer> Minimum luma plane value of input source picture\n");<br>
H0(" --max-luma <integer> Maximum luma plane value of input source picture\n");<br>
H0("\nBitstream options:\n");<br>
<br>______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
<br></blockquote></div><br></div></div>