[x265] [PATCH] aq: Bug Fixes in aq , ssim when ctu size is not set as 64

Aarthi Thirumalai aarthi at multicorewareinc.com
Wed Nov 27 11:13:11 CET 2013


# HG changeset patch
# User Aarthi Thirumalai
# Date 1385547183 -19800
#      Wed Nov 27 15:43:03 2013 +0530
# Node ID c8500d4eaab21941566bec222eaf8eeb9797861f
# Parent  ece323e1b6035c125b8d1e892e02cca84917990b
aq: Bug Fixes in aq , ssim when ctu size is not set as 64.

1.Calculate qp offset for CU based maxCuSize set in FrameEncoder::calcQpForCu
2.Fix height for ssim computation based on maxCuHeight in FrameFilter::processRowPost

diff -r ece323e1b603 -r c8500d4eaab2 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Wed Nov 27 00:29:23 2013 -0600
+++ b/source/encoder/frameencoder.cpp	Wed Nov 27 15:43:03 2013 +0530
@@ -1105,12 +1105,14 @@
         double qp_offset = 0;
         int maxBlockCols = (pic->getPicYuvOrg()->getWidth() + (16 - 1)) / 16;
         int maxBlockRows = (pic->getPicYuvOrg()->getHeight() + (16 - 1)) / 16;
-        int block_y = (cuAddr / pic->getPicSym()->getFrameWidthInCU()) * 4;
-        int block_x = (cuAddr * 4) - block_y * pic->getPicSym()->getFrameWidthInCU();
+        int noOfBlocks = g_maxCUWidth / 16;
+        int block_y = (cuAddr / pic->getPicSym()->getFrameWidthInCU()) * noOfBlocks;
+        int block_x = (cuAddr * noOfBlocks) - block_y * pic->getPicSym()->getFrameWidthInCU();
         int cnt = 0;
-        for (int h = 0; h < 4 && block_y < maxBlockRows; h++, block_y++)
+
+        for (int h = 0; h < noOfBlocks && block_y < maxBlockRows; h++, block_y++)
         {
-            for (int w = 0; w < 4 && (block_x + w) < maxBlockCols; w++)
+            for (int w = 0; w < noOfBlocks && (block_x + w) < maxBlockCols; w++)
             {
                 qp_offset += pic->m_lowres.qpAqOffset[block_x + w + (block_y * maxBlockCols)];
                 cnt++;
diff -r ece323e1b603 -r c8500d4eaab2 source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp	Wed Nov 27 00:29:23 2013 -0600
+++ b/source/encoder/framefilter.cpp	Wed Nov 27 15:43:03 2013 +0530
@@ -309,8 +309,8 @@
         int stride2 = m_pic->getPicYuvRec()->getStride();
         int bEnd = ((row + 1) == (this->m_numRows - 1));
         int bStart = (row == 0);
-        int minPixY = row * 64 - 4 * !bStart;
-        int maxPixY = (row + 1) * 64 - 4 * !bEnd;
+        int minPixY = row * g_maxCUHeight - 4 * !bStart;
+        int maxPixY = (row + 1) * g_maxCUHeight - 4 * !bEnd;
         int ssim_cnt;
         x265_emms();
 


More information about the x265-devel mailing list