[x265] [PATCH] slicetype: change the value of total 16x16 blocks for averaging of qp_adj

sreelakshmy at multicorewareinc.com sreelakshmy at multicorewareinc.com
Mon Mar 9 10:53:06 CET 2015


# HG changeset patch
# User Sreelakshmy V G <sreelakshmy at multicorewareinc.com>
# Date 1425894727 -19800
#      Mon Mar 09 15:22:07 2015 +0530
# Node ID 529261927aacc08a053f676e75a187d712729744
# Parent  043c2418864b0a3ada6f597e6def6ead73d90b5f
slicetype: change the value of total 16x16 blocks for averaging of qp_adj

m_ncu in ratecontrol signifies actual number of 16x16 blocks, whereas ncu in
slicetype leaves out the border blocks. So there is a difference in the value of
both.

diff -r 043c2418864b -r 529261927aac source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Fri Mar 06 13:15:55 2015 -0600
+++ b/source/encoder/slicetype.cpp	Mon Mar 09 15:22:07 2015 +0530
@@ -105,6 +105,9 @@
     /* Actual adaptive quantization */
     int maxCol = curFrame->m_fencPic->m_picWidth;
     int maxRow = curFrame->m_fencPic->m_picHeight;
+    int cuWidth = ((param->sourceWidth / 2) + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
+    int cuHeight = ((param->sourceHeight / 2) + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
+    int m_ncu = cuWidth * cuHeight;
 
     for (int y = 0; y < 3; y++)
     {
@@ -157,8 +160,8 @@
                 }
             }
 
-            avg_adj /= ncu;
-            avg_adj_pow2 /= ncu;
+            avg_adj /= m_ncu;
+            avg_adj_pow2 /= m_ncu;
             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