[x265] [PATCH 1 of 2] ratecontrol: clean up confusing if-checks in calcAdaptiveQuantFrame

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Fri Feb 21 12:23:29 CET 2014


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1392976266 -19800
# Node ID 3275142274c8e424c9a9a57dbc2c70b0707ea996
# Parent  5e2043f89aa11363dffe33a0ff06550a7d862326
ratecontrol: clean up confusing if-checks in calcAdaptiveQuantFrame

diff -r 5e2043f89aa1 -r 3275142274c8 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Fri Feb 21 03:05:48 2014 -0600
+++ b/source/encoder/ratecontrol.cpp	Fri Feb 21 15:21:06 2014 +0530
@@ -105,23 +105,20 @@
     int block_xy = 0;
     int block_x = 0, block_y = 0;
     double strength = 0.f;
-    if (cfg->param.rc.aqMode == X265_AQ_NONE || cfg->param.rc.aqStrength == 0)
+
+    if (cfg->param.rc.cuTree && cfg->param.rc.aqStrength == 0) /* CUTree is enabled with zero strength AQ */
     {
-        /* Need to init it anyways for CU tree */
         int cuWidth = ((maxCol / 2) + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
         int cuHeight = ((maxRow / 2) + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
         int cuCount = cuWidth * cuHeight;
-
-        if (cfg->param.rc.aqMode && cfg->param.rc.aqStrength == 0)
+                
+        memset(pic->m_lowres.qpOffset, 0, cuCount * sizeof(double));
+        memset(pic->m_lowres.qpAqOffset, 0, cuCount * sizeof(double));
+        for (int cuxy = 0; cuxy < cuCount; cuxy++)
         {
-            memset(pic->m_lowres.qpOffset, 0, cuCount * sizeof(double));
-            memset(pic->m_lowres.qpAqOffset, 0, cuCount * sizeof(double));
-            for (int cuxy = 0; cuxy < cuCount; cuxy++)
-            {
-                pic->m_lowres.invQscaleFactor[cuxy] = 256;
-            }
+            pic->m_lowres.invQscaleFactor[cuxy] = 256;
         }
-
+        
         /* Need variance data for weighted prediction */
         if (cfg->param.bEnableWeightedPred)
         {


More information about the x265-devel mailing list