[x265] [PATCH] Fix to elliminate unwanted application of weight in some (ref, enc) pairs

shazeb at multicorewareinc.com shazeb at multicorewareinc.com
Wed Nov 27 13:09:56 CET 2013


# HG changeset patch
# User Shazeb Nawaz Khan <shazeb at multicorewareinc.com>
# Date 1385554155 -19800
#      Wed Nov 27 17:39:15 2013 +0530
# Branch stable
# Node ID 496e27bd9d13c10b6f90e83fc36db2f74f1013e5
# Parent  417f794274e5692851b558eaa609e6fbdac1d50f
Fix to elliminate unwanted application of weight in some (ref, enc) pairs

diff -r 417f794274e5 -r 496e27bd9d13 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Wed Nov 27 01:49:09 2013 -0600
+++ b/source/encoder/frameencoder.cpp	Wed Nov 27 17:39:15 2013 +0530
@@ -461,12 +461,12 @@
     int numPredDir = slice->isInterP() ? 1 : slice->isInterB() ? 2 : 0;
     for (int l = 0; l < numPredDir; l++)
     {
-        wpScalingParam *w = NULL;
         for (int ref = 0; ref < slice->getNumRefIdx(l); ref++)
         {
-            if ((slice->isInterP() && slice->getPPS()->getUseWP()))
+            wpScalingParam *w = NULL;
+            if ((slice->isInterP() && slice->getPPS()->getUseWP() && slice->m_weightPredTable[l][ref][0].bPresentFlag))
             {
-                w = slice->m_weightPredTable[l][ref];
+                w = &slice->m_weightPredTable[l][ref][0];
                 slice->m_numWPRefs++;
             }
             m_mref[l][ref].init(slice->getRefPic(l, ref)->getPicYuvRec(), w);
@@ -959,7 +959,7 @@
                         refpic->m_reconRowWait.wait();
                     }
 
-                    if (slice->getPPS()->getUseWP() && (slice->getSliceType() == P_SLICE))
+                    if (slice->getPPS()->getUseWP() && (slice->getSliceType() == P_SLICE) && m_mref[l][ref].isWeighted)
                     {
                         m_mref[l][ref].applyWeight(row + refLagRows, m_numRows);
                     }
@@ -996,7 +996,7 @@
                             refpic->m_reconRowWait.wait();
                         }
 
-                        if (slice->getPPS()->getUseWP() && (slice->getSliceType() == P_SLICE))
+                        if (slice->getPPS()->getUseWP() && (slice->getSliceType() == P_SLICE) && m_mref[l][ref].isWeighted)
                         {
                             m_mref[list][ref].applyWeight(i + refLagRows, m_numRows);
                         }


More information about the x265-devel mailing list