[x265] [PATCH] cleanup: move m_predYuv and m_predTempYuv from predict to TEncSearch

santhoshini at multicorewareinc.com santhoshini at multicorewareinc.com
Fri Aug 1 11:36:00 CEST 2014


# HG changeset patch
# User Santhoshini Sekar <santhoshini at multicorewareinc.com>
# Date 1406885676 -19800
#      Fri Aug 01 15:04:36 2014 +0530
# Node ID ddcc46309023d8e577b25325370503660a0d1c87
# Parent  e85b0aaa64e4aaccdfd37de92e14d91a53a789ea
cleanup:  move m_predYuv and m_predTempYuv from predict to TEncSearch

diff -r e85b0aaa64e4 -r ddcc46309023 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Jul 31 11:08:02 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Fri Aug 01 15:04:36 2014 +0530
@@ -77,6 +77,7 @@
     X265_FREE(m_qtTempTrIdx);
     X265_FREE(m_qtTempCbf[0]);
     X265_FREE(m_qtTempTransformSkipFlag[0]);
+    m_predTempYuv.destroy();
 
     delete[] m_qtTempShortYuv;
 }
@@ -92,6 +93,7 @@
     m_numLayers = top.m_quadtreeTULog2MaxSize - 2 + 1;
 
     initTempBuff(m_param->internalCsp);
+    m_predTempYuv.create(MAX_CU_SIZE, MAX_CU_SIZE, m_param->internalCsp);
     m_me.setSearchMethod(m_param->searchMethod);
     m_me.setSubpelRefine(m_param->subpelRefine);
 
@@ -1894,6 +1896,7 @@
     int      numPredDir = cu->m_slice->isInterP() ? 1 : 2;
     uint32_t lastMode = 0;
     int      totalmebits = 0;
+    TComYuv   m_predYuv[2];
 
     const int* numRefIdx = cu->m_slice->m_numRefIdx;
 
@@ -1901,6 +1904,9 @@
 
     memset(&merge, 0, sizeof(merge));
 
+    m_predYuv[0].create(MAX_CU_SIZE, MAX_CU_SIZE, m_param->internalCsp);
+    m_predYuv[1].create(MAX_CU_SIZE, MAX_CU_SIZE, m_param->internalCsp);
+
     for (int partIdx = 0; partIdx < numPart; partIdx++)
     {
         uint32_t partAddr;
@@ -1936,7 +1942,7 @@
                 cu->getCUMvField(REF_PIC_LIST_1)->setAllMvField(merge.mvField[1], partSize, partAddr, 0, partIdx);
                 totalmebits += merge.bits;
 
-                prepMotionCompensation(cu, partIdx);     
+                prepMotionCompensation(cu, partIdx);
                 motionCompensation(cu, predYuv, REF_PIC_LIST_X, true, bChroma);
                 continue;
             }
@@ -2159,6 +2165,9 @@
         motionCompensation(cu, predYuv, REF_PIC_LIST_X, true, bChroma);
     }
 
+    m_predYuv[0].destroy();
+    m_predYuv[1].destroy();
+
     x265_emms();
     cu->m_totalBits = totalmebits;
     return true;
diff -r e85b0aaa64e4 -r ddcc46309023 source/Lib/TLibEncoder/TEncSearch.h
--- a/source/Lib/TLibEncoder/TEncSearch.h	Thu Jul 31 11:08:02 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.h	Fri Aug 01 15:04:36 2014 +0530
@@ -106,6 +106,7 @@
     MotionReference (*m_mref)[MAX_NUM_REF + 1];
 
     ShortYuv*       m_qtTempShortYuv;
+    TComYuv         m_predTempYuv;
 
     coeff_t*        m_qtTempCoeff[3][NUM_LAYERS];
     uint8_t*        m_qtTempTrIdx;
diff -r e85b0aaa64e4 -r ddcc46309023 source/encoder/predict.cpp
--- a/source/encoder/predict.cpp	Thu Jul 31 11:08:02 2014 +0530
+++ b/source/encoder/predict.cpp	Fri Aug 01 15:04:36 2014 +0530
@@ -55,11 +55,8 @@
     X265_FREE(m_refLeftFlt);
     X265_FREE(m_immedVals);
 
-    m_predYuv[0].destroy();
-    m_predYuv[1].destroy();
     m_predShortYuv[0].destroy();
     m_predShortYuv[1].destroy();
-    m_predTempYuv.destroy();
 }
 
 void Predict::initTempBuff(int csp)
@@ -77,11 +74,8 @@
         m_refLeft = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
         m_refLeftFlt = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
 
-        m_predYuv[0].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
-        m_predYuv[1].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
         m_predShortYuv[0].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
         m_predShortYuv[1].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
-        m_predTempYuv.create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
 
         m_immedVals = X265_MALLOC(int16_t, 64 * (64 + NTAPS_LUMA - 1));
     }
diff -r e85b0aaa64e4 -r ddcc46309023 source/encoder/predict.h
--- a/source/encoder/predict.h	Thu Jul 31 11:08:02 2014 +0530
+++ b/source/encoder/predict.h	Fri Aug 01 15:04:36 2014 +0530
@@ -39,17 +39,13 @@
 {
 protected:
 
-    /* TODO: remove m_predYuv, m_predTempYuv, these should just be temporary structs inside predInterSearch */
-    TComYuv   m_predYuv[2];
-    TComYuv   m_predTempYuv;
-
     ShortYuv  m_predShortYuv[2]; //temporary storage for weighted prediction
     int16_t*  m_immedVals;
 
     /* Slice information */
     Slice*    m_slice;
     int       m_csp;
-    
+
     /* CU information for prediction */
     int       m_width;
     int       m_height; 
@@ -75,7 +71,7 @@
     void getLLSPrediction(TComPattern* pcPattern, int* src0, int srcstride, pixel* dst0, int dststride, uint32_t width, uint32_t height, uint32_t ext0);
 
     bool checkIdenticalMotion();
-    
+
 public:
 
     // Intra prediction buffers


More information about the x265-devel mailing list