[x265] [PATCH] MotionReference objects with distinct weights handled as linked list
Steve Borho
steve at borho.org
Wed Jul 31 20:45:08 CEST 2013
On Wed, Jul 31, 2013 at 5:23 AM, <deepthidevaki at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Deepthi Devaki
> # Date 1375266155 -19800
> # Node ID 2a8fb9ec2a10c510df180f2c4a8ea065089d4568
> # Parent 66eab44e4c56d7f7841a417aa05b9b49a6192a5a
> MotionReference objects with distinct weights handled as linked list
>
I'll push a tweaked version of this, please see comments below
> diff -r 66eab44e4c56 -r 2a8fb9ec2a10 source/Lib/TLibCommon/TComPicYuv.cpp
> --- a/source/Lib/TLibCommon/TComPicYuv.cpp Wed Jul 31 01:18:43 2013
> -0500
> +++ b/source/Lib/TLibCommon/TComPicYuv.cpp Wed Jul 31 15:52:35 2013
> +0530
> @@ -229,22 +229,50 @@
> ::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(wpScalingParam *w)
> {
> - if (m_bIsBorderExtended)
> + MotionReference *temp;
> + for(temp = m_refList; temp!=NULL; temp = temp->m_next)
>
You should run uncrustify before generating patches, it will cleanup
white-space issues like above.
> + {
> + if (w!=NULL)
>
x264's style is to simply use "if (w)" for checks like this, and we should
follow that convention
> + {
> + if ((temp->m_weight == w->inputWeight)&&(temp->m_offset ==
> (w->inputOffset * (1 << (g_bitDepth - 8))))&&(temp->m_shift ==
> w->log2WeightDenom))
>
You should be using X265_DEPTH instead of g_bitDepth, so that in 8bpp
builds all that logic is combined by the compiler.
> + {
> + return(temp);
> + }
> + }
> + else
> + {
> + if (temp->m_isWeighted == false)
>
if (!temp->m_isWeighted)
> + {
> + return(temp);
> + }
> + }
> + }
> + return NULL;
> +}
> +
> +Void TComPicYuv::extendPicBorder(x265::ThreadPool *pool, wpScalingParam
> *w)
> +{
> + if (getMotionReference(w)!=NULL)
> + {
> return;
> + }
>
> - /* HPEL generation requires luma integer plane to already be extended
> */
> - xExtendPicCompBorder(getLumaAddr(), getStride(), getWidth(),
> getHeight(), m_lumaMarginX, m_lumaMarginY);
> + if (!m_bIsBorderExtended)
> + {
> + /* 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);
> + m_bIsBorderExtended = true;
> + }
>
> - xExtendPicCompBorder(getCbAddr(), getCStride(), getWidth() >> 1,
> getHeight() >> 1, m_chromaMarginX, m_chromaMarginY);
> - xExtendPicCompBorder(getCrAddr(), getCStride(), getWidth() >> 1,
> getHeight() >> 1, m_chromaMarginX, m_chromaMarginY);
> + MotionReference *temp = new x265::MotionReference(this, pool, w);
> + temp->generateReferencePlanes();
> + temp->m_next = m_refList;
> + m_refList = temp;
>
> - if (m_refList == NULL)
> - m_refList = new x265::MotionReference(this, pool);
> - m_refList->generateReferencePlanes();
> -
> - m_bIsBorderExtended = true;
> }
>
> Void TComPicYuv::xExtendPicCompBorder(Pel* recon, Int stride, Int width,
> Int height, Int iMarginX, Int iMarginY)
> diff -r 66eab44e4c56 -r 2a8fb9ec2a10 source/Lib/TLibCommon/TComPicYuv.h
> --- a/source/Lib/TLibCommon/TComPicYuv.h Wed Jul 31 01:18:43 2013
> -0500
> +++ b/source/Lib/TLibCommon/TComPicYuv.h Wed Jul 31 15:52:35 2013
> +0530
> @@ -152,8 +152,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(wpScalingParam *w);
>
> // 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]; }
> @@ -185,7 +184,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);
> diff -r 66eab44e4c56 -r 2a8fb9ec2a10 source/common/reference.h
> --- a/source/common/reference.h Wed Jul 31 01:18:43 2013 -0500
> +++ b/source/common/reference.h Wed Jul 31 15:52:35 2013 +0530
> @@ -50,6 +50,9 @@
> int m_lumaStride;
> int m_weight;
> bool m_isWeighted;
> + int m_offset;
> + int m_shift;
> + int m_round;
>
> MotionReference *m_next;
>
> @@ -78,10 +81,6 @@
> int m_filterHeight;
> short *m_intermediateValues;
>
> - int m_offset;
> - int m_shift;
> - int m_round;
> -
> MotionReference& operator =(const MotionReference&);
> };
> }
>
> _______________________________________________
> 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/20130731/e5dbf800/attachment-0001.html>
More information about the x265-devel
mailing list