[x265] [PATCH 9/14] Fixed left and above motion vector index

Snehaa Giridharan snehaa at multicorewareinc.com
Wed Oct 19 07:31:10 UTC 2022


>From 5b4eb291b7daeb0e303c1e0a42204c83ddc988dd Mon Sep 17 00:00:00 2001
From: ashok2022 <ashok at multicorewareinc.com>
Date: Thu, 13 Oct 2022 19:32:22 +0530
Subject: [PATCH] Fixed left and above motion vector index

---
 source/common/temporalfilter.cpp | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/source/common/temporalfilter.cpp
b/source/common/temporalfilter.cpp
index 1d7e670e1..1d5a7d076 100644
--- a/source/common/temporalfilter.cpp
+++ b/source/common/temporalfilter.cpp
@@ -624,7 +624,6 @@ void TemporalFilter::bilateralFilter(Frame* frame,
                 newVal /= temporalWeightSum;
                 pixel sampleVal = (pixel)round(newVal);
                 sampleVal = (sampleVal < 0 ? 0 : (sampleVal >
maxSampleValue ? maxSampleValue : sampleVal));
-                //*dstPel = sampleVal;
                 *srcPel = sampleVal;
             }
         }
@@ -819,7 +818,8 @@ void TemporalFilter::motionEstimationLuma(MV *mvs,
uint32_t mvStride, PicYuv *or

             if (blockY > 0)
             {
-                MV aboveMV = mvs[(blockX / stepSize, (blockY - stepSize) /
stepSize)];
+                int idx = ((blockY - stepSize) / stepSize) * mvStride +
(blockX / stepSize);
+                MV aboveMV = mvs[idx];
                 int error = motionErrorLuma(orig, buffer, blockX, blockY,
aboveMV.x, aboveMV.y, blockSize, leastError);
                 if (error < leastError)
                 {
@@ -827,9 +827,12 @@ void TemporalFilter::motionEstimationLuma(MV *mvs,
uint32_t mvStride, PicYuv *or
                     leastError = error;
                 }
             }
+
             if (blockX > 0)
             {
-                MV leftMV = mvs[((blockX - stepSize) / stepSize, blockY /
stepSize)];
+                int idx = ((blockY / stepSize) * mvStride + (blockX -
stepSize) / stepSize);
+                MV leftMV = mvs[idx];
+
                 int error = motionErrorLuma(orig, buffer, blockX, blockY,
leftMV.x, leftMV.y, blockSize, leastError);
                 if (error < leastError)
                 {
@@ -974,7 +977,8 @@ void TemporalFilter::motionEstimationLumaDoubleRes(MV
*mvs, uint32_t mvStride, P

             if (blockY > 0)
             {
-                MV aboveMV = mvs[(blockX / stepSize, (blockY - stepSize) /
stepSize)];
+                int idx = ((blockY - stepSize) / stepSize) * mvStride +
(blockX / stepSize);
+                MV aboveMV = mvs[idx];
                 int error = motionErrorLuma(orig, buffer, blockX, blockY,
aboveMV.x, aboveMV.y, blockSize, leastError);
                 if (error < leastError)
                 {
@@ -982,9 +986,11 @@ void TemporalFilter::motionEstimationLumaDoubleRes(MV
*mvs, uint32_t mvStride, P
                     leastError = error;
                 }
             }
+
             if (blockX > 0)
             {
-                MV leftMV = mvs[((blockX - stepSize) / stepSize, blockY /
stepSize)];
+                int idx = ((blockY / stepSize) * mvStride + (blockX -
stepSize) / stepSize);
+                MV leftMV = mvs[idx];
                 int error = motionErrorLuma(orig, buffer, blockX, blockY,
leftMV.x, leftMV.y, blockSize, leastError);
                 if (error < leastError)
                 {
@@ -1051,7 +1057,6 @@ void TemporalFilter::subsampleLuma(PicYuv *input,
PicYuv *output, int factor)
         }
     }

-    // output.extendPicBorder();
     extendPicBorder(output->m_picOrg[0], output->m_stride,
output->m_picWidth, output->m_picHeight, output->m_lumaMarginX,
output->m_lumaMarginY);
 }

-- 
2.34.1.windows.1

*Thanks and Regards,*





*Snehaa.GVideo Codec Engineer,Media & AI analytics
<https://multicorewareinc.com/>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20221019/c4301f16/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcstf_patch_09.diff
Type: application/octet-stream
Size: 3581 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20221019/c4301f16/attachment.obj>


More information about the x265-devel mailing list