[x265] [PATCH] TEncSearch: use actual frame thread count to decide motion search limits

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Fri May 30 12:06:00 CEST 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1401444351 -19800
#      Fri May 30 15:35:51 2014 +0530
# Node ID f11b3c9c7c2da752509c1a7613df7b175996bd63
# Parent  592ef184549ef631c0fe725cb9fe3cbab8de1db4
TEncSearch: use actual frame thread count to decide motion search limits

diff -r 592ef184549e -r f11b3c9c7c2d source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Thu May 29 23:42:16 2014 +0300
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Fri May 30 15:35:51 2014 +0530
@@ -1292,7 +1292,7 @@
     {
         for (uint32_t mergeCand = 0; mergeCand < maxNumMergeCand; ++mergeCand)
         {
-            if (m_param->frameNumThreads > 1 &&
+            if (m_search->m_cfg->m_totalFrameThreads > 1 &&
                 (mvFieldNeighbours[mergeCand][0].mv.y >= (m_param->searchRange + 1) * 4 ||
                  mvFieldNeighbours[mergeCand][1].mv.y >= (m_param->searchRange + 1) * 4))
             {
diff -r 592ef184549e -r f11b3c9c7c2d source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Thu May 29 23:42:16 2014 +0300
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Fri May 30 15:35:51 2014 +0530
@@ -107,7 +107,7 @@
 
     /* When frame parallelism is active, only 'refLagPixels' of reference frames will be guaranteed
      * available for motion reference.  See refLagRows in FrameEncoder::compressCTURows() */
-    m_refLagPixels = cfg->param->frameNumThreads > 1 ? cfg->param->searchRange : cfg->param->sourceHeight;
+    m_refLagPixels = cfg->m_totalFrameThreads > 1 ? cfg->param->searchRange : cfg->param->sourceHeight;
 
     const uint32_t numLayersToAllocate = cfg->m_quadtreeTULog2MaxSize - cfg->m_quadtreeTULog2MinSize + 1;
     m_qtTempCoeff[0] = new coeff_t*[numLayersToAllocate * 3];
@@ -2166,7 +2166,7 @@
     for (uint32_t mergeCand = 0; mergeCand < m.maxNumMergeCand; ++mergeCand)
     {
         /* Prevent TMVP candidates from using unavailable reference pixels */
-        if (m_cfg->param->frameNumThreads > 1 &&
+        if (m_cfg->m_totalFrameThreads > 1 &&
             (m.mvFieldNeighbours[mergeCand][0].mv.y >= (m_cfg->param->searchRange + 1) * 4 ||
              m.mvFieldNeighbours[mergeCand][1].mv.y >= (m_cfg->param->searchRange + 1) * 4))
         {
diff -r 592ef184549e -r f11b3c9c7c2d source/Lib/TLibEncoder/TEncSearch.h
--- a/source/Lib/TLibEncoder/TEncSearch.h	Thu May 29 23:42:16 2014 +0300
+++ b/source/Lib/TLibEncoder/TEncSearch.h	Fri May 30 15:35:51 2014 +0530
@@ -123,9 +123,6 @@
     uint8_t*        m_qtTempTransformSkipFlag[3];
     TComYuv         m_qtTempTransformSkipYuv;
 
-    // interface to option
-    Encoder*        m_cfg;
-
     // interface to classes
     TComTrQuant*    m_trQuant;
     RDCost*         m_rdCost;
@@ -136,6 +133,9 @@
 
 public:
 
+        // interface to option
+    Encoder*        m_cfg;
+
     void setRDSbacCoder(TEncSbac*** rdSbacCoders) { m_rdSbacCoders = rdSbacCoders; }
 
     void setEntropyCoder(TEncEntropy* entropyCoder) { m_entropyCoder = entropyCoder; }
diff -r 592ef184549e -r f11b3c9c7c2d source/encoder/compress.cpp
--- a/source/encoder/compress.cpp	Thu May 29 23:42:16 2014 +0300
+++ b/source/encoder/compress.cpp	Fri May 30 15:35:51 2014 +0530
@@ -248,7 +248,7 @@
 
     for (uint32_t mergeCand = 0; mergeCand < maxNumMergeCand; ++mergeCand)
     {
-        if (m_param->frameNumThreads <= 1 ||
+        if (m_search->m_cfg->m_totalFrameThreads <= 1 ||
             (mvFieldNeighbours[mergeCand][0].mv.y < (m_param->searchRange + 1) * 4 &&
              mvFieldNeighbours[mergeCand][1].mv.y < (m_param->searchRange + 1) * 4))
         {
diff -r 592ef184549e -r f11b3c9c7c2d source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Thu May 29 23:42:16 2014 +0300
+++ b/source/encoder/encoder.cpp	Fri May 30 15:35:51 2014 +0530
@@ -133,7 +133,7 @@
 {
     if (m_frameEncoder)
     {
-        for (int i = 0; i < param->frameNumThreads; i++)
+        for (int i = 0; i < m_totalFrameThreads; i++)
         {
             // Ensure frame encoder is idle before destroying it
             m_frameEncoder[i].getEncodedPicture(NULL);
@@ -544,7 +544,7 @@
         StatisticLog finalLog;
         for (int depth = 0; depth < (int)g_maxCUDepth; depth++)
         {
-            for (int j = 0; j < param->frameNumThreads; j++)
+            for (int j = 0; j < m_totalFrameThreads; j++)
             {
                 for (int row = 0; row < m_frameEncoder[0].m_numRows; row++)
                 {
diff -r 592ef184549e -r f11b3c9c7c2d source/encoder/encoder.h
--- a/source/encoder/encoder.h	Thu May 29 23:42:16 2014 +0300
+++ b/source/encoder/encoder.h	Fri May 30 15:35:51 2014 +0530
@@ -90,7 +90,7 @@
     DPB*               m_dpb;
     /* frame parallelism */
     int                m_curEncoder;
-    int                m_totalFrameThreads;
+
 
     /* Collect statistics globally */
     EncStats           m_analyzeAll;
@@ -194,6 +194,7 @@
 
     x265_nal*          m_nals;
     char*              m_packetData;
+    int                m_totalFrameThreads;
 
     Encoder();
 


More information about the x265-devel mailing list