[x265] [PATCH 2 of 2] Weighted prediction primitives integrated to encoder

deepthidevaki at multicorewareinc.com deepthidevaki at multicorewareinc.com
Thu Jul 11 11:27:43 CEST 2013


# HG changeset patch
# User Deepthi Devaki
# Date 1373534778 -19800
# Node ID 91c591f8a12e423f095acaf0ebdfb1d04167b149
# Parent  bb29ce5d4caec8a9ca75bcae2aa1c74618ebdb84
Weighted prediction primitives integrated to encoder.

diff -r bb29ce5d4cae -r 91c591f8a12e source/Lib/TLibCommon/TComWeightPrediction.cpp
--- a/source/Lib/TLibCommon/TComWeightPrediction.cpp	Thu Jul 11 14:55:16 2013 +0530
+++ b/source/Lib/TLibCommon/TComWeightPrediction.cpp	Thu Jul 11 14:56:18 2013 +0530
@@ -39,6 +39,7 @@
 #include "TComSlice.h"
 #include "TComWeightPrediction.h"
 #include "TComPrediction.h"
+#include "primitives.h"
 
 static inline Pel weightBidirY(Int w0, Short P0, Int w1, Short P1, Int round, Int shift, Int offset)
 {
@@ -402,15 +403,14 @@
  * \param TComYuv* rpcYuvDst
  * \returns Void
  */
+
 Void TComWeightPrediction::addWeightUni(TShortYUV* srcYuv0, UInt iPartUnitIdx, UInt width, UInt height, wpScalingParam *wp0, TComYuv* rpcYuvDst)
 {
-    Int x, y;
-
     Short* pSrcY0  = srcYuv0->getLumaAddr(iPartUnitIdx);
     Short* pSrcU0  = srcYuv0->getCbAddr(iPartUnitIdx);
     Short* pSrcV0  = srcYuv0->getCrAddr(iPartUnitIdx);
 
-    Pel* pDstY   = rpcYuvDst->getLumaAddr(iPartUnitIdx);
+    Pel* dstY   = rpcYuvDst->getLumaAddr(iPartUnitIdx);
     Pel* dstU   = rpcYuvDst->getCbAddr(iPartUnitIdx);
     Pel* dstV   = rpcYuvDst->getCrAddr(iPartUnitIdx);
 
@@ -420,27 +420,10 @@
     Int shiftNum = IF_INTERNAL_PREC - g_bitDepthY;
     Int shift   = wp0[0].shift + shiftNum;
     Int round   = shift ? (1 << (shift - 1)) : 0;
-    UInt  iSrc0Stride = srcYuv0->width;
-    UInt  dststride  = rpcYuvDst->getStride();
+    UInt  srcStride = srcYuv0->width;
+    UInt  dstStride  = rpcYuvDst->getStride();
 
-    for (y = height - 1; y >= 0; y--)
-    {
-        for (x = width - 1; x >= 0; )
-        {
-            // note: luma min width is 4
-            pDstY[x] = weightUnidirY(w0, pSrcY0[x], round, shift, offset);
-            x--;
-            pDstY[x] = weightUnidirY(w0, pSrcY0[x], round, shift, offset);
-            x--;
-            pDstY[x] = weightUnidirY(w0, pSrcY0[x], round, shift, offset);
-            x--;
-            pDstY[x] = weightUnidirY(w0, pSrcY0[x], round, shift, offset);
-            x--;
-        }
-
-        pSrcY0 += iSrc0Stride;
-        pDstY  += dststride;
-    }
+   x265::primitives.weightpUni(pSrcY0, dstY, srcStride, dstStride, width, height, w0, round, shift, offset, g_bitDepthY);
 
     // Chroma U : --------------------------------------------
     w0      = wp0[1].w;
@@ -449,26 +432,13 @@
     shift   = wp0[1].shift + shiftNum;
     round   = shift ? (1 << (shift - 1)) : 0;
 
-    iSrc0Stride = srcYuv0->Cwidth;
-    dststride  = rpcYuvDst->getCStride();
+    srcStride = srcYuv0->Cwidth;
+    dstStride  = rpcYuvDst->getCStride();
 
     width  >>= 1;
     height >>= 1;
 
-    for (y = height - 1; y >= 0; y--)
-    {
-        for (x = width - 1; x >= 0; )
-        {
-            // note: chroma min width is 2
-            dstU[x] = weightUnidirC(w0, pSrcU0[x], round, shift, offset);
-            x--;
-            dstU[x] = weightUnidirC(w0, pSrcU0[x], round, shift, offset);
-            x--;
-        }
-
-        pSrcU0 += iSrc0Stride;
-        dstU  += dststride;
-    }
+    x265::primitives.weightpUni(pSrcU0, dstU, srcStride, dstStride, width, height, w0, round, shift, offset, g_bitDepthC);
 
     // Chroma V : --------------------------------------------
     w0      = wp0[2].w;
@@ -476,20 +446,8 @@
     shift   = wp0[2].shift + shiftNum;
     round   = shift ? (1 << (shift - 1)) : 0;
 
-    for (y = height - 1; y >= 0; y--)
-    {
-        for (x = width - 1; x >= 0; )
-        {
-            // note: chroma min width is 2
-            dstV[x] = weightUnidirC(w0, pSrcV0[x], round, shift, offset);
-            x--;
-            dstV[x] = weightUnidirC(w0, pSrcV0[x], round, shift, offset);
-            x--;
-        }
+    x265::primitives.weightpUni(pSrcU0, dstV, srcStride, dstStride, width, height, w0, round, shift, offset, g_bitDepthC);
 
-        pSrcV0 += iSrc0Stride;
-        dstV  += dststride;
-    }
 }
 
 //=======================================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xhevc_deepthid-2.patch
Type: text/x-patch
Size: 4150 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130711/f8ca10de/attachment.bin>


More information about the x265-devel mailing list