<div dir="ltr">14 patches pushed to the master branch.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 19, 2022 at 1:10 PM Snehaa Giridharan <<a href="mailto:snehaa@multicorewareinc.com">snehaa@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 dir="ltr"><div dir="ltr"><div><div><div>From 7532117d7a4161b05df3f80103ff149699688d82 Mon Sep 17 00:00:00 2001</div><div>From: Snehaa Giridharan <<a href="mailto:snehaa@multicorewareinc.com" target="_blank">snehaa@multicorewareinc.com</a>></div><div>Date: Wed, 19 Oct 2022 12:40:51 +0530</div><div>Subject: [PATCH] Cleanup and Fix warnings</div><div><br></div><div>Also modifies cli.rst</div><div>---</div><div> doc/reST/cli.rst | 5 +</div><div> source/CMakeLists.txt | 2 +-</div><div> source/common/temporalfilter.cpp | 228 +------------------------------</div><div> source/common/temporalfilter.h | 11 --</div><div> source/encoder/dpb.cpp | 2 +-</div><div> 5 files changed, 10 insertions(+), 238 deletions(-)</div><div><br></div><div>diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst</div><div>index be32fc6cc..9fa12fa92 100755</div><div>--- a/doc/reST/cli.rst</div><div>+++ b/doc/reST/cli.rst</div><div>@@ -1328,6 +1328,11 @@ Temporal / motion search options</div><div> <span style="white-space:pre-wrap"> </span>Search range for HME level 0, 1 and 2.</div><div> <span style="white-space:pre-wrap"> </span>The Search Range for each HME level must be between 0 and 32768(excluding).</div><div> <span style="white-space:pre-wrap"> </span>Default search range is 16,32,48 for level 0,1,2 respectively.</div><div>+<span style="white-space:pre-wrap"> </span></div><div>+.. option:: --mcstf, --no-mcstf</div><div>+</div><div>+ Enable Motion Compensated Temporal filtering.</div><div>+<span style="white-space:pre-wrap"> </span>Default: disabled</div><div> </div><div> Spatial/intra options</div><div> =====================</div><div>diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt</div><div>index 8a93a8bc4..04ceea0ec 100755</div><div>--- a/source/CMakeLists.txt</div><div>+++ b/source/CMakeLists.txt</div><div>@@ -29,7 +29,7 @@ option(NATIVE_BUILD "Target the build CPU" OFF)</div><div> option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)</div><div> mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)</div><div> # X265_BUILD must be incremented each time the public API is changed</div><div>-set(X265_BUILD 205)</div><div>+set(X265_BUILD 206)</div><div> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265.def.in" target="_blank">x265.def.in</a>"</div><div> "${PROJECT_BINARY_DIR}/x265.def")</div><div> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in" target="_blank">x265_config.h.in</a>"</div><div>diff --git a/source/common/temporalfilter.cpp b/source/common/temporalfilter.cpp</div><div>index d178c5800..01a6ddf15 100644</div><div>--- a/source/common/temporalfilter.cpp</div><div>+++ b/source/common/temporalfilter.cpp</div><div>@@ -494,113 +494,6 @@ void TemporalFilter::applyMotion(MV *mvs, uint32_t mvsStride, PicYuv *input, Pic</div><div> }</div><div> }</div><div> </div><div>-#if 0</div><div>-/*</div><div>-* Old Version: bilateralFilter</div><div>-*/</div><div>-void TemporalFilter::bilateralFilter(Frame* frame,</div><div>- TemporalFilterRefPicInfo* m_mcstfRefList,</div><div>- double overallStrength)</div><div>-{</div><div>-</div><div>- const int numRefs = frame->m_mcstf->m_numRef;</div><div>-</div><div>- for (int i = 0; i < numRefs; i++)</div><div>- {</div><div>- TemporalFilterRefPicInfo *ref = &m_mcstfRefList[i];</div><div>- applyMotion(m_mcstfRefList[i].mvs, m_mcstfRefList[i].mvsStride, m_mcstfRefList[i].picBuffer, ref->compensatedPic);</div><div>- }</div><div>-</div><div>- int refStrengthRow = 2;</div><div>- if (numRefs == m_range * 2)</div><div>- {</div><div>- refStrengthRow = 0;</div><div>- }</div><div>- else if (numRefs == m_range)</div><div>- {</div><div>- refStrengthRow = 1;</div><div>- }</div><div>-</div><div>- const double lumaSigmaSq = (m_QP - m_sigmaZeroPoint) * (m_QP - m_sigmaZeroPoint) * m_sigmaMultiplier;</div><div>- const double chromaSigmaSq = 30 * 30;</div><div>-</div><div>- PicYuv* orgPic = frame->m_fencPic;</div><div>-</div><div>- for (int c = 0; c < m_numComponents; c++)</div><div>- {</div><div>- int height, width;</div><div>- pixel *srcPelRow = NULL;</div><div>- intptr_t srcStride, correctedPicsStride = 0;</div><div>-</div><div>- if (!c)</div><div>- {</div><div>- height = orgPic->m_picHeight;</div><div>- width = orgPic->m_picWidth;</div><div>- srcPelRow = orgPic->m_picOrg[c];</div><div>- srcStride = orgPic->m_stride;</div><div>- }</div><div>- else</div><div>- {</div><div>- int csx = CHROMA_H_SHIFT(m_internalCsp);</div><div>- int csy = CHROMA_V_SHIFT(m_internalCsp);</div><div>-</div><div>- height = orgPic->m_picHeight >> csy;</div><div>- width = orgPic->m_picWidth >> csx;</div><div>- srcPelRow = orgPic->m_picOrg[c];</div><div>- srcStride = (int)orgPic->m_strideC;</div><div>- }</div><div>-</div><div>- const double sigmaSq = (!c) ? lumaSigmaSq : chromaSigmaSq;</div><div>- const double weightScaling = overallStrength * ((!c) ? 0.4 : m_chromaFactor);</div><div>-</div><div>- const pixel maxSampleValue = (1 << m_bitDepth) - 1;</div><div>- const double bitDepthDiffWeighting = 1024.0 / (maxSampleValue + 1);</div><div>-</div><div>- for (int y = 0; y < height; y++, srcPelRow += srcStride)</div><div>- {</div><div>- pixel *srcPel = srcPelRow;</div><div>-</div><div>- for (int x = 0; x < width; x++, srcPel++)</div><div>- {</div><div>- const int orgVal = (int)*srcPel;</div><div>- double temporalWeightSum = 1.0;</div><div>- double newVal = (double)orgVal;</div><div>-</div><div>- for (int i = 0; i < numRefs; i++)</div><div>- {</div><div>- TemporalFilterRefPicInfo *refPicInfo = &m_mcstfRefList[i];</div><div>-</div><div>- if (!c)</div><div>- correctedPicsStride = refPicInfo->compensatedPic->m_stride;</div><div>- else</div><div>- correctedPicsStride = refPicInfo->compensatedPic->m_strideC;</div><div>-</div><div>- const pixel *pCorrectedPelPtr = refPicInfo->compensatedPic->m_picOrg[c] + (y * correctedPicsStride + x);</div><div>- const int refVal = (int)*pCorrectedPelPtr;</div><div>- double diff = (double)(refVal - orgVal);</div><div>- diff *= bitDepthDiffWeighting;</div><div>- double diffSq = diff * diff;</div><div>-</div><div>- const int index = X265_MIN(1, std::abs(refPicInfo->origOffset) - 1);</div><div>- const double weight = weightScaling * s_refStrengths[refStrengthRow][index] * exp(-diffSq / (2 * sigmaSq));</div><div>-</div><div>- newVal += weight * refVal;</div><div>- temporalWeightSum += weight;</div><div>- }</div><div>- newVal /= temporalWeightSum;</div><div>- pixel sampleVal = (pixel)round(newVal);</div><div>- sampleVal = (sampleVal < 0 ? 0 : (sampleVal > maxSampleValue ? maxSampleValue : sampleVal));</div><div>- *srcPel = sampleVal;</div><div>- }</div><div>- }</div><div>- }</div><div>-}</div><div>-</div><div>-#else</div><div>-</div><div>-/*</div><div>-* New Version: bilateralFilter</div><div>-*/</div><div> void TemporalFilter::bilateralFilter(Frame* frame,</div><div> TemporalFilterRefPicInfo* m_mcstfRefList,</div><div> double overallStrength)</div><div>@@ -656,7 +549,7 @@ void TemporalFilter::bilateralFilter(Frame* frame,</div><div> const double sigmaSq = (!c) ? lumaSigmaSq : chromaSigmaSq;</div><div> const double weightScaling = overallStrength * ( (!c) ? 0.4 : m_chromaFactor);</div><div> </div><div>- const pixel maxSampleValue = (1 << m_bitDepth) - 1;</div><div>+ const double maxSampleValue = (1 << m_bitDepth) - 1;</div><div> const double bitDepthDiffWeighting = 1024.0 / (maxSampleValue + 1);</div><div> </div><div> const int blkSize = (!c) ? 8 : 4;</div><div>@@ -742,128 +635,14 @@ void TemporalFilter::bilateralFilter(Frame* frame,</div><div> temporalWeightSum += weight;</div><div> }</div><div> newVal /= temporalWeightSum;</div><div>- pixel sampleVal = (pixel)round(newVal);</div><div>+ double sampleVal = round(newVal);</div><div> sampleVal = (sampleVal < 0 ? 0 : (sampleVal > maxSampleValue ? maxSampleValue : sampleVal));</div><div>- *srcPel = sampleVal;</div><div>- }</div><div>- }</div><div>- }</div><div>-}</div><div>-#endif</div><div>-</div><div>-#if 0</div><div>-/*Old Version: motionEstimationLuma*/</div><div>-</div><div>-void TemporalFilter::motionEstimationLuma(MV *mvs, uint32_t mvStride, PicYuv *orig, PicYuv *buffer, int blockSize,</div><div>- MV *previous, uint32_t prevMvStride, int factor, bool doubleRes, int* minError)</div><div>-{</div><div>-</div><div>- int range = 5;</div><div>-</div><div>-</div><div>- const int stepSize = blockSize;</div><div>-</div><div>- const int origWidth = orig->m_picWidth;</div><div>- const int origHeight = orig->m_picHeight;</div><div>-</div><div>-</div><div>- for (int blockY = 0; blockY + blockSize < origHeight; blockY += stepSize)</div><div>- {</div><div>- for (int blockX = 0; blockX + blockSize < origWidth; blockX += stepSize)</div><div>- {</div><div>- MV best(0, 0);</div><div>- int leastError = INT_MAX;</div><div>-</div><div>- if (previous == NULL)</div><div>- {</div><div>- range = 8;</div><div>- }</div><div>- else</div><div>- {</div><div>-</div><div>- for (int py = -2; py <= 2; py++)</div><div>- {</div><div>- int testy = blockY / (2 * blockSize) + py;</div><div>-</div><div>- for (int px = -2; px <= 2; px++)</div><div>- {</div><div>-</div><div>- int testx = blockX / (2 * blockSize) + px;</div><div>- if ((testx >= 0) && (testx < origWidth / (2 * blockSize)) && (testy >= 0) && (testy < origHeight / (2 * blockSize)))</div><div>- {</div><div>- int mvIdx = testy * prevMvStride + testx;</div><div>- MV old = previous[mvIdx];</div><div>-</div><div>- int error = motionErrorLuma(orig, buffer, blockX, blockY, old.x * factor, old.y * factor, blockSize, leastError);</div><div>- if (error < leastError)</div><div>- {</div><div>- best.set(old.x * factor, old.y * factor);</div><div>- leastError = error;</div><div>- }</div><div>- }</div><div>- }</div><div>- }</div><div>-</div><div>- }</div><div>-</div><div>- MV prevBest = best;</div><div>- for (int y2 = prevBest.y / s_motionVectorFactor - range; y2 <= prevBest.y / s_motionVectorFactor + range; y2++)</div><div>- {</div><div>- for (int x2 = prevBest.x / s_motionVectorFactor - range; x2 <= prevBest.x / s_motionVectorFactor + range; x2++)</div><div>- {</div><div>- int error = motionErrorLuma(orig, buffer, blockX, blockY, x2 * s_motionVectorFactor, y2 * s_motionVectorFactor, blockSize, leastError/*best.error*/);</div><div>- if (error < leastError)</div><div>- {</div><div>- best.set(x2 * s_motionVectorFactor, y2 * s_motionVectorFactor);</div><div>- leastError = error;</div><div>- }</div><div>- }</div><div>- }</div><div>-</div><div>- if (doubleRes)</div><div>- { // merge into one loop, probably with precision array (here [12, 3] or maybe [4, 1]) with setable number of iterations</div><div>- prevBest = best;</div><div>- int doubleRange = 3 * 4;</div><div>- for (int y2 = prevBest.y - doubleRange; y2 <= prevBest.y + doubleRange; y2 += 4)</div><div>- {</div><div>- for (int x2 = prevBest.x - doubleRange; x2 <= prevBest.x + doubleRange; x2 += 4)</div><div>- {</div><div>- int error = motionErrorLuma(orig, buffer, blockX, blockY, x2, y2, blockSize, leastError);</div><div>- if (error < leastError)</div><div>- {</div><div>- best.set(x2, y2);</div><div>- leastError = error;</div><div>- }</div><div>- }</div><div>- }</div><div>-</div><div>- prevBest = best;</div><div>- doubleRange = 3;</div><div>- for (int y2 = prevBest.y - doubleRange; y2 <= prevBest.y + doubleRange; y2++)</div><div>- {</div><div>- for (int x2 = prevBest.x - doubleRange; x2 <= prevBest.x + doubleRange; x2++)</div><div>- {</div><div>- int error = motionErrorLuma(orig, buffer, blockX, blockY, x2, y2, blockSize, leastError);</div><div>- if (error < leastError)</div><div>- {</div><div>- best.set(x2, y2);</div><div>- leastError = error;</div><div>- }</div><div>- }</div><div>- }</div><div>+ *srcPel = (pixel)sampleVal;</div><div> }</div><div>-</div><div>- int mvIdx = (blockY / stepSize) * mvStride + (blockX / stepSize);</div><div>- mvs[mvIdx] = best;</div><div>- if (doubleRes)</div><div>- minError[mvIdx] = leastError;</div><div> }</div><div> }</div><div> }</div><div> </div><div>-#else</div><div>-</div><div>-/*New Version: motionEstimationLuma*/</div><div> void TemporalFilter::motionEstimationLuma(MV *mvs, uint32_t mvStride, PicYuv *orig, PicYuv *buffer, int blockSize,</div><div> MV *previous, uint32_t prevMvStride, int factor)</div><div> {</div><div>@@ -1211,7 +990,6 @@ void TemporalFilter::motionEstimationLumaDoubleRes(MV *mvs, uint32_t mvStride, P</div><div> }</div><div> }</div><div> }</div><div>-#endif</div><div> </div><div> void TemporalFilter::destroyRefPicInfo(TemporalFilterRefPicInfo* curFrame)</div><div> {</div><div>diff --git a/source/common/temporalfilter.h b/source/common/temporalfilter.h</div><div>index 55ae6736d..10f0c52b4 100644</div><div>--- a/source/common/temporalfilter.h</div><div>+++ b/source/common/temporalfilter.h</div><div>@@ -35,8 +35,6 @@</div><div> </div><div> using namespace X265_NS;</div><div> </div><div>-#define BILTERAL_FILTER_NEW_VERSION 1</div><div>-</div><div> const int s_interpolationFilter[16][8] =</div><div> {</div><div> { 0, 0, 0, 64, 0, 0, 0, 0 }, //0</div><div>@@ -57,7 +55,6 @@ const int s_interpolationFilter[16][8] =</div><div> { 0, 0, -2, 4, 64, -3, 1, 0 } //15-->--></div><div> };</div><div> </div><div>-#if BILTERAL_FILTER_NEW_VERSION</div><div> const double s_refStrengths[3][4] =</div><div> { // abs(POC offset)</div><div> // 1, 2 3 4</div><div>@@ -65,14 +62,6 @@ const double s_refStrengths[3][4] =</div><div> {1.13, 0.97, 0.81, 0.57}, // m_range</div><div> {0.30, 0.30, 0.30, 0.30} // otherwise</div><div> };</div><div>-#else</div><div>-const double s_refStrengths[2][2] =</div><div>-{ // abs(POC offset)</div><div>- // 1, 2</div><div>- {0.85, 0.60}, // w future refs</div><div>- {1.20, 1.00}, // w/o future refs</div><div>-};</div><div>-#endif</div><div> </div><div> class OrigPicBuffer</div><div> {</div><div>diff --git a/source/encoder/dpb.cpp b/source/encoder/dpb.cpp</div><div>index 9292b6c75..79274f5dd 100644</div><div>--- a/source/encoder/dpb.cpp</div><div>+++ b/source/encoder/dpb.cpp</div><div>@@ -73,7 +73,7 @@ void DPB::recycleUnreferenced()</div><div> bool isMCSTFReferenced = false;</div><div> </div><div> if (curFrame->m_param->bEnableTemporalFilter)</div><div>- isMCSTFReferenced = curFrame->m_refPicCnt[1];</div><div>+ isMCSTFReferenced =!!(curFrame->m_refPicCnt[1]);</div><div> </div><div> if (!curFrame->m_encData->m_bHasReferences && !curFrame->m_countRefEncoders && !isMCSTFReferenced)</div><div> {</div><div>-- </div><div>2.37.2.windows.2</div><div><br></div></div><div><br></div></div><div><div dir="ltr"><div dir="ltr"><div><i><font face="georgia, serif">Thanks and Regards,</font></i></div><div><i><font face="georgia, serif"><b>Snehaa.G</b><br>Video Codec Engineer,<br>Media & AI analytics<br><a href="https://multicorewareinc.com/" target="_blank"><img src="https://ci3.googleusercontent.com/mail-sig/AIorK4yEumXeQ2mgcFAR2us9INa7z3rCbl8ordut3fbdeIbuPv0n3EA75Or1rHs0neGaI0WM8mFPz1g"></a><br><span></span><span></span><br></font></i></div></div></div></div></div></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>