Commits

Anonymous committed bfd5204

Fix to eliminate unwanted application of weight in some (ref, enc) pairs

Comments (0)

Files changed (1)

source/encoder/frameencoder.cpp

     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]->bPresentFlag))
             {
                 w = slice->m_weightPredTable[l][ref];
                 slice->m_numWPRefs++;
                         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);
                     }
                             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);
                         }