[x265] [PATCH 3 of 3] MotionReference objects with distinct weights handled as linked list

Steve Borho steve at borho.org
Tue Jul 30 19:08:57 CEST 2013


On Tue, Jul 30, 2013 at 6:39 AM, <deepthidevaki at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Deepthi Devaki
> # Date 1375184226 -19800
> # Node ID e3ab4a7575dcb2f8f6129b70dc679b3a3dc6fe7a
> # Parent  25b74f97e87324d065c10a25d2c5ee85b1db4792
> MotionReference objects with distinct weights handled as linked list
>
> diff -r 25b74f97e873 -r e3ab4a7575dc source/Lib/TLibCommon/TComPicYuv.cpp
> --- a/source/Lib/TLibCommon/TComPicYuv.cpp      Tue Jul 30 16:55:53 2013
> +0530
> +++ b/source/Lib/TLibCommon/TComPicYuv.cpp      Tue Jul 30 17:07:06 2013
> +0530
> @@ -229,21 +229,40 @@
>      ::memcpy(destPicYuv->getBufV(), m_picBufV, sizeof(Pel) * ((m_picWidth
> >> 1) + (m_chromaMarginX << 1)) * ((m_picHeight >> 1) + (m_chromaMarginY <<
> 1)));
>  }
>
> -Void TComPicYuv::extendPicBorder(x265::ThreadPool *pool)
> +x265::MotionReference * TComPicYuv::getMotionReference(int weight)
>  {
> -    if (m_bIsBorderExtended)
> +    MotionReference *temp;
> +    for(temp = m_refList; temp!=NULL; temp = temp->m_next)
> +    {
> +        if(temp->m_weight == weight)
> +        {
> +            return(temp);
> +        }
> +    }
> +    return NULL;
> +}
>

I don't think we can use a single int to represent the weight.  I think you
have to compare all the weight parameters, so getMotionReference() would
need to accept a wpScalingParam*


> +Void TComPicYuv::extendPicBorder(x265::ThreadPool *pool, wpScalingParam
> *w)
> +{
> +    int weight = (w==NULL)? 0: w->inputWeight;          // Assuming
> weight ==0 to represent the unweighted frames
> +    if (getMotionReference(weight)!=NULL)
> +    {
>          return;
> +    }
>
> -    /* HPEL generation requires luma integer plane to already be extended
> */
> -    xExtendPicCompBorder(getLumaAddr(), getStride(), getWidth(),
> getHeight(), m_lumaMarginX, m_lumaMarginY);
> +    if(!m_bIsBorderExtended)
>

white-space, if ()


> +    {
> +        /* HPEL generation requires luma integer plane to already be
> extended */
> +        xExtendPicCompBorder(getLumaAddr(), getStride(), getWidth(),
> getHeight(), m_lumaMarginX, m_lumaMarginY);
>
> -    xExtendPicCompBorder(getCbAddr(), getCStride(), getWidth() >> 1,
> getHeight() >> 1, m_chromaMarginX, m_chromaMarginY);
> -    xExtendPicCompBorder(getCrAddr(), getCStride(), getWidth() >> 1,
> getHeight() >> 1, m_chromaMarginX, m_chromaMarginY);
> +        xExtendPicCompBorder(getCbAddr(), getCStride(), getWidth() >> 1,
> getHeight() >> 1, m_chromaMarginX, m_chromaMarginY);
> +        xExtendPicCompBorder(getCrAddr(), getCStride(), getWidth() >> 1,
> getHeight() >> 1, m_chromaMarginX, m_chromaMarginY);
> +    }
>
> -    if (m_refList == NULL)
> -        m_refList = new x265::MotionReference(this, pool);
> -    m_refList->generateReferencePlanes();
> -
> +    MotionReference *temp = new x265::MotionReference(this, pool, w);
> +    temp->generateReferencePlanes();
> +    temp->m_next = m_refList;
> +    m_refList = temp;
>      m_bIsBorderExtended = true;
>

m_bIsBorderExtended basically needs to be handled separately from the
MotionReference generation.  m_bIsBorderExtended only pertains to the
unweighted fpel luma.


>  }
>
> diff -r 25b74f97e873 -r e3ab4a7575dc source/Lib/TLibCommon/TComPicYuv.h
> --- a/source/Lib/TLibCommon/TComPicYuv.h        Tue Jul 30 16:55:53 2013
> +0530
> +++ b/source/Lib/TLibCommon/TComPicYuv.h        Tue Jul 30 17:07:06 2013
> +0530
> @@ -153,7 +153,7 @@
>      Pel*  getCrAddr()     { return m_picOrgV; }
>
>      /* Actual weight handling TBD: this is just a placeholder.  Always
> pass 0 */
> -    x265::MotionReference *getMotionReference(Int weightIdx) { return
> &m_refList[weightIdx]; }
> +    x265::MotionReference *getMotionReference(Int weightIdx);
>
>      //  Access starting position of original picture for specific coding
> unit (CU) or partition unit (PU)
>      Pel*  getLumaAddr(Int cuAddr) { return m_picOrgY +
> m_cuOffsetY[cuAddr]; }
> @@ -169,9 +169,9 @@
>      Pel*  getCrAddr(Int cuAddr, Int absZOrderIdx) { return m_picOrgV +
> m_cuOffsetC[cuAddr] + m_buOffsetC[g_zscanToRaster[absZOrderIdx]]; }
>
>      /* Access functions for m_filteredBlock */
> -    Pel* getLumaFilterBlock(int ver, int hor) { return
> (Pel*)m_refList->m_lumaPlane[hor][ver]; }
> +    Pel* getLumaFilterBlock(int ver, int hor, int weight=0) { return
> (Pel*)getMotionReference(weight)->m_lumaPlane[hor][ver]; }
>
> -    Pel* getLumaFilterBlock(int ver, int hor, Int cuAddr, Int
> absZOrderIdx) { return (Pel*)m_refList->m_lumaPlane[hor][ver] +
> m_cuOffsetY[cuAddr] + m_buOffsetY[g_zscanToRaster[absZOrderIdx]]; }
> +    Pel* getLumaFilterBlock(int ver, int hor, Int cuAddr, Int
> absZOrderIdx, int weight=0) { return
> (Pel*)getMotionReference(weight)->m_lumaPlane[hor][ver] +
> m_cuOffsetY[cuAddr] + m_buOffsetY[g_zscanToRaster[absZOrderIdx]]; }
>

We should be caching the MotionReference pointers for each search direction
in the slice or pic so we never need to use these functions.  Then we just
need to add the offset specified by (int ver, int hor, Int cuAddr, Int
absZOrderIdx)



>      //
> ------------------------------------------------------------------------------------------------
>      //  Miscellaneous
> @@ -185,7 +185,7 @@
>      Void  copyFromPicture(const x265_picture_t&);
>
>      //  Extend function of picture buffer
> -    Void  extendPicBorder(x265::ThreadPool *pool);
> +    Void  extendPicBorder(x265::ThreadPool *pool, wpScalingParam *w=NULL);
>
>      //  Dump picture
>      Void  dump(Char* pFileName, Bool bAdd = false);
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> http://mailman.videolan.org/listinfo/x265-devel
>
>


-- 
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/private/x265-devel/attachments/20130730/5be1a6da/attachment.html>


More information about the x265-devel mailing list