[x265] [PATCH RFC] lookahead: Downscaled input image and lowres extended for motion search

Steve Borho steve at borho.org
Tue Jul 30 18:46:01 CEST 2013


On Tue, Jul 30, 2013 at 6:46 PM, <gopu at multicorewareinc.com> wrote:

> # HG changeset patch
> # User ggopu
> # Date 1375227961 25200
> # Node ID 69046efce5e98b655a9be30061ce9827231eaff5
> # Parent  057b9a97c920aa2402ec52efb8fdec400c591a7e
> lookahead: Downscaled input image and lowres extended for motion search
>
> diff -r 057b9a97c920 -r 69046efce5e9 source/Lib/TLibCommon/TComPic.cpp
> --- a/source/Lib/TLibCommon/TComPic.cpp Mon Jul 29 19:29:39 2013 -0500
> +++ b/source/Lib/TLibCommon/TComPic.cpp Tue Jul 30 16:46:01 2013 -0700
> @@ -74,6 +74,19 @@
>
>      /* store display window parameters with picture */
>      m_defaultDisplayWindow = defaultDisplayWindow;
> +
> +    /* generates the Lowres */
> +    m_width_lowres = m_origPicYuv->getWidth() / 2;
> +    m_lines_lowres = m_origPicYuv->getHeight() / 2;
> +    m_stride_lowres = m_width_lowres + m_origPicYuv->getLumaMargin();
>

There's a left and right margin, so it needs to be 2x


> +
> +    /*allocate the buffer for Lowres */
> +    for( int i = 0; i < 4; i++ )
> +    {
> +        m_buffer_lowres[i] = (Pel*)X265_MALLOC(Pel, (m_width_lowres +
> (m_origPicYuv->getLumaMargin()<< 1)) * (m_lines_lowres +
> (m_origPicYuv->getLumaMarginY() << 1)));
>

use stride * (height + 2*marginY)


> +        m_lowres[i] =  m_buffer_lowres[i] +
> m_origPicYuv->getLumaMarginY() * getStride()  +
> m_origPicYuv->getLumaMargin();
> +    }
> +
>  }
>
>  Void TComPic::destroy()
> diff -r 057b9a97c920 -r 69046efce5e9 source/Lib/TLibCommon/TComPic.h
> --- a/source/Lib/TLibCommon/TComPic.h   Mon Jul 29 19:29:39 2013 -0500
> +++ b/source/Lib/TLibCommon/TComPic.h   Tue Jul 30 16:46:01 2013 -0700
> @@ -67,8 +67,15 @@
>      Bool                  m_bIsLongTerm;          // IS long term picture
>      Bool                  m_bCheckLTMSB;
>
> +
>  public:
>
> +    pixel *m_lowres[4]; /* half-size copy of input frame: Orig, H, V, HV
> */
> +    pixel *m_buffer_lowres[4];
> +    int     m_stride_lowres;
> +    int     m_width_lowres;
> +    int     m_lines_lowres;
>

I'm tempted to place all of the lookahead related data into a separate
structure which is included in TComPic.  In this way we can pass this
lookahead struct to the lookahead functions without making them all aware
of all the details of TComPic.



> +
>      TComPic();
>      virtual ~TComPic();
>
> diff -r 057b9a97c920 -r 69046efce5e9 source/Lib/TLibCommon/TComPicYuv.h
> --- a/source/Lib/TLibCommon/TComPicYuv.h        Mon Jul 29 19:29:39 2013
> -0500
> +++ b/source/Lib/TLibCommon/TComPicYuv.h        Tue Jul 30 16:46:01 2013
> -0700
> @@ -97,12 +97,10 @@
>
>      Bool  m_bIsBorderExtended;
>
> -protected:
> +public:
>
>      Void xExtendPicCompBorder(Pel* recon, Int stride, Int width, Int
> height, Int marginX, Int marginY);
>
> -public:
> -
>      TComPicYuv();
>      virtual ~TComPicYuv();
>
> @@ -132,6 +130,8 @@
>
>      Int   getLumaMargin() { return m_lumaMarginX; }
>

to be consistent we should rename this one to getLumaMarginX (or just make
the member variables public).


>
> +    Int   getLumaMarginY() { return m_lumaMarginY; }
> +
>      Int   getChromaMargin() { return m_chromaMarginX; }
>
>      //
> ------------------------------------------------------------------------------------------------
> diff -r 057b9a97c920 -r 69046efce5e9 source/Lib/TLibEncoder/TEncTop.cpp
> --- a/source/Lib/TLibEncoder/TEncTop.cpp        Mon Jul 29 19:29:39 2013
> -0500
> +++ b/source/Lib/TLibEncoder/TEncTop.cpp        Tue Jul 30 16:46:01 2013
> -0700
> @@ -170,6 +170,15 @@
>              pic->getPicYuvOrg()->copyFromPicture(*picture);
>              pic->getPicYuvRec()->setBorderExtension(false);
>              pic->getSlice()->setReferenced(true);
> +
> +            if(!true) //Untill Lookahead implementation complete
>

spacing and tpyos.  You're also combining C++ style comments with C style.
 You should stick with one within a given file, within reason.


> +            {
> +                /*downscale the luma planes*/
> +
>  x265::primitives.frame_init_lowres_core(pic->getPicYuvOrg()->getLumaAddr(),
> pic->m_lowres[0], pic->m_lowres[1], pic->m_lowres[2], pic->m_lowres[3],
> pic->getPicYuvOrg()->getStride(), pic->m_stride_lowres,
> pic->m_width_lowres, pic->m_lines_lowres);
> +
> +                for(int i=0; i<4; i++)
> +
>  pic->getPicYuvOrg()->xExtendPicCompBorder(pic->m_lowres[i], 512,
> pic->m_width_lowres, pic->m_lines_lowres,
> pic->getPicYuvOrg()->getLumaMargin(),
> pic->getPicYuvOrg()->getLumaMarginY());
>

what is the 512 argument?


> +            }
>              return;
>          }
>      }
>


BTW: now that we have a patchworks client, you don't need to attach patch
files any more.

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


More information about the x265-devel mailing list