<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jun 21, 2013 at 7:26 AM,  <span dir="ltr"><<a href="mailto:deepthidevaki@multicorewareinc.com" target="_blank">deepthidevaki@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 Deepthi Devaki<br>
# Date 1371817190 -19800<br>
# Node ID caaf0b1a045c9e79b8124dab5585e0ca1a75dd42<br>
# Parent  371e9320d819387ced987a42f55bda2815dcc7ae<br>
Restructured xPredInterBi. Added xPredInterluma/chromablk/Uni functions with TShortYuv argument for bipred. Not yet usable.<br></blockquote><div><br></div><div style>When applied, this patch results in heap corruption errors being reported at exit when the TComPrediction buffers are deleted, so I'm leaving this un-applied.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
diff -r 371e9320d819 -r caaf0b1a045c source/Lib/TLibCommon/TComPrediction.cpp<br>
--- a/source/Lib/TLibCommon/TComPrediction.cpp  Fri Jun 21 17:46:23 2013 +0530<br>
+++ b/source/Lib/TLibCommon/TComPrediction.cpp  Fri Jun 21 17:49:50 2013 +0530<br>
@@ -480,6 +480,21 @@<br>
<br>
 Void TComPrediction::xPredInterUni(TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi)<br>
 {<br>
+    assert (bi == false);<br>
+    Int iRefIdx = pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);<br>
+<br>
+    assert(iRefIdx >= 0);<br>
+    TComMv cMv = pcCU->getCUMvField(eRefPicList)->getMv(uiPartAddr);<br>
+<br>
+    pcCU->clipMv(cMv);<br>
+    xPredInterLumaBlk(pcCU, pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi);<br>
+    xPredInterChromaBlk(pcCU, pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi);<br>
+}<br>
+<br>
+Void TComPrediction::xPredInterUni(TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TShortYUV*& rpcYuvPred, Bool bi)<br>
+{<br>
+    assert (bi == true);<br>
+<br>
     Int iRefIdx = pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);<br>
<br>
     assert(iRefIdx >= 0);<br>
@@ -495,47 +510,87 @@<br>
     TComYuv* pcMbYuv;<br>
     Int      iRefIdx[2] = { -1, -1 };<br>
<br>
-    for (Int iRefList = 0; iRefList < 2; iRefList++)<br>
+    if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartAddr) >= 0 && pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartAddr) >= 0)<br>
     {<br>
-        RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);<br>
-        iRefIdx[iRefList] = pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);<br>
+        for (Int iRefList = 0; iRefList < 2; iRefList++)<br>
+        {<br>
+            RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);<br>
+            iRefIdx[iRefList] = pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);<br>
<br>
-        if (iRefIdx[iRefList] < 0)<br>
+            assert(iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList));<br>
+<br>
+            pcMbYuv = &m_acYuvPred[iRefList];<br>
+            xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true);   //pcMbYuv should be TShortYuv<br>
+        }<br>
+        if (pcCU->getSlice()->getPPS()->getWPBiPred() && pcCU->getSlice()->getSliceType() == B_SLICE)<br>
         {<br>
-            continue;<br>
-        }<br>
-<br>
-        assert(iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList));<br>
-<br>
-        pcMbYuv = &m_acYuvPred[iRefList];<br>
-        if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartAddr) >= 0 && pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartAddr) >= 0)<br>
-        {<br>
-            xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true);<br>
+            //m_acYuvPred must be TShortYuv<br>
+            xWeightedPredictionBi(pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred);<br>
         }<br>
         else<br>
         {<br>
-            if ((pcCU->getSlice()->getPPS()->getUseWP()       && pcCU->getSlice()->getSliceType() == P_SLICE) ||<br>
-                (pcCU->getSlice()->getPPS()->getWPBiPred() && pcCU->getSlice()->getSliceType() == B_SLICE))<br>
-            {<br>
-                xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true);<br>
-            }<br>
-            else<br>
-            {<br>
-                xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv);<br>
-            }<br>
+            //m_acYuvPred must be TShortYuv<br>
+            xWeightedAverage(&m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred);<br>
         }<br>
     }<br>
