[x265] [PATCH] fix for the number of weighted references exceeding 8 in HM weight analysis

shazeb at multicorewareinc.com shazeb at multicorewareinc.com
Mon Dec 2 08:22:10 CET 2013


# HG changeset patch
# User Shazeb Nawaz Khan <shazeb at multicorewareinc.com>
# Date 1385968917 -19800
#      Mon Dec 02 12:51:57 2013 +0530
# Node ID 69dd7abaa4bace8107e415665fe51720fd153d05
# Parent  0a85121531fcff9cef495ccc51b4fd6f6006ed1f
fix for the number of weighted references exceeding 8 in HM weight analysis

diff -r 0a85121531fc -r 69dd7abaa4ba source/Lib/TLibEncoder/WeightPredAnalysis.cpp
--- a/source/Lib/TLibEncoder/WeightPredAnalysis.cpp	Mon Dec 02 01:04:33 2013 -0600
+++ b/source/Lib/TLibEncoder/WeightPredAnalysis.cpp	Mon Dec 02 12:51:57 2013 +0530
@@ -281,6 +281,7 @@
     int height = pic->getHeight();
     int defaultWeight = ((int)1 << denom);
     int numPredDir = slice->isInterP() ? 1 : 2;
+    int numWeighted = 0;
 
     for (int list = 0; list < numPredDir; list++)
     {
@@ -313,7 +314,7 @@
             SADnoWP += this->xCalcSADvalueWP(X265_DEPTH, fenc, fref, width >> 1, height >> 1, orgStride, refStride, denom, defaultWeight, 0);
 
             double dRatio = ((double)SADWP / (double)SADnoWP);
-            if (dRatio >= (double)DTHRESH)
+            if (dRatio >= (double)DTHRESH || numWeighted >= 8)
             {
                 for (int comp = 0; comp < 3; comp++)
                 {
@@ -323,6 +324,10 @@
                     weightPredTable[list][refIdxTmp][comp].log2WeightDenom = (int)denom;
                 }
             }
+            else
+            {
+                numWeighted++;
+            }
         }
     }
 


More information about the x265-devel mailing list