[x265] [PATCH] MotionReference objects with distinct weights handled as linked list

deepthidevaki at multicorewareinc.com deepthidevaki at multicorewareinc.com
Wed Jul 31 12:23:07 CEST 2013


# HG changeset patch
# User Deepthi Devaki
# Date 1375266155 -19800
# Node ID 2a8fb9ec2a10c510df180f2c4a8ea065089d4568
# Parent  66eab44e4c56d7f7841a417aa05b9b49a6192a5a
MotionReference objects with distinct weights handled as linked list

diff -r 66eab44e4c56 -r 2a8fb9ec2a10 source/Lib/TLibCommon/TComPicYuv.cpp
--- a/source/Lib/TLibCommon/TComPicYuv.cpp	Wed Jul 31 01:18:43 2013 -0500
+++ b/source/Lib/TLibCommon/TComPicYuv.cpp	Wed Jul 31 15:52:35 2013 +0530
@@ -229,22 +229,50 @@
     ::memcpy(destPicYuv->getBufV(), m_picBufV, sizeof(Pel) * ((m_picWidth >> 1) + (m_chromaMarginX << 1)) * ((m_picHeight >> 1) + (m_chromaMarginY << 1)));
 }
 
-Void TComPicYuv::extendPicBorder(x265::ThreadPool *pool)
+x265::MotionReference * TComPicYuv::getMotionReference(wpScalingParam *w)
 {
-    if (m_bIsBorderExtended)
+    MotionReference *temp;
+    for(temp = m_refList; temp!=NULL; temp = temp->m_next)
+    {
+        if (w!=NULL)
+        {   
+            if ((temp->m_weight == w->inputWeight)&&(temp->m_offset == (w->inputOffset * (1 << (g_bitDepth - 8))))&&(temp->m_shift == w->log2WeightDenom))
+            {
+                return(temp);
+            }
+        }
+        else
+        {
+            if (temp->m_isWeighted == false)
+            {
+                return(temp);
+            }
+        }
+    }
+    return NULL;
+}
+
+Void TComPicYuv::extendPicBorder(x265::ThreadPool *pool, wpScalingParam *w)
+{
+    if (getMotionReference(w)!=NULL)
+    {
         return;
+    }
 
-    /* HPEL generation requires luma integer plane to already be extended */
-    xExtendPicCompBorder(getLumaAddr(), getStride(), getWidth(), getHeight(), m_lumaMarginX, m_lumaMarginY);
+    if (!m_bIsBorderExtended)
+    {
+        /* HPEL generation requires luma integer plane to already be extended */
+        xExtendPicCompBorder(getLumaAddr(), getStride(), getWidth(), getHeight(), m_lumaMarginX, m_lumaMarginY);
+        xExtendPicCompBorder(getCbAddr(), getCStride(), getWidth() >> 1, getHeight() >> 1, m_chromaMarginX, m_chromaMarginY);
+        xExtendPicCompBorder(getCrAddr(), getCStride(), getWidth() >> 1, getHeight() >> 1, m_chromaMarginX, m_chromaMarginY);
+        m_bIsBorderExtended = true;
+    }
 
-    xExtendPicCompBorder(getCbAddr(), getCStride(), getWidth() >> 1, getHeight() >> 1, m_chromaMarginX, m_chromaMarginY);
-    xExtendPicCompBorder(getCrAddr(), getCStride(), getWidth() >> 1, getHeight() >> 1, m_chromaMarginX, m_chromaMarginY);
+    MotionReference *temp = new x265::MotionReference(this, pool, w);
+    temp->generateReferencePlanes();
+    temp->m_next = m_refList;
+    m_refList = temp;
 
-    if (m_refList == NULL)
-        m_refList = new x265::MotionReference(this, pool);
-    m_refList->generateReferencePlanes();
-
-    m_bIsBorderExtended = true;
 }
 
 Void TComPicYuv::xExtendPicCompBorder(Pel* recon, Int stride, Int width, Int height, Int iMarginX, Int iMarginY)
diff -r 66eab44e4c56 -r 2a8fb9ec2a10 source/Lib/TLibCommon/TComPicYuv.h
--- a/source/Lib/TLibCommon/TComPicYuv.h	Wed Jul 31 01:18:43 2013 -0500
+++ b/source/Lib/TLibCommon/TComPicYuv.h	Wed Jul 31 15:52:35 2013 +0530
@@ -152,8 +152,7 @@
 
     Pel*  getCrAddr()     { return m_picOrgV; }
 
-    /* Actual weight handling TBD: this is just a placeholder.  Always pass 0 */
-    x265::MotionReference *getMotionReference(Int weightIdx) { return &m_refList[weightIdx]; }
+    x265::MotionReference *getMotionReference(wpScalingParam *w); 
 
     //  Access starting position of original picture for specific coding unit (CU) or partition unit (PU)
     Pel*  getLumaAddr(Int cuAddr) { return m_picOrgY + m_cuOffsetY[cuAddr]; }
@@ -185,7 +184,7 @@
     Void  copyFromPicture(const x265_picture_t&);
 
     //  Extend function of picture buffer
-    Void  extendPicBorder(x265::ThreadPool *pool);
+    Void  extendPicBorder(x265::ThreadPool *pool, wpScalingParam *w=NULL);
 
     //  Dump picture
     Void  dump(Char* pFileName, Bool bAdd = false);
diff -r 66eab44e4c56 -r 2a8fb9ec2a10 source/common/reference.h
--- a/source/common/reference.h	Wed Jul 31 01:18:43 2013 -0500
+++ b/source/common/reference.h	Wed Jul 31 15:52:35 2013 +0530
@@ -50,6 +50,9 @@
     int  m_lumaStride;
     int  m_weight;
     bool m_isWeighted;
+    int  m_offset;
+    int  m_shift;
+    int  m_round;
 
     MotionReference *m_next;
 
@@ -78,10 +81,6 @@
     int         m_filterHeight;
     short      *m_intermediateValues;
 
-    int         m_offset;
-    int         m_shift;
-    int         m_round;
-
     MotionReference& operator =(const MotionReference&);
 };
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265.patch
Type: text/x-patch
Size: 4563 bytes
Desc: not available
URL: <http://mailman.videolan.org/private/x265-devel/attachments/20130731/a9fcd5cf/attachment.bin>


More information about the x265-devel mailing list