[x265] [PATCH 1 of 2] intra prediction: disable 64x64 analysis

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Tue Nov 17 10:56:31 CET 2015


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1447661563 -19800
#      Mon Nov 16 13:42:43 2015 +0530
# Node ID 409424e8b1bd19a5e70236d364ca8cb7e03b5274
# Parent  8cf2d6892443027bf04ade1965e12099decf608e
intra prediction: disable 64x64 analysis

In intra CUs, the predictions are applied for each TU sequentially (and not at the
PU level). This patch turns off all 64x64 intra analysis/modes - to analyse which,
previously, x265 averaged a 64x64 block to 32x32 and then did a prediction search
on this averaged block. This is a bad idea for visual quality, and instead x265
will perform 32x32 predictions sequentially.

diff -r 8cf2d6892443 -r 409424e8b1bd source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Fri Oct 23 19:50:49 2015 +0530
+++ b/source/encoder/analysis.cpp	Mon Nov 16 13:42:43 2015 +0530
@@ -259,7 +259,7 @@
                 addSplitFlagCost(*md.bestMode, cuGeom.depth);
         }
     }
-    else if (mightNotSplit)
+    else if (cuGeom.log2CUSize != MAX_LOG2_CU_SIZE && mightNotSplit)
     {
         md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom, qp);
         checkIntra(md.pred[PRED_INTRA], cuGeom, SIZE_2Nx2N);
@@ -614,7 +614,7 @@
     if (mightNotSplit && depth >= minDepth)
     {
         int bTryAmp = m_slice->m_sps->maxAMPDepth > depth;
-        int bTryIntra = (m_slice->m_sliceType != B_SLICE || m_param->bIntraInBFrames) && (!m_param->limitReferences || splitIntra);
+        int bTryIntra = (m_slice->m_sliceType != B_SLICE || m_param->bIntraInBFrames) && (!m_param->limitReferences || splitIntra) && (cuGeom.log2CUSize != MAX_LOG2_CU_SIZE);
 
         if (m_slice->m_pps->bUseDQP && depth <= m_slice->m_pps->maxCuDQPDepth && m_slice->m_pps->maxCuDQPDepth != 0)
             setLambdaFromQP(parentCTU, qp);
@@ -1090,7 +1090,7 @@
                     }
                 }
             }
-            bool bTryIntra = m_slice->m_sliceType != B_SLICE || m_param->bIntraInBFrames;
+            bool bTryIntra = (m_slice->m_sliceType != B_SLICE || m_param->bIntraInBFrames) && cuGeom.log2CUSize != MAX_LOG2_CU_SIZE;
             if (m_param->rdLevel >= 3)
             {
                 /* Calculate RD cost of best inter option */
@@ -1570,7 +1570,7 @@
                 }
             }
 
-            if (m_slice->m_sliceType != B_SLICE || m_param->bIntraInBFrames)
+            if ((m_slice->m_sliceType != B_SLICE || m_param->bIntraInBFrames) && cuGeom.log2CUSize != MAX_LOG2_CU_SIZE)
             {
                 if (!m_param->limitReferences || splitIntra)
                 {
diff -r 8cf2d6892443 -r 409424e8b1bd source/encoder/search.cpp
--- a/source/encoder/search.cpp	Fri Oct 23 19:50:49 2015 +0530
+++ b/source/encoder/search.cpp	Mon Nov 16 13:42:43 2015 +0530
@@ -1468,25 +1468,6 @@
                 int scaleStride = stride;
                 int costShift = 0;
 
-                if (tuSize > 32)
-                {
-                    // origin is 64x64, we scale to 32x32 and setup required parameters
-                    primitives.scale2D_64to32(m_fencScaled, fenc, stride);
-                    fenc = m_fencScaled;
-
-                    pixel nScale[129];
-                    intraNeighbourBuf[1][0] = intraNeighbourBuf[0][0];
-                    primitives.scale1D_128to64(nScale + 1, intraNeighbourBuf[0] + 1);
-
-                    memcpy(&intraNeighbourBuf[0][1], &nScale[1], 2 * 64 * sizeof(pixel));
-                    memcpy(&intraNeighbourBuf[1][1], &nScale[1], 2 * 64 * sizeof(pixel));
-
-                    scaleTuSize = 32;
-                    scaleStride = 32;
-                    costShift = 2;
-                    sizeIdx = 5 - 2; // log2(scaleTuSize) - 2
-                }
-
                 m_entropyCoder.loadIntraDirModeLuma(m_rqt[depth].cur);
 
                 /* there are three cost tiers for intra modes:


More information about the x265-devel mailing list