Commits

Aarthi Thirumalai committed 6eb45b5

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

Comments (0)

Files changed (2)

source/encoder/frameencoder.cpp

         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++;

source/encoder/framefilter.cpp

         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();