<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 17, 2013 at 4:31 AM,  <span dir="ltr"><<a href="mailto:gopu@multicorewareinc.com" target="_blank">gopu@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 ggopu<br>
# Date 1374053501 -19800<br>
# Node ID ad9f7a7307572f0769e8abd1af78f66541fa4de6<br>
# Parent  c6c045e9272798ce5268643436759db22fd1950b<br>
TshortYUV: Cleanup and Used Performance Primitives for copy the block<br>
<br>
diff -r c6c045e92727 -r ad9f7a730757 source/common/TShortYUV.cpp<br>
--- a/source/common/TShortYUV.cpp       Wed Jul 17 13:06:06 2013 +0530<br>
+++ b/source/common/TShortYUV.cpp       Wed Jul 17 15:01:41 2013 +0530<br>
@@ -172,98 +172,78 @@<br>
     copyPartToPartChroma(pcYuvDst, uiPartIdx, iWidth >> 1, iHeight >> 1);<br>
 }<br>
<br>
-Void TShortYUV::copyPartToPartLuma(TShortYUV* pcYuvDst, unsigned int uiPartIdx, unsigned int iWidth, unsigned int iHeight)<br>
+Void TShortYUV::copyPartToPartLuma(TShortYUV* pcYuvDst, unsigned int partIdx, unsigned int widthl, unsigned int heightl)<br></blockquote><div><br></div><div>pcYuvDst -> dstYuv</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

 {<br>
-    short* pSrc =           getLumaAddr(uiPartIdx);<br>
-    short* pDst = pcYuvDst->getLumaAddr(uiPartIdx);<br>
+    short* src =           getLumaAddr(partIdx);<br>
+    short* dst = pcYuvDst->getLumaAddr(partIdx);<br>
<br>
-    if (pSrc == pDst)<br>
+    if (src == dst)<br>
     {<br>
         //th not a good idea<br>
         //th best would be to fix the caller<br>
         return;<br>
     }<br>
<br>
-    unsigned int  iSrcStride = width;<br>
-    unsigned int  iDstStride = pcYuvDst->width;<br>
-    for (unsigned int y = iHeight; y != 0; y--)<br>
+    unsigned int  srcStride = width;<br>
+    unsigned int  dstStride = pcYuvDst->width;<br>
+    for (unsigned int y = heightl; y != 0; y--)<br>
     {<br>
-        ::memcpy(pDst, pSrc, iWidth * sizeof(short));<br>
-        pSrc += iSrcStride;<br>
-        pDst += iDstStride;<br>
+        ::memcpy(dst, src, widthl * sizeof(short));<br></blockquote><div><br></div><div>widhtl?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+        src += srcStride;<br>
+        dst += dstStride;<br>
     }<br>
 }<br>
<br>
-Void TShortYUV::copyPartToPartLuma(TComYuv* pcYuvDst, unsigned int uiPartIdx, unsigned int iWidth, unsigned int iHeight)<br>
+Void TShortYUV::copyPartToPartLuma(TComYuv* pcYuvDst, unsigned int partIdx, unsigned int widthl, unsigned int heightl)<br>
 {<br>
-    short* pSrc =           getLumaAddr(uiPartIdx);<br>
-    Pel* pDst = pcYuvDst->getLumaAddr(uiPartIdx);<br>
+    short* src =           getLumaAddr(partIdx);<br>
+    Pel* dst = pcYuvDst->getLumaAddr(partIdx);<br>
<br>
-    unsigned int  iSrcStride = width;<br>
-    unsigned int  iDstStride = pcYuvDst->getStride();<br>
+    unsigned int  srcStride = width;<br>
+    unsigned int  dstStride = pcYuvDst->getStride();<br>
<br>
-    for (unsigned int y = iHeight; y != 0; y--)<br>
-    {<br>
-        for (unsigned int x = 0; x < iWidth; x++)<br>
-        {<br>
-            pDst[x] = (Pel)(pSrc[x]);<br>
-        }<br>
-<br>
-        pSrc += iSrcStride;<br>
-        pDst += iDstStride;<br>
-    }<br>
+    primitives.blockcpy_ps(widthl, heightl, dst, dstStride, src, srcStride);<br>
 }<br>
