<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 1, 2013 at 3:25 AM,  <span dir="ltr"><<a href="mailto:shazeb@multicorewareinc.com" target="_blank">shazeb@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Shazeb Nawaz Khan <<a href="mailto:shazeb@multicorewareinc.com">shazeb@multicorewareinc.com</a>><br>
# Date 1380615387 -19800<br>
#      Tue Oct 01 13:46:27 2013 +0530<br>
# Node ID b8fa0fa81997e668ad983618c2ccf9d76d75f83c<br>
# Parent  051ccb452f2442ec9c054e2c8758df1843058bab<br>
Adding function applyWeight in MotionRefernce...<br>
<br>
to generate weighted full pel pixels for one or more rows<br></blockquote><div><br></div><div>I would have pushed this one, but it won't build without the primitive being finished</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

diff -r 051ccb452f24 -r b8fa0fa81997 source/common/reference.cpp<br>
--- a/source/common/reference.cpp       Tue Oct 01 11:53:41 2013 +0530<br>
+++ b/source/common/reference.cpp       Tue Oct 01 13:46:27 2013 +0530<br>
@@ -62,6 +62,7 @@<br>
     m_startPad = pic->m_lumaMarginY * lumaStride + pic->m_lumaMarginX;<br>
     m_next = NULL;<br>
     isWeighted = false;<br>
+    m_numWeightedRows = 0;<br>
<br>
     if (w)<br>
     {<br>
@@ -69,7 +70,6 @@<br>
         int height = pic->getHeight();<br>
         size_t padwidth = width + pic->m_lumaMarginX * 2;<br>
         size_t padheight = height + pic->m_lumaMarginY * 2;<br>
-<br>
         setWeight(*w);<br>
         fpelPlane = (pixel*)X265_MALLOC(pixel,  padwidth * padheight);<br>
         if (fpelPlane) fpelPlane += m_startPad;<br>
@@ -88,3 +88,46 @@<br>
     if (isWeighted && fpelPlane)<br>
         X265_FREE(fpelPlane - m_startPad);<br>
 }<br>
+<br>
+void MotionReference::applyWeight(TComPic* ref, int rows, int numRows)<br>
+{<br>
+    TComPicYuv* pic = ref->getPicYuvRec();<br>
+    int marginX = pic->m_lumaMarginX;<br>
+    int marginY = pic->m_lumaMarginY;<br>
+    pixel* src = (pixel*) pic->getLumaAddr() + (m_numWeightedRows * (int)g_maxCUHeight * lumaStride);<br>
+    int width = pic->getWidth();<br>
+    int height = ((rows - m_numWeightedRows) * g_maxCUHeight);<br>
+    if (rows == numRows - 1)<br>
+        height = ((pic->getHeight() % g_maxCUHeight) ? (pic->getHeight() % g_maxCUHeight) : g_maxCUHeight);<br>
+    size_t dstStride = lumaStride;<br>
+<br>
+    // Computing weighted CU rows<br>
+    int shiftNum = IF_INTERNAL_PREC - X265_DEPTH;<br>
+    shift = shift + shiftNum;<br>
+    round = shift ? (1 << (shift - 1)) : 0;<br>
+    primitives.weightpUniPixel(src, fpelPlane, lumaStride, dstStride, width, height, weight, round, shift, offset);<br>
+<br>
+    // Extending Left & Right<br>
+    primitives.extendRowBorder(fpelPlane, dstStride, width, height, marginX);<br>
+<br>
+    // Extending Above<br>
+    if (m_numWeightedRows == 0)<br>
+    {<br>
+        pixel *pixY = fpelPlane - marginX;<br>
+        for (int y = 0; y < marginY; y++)<br>
+        {<br>
+            memcpy(pixY - (y + 1) * dstStride, pixY, dstStride * sizeof(pixel));<br>
+        }<br>
+    }<br>
+<br>
+    // Extending Bottom<br>
+    if (rows == (numRows - 1))<br>
+    {<br>
+        pixel *pixY = fpelPlane - marginX + (pic->getHeight() - 1) * dstStride;<br>
+        for (int y = 0; y < marginY; y++)<br>
+        {<br>
+            memcpy(pixY + (y + 1) * dstStride, pixY, dstStride * sizeof(pixel));<br>
+        }<br>
+    }<br>
+    m_numWeightedRows = rows;<br>
+}<br>
diff -r 051ccb452f24 -r b8fa0fa81997 source/common/reference.h<br>
--- a/source/common/reference.h Tue Oct 01 11:53:41 2013 +0530<br>
+++ b/source/common/reference.h Tue Oct 01 13:46:27 2013 +0530<br>
@@ -60,9 +60,11 @@<br>
     MotionReference();<br>
     ~MotionReference();<br>
     int  init(TComPicYuv*, wpScalingParam* w = NULL);<br>
+    void applyWeight(TComPic* src, int rows, int numRows);<br>
<br>
     MotionReference *m_next;<br>
     TComPicYuv      *m_reconPic;<br>
+    int              m_numWeightedRows;<br>
<br>
 protected:<br>
<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>