+    else if (pcCU->getSlice()->getPPS()->getWPBiPred() && pcCU->getSlice()->getSliceType() == B_SLICE)<br>
+    {<br>
+        for (Int iRefList = 0; iRefList < 2; iRefList++)<br>
+        {<br>
+            RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);<br>
+            iRefIdx[iRefList] = pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);<br>
<br>
-    if (pcCU->getSlice()->getPPS()->getWPBiPred() && pcCU->getSlice()->getSliceType() == B_SLICE)<br>
-    {<br>
+            if (iRefIdx[iRefList] < 0)<br>
+            {<br>
+                continue;<br>
+            }<br>
+<br>
+            assert(iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList));<br>
+<br>
+            pcMbYuv = &m_acYuvPred[iRefList];<br>
+            xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true); //pcMbYuv must be TShort<br>
+        }<br>
+        //m_acYuvPred must be TShort<br>
         xWeightedPredictionBi(pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred);<br>
     }<br>
     else if (pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType() == P_SLICE)<br>
     {<br>
+        for (Int iRefList = 0; iRefList < 2; iRefList++)<br>
+        {<br>
+            RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);<br>
+            iRefIdx[iRefList] = pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);<br>
+<br>
+            if (iRefIdx[iRefList] < 0)<br>
+            {<br>
+                continue;<br>
+            }<br>
+<br>
+            assert(iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList));<br>
+<br>
+            pcMbYuv = &m_acYuvPred[iRefList];<br>
+            xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true); //pcMbYuv must be TShortYuv<br>
+        }<br>
+        //m_acYuvPred must be TShortYuv<br>
         xWeightedPredictionUni(pcCU, &m_acYuvPred[0], uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, rpcYuvPred);<br>
     }<br>
     else<br>
     {<br>
+        for (Int iRefList = 0; iRefList < 2; iRefList++)<br>
+        {<br>
+            RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);<br>
+            iRefIdx[iRefList] = pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);<br>
+<br>
+            if (iRefIdx[iRefList] < 0)<br>
+            {<br>
+                continue;<br>
+            }<br>
+<br>
+            assert(iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList));<br>
+<br>
+            pcMbYuv = &m_acYuvPred[iRefList];<br>
+            xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv); //pcMbYuv must be TComYuv<br>
+        }<br>
+        //m_acYuvPred must be TComYuv<br>
         xWeightedAverage(&m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred);<br>
     }<br>
 }<br>
@@ -553,15 +608,87 @@<br>
  * \param bi       Flag indicating whether bipred is used<br>
  */<br>
 Void TComPrediction::xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi)<br>
