[x265] [PATCH 1 of 2] slicetype: update the lowresCosts and intraCosts when cutree is enabled

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Tue May 6 13:45:31 CEST 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1399375233 -19800
#      Tue May 06 16:50:33 2014 +0530
# Node ID a3a234d72841f94f605c6075a5531e93f06eaeb6
# Parent  075705aa41a9144bb1a4d7f12d837169767630e1
slicetype: update the lowresCosts and intraCosts when cutree is enabled.

diff -r 075705aa41a9 -r a3a234d72841 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Mon May 05 23:26:59 2014 -0500
+++ b/source/encoder/frameencoder.cpp	Tue May 06 16:50:33 2014 +0530
@@ -1261,8 +1261,15 @@
                 qp_offset += qpoffs[idx];
             if (bIsVbv)
             {
-                m_pic->m_cuCostsForVbv[cuAddr] += m_pic->m_lowres.lowresCostForRc[idx] & LOWRES_COST_MASK;
-                m_pic->m_intraCuCostsForVbv[cuAddr] += m_pic->m_lowres.intraCost[idx];
+                uint16_t lowresCuCost = m_pic->m_lowres.lowresCostForRc[idx] & LOWRES_COST_MASK;
+                uint16_t intraCuCost = m_pic->m_lowres.intraCost[idx];
+                if (m_cfg->param->rc.cuTree)
+                {
+                    lowresCuCost = (lowresCuCost * x265_exp2fix8(qpoffs[idx]) + 128) >> 8;
+                    intraCuCost = (intraCuCost * x265_exp2fix8(qpoffs[idx]) + 128) >> 8;
+                }
+                m_pic->m_cuCostsForVbv[cuAddr] += lowresCuCost;
+                m_pic->m_intraCuCostsForVbv[cuAddr] += intraCuCost;
             }
             cnt++;
         }
diff -r 075705aa41a9 -r a3a234d72841 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Mon May 05 23:26:59 2014 -0500
+++ b/source/encoder/slicetype.cpp	Tue May 06 16:50:33 2014 +0530
@@ -1141,7 +1141,7 @@
 {
     int64_t score = 0;
     int *rowSatd = frames[b]->rowSatds[b - p0][p1 - b];
-    double *qp_offset = IS_X265_TYPE_B(frames[b]->sliceType) ? frames[b]->qpAqOffset : frames[b]->qpOffset;
+    double *qp_offset =frames[b]->sliceType == X265_TYPE_B ? frames[b]->qpAqOffset : frames[b]->qpOffset;
 
     x265_emms();
     for (int cuy = heightInCU - 1; cuy >= 0; cuy--)


More information about the x265-devel mailing list