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

gopu at multicorewareinc.com gopu at multicorewareinc.com
Wed Jul 31 01:46:24 CEST 2013


# 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();
+
+    /*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)));
+        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;
+
     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; }
 
+    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
+            {
+                /*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());
+            }
             return;
         }
     }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265_29July.patch
Type: text/x-patch
Size: 3682 bytes
Desc: not available
URL: <http://mailman.videolan.org/private/x265-devel/attachments/20130730/65f0dc25/attachment.bin>


More information about the x265-devel mailing list