[x265] [PATCH] slicetype: change the total CU value for averaging of qp_adj

sreelakshmy at multicorewareinc.com sreelakshmy at multicorewareinc.com
Fri Mar 6 11:06:01 CET 2015


# HG changeset patch
# User Sreelakshmy V G <sreelakshmy at multicorewareinc.com>
# Date 1425636287 -19800
#      Fri Mar 06 15:34:47 2015 +0530
# Node ID 99edf8d0064295633a7c52536600f5b55b9fd060
# Parent  45deb0125890ab0211d0e256c74d91ede78d12d3
slicetype: change the total CU value for averaging of qp_adj

diff -r 45deb0125890 -r 99edf8d00642 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Thu Mar 05 20:39:08 2015 -0600
+++ b/source/encoder/slicetype.cpp	Fri Mar 06 15:34:47 2015 +0530
@@ -106,6 +106,11 @@
     int maxCol = curFrame->m_fencPic->m_picWidth;
     int maxRow = curFrame->m_fencPic->m_picHeight;
 
+    int lowresCuWidth = ((param->sourceWidth / 2) + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
+    int lowresCuHeight = ((param->sourceHeight / 2) + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
+    int totalBlocks = lowresCuWidth * lowresCuHeight;
+
+
     for (int y = 0; y < 3; y++)
     {
         curFrame->m_lowres.wp_ssd[y] = 0;
@@ -141,6 +146,7 @@
     {
         blockXY = 0;
         double avg_adj_pow2 = 0, avg_adj = 0, qp_adj = 0;
+
         if (param->rc.aqMode == X265_AQ_AUTO_VARIANCE)
         {
             double bit_depth_correction = pow(1 << (X265_DEPTH - 8), 0.5);
@@ -157,8 +163,8 @@
                 }
             }
 
-            avg_adj /= ncu;
-            avg_adj_pow2 /= ncu;
+            avg_adj /= totalBlocks;
+            avg_adj_pow2 /= totalBlocks;
             strength = param->rc.aqStrength * avg_adj / bit_depth_correction;
             avg_adj = avg_adj - 0.5f * (avg_adj_pow2 - (11.f * bit_depth_correction)) / avg_adj;
         }


More information about the x265-devel mailing list