[x265] [PATCH] Restructured xPredInterBi. Added xPredInterluma/chromablk/Uni functions with TShortYuv argument for bipred. Not yet usable

Shazeb Khan shazeb at multicorewareinc.com
Mon Jun 24 08:12:34 CEST 2013


The fix for previous patch is attached along.


On Fri, Jun 21, 2013 at 11:10 PM, Steve Borho <steve at borho.org> wrote:

>
>
>
> On Fri, Jun 21, 2013 at 7:26 AM, <deepthidevaki at multicorewareinc.com>wrote:
>
>> # HG changeset patch
>> # User Deepthi Devaki
>> # Date 1371817190 -19800
>> # Node ID caaf0b1a045c9e79b8124dab5585e0ca1a75dd42
>> # Parent  371e9320d819387ced987a42f55bda2815dcc7ae
>> Restructured xPredInterBi. Added xPredInterluma/chromablk/Uni functions
>> with TShortYuv argument for bipred. Not yet usable.
>>
>
> 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.
>
> diff -r 371e9320d819 -r caaf0b1a045c
>> source/Lib/TLibCommon/TComPrediction.cpp
>> --- a/source/Lib/TLibCommon/TComPrediction.cpp  Fri Jun 21 17:46:23 2013
>> +0530
>> +++ b/source/Lib/TLibCommon/TComPrediction.cpp  Fri Jun 21 17:49:50 2013
>> +0530
>> @@ -480,6 +480,21 @@
>>
>>  Void TComPrediction::xPredInterUni(TComDataCU* pcCU, UInt uiPartAddr,
>> Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool
>> bi)
>>  {
>> +    assert (bi == false);
>> +    Int iRefIdx = pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);
>> +
>> +    assert(iRefIdx >= 0);
>> +    TComMv cMv = pcCU->getCUMvField(eRefPicList)->getMv(uiPartAddr);
>> +
>> +    pcCU->clipMv(cMv);
>> +    xPredInterLumaBlk(pcCU, pcCU->getSlice()->getRefPic(eRefPicList,
>> iRefIdx)->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred,
>> bi);
>> +    xPredInterChromaBlk(pcCU, pcCU->getSlice()->getRefPic(eRefPicList,
>> iRefIdx)->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred,
>> bi);
>> +}
>> +
>> +Void TComPrediction::xPredInterUni(TComDataCU* pcCU, UInt uiPartAddr,
>> Int iWidth, Int iHeight, RefPicList eRefPicList, TShortYUV*& rpcYuvPred,
>> Bool bi)
>> +{
>> +    assert (bi == true);
>> +
>>      Int iRefIdx = pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);
>>
>>      assert(iRefIdx >= 0);
>> @@ -495,47 +510,87 @@
>>      TComYuv* pcMbYuv;
>>      Int      iRefIdx[2] = { -1, -1 };
>>
>> -    for (Int iRefList = 0; iRefList < 2; iRefList++)
>> +    if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartAddr) >= 0
>> && pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartAddr) >= 0)
>>      {
>> -        RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 :
>> REF_PIC_LIST_0);
>> -        iRefIdx[iRefList] =
>> pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);
>> +        for (Int iRefList = 0; iRefList < 2; iRefList++)
>> +        {
>> +            RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 :
>> REF_PIC_LIST_0);
>> +            iRefIdx[iRefList] =
>> pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);
>>
>> -        if (iRefIdx[iRefList] < 0)
>> +            assert(iRefIdx[iRefList] <
>> pcCU->getSlice()->getNumRefIdx(eRefPicList));
>> +
>> +            pcMbYuv = &m_acYuvPred[iRefList];
>> +            xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight,
>> eRefPicList, pcMbYuv, true);   //pcMbYuv should be TShortYuv
>> +        }
>> +        if (pcCU->getSlice()->getPPS()->getWPBiPred() &&
>> pcCU->getSlice()->getSliceType() == B_SLICE)
>>          {
>> -            continue;
>> -        }
>> -
>> -        assert(iRefIdx[iRefList] <
>> pcCU->getSlice()->getNumRefIdx(eRefPicList));
>> -
>> -        pcMbYuv = &m_acYuvPred[iRefList];
>> -        if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartAddr) >=
>> 0 && pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartAddr) >= 0)
>> -        {
>> -            xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight,
>> eRefPicList, pcMbYuv, true);
>> +            //m_acYuvPred must be TShortYuv
>> +            xWeightedPredictionBi(pcCU, &m_acYuvPred[0],
>> &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight,
>> rpcYuvPred);
>>          }
>>          else
>>          {
>> -            if ((pcCU->getSlice()->getPPS()->getUseWP()       &&
>> pcCU->getSlice()->getSliceType() == P_SLICE) ||
>> -                (pcCU->getSlice()->getPPS()->getWPBiPred() &&
>> pcCU->getSlice()->getSliceType() == B_SLICE))
>> -            {
>> -                xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight,
>> eRefPicList, pcMbYuv, true);
>> -            }
>> -            else
>> -            {
>> -                xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight,
>> eRefPicList, pcMbYuv);
>> -            }
>> +            //m_acYuvPred must be TShortYuv
>> +            xWeightedAverage(&m_acYuvPred[0], &m_acYuvPred[1],
>> iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred);
>>          }
>>      }
>> +    else if (pcCU->getSlice()->getPPS()->getWPBiPred() &&
>> pcCU->getSlice()->getSliceType() == B_SLICE)
>> +    {
>> +        for (Int iRefList = 0; iRefList < 2; iRefList++)
>> +        {
>> +            RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 :
>> REF_PIC_LIST_0);
>> +            iRefIdx[iRefList] =
>> pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);
>>
>> -    if (pcCU->getSlice()->getPPS()->getWPBiPred() &&
>> pcCU->getSlice()->getSliceType() == B_SLICE)
>> -    {
>> +            if (iRefIdx[iRefList] < 0)
>> +            {
>> +                continue;
>> +            }
>> +
>> +            assert(iRefIdx[iRefList] <
>> pcCU->getSlice()->getNumRefIdx(eRefPicList));
>> +
>> +            pcMbYuv = &m_acYuvPred[iRefList];
>> +            xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight,
>> eRefPicList, pcMbYuv, true); //pcMbYuv must be TShort
>> +        }
>> +        //m_acYuvPred must be TShort
>>          xWeightedPredictionBi(pcCU, &m_acYuvPred[0], &m_acYuvPred[1],
>> iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred);
>>      }
>>      else if (pcCU->getSlice()->getPPS()->getUseWP() &&
>> pcCU->getSlice()->getSliceType() == P_SLICE)
>>      {
>> +        for (Int iRefList = 0; iRefList < 2; iRefList++)
>> +        {
>> +            RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 :
>> REF_PIC_LIST_0);
>> +            iRefIdx[iRefList] =
>> pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);
>> +
>> +            if (iRefIdx[iRefList] < 0)
>> +            {
>> +                continue;
>> +            }
>> +
>> +            assert(iRefIdx[iRefList] <
>> pcCU->getSlice()->getNumRefIdx(eRefPicList));
>> +
>> +            pcMbYuv = &m_acYuvPred[iRefList];
>> +            xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight,
>> eRefPicList, pcMbYuv, true); //pcMbYuv must be TShortYuv
>> +        }
>> +        //m_acYuvPred must be TShortYuv
>>          xWeightedPredictionUni(pcCU, &m_acYuvPred[0], uiPartAddr,
>> iWidth, iHeight, REF_PIC_LIST_0, rpcYuvPred);
>>      }
>>      else
>>      {
>> +        for (Int iRefList = 0; iRefList < 2; iRefList++)
>> +        {
>> +            RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 :
>> REF_PIC_LIST_0);
>> +            iRefIdx[iRefList] =
>> pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);
>> +
>> +            if (iRefIdx[iRefList] < 0)
>> +            {
>> +                continue;
>> +            }
>> +
>> +            assert(iRefIdx[iRefList] <
>> pcCU->getSlice()->getNumRefIdx(eRefPicList));
>> +
>> +            pcMbYuv = &m_acYuvPred[iRefList];
>> +            xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight,
>> eRefPicList, pcMbYuv); //pcMbYuv must be TComYuv
>> +        }
>> +        //m_acYuvPred must be TComYuv
>>          xWeightedAverage(&m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0],
>> iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred);
>>      }
>>  }
>> @@ -553,15 +608,87 @@
>>   * \param bi       Flag indicating whether bipred is used
>>   */
>>  Void TComPrediction::xPredInterLumaBlk(TComDataCU *cu, TComPicYuv
>> *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv
>> *&dstPic, Bool bi)
>> +{
>> +    if(bi == false)
>> +    {
>> +        assert(bi == false);
>> +
>> +        Int refStride = refPic->getStride();
>> +        Int refOffset = (mv->getHor() >> 2) + (mv->getVer() >> 2) *
>> refStride;
>> +        Pel *ref      =  refPic->getLumaAddr(cu->getAddr(),
>> cu->getZorderIdxInCU() + partAddr) + refOffset;
>> +
>> +        Int dstStride = dstPic->getStride();
>> +        Pel *dst      = dstPic->getLumaAddr(partAddr);
>> +
>> +        Int xFrac = mv->getHor() & 0x3;
>> +        Int yFrac = mv->getVer() & 0x3;
>> +
>> +        Pel* src = refPic->getLumaFilterBlock(yFrac, xFrac,
>> cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;
>> +        Int srcStride = refPic->getStride();
>> +
>> +        x265::primitives.cpyblock(width, height, (pixel*)dst, dstStride,
>> (pixel*)src, srcStride);
>> +    }
>> +    else /* For biprediction. will work correctly only when HIGHBITDEPTH
>> enabled. Will be removed once bipred is fixed.  */
>> +    {
>> +        assert(bi == true);
>> +
>> +        Int refStride = refPic->getStride();
>> +        Int refOffset = (mv->getHor() >> 2) + (mv->getVer() >> 2) *
>> refStride;
>> +        Pel *ref      =  refPic->getLumaAddr(cu->getAddr(),
>> cu->getZorderIdxInCU() + partAddr) + refOffset;
>> +
>> +        Int dstStride = dstPic->getStride();
>> +        Short *dst      = (Short*)dstPic->getLumaAddr(partAddr);
>> +
>> +        Int xFrac = mv->getHor() & 0x3;
>> +        Int yFrac = mv->getVer() & 0x3;
>> +
>> +        Pel* src = refPic->getLumaFilterBlock(yFrac, xFrac,
>> cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;
>> +        Int srcStride = refPic->getStride();
>> +
>> +        if (yFrac == 0)
>> +        {
>> +            if(xFrac==0)
>> +            {
>> +                //filterconvertpeltoshort
>> +                x265::primitives.ipfilterConvert_p_s(g_bitDepthY,
>> (pixel*)ref , refStride, dst, dstStride, width, height);
>> +            }
>> +            else
>> +            {
>> +                //filterhorizontalpelshort
>> +
>>  x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY, (pixel*)ref ,
>> refStride, dst, dstStride, width, height,
>> TComInterpolationFilter::m_lumaFilter[xFrac]);
>> +            }
>> +        }
>> +        else if (xFrac == 0)
>> +        {
>> +            //filterverticalpelshort
>> +            x265::primitives.ipFilter_p_s[FILTER_V_P_S_8](g_bitDepthY,
>> (pixel*)ref , refStride, dst, dstStride, width, height,
>> TComInterpolationFilter::m_lumaFilter[yFrac]);
>> +        }
>> +        else
>> +        {
>> +            Int tmpStride = width;
>> +            Int filterSize = NTAPS_LUMA;
>> +            Int halfFilterSize = (filterSize >> 1);
>> +            Short *tmp    = (Short*)malloc(width * (height + filterSize
>> - 1) * sizeof(Short));
>> +
>> +            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]);
>> +            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]);
>> +
>> +            free(tmp);
>> +        }
>> +    }
>> +}
>> +
>> +//Motion compensated block for biprediction
>> +Void TComPrediction::xPredInterLumaBlk(TComDataCU *cu, TComPicYuv
>> *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TShortYUV
>> *&dstPic, Bool bi)
>>  {
>> -    assert(bi == false);
>> +    assert(bi == true);
>>
>>      Int refStride = refPic->getStride();
>>      Int refOffset = (mv->getHor() >> 2) + (mv->getVer() >> 2) *
>> refStride;
>>      Pel *ref      =  refPic->getLumaAddr(cu->getAddr(),
>> cu->getZorderIdxInCU() + partAddr) + refOffset;
>>
>>      Int dstStride = dstPic->getStride();
>> -    Pel *dst      = dstPic->getLumaAddr(partAddr);
>> +    Short *dst      = dstPic->getLumaAddr(partAddr);
>>
>>      Int xFrac = mv->getHor() & 0x3;
>>      Int yFrac = mv->getVer() & 0x3;
>> @@ -569,7 +696,36 @@
>>      Pel* src = refPic->getLumaFilterBlock(yFrac, xFrac, cu->getAddr(),
>> cu->getZorderIdxInCU() + partAddr) + refOffset;
>>      Int srcStride = refPic->getStride();
>>
>> -    x265::primitives.cpyblock(width, height, (pixel*)dst, dstStride,
>> (pixel*)src, srcStride);
>> +    if (yFrac == 0)
>> +    {
>> +        if(xFrac==0)
>> +        {
>> +                //filterconvertpeltoshort
>> +            x265::primitives.ipfilterConvert_p_s(g_bitDepthY,
>> (pixel*)ref , refStride, dst, dstStride, width, height);
>> +        }
>> +        else
>> +        {
>> +            //filterhorizontalpelshort
>> +            x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY,
>> (pixel*)ref , refStride, dst, dstStride, width, height,
>> TComInterpolationFilter::m_lumaFilter[xFrac]);
>> +        }
>> +    }
>> +    else if (xFrac == 0)
>> +    {
>> +        //filterverticalpelshort
>> +        x265::primitives.ipFilter_p_s[FILTER_V_P_S_8](g_bitDepthY,
>> (pixel*)ref , refStride, dst, dstStride, width, height,
>> TComInterpolationFilter::m_lumaFilter[yFrac]);
>> +    }
>> +    else
>> +    {
>> +        Int tmpStride = width;
>> +        Int filterSize = NTAPS_LUMA;
>> +        Int halfFilterSize = (filterSize >> 1);
>> +        Short *tmp    = (Short*)malloc(width * (height + filterSize - 1)
>> * sizeof(Short));
>> +
>> +        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]);
>> +        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]);
>> +
>> +        free(tmp);
>> +    }
>>  }
>>
>>  /**
>> @@ -607,38 +763,152 @@
>>      Int filterSize = NTAPS_CHROMA;
>>
>>      Int halfFilterSize = (filterSize >> 1);
>> -
>> -    if (yFrac == 0)
>> +    if(bi == false)
>>      {
>> -        if (xFrac == 0)
>> +        if (yFrac == 0)
>>          {
>> -            x265::primitives.cpyblock(cxWidth, cxHeight, (pixel*)dstCb,
>> dstStride, (pixel*)refCb, refStride);
>> -            x265::primitives.cpyblock(cxWidth, cxHeight, (pixel*)dstCr,
>> dstStride, (pixel*)refCr, refStride);
>> +            if (xFrac == 0)
>> +            {
>> +                x265::primitives.cpyblock(cxWidth, cxHeight,
>> (pixel*)dstCb, dstStride, (pixel*)refCb, refStride);
>> +                x265::primitives.cpyblock(cxWidth, cxHeight,
>> (pixel*)dstCr, dstStride, (pixel*)refCr, refStride);
>> +            }
>> +            else
>> +            {
>> +                primitives.ipFilter_p_p[FILTER_H_P_P_4](g_bitDepthC,
>> (pixel*)refCb, refStride, (pixel*)dstCb,  dstStride, cxWidth, cxHeight,
>> m_if.m_chromaFilter[xFrac]);
>> +                primitives.ipFilter_p_p[FILTER_H_P_P_4](g_bitDepthC,
>> (pixel*)refCr, refStride, (pixel*)dstCr,  dstStride, cxWidth, cxHeight,
>> m_if.m_chromaFilter[xFrac]);
>> +            }
>> +        }
>> +        else if (xFrac == 0)
>> +        {
>> +            primitives.ipFilter_p_p[FILTER_V_P_P_4](g_bitDepthC,
>> (pixel*)refCb, refStride, (pixel*)dstCb, dstStride, cxWidth, cxHeight,
>> m_if.m_chromaFilter[yFrac]);
>> +            primitives.ipFilter_p_p[FILTER_V_P_P_4](g_bitDepthC,
>> (pixel*)refCr, refStride, (pixel*)dstCr, dstStride, cxWidth, cxHeight,
>> m_if.m_chromaFilter[yFrac]);
>>          }
>>          else
>>          {
>> -            primitives.ipFilter_p_p[FILTER_H_P_P_4](g_bitDepthC,
>> (pixel*)refCb, refStride, (pixel*)dstCb,  dstStride, cxWidth, cxHeight,
>> m_if.m_chromaFilter[xFrac]);
>> -            primitives.ipFilter_p_p[FILTER_H_P_P_4](g_bitDepthC,
>> (pixel*)refCr, refStride, (pixel*)dstCr,  dstStride, cxWidth, cxHeight,
>> m_if.m_chromaFilter[xFrac]);
>> +            Int     extStride = cxWidth;
>> +            Short*  extY      = (Short*)xMalloc(Short, cxWidth *
>> (cxHeight + filterSize - 1));
>> +
>> +            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]);
>> +            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]);
>> +
>> +            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]);
>> +            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]);
>> +
>> +            xFree(extY);
>>          }
>>      }
>> -    else if (xFrac == 0)
>> -    {
>> -        primitives.ipFilter_p_p[FILTER_V_P_P_4](g_bitDepthC,
>> (pixel*)refCb, refStride, (pixel*)dstCb, dstStride, cxWidth, cxHeight,
>> m_if.m_chromaFilter[yFrac]);
>> -        primitives.ipFilter_p_p[FILTER_V_P_P_4](g_bitDepthC,
>> (pixel*)refCr, refStride, (pixel*)dstCr, dstStride, cxWidth, cxHeight,
>> m_if.m_chromaFilter[yFrac]);
>> +    else  /* For biprediction. will work correctly only when
>> HIGHBITDEPTH enabled. Will be removed once bipred is fixed.  */
>> +    {
>> +        Short* dstCb = (Short*)dstPic->getCbAddr(partAddr);
>> +        Short* dstCr = (Short*)dstPic->getCrAddr(partAddr);
>> +        if (yFrac == 0)
>> +        {
>> +            //m_if.filterHorChroma(refCb, refStride, dstCb,  dstStride,
>> cxWidth, cxHeight, xFrac, !bi);
>> +            //m_if.filterHorChroma(refCr, refStride, dstCr,  dstStride,
>> cxWidth, cxHeight, xFrac, !bi);
>> +            if(xFrac==0)
>> +            {
>> +                    //filterconvertpeltoshort
>> +                x265::primitives.ipfilterConvert_p_s(g_bitDepthC,
>> (pixel*)refCb , refStride, dstCb, dstStride, cxWidth, cxHeight);
>> +                x265::primitives.ipfilterConvert_p_s(g_bitDepthC,
>> (pixel*)refCr , refStride, dstCr, dstStride, cxWidth, cxHeight);
>> +            }
>> +            else
>> +            {
>> +                //filterhorizontalpelshort
>> +
>>  x265::primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)refCb ,
>> refStride, dstCb, dstStride, cxWidth, cxHeight,
>> TComInterpolationFilter::m_chromaFilter[xFrac]);
>> +
>>  x265::primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)refCr ,
>> refStride, dstCr, dstStride, cxWidth, cxHeight,
>> TComInterpolationFilter::m_chromaFilter[xFrac]);
>> +            }
>> +        }
>> +        else if (xFrac == 0)
>> +        {
>> +            //m_if.filterVerChroma(refCb, refStride, dstCb, dstStride,
>> cxWidth, cxHeight, yFrac, true, !bi);
>> +            //m_if.filterVerChroma(refCr, refStride, dstCr, dstStride,
>> cxWidth, cxHeight, yFrac, true, !bi);
>> +            x265::primitives.ipFilter_p_s[FILTER_V_P_S_4](g_bitDepthC,
>> (pixel*)refCb, refStride, dstCb, dstStride, cxWidth, cxHeight,
>> TComInterpolationFilter::m_chromaFilter[yFrac]);
>> +            x265::primitives.ipFilter_p_s[FILTER_V_P_S_4](g_bitDepthC,
>> (pixel*)refCr, refStride, dstCr, dstStride, cxWidth, cxHeight,
>> TComInterpolationFilter::m_chromaFilter[yFrac]);
>> +        }
>> +        else
>> +        {
>> +            Int     extStride = cxWidth;
>> +            Short*  extY      = (Short*)malloc(cxWidth * (cxHeight +
>> filterSize - 1) * sizeof(Short));
>> +            //m_if.filterHorChroma(refCb - (halfFilterSize - 1) *
>> refStride, refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1,
>> xFrac, false);
>> +            //m_if.filterVerChroma(extY  + (halfFilterSize - 1) *
>> extStride, extStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, false,
>> !bi);
>> +            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]);
>> +            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]);
>> +
>> +            //m_if.filterHorChroma(refCr - (halfFilterSize - 1) *
>> refStride, refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1,
>> xFrac, false);
>> +            //m_if.filterVerChroma(extY  + (halfFilterSize - 1) *
>> extStride, extStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, false,
>> !bi);
>> +            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]);
>> +            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]);
>> +            free(extY);
>> +        }
>> +
>>      }
>> -    else
>> -    {
>> -        Int     extStride = cxWidth;
>> -        Short*  extY      = (Short*)xMalloc(Short, cxWidth * (cxHeight +
>> filterSize - 1));
>> +}
>>
>> -        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]);
>> -        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]);
>> +//Generate motion compensated block when biprediction
>> +Void TComPrediction::xPredInterChromaBlk(TComDataCU *cu, TComPicYuv
>> *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TShortYUV
>> *&dstPic, Bool bi)
>> +{
>> +    assert (bi==true);
>>
>> -        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]);
>> -        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]);
>> +    Int refStride = refPic->getCStride();
>> +    Int dstStride = dstPic->getCStride();
>>
>> -        xFree(extY);
>> -    }
>> +    Int refOffset = (mv->getHor() >> 3) + (mv->getVer() >> 3) *
>> refStride;
>> +
>> +    Pel* refCb = refPic->getCbAddr(cu->getAddr(), cu->getZorderIdxInCU()
>> + partAddr) + refOffset;
>> +    Pel* refCr = refPic->getCrAddr(cu->getAddr(), cu->getZorderIdxInCU()
>> + partAddr) + refOffset;
>> +
>> +    Short* dstCb = dstPic->getCbAddr(partAddr);
>> +    Short* dstCr = dstPic->getCrAddr(partAddr);
>> +
>> +    Int xFrac = mv->getHor() & 0x7;
>> +    Int yFrac = mv->getVer() & 0x7;
>> +    UInt cxWidth = width >> 1;
>> +    UInt cxHeight = height >> 1;
>> +
>> +    Int filterSize = NTAPS_CHROMA;
>> +
>> +    Int halfFilterSize = (filterSize >> 1);
>> +
>> +    if (yFrac == 0)
>> +    {
>> +        //m_if.filterHorChroma(refCb, refStride, dstCb,  dstStride,
>> cxWidth, cxHeight, xFrac, !bi);
>> +        //m_if.filterHorChroma(refCr, refStride, dstCr,  dstStride,
>> cxWidth, cxHeight, xFrac, !bi);
>> +        if(xFrac==0)
>> +        {
>> +            //filterconvertpeltoshort
>> +            x265::primitives.ipfilterConvert_p_s(g_bitDepthC,
>> (pixel*)refCb , refStride, dstCb, dstStride, cxWidth, cxHeight);
>> +            x265::primitives.ipfilterConvert_p_s(g_bitDepthC,
>> (pixel*)refCr , refStride, dstCr, dstStride, cxWidth, cxHeight);
>> +        }
>> +        else
>> +        {
>> +            //filterhorizontalpelshort
>> +            x265::primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC,
>> (pixel*)refCb , refStride, dstCb, dstStride, cxWidth, cxHeight,
>> TComInterpolationFilter::m_chromaFilter[xFrac]);
>> +            x265::primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC,
>> (pixel*)refCr , refStride, dstCr, dstStride, cxWidth, cxHeight,
>> TComInterpolationFilter::m_chromaFilter[xFrac]);
>> +        }
>> +    }
>> +    else if (xFrac == 0)
>> +    {
>> +        //m_if.filterVerChroma(refCb, refStride, dstCb, dstStride,
>> cxWidth, cxHeight, yFrac, true, !bi);
>> +        //m_if.filterVerChroma(refCr, refStride, dstCr, dstStride,
>> cxWidth, cxHeight, yFrac, true, !bi);
>> +        x265::primitives.ipFilter_p_s[FILTER_V_P_S_4](g_bitDepthC,
>> (pixel*)refCb, refStride, dstCb, dstStride, cxWidth, cxHeight,
>> TComInterpolationFilter::m_chromaFilter[yFrac]);
>> +        x265::primitives.ipFilter_p_s[FILTER_V_P_S_4](g_bitDepthC,
>> (pixel*)refCr, refStride, dstCr, dstStride, cxWidth, cxHeight,
>> TComInterpolationFilter::m_chromaFilter[yFrac]);
>> +    }
>> +    else
>> +    {
>> +        Int     extStride = cxWidth;
>> +        Short*  extY      = (Short*)malloc(cxWidth * (cxHeight +
>> filterSize - 1) * sizeof(Short));
>> +        //m_if.filterHorChroma(refCb - (halfFilterSize - 1) * refStride,
>> refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1, xFrac,
>> false);
>> +        //m_if.filterVerChroma(extY  + (halfFilterSize - 1) * extStride,
>> extStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, false, !bi);
>> +        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]);
>> +        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]);
>> +
>> +        //m_if.filterHorChroma(refCr - (halfFilterSize - 1) * refStride,
>> refStride, extY,  extStride, cxWidth, cxHeight + filterSize - 1, xFrac,
>> false);
>> +        //m_if.filterVerChroma(extY  + (halfFilterSize - 1) * extStride,
>> extStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, false, !bi);
>> +        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]);
>> +        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]);
>> +        free(extY);
>> +    }
>> +
>>  }
>>
>>  Void TComPrediction::xWeightedAverage(TComYuv* pcYuvSrc0, TComYuv*
>> pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int
>> iHeight, TComYuv*& rpcYuvDst)
>> diff -r 371e9320d819 -r caaf0b1a045c
>> source/Lib/TLibCommon/TComPrediction.h
>> --- a/source/Lib/TLibCommon/TComPrediction.h    Fri Jun 21 17:46:23 2013
>> +0530
>> +++ b/source/Lib/TLibCommon/TComPrediction.h    Fri Jun 21 17:49:50 2013
>> +0530
>> @@ -81,9 +81,12 @@
>>
>>      // motion compensation functions
>>      Void xPredInterUni(TComDataCU* pcCU,                          UInt
>> uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList,
>> TComYuv*& rpcYuvPred, Bool bi = false);
>> +    Void xPredInterUni(TComDataCU* pcCU, UInt uiPartAddr, Int iWidth,
>> Int iHeight, RefPicList eRefPicList, TShortYUV*& rpcYuvPred, Bool bi);
>>      Void xPredInterBi(TComDataCU* pcCU,                          UInt
>> uiPartAddr,               Int iWidth, Int iHeight,
>> TComYuv*& rpcYuvPred);
>>      Void xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt
>> partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi);
>> +    Void xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt
>> partAddr, TComMv *mv, Int width, Int height, TShortYUV *&dstPic, Bool bi);
>>      Void xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt
>> partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi);
>> +    Void xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt
>> partAddr, TComMv *mv, Int width, Int height, TShortYUV *&dstPic, Bool bi);
>>      Void xWeightedAverage(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int
>> iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*&
>> rpcYuvDst);
>>
>>      Void xGetLLSPrediction(TComPattern* pcPattern, Int* pSrc0, Int
>> iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt
>> uiExt0);
>>
>> _______________________________________________
>> x265-devel mailing list
>> x265-devel at videolan.org
>> http://mailman.videolan.org/listinfo/x265-devel
>>
>>
>
>
> --
> Steve Borho
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> http://mailman.videolan.org/listinfo/x265-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130624/830169e3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2548.patch
Type: application/octet-stream
Size: 1713 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130624/830169e3/attachment-0001.obj>


More information about the x265-devel mailing list