+{<br>
+    if(bi == false)<br>
+    {<br>
+        assert(bi == false);<br>
+<br>
+        Int refStride = refPic->getStride();<br>
+        Int refOffset = (mv->getHor() >> 2) + (mv->getVer() >> 2) * refStride;<br>
+        Pel *ref      =  refPic->getLumaAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;<br>
+<br>
+        Int dstStride = dstPic->getStride();<br>
+        Pel *dst      = dstPic->getLumaAddr(partAddr);<br>
+<br>
+        Int xFrac = mv->getHor() & 0x3;<br>
+        Int yFrac = mv->getVer() & 0x3;<br>
+<br>
+        Pel* src = refPic->getLumaFilterBlock(yFrac, xFrac, cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;<br>
+        Int srcStride = refPic->getStride();<br>
+<br>
+        x265::primitives.cpyblock(width, height, (pixel*)dst, dstStride, (pixel*)src, srcStride);<br>
+    }<br>
+    else /* For biprediction. will work correctly only when HIGHBITDEPTH enabled. Will be removed once bipred is fixed.  */<br>
+    {<br>
+        assert(bi == true);<br>
+<br>
+        Int refStride = refPic->getStride();<br>
+        Int refOffset = (mv->getHor() >> 2) + (mv->getVer() >> 2) * refStride;<br>
+        Pel *ref      =  refPic->getLumaAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;<br>
+<br>
+        Int dstStride = dstPic->getStride();<br>
+        Short *dst      = (Short*)dstPic->getLumaAddr(partAddr);<br>
+<br>
+        Int xFrac = mv->getHor() & 0x3;<br>
+        Int yFrac = mv->getVer() & 0x3;<br>
+<br>
+        Pel* src = refPic->getLumaFilterBlock(yFrac, xFrac, cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;<br>
+        Int srcStride = refPic->getStride();<br>
+<br>
+        if (yFrac == 0)<br>
+        {<br>
+            if(xFrac==0)<br>
+            {<br>
+                //filterconvertpeltoshort<br>
+                x265::primitives.ipfilterConvert_p_s(g_bitDepthY, (pixel*)ref , refStride, dst, dstStride, width, height);<br>
+            }<br>
+            else<br>
+            {<br>
+                //filterhorizontalpelshort<br>
+                x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY, (pixel*)ref , refStride, dst, dstStride, width, height, TComInterpolationFilter::m_lumaFilter[xFrac]);<br>
+            }<br>
+        }<br>
+        else if (xFrac == 0)<br>
+        {<br>
+            //filterverticalpelshort<br>
+            x265::primitives.ipFilter_p_s[FILTER_V_P_S_8](g_bitDepthY, (pixel*)ref , refStride, dst, dstStride, width, height, TComInterpolationFilter::m_lumaFilter[yFrac]);<br>
+        }<br>
+        else<br>
+        {<br>
+            Int tmpStride = width;<br>
+            Int filterSize = NTAPS_LUMA;<br>
+            Int halfFilterSize = (filterSize >> 1);<br>
+            Short *tmp    = (Short*)malloc(width * (height + filterSize - 1) * sizeof(Short));<br>
+<br>
+            x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY, (pixel*)(ref - (halfFilterSize - 1) * refStride) , refStride, tmp, tmpStride, width, height + filterSize - 1, TComInterpolationFilter::m_lumaFilter[xFrac]);<br>

+            x265::primitives.ipFilter_s_s[FILTER_V_S_S_8](g_bitDepthY, tmp + (halfFilterSize - 1) * tmpStride ,tmpStride, dst, dstStride, width, height, TComInterpolationFilter::m_lumaFilter[yFrac]);<br>
+<br>
+            free(tmp);<br>
+        }<br>
+    }<br>
+}<br>
+<br>
+//Motion compensated block for biprediction<br>
+Void TComPrediction::xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TShortYUV *&dstPic, Bool bi)<br>
 {<br>
-    assert(bi == false);<br>
+    assert(bi == true);<br>
<br>
     Int refStride = refPic->getStride();<br>
     Int refOffset = (mv->getHor() >> 2) + (mv->getVer() >> 2) * refStride;<br>
     Pel *ref      =  refPic->getLumaAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;<br>
<br>
     Int dstStride = dstPic->getStride();<br>
-    Pel *dst      = dstPic->getLumaAddr(partAddr);<br>
+    Short *dst      = dstPic->getLumaAddr(partAddr);<br>
<br>
     Int xFrac = mv->getHor() & 0x3;<br>
     Int yFrac = mv->getVer() & 0x3;<br>
@@ -569,7 +696,36 @@<br>
     Pel* src = refPic->getLumaFilterBlock(yFrac, xFrac, cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;<br>
     Int srcStride = refPic->getStride();<br>
<br>
-    x265::primitives.cpyblock(width, height, (pixel*)dst, dstStride, (pixel*)src, srcStride);<br>
+    if (yFrac == 0)<br>
+    {<br>
+        if(xFrac==0)<br>
+        {<br>
+                //filterconvertpeltoshort<br>
+            x265::primitives.ipfilterConvert_p_s(g_bitDepthY, (pixel*)ref , refStride, dst, dstStride, width, height);<br>
+        }<br>
+        else<br>
+        {<br>
+            //filterhorizontalpelshort<br>
+            x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY, (pixel*)ref , refStride, dst, dstStride, width, height, TComInterpolationFilter::m_lumaFilter[xFrac]);<br>
+        }<br>
+    }<br>
+    else if (xFrac == 0)<br>
+    {<br>
+        //filterverticalpelshort<br>
+        x265::primitives.ipFilter_p_s[FILTER_V_P_S_8](g_bitDepthY, (pixel*)ref , refStride, dst, dstStride, width, height, TComInterpolationFilter::m_lumaFilter[yFrac]);<br>
+    }<br>
+    else<br>
+    {<br>
+        Int tmpStride = width;<br>
+        Int filterSize = NTAPS_LUMA;<br>
+        Int halfFilterSize = (filterSize >> 1);<br>
+        Short *tmp    = (Short*)malloc(width * (height + filterSize - 1) * sizeof(Short));<br>
+<br>
+        x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY, (pixel*)(ref - (halfFilterSize - 1) * refStride) , refStride, tmp, tmpStride, width, height + filterSize - 1, TComInterpolationFilter::m_lumaFilter[xFrac]);<br>

+        x265::primitives.ipFilter_s_s[FILTER_V_S_S_8](g_bitDepthY, tmp + (halfFilterSize - 1) * tmpStride ,tmpStride, dst, dstStride, width, height, TComInterpolationFilter::m_lumaFilter[yFrac]);<br>
+<br>
+        free(tmp);<br>
+    }<br>
 }<br>
