[x265] [PATCH] weightp: add unweighted duplicate of first weighted L0 reference

kavitha at multicorewareinc.com kavitha at multicorewareinc.com
Sun Mar 16 19:23:16 CET 2014


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1394994092 -19800
#      Sun Mar 16 23:51:32 2014 +0530
# Node ID a61f19998ba46b4dda79f460960af12eec47c9e8
# Parent  ba3ddc1848fff0fb8e96ca8f0453dd84171f213f
weightp: add unweighted duplicate of first weighted L0 reference

diff -r ba3ddc1848ff -r a61f19998ba4 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Fri Mar 14 12:56:01 2014 -0500
+++ b/source/encoder/frameencoder.cpp	Sun Mar 16 23:51:32 2014 +0530
@@ -454,6 +454,35 @@
         }
     }
 
+    if (bUseWeightP && slice->m_weightPredTable[0][0][0].bPresentFlag)
+    {
+        /* Add an unweighted duplicate of weighted first L0 reference */
+        int numref = slice->getNumRefIdx(0);
+        TComPic *dup = slice->getRefPic(0, 0);
+        slice->setRefPic(dup, 0, numref);
+        slice->setRefPOC(slice->getRefPOC(0, 0), 0, numref);
+
+        // update rps
+        TComReferencePictureSet *rps = slice->getLocalRPS();
+        rps->m_numberOfPictures++;
+        rps->m_numberOfNegativePictures++;
+        rps->m_deltaPOC[numref + 1] = rps->m_deltaPOC[numref];
+        rps->m_used[numref + 1] = rps->m_used[numref];
+        rps->m_POC[numref + 1] = rps->m_POC[numref];
+
+        //copy first ref data to the dup ref in rps 
+        rps->m_deltaPOC[numref] = rps->m_deltaPOC[0];
+        rps->m_used[numref] = rps->m_used[0];
+        rps->m_POC[numref] = rps->m_POC[0];
+
+        wpScalingParam *wp = slice->m_weightPredTable[0][numref];
+        SET_WEIGHT(wp[0], false, 1, 0, 0);
+        SET_WEIGHT(wp[1], false, 1, 0, 0);
+        SET_WEIGHT(wp[2], false, 1, 0, 0);
+        m_mref[0][numref].init(slice->getRefPic(0, 0)->getPicYuvRec(), NULL);
+        slice->setNumRefIdx(0, ++numref);
+    }
+
     // Analyze CTU rows, most of the hard work is done here
     // frame is compressed in a wave-front pattern if WPP is enabled. Loop filter runs as a
     // wave-front behind the CU compression and reconstruction


More information about the x265-devel mailing list