[x265] [PATCH 2 of 6 REV2] analysis: simplify CTU QP init loops

Steve Borho steve at borho.org
Sun Apr 26 19:21:03 CEST 2015


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1429906494 18000
#      Fri Apr 24 15:14:54 2015 -0500
# Node ID bfd57a0c0875e219d902ff3af6f4a0ddaa16b125
# Parent  5429e35d132d157d5b5ac50c70f4ff19c9b1fa63
analysis: simplify CTU QP init loops

diff -r 5429e35d132d -r bfd57a0c0875 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Fri Apr 24 16:51:38 2015 -0500
+++ b/source/encoder/analysis.cpp	Fri Apr 24 15:14:54 2015 -0500
@@ -141,29 +141,26 @@
 
     if (m_slice->m_pps->bUseDQP)
     {
-        CUGeom *curCUGeom  = (CUGeom *)&cuGeom;
-        CUGeom *parentGeom = (CUGeom *)&cuGeom;
+        /* TODO: In future, we could extend this to 8x8 QGs as well, since that's the minimum size 
+         * allowed by the HEVC standard. The AQ offset calculation will need to be at 8x8 granularity.
+         * And this messy section will need to be reworked */
+        m_aqQP[0][0] = calculateQpforCuSize(ctu, cuGeom);
 
-        /* TODO: In future, we should extend this to 8x8 QGs as well, since that's the minimum size 
-        allowed by the HEVC standard. The AQ offset calculation will need to be at 8x8 granularity.
-        And this messy section will need to be reworked */
-
-        m_aqQP[0][0] = calculateQpforCuSize(ctu, *curCUGeom);
-        curCUGeom = curCUGeom + curCUGeom->childOffset;
-        parentGeom = curCUGeom;
+        const CUGeom* rootGeom = &cuGeom + 1;
         if (m_slice->m_pps->maxCuDQPDepth >= 1)
         {
-            for (int i = 0; i < 4; i++)
+            for (int d0 = 0; d0 < 4; d0++)
             {
-                m_aqQP[1][i] = calculateQpforCuSize(ctu, *(parentGeom + i));
+                m_aqQP[1][d0] = calculateQpforCuSize(ctu, rootGeom[d0]);
                 if (m_slice->m_pps->maxCuDQPDepth == 2)
                 {
-                    curCUGeom = parentGeom + i + (parentGeom + i)->childOffset;
-                    for (int j = 0; j < 4; j++)
-                        m_aqQP[2][i * 4 + j] = calculateQpforCuSize(ctu, *(curCUGeom + j));
+                    const CUGeom* curGeom = &rootGeom[d0] + rootGeom[d0].childOffset;
+                    for (int d1 = 0; d1 < 4; d1++)
+                        m_aqQP[2][d0 * 4 + d1] = calculateQpforCuSize(ctu, curGeom[d1]);
                 }
             }
         }
+
         setLambdaFromQP(*m_slice, m_aqQP[0][0]);
         m_aqQP[0][0] = x265_clip3(QP_MIN, QP_MAX_SPEC, m_aqQP[0][0]);
         ctu.setQPSubParts((int8_t)m_aqQP[0][0], 0, 0);


More information about the x265-devel mailing list