[x265] [PATCH] analysis: fix segmentation fault for limit-mode in rd-0/4

ashok at multicorewareinc.com ashok at multicorewareinc.com
Thu Nov 5 13:54:29 CET 2015


# HG changeset patch
# User Ashok Kumar Mishra<ashok at multicorewareinc.com>
# Date 1446719485 -19800
#      Thu Nov 05 16:01:25 2015 +0530
# Node ID bf5ff5d08f141668ebca475819cf8b767668f500
# Parent  f851138520c7f501717cd6287c8eac2f6074263a
analysis: fix segmentation fault for limit-mode in rd-0/4

diff -r f851138520c7 -r bf5ff5d08f14 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Thu Nov 05 09:26:42 2015 +0530
+++ b/source/encoder/analysis.cpp	Thu Nov 05 16:01:25 2015 +0530
@@ -955,7 +955,7 @@
                 }
 
                 int try_2NxN_first = threshold_2NxN < threshold_Nx2N;
-                if (try_2NxN_first && splitCost < md.bestMode->rdCost + threshold_2NxN)
+                if (try_2NxN_first && splitCost < md.pred[PRED_2Nx2N].sa8dCost + threshold_2NxN)
                 {
                     refMasks[0] = splitData[0].splitRefs | splitData[1].splitRefs; /* top */
                     refMasks[1] = splitData[2].splitRefs | splitData[3].splitRefs; /* bot */
@@ -965,7 +965,7 @@
                         bestInter = &md.pred[PRED_2NxN];
                 }
 
-                if (splitCost < md.bestMode->rdCost + threshold_Nx2N)
+                if (splitCost < md.pred[PRED_2Nx2N].sa8dCost + threshold_Nx2N)
                 {
                     refMasks[0] = splitData[0].splitRefs | splitData[2].splitRefs; /* left */
                     refMasks[1] = splitData[1].splitRefs | splitData[3].splitRefs; /* right */
@@ -975,7 +975,7 @@
                         bestInter = &md.pred[PRED_Nx2N];
                 }
 
-                if (!try_2NxN_first && splitCost < md.bestMode->rdCost + threshold_2NxN)
+                if (!try_2NxN_first && splitCost < md.pred[PRED_2Nx2N].sa8dCost + threshold_2NxN)
                 {
                     refMasks[0] = splitData[0].splitRefs | splitData[1].splitRefs; /* top */
                     refMasks[1] = splitData[2].splitRefs | splitData[3].splitRefs; /* bot */
@@ -1027,7 +1027,7 @@
                 if (bHor)
                 {
                     int try_2NxnD_first = threshold_2NxnD < threshold_2NxnU;
-                    if (try_2NxnD_first && splitCost < md.bestMode->rdCost + threshold_2NxnD)
+                    if (try_2NxnD_first && splitCost < md.pred[PRED_2Nx2N].sa8dCost + threshold_2NxnD)
                     {
                         refMasks[0] = allSplitRefs;                                    /* 75% top */
                         refMasks[1] = splitData[2].splitRefs | splitData[3].splitRefs; /* 25% bot */
@@ -1037,7 +1037,7 @@
                             bestInter = &md.pred[PRED_2NxnD];
                     }
 
-                    if (splitCost < md.bestMode->rdCost + threshold_2NxnU)
+                    if (splitCost < md.pred[PRED_2Nx2N].sa8dCost + threshold_2NxnU)
                     {
                         refMasks[0] = splitData[0].splitRefs | splitData[1].splitRefs; /* 25% top */
                         refMasks[1] = allSplitRefs;                                    /* 75% bot */
@@ -1047,7 +1047,7 @@
                             bestInter = &md.pred[PRED_2NxnU];
                     }
 
-                    if (!try_2NxnD_first && splitCost < md.bestMode->rdCost + threshold_2NxnD)
+                    if (!try_2NxnD_first && splitCost < md.pred[PRED_2Nx2N].sa8dCost + threshold_2NxnD)
                     {
                         refMasks[0] = allSplitRefs;                                    /* 75% top */
                         refMasks[1] = splitData[2].splitRefs | splitData[3].splitRefs; /* 25% bot */
@@ -1060,7 +1060,7 @@
                 if (bVer)
                 {
                     int try_nRx2N_first = threshold_nRx2N < threshold_nLx2N;
-                    if (try_nRx2N_first && splitCost < md.bestMode->rdCost + threshold_nRx2N)
+                    if (try_nRx2N_first && splitCost < md.pred[PRED_2Nx2N].sa8dCost + threshold_nRx2N)
                     {
                         refMasks[0] = allSplitRefs;                                    /* 75% left  */
                         refMasks[1] = splitData[1].splitRefs | splitData[3].splitRefs; /* 25% right */
@@ -1070,7 +1070,7 @@
                             bestInter = &md.pred[PRED_nRx2N];
                     }
 
-                    if (splitCost < md.bestMode->rdCost + threshold_nLx2N)
+                    if (splitCost < md.pred[PRED_2Nx2N].sa8dCost + threshold_nLx2N)
                     {
                         refMasks[0] = splitData[0].splitRefs | splitData[2].splitRefs; /* 25% left  */
                         refMasks[1] = allSplitRefs;                                    /* 75% right */
@@ -1080,7 +1080,7 @@
                             bestInter = &md.pred[PRED_nLx2N];
                     }
 
-                    if (!try_nRx2N_first && splitCost < md.bestMode->rdCost + threshold_nRx2N)
+                    if (!try_nRx2N_first && splitCost < md.pred[PRED_2Nx2N].sa8dCost + threshold_nRx2N)
                     {
                         refMasks[0] = allSplitRefs;                                    /* 75% left  */
                         refMasks[1] = splitData[1].splitRefs | splitData[3].splitRefs; /* 25% right */
@@ -1264,7 +1264,7 @@
     {
         splitCUData.mvCost[0] = md.pred[PRED_2Nx2N].bestME[0][0].mvCost; // L0
         splitCUData.mvCost[1] = md.pred[PRED_2Nx2N].bestME[0][1].mvCost; // L1
-        splitCUData.rdCost    = md.bestMode->rdCost;
+        splitCUData.rdCost    = md.pred[PRED_2Nx2N].sa8dCost;
     }
     
     if (mightNotSplit)


More information about the x265-devel mailing list