<br>
 /**<br>
@@ -607,38 +763,152 @@<br>
     Int filterSize = NTAPS_CHROMA;<br>
<br>
     Int halfFilterSize = (filterSize >> 1);<br>
-<br>
-    if (yFrac == 0)<br>
+    if(bi == false)<br>
     {<br>
-        if (xFrac == 0)<br>
+        if (yFrac == 0)<br>
         {<br>
-            x265::primitives.cpyblock(cxWidth, cxHeight, (pixel*)dstCb, dstStride, (pixel*)refCb, refStride);<br>
-            x265::primitives.cpyblock(cxWidth, cxHeight, (pixel*)dstCr, dstStride, (pixel*)refCr, refStride);<br>
+            if (xFrac == 0)<br>
+            {<br>
+                x265::primitives.cpyblock(cxWidth, cxHeight, (pixel*)dstCb, dstStride, (pixel*)refCb, refStride);<br>
+                x265::primitives.cpyblock(cxWidth, cxHeight, (pixel*)dstCr, dstStride, (pixel*)refCr, refStride);<br>
+            }<br>
+            else<br>
+            {<br>
+                primitives.ipFilter_p_p[FILTER_H_P_P_4](g_bitDepthC, (pixel*)refCb, refStride, (pixel*)dstCb,  dstStride, cxWidth, cxHeight, m_if.m_chromaFilter[xFrac]);<br>
+                primitives.ipFilter_p_p[FILTER_H_P_P_4](g_bitDepthC, (pixel*)refCr, refStride, (pixel*)dstCr,  dstStride, cxWidth, cxHeight, m_if.m_chromaFilter[xFrac]);<br>
+            }<br>
+        }<br>
+        else if (xFrac == 0)<br>
+        {<br>
+            primitives.ipFilter_p_p[FILTER_V_P_P_4](g_bitDepthC, (pixel*)refCb, refStride, (pixel*)dstCb, dstStride, cxWidth, cxHeight, m_if.m_chromaFilter[yFrac]);<br>
+            primitives.ipFilter_p_p[FILTER_V_P_P_4](g_bitDepthC, (pixel*)refCr, refStride, (pixel*)dstCr, dstStride, cxWidth, cxHeight, m_if.m_chromaFilter[yFrac]);<br>
         }<br>
         else<br>
         {<br>
-            primitives.ipFilter_p_p[FILTER_H_P_P_4](g_bitDepthC, (pixel*)refCb, refStride, (pixel*)dstCb,  dstStride, cxWidth, cxHeight, m_if.m_chromaFilter[xFrac]);<br>
-            primitives.ipFilter_p_p[FILTER_H_P_P_4](g_bitDepthC, (pixel*)refCr, refStride, (pixel*)dstCr,  dstStride, cxWidth, cxHeight, m_if.m_chromaFilter[xFrac]);<br>
+            Int     extStride = cxWidth;<br>
+            Short*  extY      = (Short*)xMalloc(Short, cxWidth * (cxHeight + filterSize - 1));<br>
+<br>
+            primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)(refCb - (halfFilterSize - 1) * refStride), refStride, extY, extStride, cxWidth, cxHeight + filterSize - 1, m_if.m_chromaFilter[xFrac]);<br>
+            primitives.ipFilter_s_p[FILTER_V_S_P_4](g_bitDepthC, extY + (halfFilterSize - 1) * extStride, extStride, (pixel*)dstCb, dstStride, cxWidth, cxHeight, m_if.m_chromaFilter[yFrac]);<br>
+<br>
+            primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)(refCr - (halfFilterSize - 1) * refStride), refStride, extY, extStride, cxWidth, cxHeight + filterSize - 1,  m_if.m_chromaFilter[xFrac]);<br>
+            primitives.ipFilter_s_p[FILTER_V_S_P_4](g_bitDepthC, extY + (halfFilterSize - 1) * extStride, extStride, (pixel*)dstCr, dstStride, cxWidth, cxHeight,  m_if.m_chromaFilter[yFrac]);<br>
+<br>
+            xFree(extY);<br>
         }<br>
     }<br>
-    else if (xFrac == 0)<br>
-    {<br>
-        primitives.ipFilter_p_p[FILTER_V_P_P_4](g_bitDepthC, (pixel*)refCb, refStride, (pixel*)dstCb, dstStride, cxWidth, cxHeight, m_if.m_chromaFilter[yFrac]);<br>
-        primitives.ipFilter_p_p[FILTER_V_P_P_4](g_bitDepthC, (pixel*)refCr, refStride, (pixel*)dstCr, dstStride, cxWidth, cxHeight, m_if.m_chromaFilter[yFrac]);<br>
+    else  /* For biprediction. will work correctly only when HIGHBITDEPTH enabled. Will be removed once bipred is fixed.  */<br>
+    {<br>
+        Short* dstCb = (Short*)dstPic->getCbAddr(partAddr);<br>
+        Short* dstCr = (Short*)dstPic->getCrAddr(partAddr);<br>
+        if (yFrac == 0)<br>
+        {<br>
+            //m_if.filterHorChroma(refCb, refStride, dstCb,  dstStride, cxWidth, cxHeight, xFrac, !bi);<br>
+            //m_if.filterHorChroma(refCr, refStride, dstCr,  dstStride, cxWidth, cxHeight, xFrac, !bi);<br>
+            if(xFrac==0)<br>
+            {<br>
+                    //filterconvertpeltoshort<br>
+                x265::primitives.ipfilterConvert_p_s(g_bitDepthC, (pixel*)refCb , refStride, dstCb, dstStride, cxWidth, cxHeight);<br>
+                x265::primitives.ipfilterConvert_p_s(g_bitDepthC, (pixel*)refCr , refStride, dstCr, dstStride, cxWidth, cxHeight);<br>
+            }<br>
+            else<br>
+            {<br>
+                //filterhorizontalpelshort<br>
+                x265::primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)refCb , refStride, dstCb, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[xFrac]);<br>
+                x265::primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)refCr , refStride, dstCr, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[xFrac]);<br>
+            }<br>
+        }<br>
+        else if (xFrac == 0)<br>
+        {<br>
+            //m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi);<br>
+            //m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi);<br>
+            x265::primitives.ipFilter_p_s[FILTER_V_P_S_4](g_bitDepthC, (pixel*)refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[yFrac]);<br>
+            x265::primitives.ipFilter_p_s[FILTER_V_P_S_4](g_bitDepthC, (pixel*)refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[yFrac]);<br>
+        }<br>
+        else<br>
+        {<br>
+            Int     extStride = cxWidth;<br>
+            Short*  extY      = (Short*)malloc(cxWidth * (cxHeight + filterSize - 1) * sizeof(Short));<br>
+            //m_if.filterHorChroma(refCb - (halfFilterSize - 1) * refStride, refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1, xFrac, false);<br>
+            //m_if.filterVerChroma(extY  + (halfFilterSize - 1) * extStride, extStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, false, !bi);<br>
+            x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY, (pixel*)(refCb - (halfFilterSize - 1) * refStride), refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1, TComInterpolationFilter::m_chromaFilter[xFrac]);<br>

