[x265] [PATCH] Improve Slices option with check zeroMv

Yaswanth Sastry yaswanth.sastry at multicorewareinc.com
Mon Mar 17 06:29:32 UTC 2025


>From baff7691e9bc4f93bccc85ae78d95ad9ade7a8d0 Mon Sep 17 00:00:00 2001
From: Chen <test at test>
Date: Fri, 14 Mar 2025 22:27:02 -0700
Subject: [PATCH] Improve Slices option with check zeroMv

---
 source/encoder/analysis.cpp | 4 ++--
 source/encoder/motion.cpp   | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp
index 5475e4800..e3c410e59 100644
--- a/source/encoder/analysis.cpp
+++ b/source/encoder/analysis.cpp
@@ -3166,7 +3166,7 @@ void Analysis::checkMerge2Nx2N_rd0_4(Mode& skip, Mode& merge, const CUGeom& cuGe
     }
     for (uint32_t i = 0; i < numMergeCand; ++i)
     {
-        if (m_bFrameParallel)
+        if (m_bFrameParallel && candMvField[i][0].mv.notZero())
         {
             // Parallel slices bound check
             if (m_param->maxSlices > 1)
@@ -3300,7 +3300,7 @@ void Analysis::checkMerge2Nx2N_rd5_6(Mode& skip, Mode& merge, const CUGeom& cuGe
     }
     for (uint32_t i = 0; i < numMergeCand; i++)
     {
-        if (m_bFrameParallel)
+        if (m_bFrameParallel && candMvField[i][0].mv.notZero())
         {
             // Parallel slices bound check
             if (m_param->maxSlices > 1)
diff --git a/source/encoder/motion.cpp b/source/encoder/motion.cpp
index 58e943652..86f413c3d 100644
--- a/source/encoder/motion.cpp
+++ b/source/encoder/motion.cpp
@@ -1596,6 +1596,14 @@ me_hex2:
     // check mv range for slice bound
     X265_CHECK(((bmv.y >= qmvmin.y) & (bmv.y <= qmvmax.y)), "mv beyond range!");

+    // Get a chance to ZeroMv
+    if (bmv.notZero())
+    {
+      int cost = subpelCompare(ref, MV(0, 0), satd) + mvcost(MV(0, 0));
+      if (cost <= bcost)
+        bmv = MV(0, 0);
+    }
+
     x265_emms();
     outQMv = bmv;
     return bcost;
--
2.43.0.windows.1


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20250317/5f305f89/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Improve-with-check-zeroMv.patch
Type: application/octet-stream
Size: 1808 bytes
Desc: 0001-Improve-with-check-zeroMv.patch
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20250317/5f305f89/attachment-0001.obj>


More information about the x265-devel mailing list