<div dir="ltr"><span style="color:rgb(0,0,0);font-family:arial;font-size:14px">Pushed to master branch.</span><br style="color:rgb(0,0,0);font-family:arial;font-size:14px"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><b>__________________________</b></div><div><b>Karam Singh</b></div><div><b>Ph.D. IIT Guwahati</b></div><div><font size="1">Senior Software (Video Coding) Engineer </font></div><div><font size="1">Mobile: +91 8011279030</font></div><div><font size="1">Block 9A, 6th floor, DLF Cyber City</font></div><div><font size="1">Manapakkam, Chennai 600 089</font></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 15, 2024 at 10:15 AM Gopi Satykrishna Akisetty <<a href="mailto:gopi.satykrishna@multicorewareinc.com">gopi.satykrishna@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>From d3127dca7b3028e158ca73edaec803ee92facb94 Mon Sep 17 00:00:00 2001</div><div>From: gopi satykrishna akisetty <<a href="mailto:gopi.satykrishna@multicorewareinc.com" target="_blank">gopi.satykrishna@multicorewareinc.com</a>></div><div>Date: Thu, 8 Aug 2024 22:06:12 +0530</div><div>Subject: [PATCH] ABR tuning for MV-HEVC</div><div><br></div><div>---</div><div> source/common/param.cpp | 3 ++-</div><div> source/encoder/frameencoder.cpp | 48 ++++++++++++++++++++++++++++++---</div><div> 2 files changed, 47 insertions(+), 4 deletions(-)</div><div><br></div><div>diff --git a/source/common/param.cpp b/source/common/param.cpp</div><div>index 5288bf453..aad31b515 100755</div><div>--- a/source/common/param.cpp</div><div>+++ b/source/common/param.cpp</div><div>@@ -1965,7 +1965,8 @@ int x265_check_params(x265_param* param)</div><div> #if ENABLE_MULTIVIEW</div><div> CHECK((param->numViews > 2), "Multi-View Encoding currently support only 2 views");</div><div> CHECK((param->numViews > 1) && (param->internalBitDepth != 8), "BitDepthConstraint must be 8 for Multiview main profile");</div><div>- CHECK((param->numViews > 1 && param->rc.rateControlMode != X265_RC_CQP), "Multiview encode supported only with CQP mode");</div><div>+ CHECK((param->numViews > 1) && (param->rc.rateControlMode != X265_RC_CQP && param->rc.rateControlMode != X265_RC_ABR),</div><div>+ "Multiview encode supported only with CQP and ABR modes");</div><div> #endif</div><div> #if ENABLE_SCC_EXT</div><div> CHECK(!!param->bEnableSCC&& param->rdLevel != 6, "Enabling scc extension in x265 requires rdlevel of 6 ");</div><div>diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp</div><div>index 7d02d0d96..0faa16713 100644</div><div>--- a/source/encoder/frameencoder.cpp</div><div>+++ b/source/encoder/frameencoder.cpp</div><div>@@ -613,7 +613,49 @@ void FrameEncoder::compressFrame(int layer)</div><div> int qp = (layer == 0) ? m_top->m_rateControl->rateControlStart(m_frame[layer], &m_rce, m_top) : (int)m_rce.newQp;</div><div> </div><div> m_rce.newQp = qp;</div><div>+ </div><div>+ if (!!layer && m_top->m_lookahead->m_bAdaptiveQuant)</div><div>+ {</div><div>+ int ncu;</div><div>+ if (m_param->rc.qgSize == 8)</div><div>+ ncu = m_top->m_rateControl->m_ncu * 4;</div><div>+ else</div><div>+ ncu = m_top->m_rateControl->m_ncu;</div><div>+ for (int i = 0; i < ncu; i++)</div><div>+ {</div><div>+ m_frame[layer]->m_lowres.qpCuTreeOffset[i] = m_frame[0]->m_lowres.qpCuTreeOffset[i];</div><div>+ m_frame[layer]->m_lowres.qpAqOffset[i] = m_frame[0]->m_lowres.qpAqOffset[i];</div><div>+ }</div><div> </div><div>+ m_frame[layer]->m_encData->m_avgQpAq = m_frame[0]->m_encData->m_avgQpAq;</div><div>+ m_frame[layer]->m_encData->m_avgQpRc = m_frame[0]->m_encData->m_avgQpRc;</div><div>+ if (!!m_param->rc.hevcAq)</div><div>+ {</div><div>+ for (uint32_t d = 0; d < 4; d++)</div><div>+ {</div><div>+ int ctuSizeIdx = 6 - g_log2Size[m_param->maxCUSize];</div><div>+ int aqDepth = g_log2Size[m_param->maxCUSize] - g_log2Size[m_param->rc.qgSize];</div><div>+ if (!aqLayerDepth[ctuSizeIdx][aqDepth][d])</div><div>+ continue;</div><div>+ PicQPAdaptationLayer* pcAQLayer0 = &m_frame[0]->m_lowres.pAQLayer[d];</div><div>+ PicQPAdaptationLayer* pcAQLayer1 = &m_frame[layer]->m_lowres.pAQLayer[d];</div><div>+ const uint32_t aqPartWidth = m_frame[0]->m_lowres.pAQLayer[d].aqPartWidth;</div><div>+ const uint32_t aqPartHeight = m_frame[0]->m_lowres.pAQLayer[d].aqPartHeight;</div><div>+ double* pcQP0 = pcAQLayer0->dQpOffset;</div><div>+ double* pcCuTree0 = pcAQLayer0->dCuTreeOffset;</div><div>+ double* pcQP1 = pcAQLayer1->dQpOffset;</div><div>+ double* pcCuTree1 = pcAQLayer1->dCuTreeOffset;</div><div>+ for (uint32_t y = 0; y < m_frame[0]->m_fencPic->m_picHeight; y += aqPartHeight)</div><div>+ {</div><div>+ for (uint32_t x = 0; x < m_frame[0]->m_fencPic->m_picWidth; x += aqPartWidth, pcQP0++, pcCuTree0++, pcQP1++, pcCuTree1++)</div><div>+ {</div><div>+ *pcQP1 = *pcQP0;</div><div>+ *pcCuTree1 = *pcCuTree0;</div><div>+ }</div><div>+ }</div><div>+ }</div><div>+ }</div><div>+ }</div><div> if (m_param->bEnableTemporalFilter)</div><div> {</div><div> m_frameEncTF->m_QP = qp;</div><div>@@ -1551,7 +1593,7 @@ void FrameEncoder::processRowEncoder(int intRow, ThreadLocalData& tld, int layer</div><div> const uint32_t bLastCuInSlice = (bLastRowInSlice & (col == numCols - 1)) ? 1 : 0;</div><div> ctu->initCTU(*m_frame[layer], cuAddr, slice->m_sliceQp, bFirstRowInSlice, bLastRowInSlice, bLastCuInSlice);</div><div> </div><div>- if (bIsVbv)</div><div>+ if (!layer && bIsVbv)</div><div> {</div><div> if (col == 0 && !m_param->bEnableWavefront)</div><div> {</div><div>@@ -1719,7 +1761,7 @@ void FrameEncoder::processRowEncoder(int intRow, ThreadLocalData& tld, int layer</div><div> curEncData.m_cuStat[cuAddr].totalBits = best.totalBits;</div><div> x265_emms();</div><div> </div><div>- if (bIsVbv)</div><div>+ if (!layer && bIsVbv)</div><div> { </div><div> // Update encoded bits, satdCost, baseQP for each CU if tune grain is disabled</div><div> FrameData::RCStatCU& cuStat = curEncData.m_cuStat[cuAddr]; </div><div>@@ -1904,7 +1946,7 @@ void FrameEncoder::processRowEncoder(int intRow, ThreadLocalData& tld, int layer</div><div> * after half the frame is encoded, but after this initial period we update</div><div> * after refLagRows (the number of rows reference frames must have completed</div><div> * before referencees may begin encoding) */</div><div>- if (m_param->rc.rateControlMode == X265_RC_ABR || bIsVbv)</div><div>+ if ((!layer) && (m_param->rc.rateControlMode == X265_RC_ABR || bIsVbv))</div><div> {</div><div> uint32_t rowCount = 0;</div><div> uint32_t maxRows = m_sliceBaseRow[sliceId + 1] - m_sliceBaseRow[sliceId];</div><div>-- </div><div>2.34.1</div><div><br></div></div></div>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div>