<br>
-Void TShortYUV::copyPartToPartChroma(TShortYUV* pcYuvDst, unsigned int uiPartIdx, unsigned int iWidth, unsigned int iHeight)<br>
+Void TShortYUV::copyPartToPartChroma(TShortYUV* pcYuvDst, unsigned int partIdx, unsigned int widthc, unsigned int heightc)<br>
 {<br>
-    short*  pSrcU =           getCbAddr(uiPartIdx);<br>
-    short*  pSrcV =           getCrAddr(uiPartIdx);<br>
-    short*  pDstU = pcYuvDst->getCbAddr(uiPartIdx);<br>
-    short*  pDstV = pcYuvDst->getCrAddr(uiPartIdx);<br>
+    short*  srcU =           getCbAddr(partIdx);<br>
+    short*  srcV =           getCrAddr(partIdx);<br>
+    short*  dstU = pcYuvDst->getCbAddr(partIdx);<br>
+    short*  dstV = pcYuvDst->getCrAddr(partIdx);<br>
<br>
-    if (pSrcU == pDstU && pSrcV == pDstV)<br>
+    if (srcU == dstU && srcV == dstV)<br>
     {<br>
         //th not a good idea<br>
         //th best would be to fix the caller<br>
         return;<br>
     }<br>
<br>
-    unsigned int   iSrcStride = Cwidth;<br>
-    unsigned int   iDstStride = pcYuvDst->Cwidth;<br>
-    for (unsigned int y = iHeight; y != 0; y--)<br>
+    unsigned int   srcStride = Cwidth;<br>
+    unsigned int   dstStride = pcYuvDst->Cwidth;<br>
+    for (unsigned int y = heightc; y != 0; y--)<br>
     {<br>
-        ::memcpy(pDstU, pSrcU, iWidth * sizeof(short));<br>
-        ::memcpy(pDstV, pSrcV, iWidth * sizeof(short));<br>
-        pSrcU += iSrcStride;<br>
-        pSrcV += iSrcStride;<br>
-        pDstU += iDstStride;<br>
-        pDstV += iDstStride;<br>
+        ::memcpy(dstU, srcU, widthc * sizeof(short));<br>
+        ::memcpy(dstV, srcV, widthc * sizeof(short));<br>
+        srcU += srcStride;<br>
+        srcV += srcStride;<br>
+        dstU += dstStride;<br>
+        dstV += dstStride;<br>
     }<br>
 }<br>
<br>
-Void TShortYUV::copyPartToPartChroma(TComYuv* pcYuvDst, unsigned int uiPartIdx, unsigned int iWidth, unsigned int iHeight)<br>
+Void TShortYUV::copyPartToPartChroma(TComYuv* pcYuvDst, unsigned int partIdx, unsigned int widthc, unsigned int heightc)<br>
 {<br>
-    short*  pSrcU =           getCbAddr(uiPartIdx);<br>
-    short*  pSrcV =           getCrAddr(uiPartIdx);<br>
-    Pel*  pDstU = pcYuvDst->getCbAddr(uiPartIdx);<br>
-    Pel*  pDstV = pcYuvDst->getCrAddr(uiPartIdx);<br>
+    short*  srcU =           getCbAddr(partIdx);<br>
+    short*  srcV =           getCrAddr(partIdx);<br>
+    Pel*  dstU = pcYuvDst->getCbAddr(partIdx);<br>
+    Pel*  dstV = pcYuvDst->getCrAddr(partIdx);<br>
<br>
-    unsigned int   iSrcStride = Cwidth;<br>
-    unsigned int   iDstStride = pcYuvDst->getCStride();<br>
+    unsigned int   srcStride = Cwidth;<br>
+    unsigned int   dstStride = pcYuvDst->getCStride();<br>
<br>
-    for (unsigned int y = iHeight; y != 0; y--)<br>
-    {<br>
-        for (unsigned int x = 0; x < iWidth; x++)<br>
-        {<br>
-            pDstU[x] = (Pel)(pSrcU[x]);<br>
-            pDstV[x] = (Pel)(pSrcV[x]);<br>
-        }<br>
-<br>
-        pSrcU += iSrcStride;<br>
-        pSrcV += iSrcStride;<br>
-        pDstU += iDstStride;<br>
-        pDstV += iDstStride;<br>
-    }<br>
+    primitives.blockcpy_ps(widthc, heightc, dstU, dstStride, srcU, srcStride);<br>
+    primitives.blockcpy_ps(widthc, heightc, dstV, dstStride, srcV, srcStride);<br>
 }<br>
<br>
 Void TShortYUV::copyPartToPartChroma(TShortYUV* pcYuvDst, unsigned int uiPartIdx, unsigned int iWidth, unsigned int iHeight, unsigned int chromaId)<br>
@@ -329,63 +309,34 @@<br>
     }<br>
 }<br>
