[x265] [PATCH] TComPic: add m_qpAqOffset to store qp offsets per CU when Aq is enabled

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Thu Oct 17 09:21:50 CEST 2013


# HG changeset patch
# User Aarthi Thirumalai<aarthi at multicorewareinc.com>
# Date 1381989693 -19800
#      Thu Oct 17 11:31:33 2013 +0530
# Node ID aad785763f1d38473177e3f1293d3012d79239ca
# Parent  1d6b3626f1b3d4b8f8f181e66eaaa649f90bac02
TComPic: add m_qpAqOffset to store qp offsets per CU when Aq is enabled

diff -r 1d6b3626f1b3 -r aad785763f1d source/Lib/TLibCommon/TComPic.cpp
--- a/source/Lib/TLibCommon/TComPic.cpp	Wed Oct 16 20:38:44 2013 -0500
+++ b/source/Lib/TLibCommon/TComPic.cpp	Thu Oct 17 11:31:33 2013 +0530
@@ -61,6 +61,7 @@
     memset(&m_lowres, 0, sizeof(m_lowres));
     m_next = NULL;
     m_prev = NULL;
+    m_qpAqOffset = NULL;
     m_SSDY = 0;
     m_SSDU = 0;
     m_SSDV = 0;
@@ -69,25 +70,32 @@
 TComPic::~TComPic()
 {}
 
-void TComPic::create(int width, int height, UInt maxWidth, UInt maxHeight, UInt maxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, int bframes)
+void TComPic::create(TEncCfg* cfg)
 {
     m_picSym = new TComPicSym;
-    m_picSym->create(width, height, maxWidth, maxHeight, maxDepth);
+    m_picSym->create(cfg->param.sourceWidth,cfg->param.sourceHeight, g_maxCUWidth, g_maxCUHeight, g_maxCUDepth);
 
     m_origPicYuv = new TComPicYuv;
-    m_origPicYuv->create(width, height, maxWidth, maxHeight, maxDepth);
+    m_origPicYuv->create(cfg->param.sourceWidth,cfg->param.sourceHeight, g_maxCUWidth, g_maxCUHeight, g_maxCUDepth);
 
     m_reconPicYuv = new TComPicYuv;
-    m_reconPicYuv->create(width, height, maxWidth, maxHeight, maxDepth);
+    m_reconPicYuv->create(cfg->param.sourceWidth,cfg->param.sourceHeight, g_maxCUWidth, g_maxCUHeight, g_maxCUDepth);
 
     /* store conformance window parameters with picture */
-    m_conformanceWindow = conformanceWindow;
+    m_conformanceWindow = cfg->getConformanceWindow();
 
     /* store display window parameters with picture */
-    m_defaultDisplayWindow = defaultDisplayWindow;
+    m_defaultDisplayWindow = cfg->getDefaultDisplayWindow();
 
     /* configure lowres dimensions */
-    m_lowres.create(this, bframes);
+    m_lowres.create(this, cfg->param.bframes);
+
+    if (cfg->param.rc.aqMode)
+    {
+        m_qpAqOffset = (double *)x265_malloc(sizeof(double) * getPicSym()->getNumberOfCUsInFrame());
+        if (!m_qpAqOffset)
+            cfg->param.rc.aqMode = 0;
+    }
 }
 
 void TComPic::destroy(int bframes)
@@ -114,6 +122,7 @@
     }
 
     m_lowres.destroy(bframes);
+    X265_FREE(m_qpAqOffset);
 }
 
 //! \}
diff -r 1d6b3626f1b3 -r aad785763f1d source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h	Wed Oct 16 20:38:44 2013 -0500
+++ b/source/Lib/TLibCommon/TComPic.h	Thu Oct 17 11:31:33 2013 +0530
@@ -44,6 +44,7 @@
 #include "TComPicYuv.h"
 #include "lowres.h"
 #include "threading.h"
+#include "TLibEncoder/TEncCfg.h"
 
 namespace x265 {
 // private namespace
@@ -84,7 +85,7 @@
 
     TComPic*              m_next;
     TComPic*              m_prev;
-
+    double*               m_qpAqOffset;
     UInt64                m_SSDY;
     UInt64                m_SSDU;
     UInt64                m_SSDV;
@@ -92,7 +93,7 @@
     TComPic();
     virtual ~TComPic();
 
-    void          create(int width, int height, UInt maxWidth, UInt maxHeight, UInt maxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, int bframes);
+    void          create(TEncCfg* cfg);
 
     virtual void  destroy(int bframes);
 
diff -r 1d6b3626f1b3 -r aad785763f1d source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Oct 16 20:38:44 2013 -0500
+++ b/source/encoder/encoder.cpp	Thu Oct 17 11:31:33 2013 +0530
@@ -166,8 +166,7 @@
         if (m_freeList.empty())
         {
             pic = new TComPic;
-            pic->create(param.sourceWidth, param.sourceHeight, g_maxCUWidth, g_maxCUHeight, g_maxCUDepth,
-                        getConformanceWindow(), getDefaultDisplayWindow(), param.bframes);
+            pic->create(this);
             if (param.bEnableSAO)
             {
                 // TODO: these should be allocated on demand within the encoder


More information about the x265-devel mailing list