[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 11:12:15 CEST 2013


# HG changeset patch
# User Aarthi Thirumalai<aarthi at multicorewareinc.com>
# Date 1382000829 -19800
#      Thu Oct 17 14:37:09 2013 +0530
# Node ID f00b85a3ac349edfd9af05c0984d83decdd4373c
# Parent  2fbeab18f1826fb6225a3e6a73860513cc08ae9e
TComPic: add m_qpAqOffset to store qp offsets per CU when Aq is enabled

diff -r 2fbeab18f182 -r f00b85a3ac34 source/Lib/TLibCommon/TComPic.cpp
--- a/source/Lib/TLibCommon/TComPic.cpp	Thu Oct 17 02:55:32 2013 -0500
+++ b/source/Lib/TLibCommon/TComPic.cpp	Thu Oct 17 14:37:09 2013 +0530
@@ -38,6 +38,7 @@
 #include "TComPic.h"
 #include "SEI.h"
 #include "mv.h"
+#include "TLibEncoder/TEncCfg.h"
 
 using namespace x265;
 
@@ -61,6 +62,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 +71,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 +123,7 @@
     }
 
     m_lowres.destroy(bframes);
+    X265_FREE(m_qpAqOffset);
 }
 
 //! \}
diff -r 2fbeab18f182 -r f00b85a3ac34 source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h	Thu Oct 17 02:55:32 2013 -0500
+++ b/source/Lib/TLibCommon/TComPic.h	Thu Oct 17 14:37:09 2013 +0530
@@ -48,6 +48,8 @@
 namespace x265 {
 // private namespace
 
+class TEncCfg;
+
 //! \ingroup TLibCommon
 //! \{
 
@@ -84,7 +86,7 @@
 
     TComPic*              m_next;
     TComPic*              m_prev;
-
+    double*               m_qpAqOffset;
     UInt64                m_SSDY;
     UInt64                m_SSDU;
     UInt64                m_SSDV;
@@ -92,7 +94,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 2fbeab18f182 -r f00b85a3ac34 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Thu Oct 17 02:55:32 2013 -0500
+++ b/source/encoder/encoder.cpp	Thu Oct 17 14:37:09 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