[x265] [PATCH 1 of 4] lowres: move m_qpAqOffset from TComPic to Lowres

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Mon Oct 21 19:35:52 CEST 2013


# HG changeset patch
# User Aarthi Thirumalai<aarthi at multicorewareinc.com>
# Date 1382373863 -19800
#      Mon Oct 21 22:14:23 2013 +0530
# Node ID 371bb66ae9345ebed4e0c028daeec1d65009a663
# Parent  92d13feba8fe3eb831b31225274bb9d24ae2f5f6
lowres: move m_qpAqOffset from TComPic to Lowres

diff -r 92d13feba8fe -r 371bb66ae934 source/Lib/TLibCommon/TComPic.cpp
--- a/source/Lib/TLibCommon/TComPic.cpp	Mon Oct 21 16:21:19 2013 +0530
+++ b/source/Lib/TLibCommon/TComPic.cpp	Mon Oct 21 22:14:23 2013 +0530
@@ -62,7 +62,6 @@
     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;
@@ -89,14 +88,7 @@
     m_defaultDisplayWindow = cfg->getDefaultDisplayWindow();
 
     /* configure lowres dimensions */
-    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;
-    }
+    m_lowres.create(this, cfg->param.bframes, &cfg->param.rc.aqMode);
 }
 
 void TComPic::destroy(int bframes)
@@ -123,7 +115,6 @@
     }
 
     m_lowres.destroy(bframes);
-    X265_FREE(m_qpAqOffset);
 }
 
 //! \}
diff -r 92d13feba8fe -r 371bb66ae934 source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h	Mon Oct 21 16:21:19 2013 +0530
+++ b/source/Lib/TLibCommon/TComPic.h	Mon Oct 21 22:14:23 2013 +0530
@@ -86,7 +86,6 @@
 
     TComPic*              m_next;
     TComPic*              m_prev;
-    double*               m_qpAqOffset;
     UInt64                m_SSDY;
     UInt64                m_SSDU;
     UInt64                m_SSDV;
diff -r 92d13feba8fe -r 371bb66ae934 source/common/lowres.cpp
--- a/source/common/lowres.cpp	Mon Oct 21 16:21:19 2013 +0530
+++ b/source/common/lowres.cpp	Mon Oct 21 22:14:23 2013 +0530
@@ -27,7 +27,7 @@
 
 using namespace x265;
 
-void Lowres::create(TComPic *pic, int bframes)
+void Lowres::create(TComPic *pic, int bframes, int *aqMode)
 {
     TComPicYuv *orig = pic->getPicYuvOrg();
 
@@ -45,6 +45,13 @@
     width = cuWidth * X265_LOWRES_CU_SIZE;
     lines = cuHeight * X265_LOWRES_CU_SIZE;
 
+    if (*aqMode)
+    {
+        m_qpAqOffset = (double*)x265_malloc(sizeof(double) * cuCount);
+        if (!m_qpAqOffset)
+            *aqMode = 0;
+    }
+
     /* allocate lowres buffers */
     for (int i = 0; i < 4; i++)
     {
@@ -102,6 +109,7 @@
         X265_FREE(lowresMvCosts[0][i]);
         X265_FREE(lowresMvCosts[1][i]);
     }
+    X265_FREE(m_qpAqOffset);
 }
 
 // (re) initialize lowres state
diff -r 92d13feba8fe -r 371bb66ae934 source/common/lowres.h
--- a/source/common/lowres.h	Mon Oct 21 16:21:19 2013 +0530
+++ b/source/common/lowres.h	Mon Oct 21 22:14:23 2013 +0530
@@ -36,6 +36,7 @@
 {
     /* lowres buffers, sizes and strides */
     pixel *buffer[4];
+    double *m_qpAqOffset; // qp Aq offset values for each Cu
     int    width;     // width of lowres frame in pixels
     int    lines;     // height of lowres frame in pixel lines
     int    frameNum;  // Presentation frame number
@@ -56,7 +57,7 @@
     int      *lowresMvCosts[2][X265_BFRAME_MAX + 1];
     MV       *lowresMvs[2][X265_BFRAME_MAX + 1];
 
-    void create(TComPic *pic, int bframes);
+    void create(TComPic *pic, int bframes, int *aqMode);
     void destroy(int bframes);
     void init(TComPicYuv *orig, int poc, int sliceType, int bframes);
 };
diff -r 92d13feba8fe -r 371bb66ae934 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Mon Oct 21 16:21:19 2013 +0530
+++ b/source/encoder/ratecontrol.cpp	Mon Oct 21 22:14:23 2013 +0530
@@ -120,7 +120,7 @@
                 double qp_adj;
                 int cu_xy = maxCols * cu_y + cu_x;
                 qp_adj = acEnergyCu(pic, cu_xy);
-                pic->m_qpAqOffset[cu_xy] = qp_adj;
+                pic->m_lowres.m_qpAqOffset[cu_xy] = qp_adj;
             }
         }
     }


More information about the x265-devel mailing list