[x265] [PATCH 10 of 14] predict: combine redundant logic paths in predInterBi()

Steve Borho steve at borho.org
Sat Sep 20 18:46:09 CEST 2014


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1411233176 -3600
#      Sat Sep 20 18:12:56 2014 +0100
# Node ID a2f5d5a4b48f9e0679684a5c723f7b488b016f40
# Parent  e8dfe19c9f01fec26c7bdbe5799a7252b7dccba2
predict: combine redundant logic paths in predInterBi()

removes weightedPredictionBi(), which is no longer called

diff -r e8dfe19c9f01 -r a2f5d5a4b48f source/encoder/predict.cpp
--- a/source/encoder/predict.cpp	Sat Sep 20 18:05:32 2014 +0100
+++ b/source/encoder/predict.cpp	Sat Sep 20 18:12:56 2014 +0100
@@ -267,18 +267,30 @@
         predInterUni(1, &m_predShortYuv[1], bLuma, bChroma);
 
         if (m_slice->m_pps->bUseWeightedBiPred)
-            weightedPredictionBi(cu, &m_predShortYuv[0], &m_predShortYuv[1], refIdx0, refIdx1, m_partAddr, m_width, m_height, outPredYuv, bLuma, bChroma);
+        {
+            WeightParam *pwp0 = NULL, *pwp1 = NULL;
+            getWpScaling(cu, refIdx0, refIdx1, pwp0, pwp1);
+            addWeightBi(&m_predShortYuv[0], &m_predShortYuv[1], m_partAddr, m_width, m_height, pwp0, pwp1, outPredYuv, bLuma, bChroma);
+        }
         else
             outPredYuv->addAvg(&m_predShortYuv[0], &m_predShortYuv[1], m_partAddr, m_width, m_height, bLuma, bChroma);
     }
     else if (m_slice->m_pps->bUseWeightedBiPred)
     {
+        WeightParam *pwp0 = NULL, *pwp1 = NULL;
+        getWpScaling(cu, refIdx0, refIdx1, pwp0, pwp1);
+
         if (refIdx0 >= 0)
+        {
             predInterUni(0, &m_predShortYuv[0], bLuma, bChroma);
-        if (refIdx1 >= 0)
+            addWeightUni(&m_predShortYuv[0], m_partAddr, m_width, m_height, pwp0, outPredYuv, bLuma, bChroma);
+        }
+        else
+        {
+            X265_CHECK(refIdx1 >= 0, "refidx1 was not positive\n");
             predInterUni(1, &m_predShortYuv[1], bLuma, bChroma);
-
-        weightedPredictionBi(cu, &m_predShortYuv[0], &m_predShortYuv[1], refIdx0, refIdx1, m_partAddr, m_width, m_height, outPredYuv, bLuma, bChroma);
+            addWeightUni(&m_predShortYuv[1], m_partAddr, m_width, m_height, pwp1, outPredYuv, bLuma, bChroma);
+        }
     }
     else if (refIdx0 >= 0)
     {
@@ -686,25 +698,6 @@
     }
 }
 
-/* weighted prediction for bi-pred */
-void Predict::weightedPredictionBi(TComDataCU* cu, ShortYuv* srcYuv0, ShortYuv* srcYuv1, int refIdx0, int refIdx1, uint32_t partIdx, int width, int height, TComYuv* outPredYuv, bool bLuma, bool bChroma)
-{
-    WeightParam *pwp0 = NULL, *pwp1 = NULL;
-
-    getWpScaling(cu, refIdx0, refIdx1, pwp0, pwp1);
-
-    if (refIdx0 >= 0 && refIdx1 >= 0)
-        addWeightBi(srcYuv0, srcYuv1, partIdx, width, height, pwp0, pwp1, outPredYuv, bLuma, bChroma);
-    else if (refIdx0 >= 0 && refIdx1 <  0)
-        addWeightUni(srcYuv0, partIdx, width, height, pwp0, outPredYuv, bLuma, bChroma);
-    else if (refIdx0 <  0 && refIdx1 >= 0)
-        addWeightUni(srcYuv1, partIdx, width, height, pwp1, outPredYuv, bLuma, bChroma);
-    else
-    {
-        X265_CHECK(0, "unexpected weighte biprediction configuration\n");
-    }
-}
-
 /* weighted prediction for uni-pred */
 void Predict::weightedPredictionUni(TComDataCU* cu, ShortYuv* srcYuv, uint32_t partAddr, int width, int height, int picList, TComYuv* outPredYuv, int refIdx, bool bLuma, bool bChroma)
 {
diff -r e8dfe19c9f01 -r a2f5d5a4b48f source/encoder/predict.h
--- a/source/encoder/predict.h	Sat Sep 20 18:05:32 2014 +0100
+++ b/source/encoder/predict.h	Sat Sep 20 18:12:56 2014 +0100
@@ -72,7 +72,6 @@
     void addWeightUni(ShortYuv* srcYuv0, uint32_t partUnitIdx, uint32_t width, uint32_t height, WeightParam *wp0, TComYuv* outDstYuv, bool bLuma, bool bChroma);
 
     void weightedPredictionUni(TComDataCU* cu, ShortYuv* srcYuv, uint32_t partAddr, int width, int height, int picList, TComYuv* outPredYuv, int refIdx, bool bLuma, bool bChroma);
-    void weightedPredictionBi(TComDataCU* cu, ShortYuv* srcYuv0, ShortYuv* srcYuv1, int refIdx0, int refIdx1, uint32_t partIdx, int width, int height, TComYuv* outDstYuv, bool bLuma, bool bChroma);
 
     void getLLSPrediction(TComPattern* pcPattern, int* src0, int srcstride, pixel* dst0, int dststride, uint32_t width, uint32_t height, uint32_t ext0);
 


More information about the x265-devel mailing list