+            x265::primitives.ipFilter_s_s[FILTER_V_S_S_4](g_bitDepthY, extY  + (halfFilterSize - 1) * extStride, extStride, dstCb, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[yFrac]);<br>
+<br>
+            //m_if.filterHorChroma(refCr - (halfFilterSize - 1) * refStride, refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1, xFrac, false);<br>
+            //m_if.filterVerChroma(extY  + (halfFilterSize - 1) * extStride, extStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, false, !bi);<br>
+            x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY, (pixel*)(refCr - (halfFilterSize - 1) * refStride), refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1, TComInterpolationFilter::m_chromaFilter[xFrac]);<br>

+            x265::primitives.ipFilter_s_s[FILTER_V_S_S_4](g_bitDepthY, extY  + (halfFilterSize - 1) * extStride, extStride, dstCr, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[yFrac]);<br>
+            free(extY);<br>
+        }<br>
+<br>
     }<br>
-    else<br>
-    {<br>
-        Int     extStride = cxWidth;<br>
-        Short*  extY      = (Short*)xMalloc(Short, cxWidth * (cxHeight + filterSize - 1));<br>
+}<br>
<br>
-        primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)(refCb - (halfFilterSize - 1) * refStride), refStride, extY, extStride, cxWidth, cxHeight + filterSize - 1, m_if.m_chromaFilter[xFrac]);<br>
-        primitives.ipFilter_s_p[FILTER_V_S_P_4](g_bitDepthC, extY + (halfFilterSize - 1) * extStride, extStride, (pixel*)dstCb, dstStride, cxWidth, cxHeight, m_if.m_chromaFilter[yFrac]);<br>
+//Generate motion compensated block when biprediction<br>
+Void TComPrediction::xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TShortYUV *&dstPic, Bool bi)<br>
+{<br>
+    assert (bi==true);<br>
<br>
-        primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)(refCr - (halfFilterSize - 1) * refStride), refStride, extY, extStride, cxWidth, cxHeight + filterSize - 1,  m_if.m_chromaFilter[xFrac]);<br>
-        primitives.ipFilter_s_p[FILTER_V_S_P_4](g_bitDepthC, extY + (halfFilterSize - 1) * extStride, extStride, (pixel*)dstCr, dstStride, cxWidth, cxHeight,  m_if.m_chromaFilter[yFrac]);<br>
+    Int refStride = refPic->getCStride();<br>
+    Int dstStride = dstPic->getCStride();<br>
<br>
-        xFree(extY);<br>
-    }<br>
+    Int refOffset = (mv->getHor() >> 3) + (mv->getVer() >> 3) * refStride;<br>
+<br>
+    Pel* refCb = refPic->getCbAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;<br>
+    Pel* refCr = refPic->getCrAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;<br>
+<br>
+    Short* dstCb = dstPic->getCbAddr(partAddr);<br>
+    Short* dstCr = dstPic->getCrAddr(partAddr);<br>
+<br>
+    Int xFrac = mv->getHor() & 0x7;<br>
+    Int yFrac = mv->getVer() & 0x7;<br>
+    UInt cxWidth = width >> 1;<br>
+    UInt cxHeight = height >> 1;<br>
+<br>
+    Int filterSize = NTAPS_CHROMA;<br>
+<br>
+    Int halfFilterSize = (filterSize >> 1);<br>
+<br>
+    if (yFrac == 0)<br>
+    {<br>
+        //m_if.filterHorChroma(refCb, refStride, dstCb,  dstStride, cxWidth, cxHeight, xFrac, !bi);<br>
+        //m_if.filterHorChroma(refCr, refStride, dstCr,  dstStride, cxWidth, cxHeight, xFrac, !bi);<br>
+        if(xFrac==0)<br>
+        {<br>
+            //filterconvertpeltoshort<br>
+            x265::primitives.ipfilterConvert_p_s(g_bitDepthC, (pixel*)refCb , refStride, dstCb, dstStride, cxWidth, cxHeight);<br>
+            x265::primitives.ipfilterConvert_p_s(g_bitDepthC, (pixel*)refCr , refStride, dstCr, dstStride, cxWidth, cxHeight);<br>
+        }<br>
+        else<br>
+        {<br>
+            //filterhorizontalpelshort<br>
+            x265::primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)refCb , refStride, dstCb, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[xFrac]);<br>
+            x265::primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)refCr , refStride, dstCr, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[xFrac]);<br>
+        }<br>
+    }<br>
+    else if (xFrac == 0)<br>
+    {<br>
+        //m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi);<br>
+        //m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi);<br>
+        x265::primitives.ipFilter_p_s[FILTER_V_P_S_4](g_bitDepthC, (pixel*)refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[yFrac]);<br>
+        x265::primitives.ipFilter_p_s[FILTER_V_P_S_4](g_bitDepthC, (pixel*)refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[yFrac]);<br>
+    }<br>
+    else<br>
+    {<br>
+        Int     extStride = cxWidth;<br>
+        Short*  extY      = (Short*)malloc(cxWidth * (cxHeight + filterSize - 1) * sizeof(Short));<br>
+        //m_if.filterHorChroma(refCb - (halfFilterSize - 1) * refStride, refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1, xFrac, false);<br>
+        //m_if.filterVerChroma(extY  + (halfFilterSize - 1) * extStride, extStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, false, !bi);<br>
+        x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY, (pixel*)(refCb - (halfFilterSize - 1) * refStride), refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1, TComInterpolationFilter::m_chromaFilter[xFrac]);<br>