<br>
-Void TShortYUV::copyPartToPartChroma(TComYuv* pcYuvDst, unsigned int uiPartIdx, unsigned int iWidth, unsigned int iHeight, unsigned int chromaId)<br>
+Void TShortYUV::copyPartToPartChroma(TComYuv* pcYuvDst, unsigned int partIdx, unsigned int widthc, unsigned int heightc, unsigned int chromaId)<br>
 {<br>
     if (chromaId == 0)<br>
     {<br>
-        short*  pSrcU =           getCbAddr(uiPartIdx);<br>
-        Pel*  pDstU = pcYuvDst->getCbAddr(uiPartIdx);<br>
-        unsigned int   iSrcStride = Cwidth;<br>
-        unsigned int   iDstStride = pcYuvDst->getCStride();<br>
-        for (unsigned int y = iHeight; y != 0; y--)<br>
-        {<br>
-            for (unsigned int x = 0; x < iWidth; x++)<br>
-            {<br>
-                pDstU[x] = (Pel)(pSrcU[x]);<br>
-            }<br>
-<br>
-            pSrcU += iSrcStride;<br>
-            pDstU += iDstStride;<br>
-        }<br>
+        short*  srcU =           getCbAddr(partIdx);<br>
+        Pel*  dstU = pcYuvDst->getCbAddr(partIdx);<br>
+        unsigned int   srcStride = Cwidth;<br>
+        unsigned int   dstStride = pcYuvDst->getCStride();<br>
+        primitives.blockcpy_ps(widthc, heightc, dstU, dstStride, srcU, srcStride);<br>
     }<br>
     else if (chromaId == 1)<br>
     {<br>
-        short*  pSrcV =           getCrAddr(uiPartIdx);<br>
-        Pel*  pDstV = pcYuvDst->getCrAddr(uiPartIdx);<br>
-        unsigned int   iSrcStride = Cwidth;<br>
-        unsigned int   iDstStride = pcYuvDst->getCStride();<br>
-        for (unsigned int y = iHeight; y != 0; y--)<br>
-        {<br>
-            for (unsigned int x = 0; x < iWidth; x++)<br>
-            {<br>
-                pDstV[x] = (Pel)(pSrcV[x]);<br>
-            }<br>
-<br>
-            pSrcV += iSrcStride;<br>
-            pDstV += iDstStride;<br>
-        }<br>
+        short*  srcV =           getCrAddr(partIdx);<br>
+        Pel*  dstV = pcYuvDst->getCrAddr(partIdx);<br>
+        unsigned int   srcStride = Cwidth;<br>
+        unsigned int   dstStride = pcYuvDst->getCStride();<br>
+        primitives.blockcpy_ps(widthc, heightc, dstV, dstStride, srcV, srcStride);<br>
     }<br>
     else<br>
     {<br>
-        short*  pSrcU =           getCbAddr(uiPartIdx);<br>
-        short*  pSrcV =           getCrAddr(uiPartIdx);<br>
-        Pel*  pDstU = pcYuvDst->getCbAddr(uiPartIdx);<br>
-        Pel*  pDstV = pcYuvDst->getCrAddr(uiPartIdx);<br>
+        short*  srcU =           getCbAddr(partIdx);<br>
+        short*  srcV =           getCrAddr(partIdx);<br>
+        Pel*  dstU = pcYuvDst->getCbAddr(partIdx);<br>
+        Pel*  dstV = pcYuvDst->getCrAddr(partIdx);<br>
<br>
-        unsigned int   iSrcStride = Cwidth;<br>
-        unsigned int   iDstStride = pcYuvDst->getCStride();<br>
-        for (unsigned int y = iHeight; y != 0; y--)<br>
-        {<br>
-            for (unsigned int x = 0; x < iWidth; x++)<br>
-            {<br>
-                pDstU[x] = (Pel)(pSrcU[x]);<br>
-                pDstV[x] = (Pel)(pSrcV[x]);<br>
-            }<br>
-<br>
-            pSrcU += iSrcStride;<br>
-            pSrcV += iSrcStride;<br>
-            pDstU += iDstStride;<br>
-            pDstV += iDstStride;<br>
-        }<br>
+        unsigned int   srcStride = Cwidth;<br>
+        unsigned int   dstStride = pcYuvDst->getCStride();<br>
+        primitives.blockcpy_ps(widthc, heightc, dstU, dstStride, srcU, srcStride);<br>
+        primitives.blockcpy_ps(widthc, heightc, dstV, dstStride, srcV, srcStride);<br>
     }<br>
 }<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="http://mailman.videolan.org/listinfo/x265-devel" target="_blank">http://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>