[x265] [PATCH] intra: use lookahead intra mode in fast intra mode

Ximing Cheng chengximing1989 at foxmail.com
Sat Jul 30 09:24:54 CEST 2016


# HG changeset patch
# User Ximing Cheng <ximingcheng at tencent.com>
# Date 1469863429 -28800
#      Sat Jul 30 15:23:49 2016 +0800
# Node ID 7aaf5c9148259ce9147620ffbab2dba3d8b67188
# Parent  4be91b287e3ca9ee9c469b64a0f322243f439342
intra: use lookahead intra mode in fast intra mode

diff -r 4be91b287e3c -r 7aaf5c914825 source/encoder/search.cpp
--- a/source/encoder/search.cpp	Wed Jul 27 14:29:47 2016 -0500
+++ b/source/encoder/search.cpp	Sat Jul 30 15:23:49 2016 +0800
@@ -1338,7 +1338,38 @@
         cost = m_rdCost.calcRdSADCost(sad, bits); \
     }
 
-    if (m_param->bEnableFastIntra)
+    if (m_param->bEnableFastIntra && tuSize == 16)
+    {
+        int asad = 0;
+        uint32_t lowmode, highmode, amode, abits = 0;
+        uint64_t acost = MAX_INT64;
+        uint32_t block_x = cu.m_cuPelX >> 4;
+        uint32_t block_y = cu.m_cuPelY >> 4;
+        uint32_t idx = block_y * m_frame->m_lowres.maxBlocksInRow + block_x;
+
+        amode = mode = m_frame->m_lowres.intraMode[idx];
+        if (mode > 1)
+        {
+            TRY_ANGLE(mode);
+            COPY4_IF_LT(acost, cost, amode, mode, asad, sad, abits, bits);
+
+            if (amode >= 3 && amode <= 33)
+            {
+                lowmode = amode - 1;
+                highmode = amode + 1;
+
+                X265_CHECK(lowmode >= 2 && lowmode <= 34, "low intra mode out of range\n");
+                TRY_ANGLE(lowmode);
+                COPY4_IF_LT(acost, cost, amode, lowmode, asad, sad, abits, bits);
+
+                X265_CHECK(highmode >= 2 && highmode <= 34, "high intra mode out of range\n");
+                TRY_ANGLE(highmode);
+                COPY4_IF_LT(acost, cost, amode, highmode, asad, sad, abits, bits);
+            }
+            COPY4_IF_LT(bcost, acost, bmode, amode, bsad, asad, bbits, abits);
+        }
+    }
+    else if (m_param->bEnableFastIntra)
     {
         int asad = 0;
         uint32_t lowmode, highmode, amode = 5, abits = 0;




More information about the x265-devel mailing list