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

Steve Borho steve at borho.org
Wed Jul 31 22:25:21 CEST 2013


On Wed, Jul 31, 2013 at 5:55 PM, <gopu at multicorewareinc.com> wrote:

> # HG changeset patch
> # User ggopu
> # Date 1375311274 25200
> # Node ID 43f1ceee90f6995bc6c7e2d286dd9b44e86b9d1f
> # Parent  66eab44e4c56d7f7841a417aa05b9b49a6192a5a
> lookahead: Downscaled input image and lowres extended for motion search
>
> diff -r 66eab44e4c56 -r 43f1ceee90f6 source/Lib/TLibCommon/TComPic.cpp
> --- a/source/Lib/TLibCommon/TComPic.cpp Wed Jul 31 01:18:43 2013 -0500
> +++ b/source/Lib/TLibCommon/TComPic.cpp Wed Jul 31 15:54:34 2013 -0700
> @@ -73,6 +73,18 @@
>
>      /* store display window parameters with picture */
>      m_defaultDisplayWindow = defaultDisplayWindow;
> +
> +    /* generates the Lowres */
>

lower case lowres


> +    m_lookahead.m_width_lowres = m_origPicYuv->getWidth() / 2;
> +    m_lookahead.m_lines_lowres = m_origPicYuv->getHeight() / 2;
> +    m_lookahead.m_stride_lowres = m_lookahead.m_width_lowres + 2 *
> m_origPicYuv->getLumaMarginX();
> +
> +    /*allocate the buffer for Lowres */
> +    for( int i = 0; i < 4; i++)
>

white-space


> +    {
> +        m_lookahead.m_buffer_lowres[i] = (Pel*)X265_MALLOC(Pel,
>  m_lookahead.m_stride_lowres * (m_lookahead.m_lines_lowres +
> 2*m_origPicYuv->getLumaMarginY()));
> +        m_lookahead.m_lowres[i] =  m_lookahead.m_buffer_lowres[i] +
> m_origPicYuv->getLumaMarginY() * getStride() +
>  m_origPicYuv->getLumaMarginX();
> +    }
>  }
>
>  Void TComPic::destroy()
> diff -r 66eab44e4c56 -r 43f1ceee90f6 source/Lib/TLibCommon/TComPic.h
> --- a/source/Lib/TLibCommon/TComPic.h   Wed Jul 31 01:18:43 2013 -0500
> +++ b/source/Lib/TLibCommon/TComPic.h   Wed Jul 31 15:54:34 2013 -0700
> @@ -42,6 +42,7 @@
>  #include "CommonDef.h"
>  #include "TComPicSym.h"
>  #include "TComPicYuv.h"
> +#include "common.h"
>
>  //! \ingroup TLibCommon
>  //! \{
> @@ -68,6 +69,8 @@
>
>  public:
>
> +    lookahead             m_lookahead;
> +
>      TComPic();
>      virtual ~TComPic();
>
> diff -r 66eab44e4c56 -r 43f1ceee90f6 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:54:34 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();
>
> @@ -130,7 +128,9 @@
>
>      Int   getCStride()    { return m_strideC; }
>
> -    Int   getLumaMargin() { return m_lumaMarginX; }
> +    Int   getLumaMarginX() { return m_lumaMarginX; }
> +
> +    Int   getLumaMarginY() { return m_lumaMarginY; }
>
>      Int   getChromaMargin() { return m_chromaMarginX; }
>
> diff -r 66eab44e4c56 -r 43f1ceee90f6 source/Lib/TLibEncoder/TEncTop.cpp
> --- a/source/Lib/TLibEncoder/TEncTop.cpp        Wed Jul 31 01:18:43 2013
> -0500
> +++ b/source/Lib/TLibEncoder/TEncTop.cpp        Wed Jul 31 15:54:34 2013
> -0700
> @@ -162,6 +162,17 @@
>              pic->getPicYuvOrg()->copyFromPicture(*picture);
>              pic->getPicYuvRec()->setBorderExtension(false);
>              pic->getSlice()->setReferenced(true);
> +
> +            /* Until Lookahead implementation complete */
> +            if(!true)
>

white-space


> +            {
> +                /*downscale the luma planes*/
> +
>  x265::primitives.frame_init_lowres_core(pic->getPicYuvOrg()->getLumaAddr(),
> pic->m_lookahead.m_lowres[0], pic->m_lookahead.m_lowres[1],
> pic->m_lookahead.m_lowres[2], pic->m_lookahead.m_lowres[3],
> pic->getPicYuvOrg()->getStride(), pic->m_lookahead.m_stride_lowres,
> pic->m_lookahead.m_width_lowres, pic->m_lookahead.m_lines_lowres);
> +
> +                for(int i=0; i<4; i)
> +
>  pic->getPicYuvOrg()->xExtendPicCompBorder(pic->m_lookahead.m_lowres[i],
> pic->m_lookahead.m_stride_lowres, pic->m_lookahead.m_width_lowres,
> pic->m_lookahead.m_lines_lowres, pic->getPicYuvOrg()->getLumaMarginX(),
> pic->getPicYuvOrg()->getLumaMarginY());
> +            }
> +
>              return;
>          }
>      }
> diff -r 66eab44e4c56 -r 43f1ceee90f6 source/common/common.h
> --- a/source/common/common.h    Wed Jul 31 01:18:43 2013 -0500
> +++ b/source/common/common.h    Wed Jul 31 15:54:34 2013 -0700
> @@ -26,6 +26,7 @@
>
>  #include <stdlib.h>
>  #include "x265.h"
> +#include "primitives.h"
>
>  #define CU_STAT_LOGFILE 0
>
> @@ -112,6 +113,15 @@
>  #define REPORT_CYCLE_COUNTER(SUBSYSTEM_NAME)
>  #endif // if ENABLE_CYCLE_COUNTERS
>
> +struct lookahead
> + {
> +    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;
> + };
>

this should be in a new header, say lookahead.h in the common/ folder, it
needs to be in the x265 namespace, and it should probably have a caps first
character.  the 4 lowres pointers are redundant once we add the motion
reference struct here.

Also, since this is a simple structure with no methods, let's drop the m_
prefix here.  I would ok with dropping lowres from the names as well,
leaving you with something like  this:

namespace x265 {

struct Lookahead
{
  MotionReference  mref;
  pixel *buffer[4];
  int     stride;
  int     width;
  int     lines;
};

}



> +
>  /* defined in common.cpp */
>  void x265_log(x265_param_t *param, int level, const char *fmt, ...);
>  int  x265_check_params(x265_param_t *param);
> _______________________________________________
> 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/85b3aa5d/attachment.html>


More information about the x265-devel mailing list