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

shazeb at multicorewareinc.com shazeb at multicorewareinc.com
Wed Nov 27 13:13:04 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 68bc1cb9ee3fb99a60d5e2b0e3628409e110a4ee
# Parent  417f794274e5692851b558eaa609e6fbdac1d50f
Fix to eliminate unwanted application of weight in some (ref, enc) pairs

diff -r 417f794274e5 -r 68bc1cb9ee3f 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