+        x265::primitives.ipFilter_s_s[FILTER_V_S_S_4](g_bitDepthY, extY  + (halfFilterSize - 1) * extStride, extStride, dstCb, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[yFrac]);<br>
+<br>
+        //m_if.filterHorChroma(refCr - (halfFilterSize - 1) * refStride, refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1, xFrac, false);<br>
+        //m_if.filterVerChroma(extY  + (halfFilterSize - 1) * extStride, extStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, false, !bi);<br>
+        x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY, (pixel*)(refCr - (halfFilterSize - 1) * refStride), refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1, TComInterpolationFilter::m_chromaFilter[xFrac]);<br>

+        x265::primitives.ipFilter_s_s[FILTER_V_S_S_4](g_bitDepthY, extY  + (halfFilterSize - 1) * extStride, extStride, dstCr, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[yFrac]);<br>
+        free(extY);<br>
+    }<br>
+<br>
 }<br>
<br>
 Void TComPrediction::xWeightedAverage(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst)<br>
diff -r 371e9320d819 -r caaf0b1a045c source/Lib/TLibCommon/TComPrediction.h<br>
--- a/source/Lib/TLibCommon/TComPrediction.h    Fri Jun 21 17:46:23 2013 +0530<br>
+++ b/source/Lib/TLibCommon/TComPrediction.h    Fri Jun 21 17:49:50 2013 +0530<br>
@@ -81,9 +81,12 @@<br>
<br>
     // motion compensation functions<br>
     Void xPredInterUni(TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi = false);<br>
+    Void xPredInterUni(TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TShortYUV*& rpcYuvPred, Bool bi);<br>
     Void xPredInterBi(TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred);<br>
     Void xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi);<br>
+    Void xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TShortYUV *&dstPic, Bool bi);<br>
     Void xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi);<br>
+    Void xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TShortYUV *&dstPic, Bool bi);<br>
     Void xWeightedAverage(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst);<br>
<br>
     Void xGetLLSPrediction(TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0);<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>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>