[x265] [PATCH 12 of 14] predict: streamline getWpScaling()
Steve Borho
steve at borho.org
Sat Sep 20 18:46:11 CEST 2014
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1411234235 -3600
# Sat Sep 20 18:30:35 2014 +0100
# Node ID 692d56f307081135f2aacd7b7692b010cae33498
# Parent c388593c272d1d2e51b466645c132d6b45bd40ec
predict: streamline getWpScaling()
diff -r c388593c272d -r 692d56f30708 source/encoder/predict.cpp
--- a/source/encoder/predict.cpp Sat Sep 20 18:30:03 2014 +0100
+++ b/source/encoder/predict.cpp Sat Sep 20 18:30:35 2014 +0100
@@ -664,11 +664,12 @@
void Predict::getWpScaling(TComDataCU* cu, int refIdx0, int refIdx1, WeightParam *&wp0, WeightParam *&wp1)
{
Slice* slice = cu->m_slice;
- bool wpBiPred = slice->m_pps->bUseWeightedBiPred;
- bool bBiDir = (refIdx0 >= 0 && refIdx1 >= 0);
- bool bUniDir = !bBiDir;
+ bool bBiDir = refIdx0 >= 0 && refIdx1 >= 0;
- if (bUniDir || wpBiPred)
+ wp0 = NULL;
+ wp1 = NULL;
+
+ if (!bBiDir || slice->m_pps->bUseWeightedBiPred)
{
if (refIdx0 >= 0)
wp0 = slice->m_weightPredTable[0][refIdx0];
@@ -681,12 +682,6 @@
X265_CHECK(0, "unexpected wpScaling configuration\n");
}
- if (refIdx0 < 0)
- wp0 = NULL;
-
- if (refIdx1 < 0)
- wp1 = NULL;
-
if (bBiDir)
{
for (int yuv = 0; yuv < 3; yuv++)
@@ -696,7 +691,7 @@
wp1[yuv].w = wp1[yuv].inputWeight;
wp1[yuv].o = wp1[yuv].inputOffset * (1 << (X265_DEPTH - 8));
wp0[yuv].shift = wp0[yuv].log2WeightDenom;
- wp0[yuv].round = (1 << wp0[yuv].log2WeightDenom);
+ wp0[yuv].round = 1 << wp0[yuv].log2WeightDenom;
wp1[yuv].shift = wp0[yuv].shift;
wp1[yuv].round = wp0[yuv].round;
}
@@ -709,7 +704,7 @@
pwp[yuv].w = pwp[yuv].inputWeight;
pwp[yuv].offset = pwp[yuv].inputOffset * (1 << (X265_DEPTH - 8));
pwp[yuv].shift = pwp[yuv].log2WeightDenom;
- pwp[yuv].round = (pwp[yuv].log2WeightDenom >= 1) ? (1 << (pwp[yuv].log2WeightDenom - 1)) : (0);
+ pwp[yuv].round = pwp[yuv].log2WeightDenom >= 1 ? 1 << (pwp[yuv].log2WeightDenom - 1) : 0;
}
}
}
More information about the x265-devel
mailing list