[x265-commits] [x265] analysis: nits

Steve Borho steve at borho.org
Fri Apr 24 23:49:02 CEST 2015


details:   http://hg.videolan.org/x265/rev/0eca2eadfd82
branches:  
changeset: 10284:0eca2eadfd82
user:      Steve Borho <steve at borho.org>
date:      Fri Apr 24 16:05:19 2015 -0500
description:
analysis: nits
Subject: [x265] search: rename setQP() method to setLambdaFromQP

details:   http://hg.videolan.org/x265/rev/4a7176bab742
branches:  
changeset: 10285:4a7176bab742
user:      Steve Borho <steve at borho.org>
date:      Fri Apr 24 16:07:42 2015 -0500
description:
search: rename setQP() method to setLambdaFromQP

This function's main purpose is to configure lambdas for RDO based on a QP that
is possibly out of range (on the high side). The QP is generally clamped to the
spec max shortly after configuring lambdas

diffstat:

 source/encoder/analysis.cpp     |  24 ++++++++++++------------
 source/encoder/frameencoder.cpp |   2 +-
 source/encoder/search.cpp       |   4 ++--
 source/encoder/search.h         |   2 +-
 4 files changed, 16 insertions(+), 16 deletions(-)

diffs (153 lines):

diff -r 55eedcef3708 -r 4a7176bab742 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Fri Apr 24 19:22:48 2015 +0530
+++ b/source/encoder/analysis.cpp	Fri Apr 24 16:07:42 2015 -0500
@@ -136,8 +136,9 @@ Mode& Analysis::compressCTU(CUData& ctu,
     for (uint32_t i = 0; i <= g_maxCUDepth; i++)
         for (uint32_t j = 0; j < MAX_PRED_TYPES; j++)
             m_modeDepth[i].pred[j].invalidate();
+    invalidateContexts(0);
 #endif
-    invalidateContexts(0);
+
     if (m_slice->m_pps->bUseDQP)
     {
         CUGeom *curCUGeom  = (CUGeom *)&cuGeom;
@@ -163,7 +164,7 @@ Mode& Analysis::compressCTU(CUData& ctu,
                 }
             }
         }
-        this->setQP(*m_slice, m_qp[0][0]);
+        setLambdaFromQP(*m_slice, m_qp[0][0]);
         m_qp[0][0] = x265_clip3(QP_MIN, QP_MAX_SPEC, m_qp[0][0]);
         ctu.setQPSubParts((int8_t)m_qp[0][0], 0, 0);
     }
@@ -178,11 +179,11 @@ Mode& Analysis::compressCTU(CUData& ctu,
     if (m_param->analysisMode)
     {
         if (m_slice->m_sliceType == I_SLICE)
-            m_reuseIntraDataCTU = (analysis_intra_data *)m_frame->m_analysisData.intraData;
+            m_reuseIntraDataCTU = (analysis_intra_data*)m_frame->m_analysisData.intraData;
         else
         {
             int numPredDir = m_slice->isInterP() ? 1 : 2;
-            m_reuseInterDataCTU = (analysis_inter_data *)m_frame->m_analysisData.interData;
+            m_reuseInterDataCTU = (analysis_inter_data*)m_frame->m_analysisData.interData;
             m_reuseRef = &m_reuseInterDataCTU->ref[ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];
             m_reuseBestMergeCand = &m_reuseInterDataCTU->bestMergeCand[ctu.m_cuAddr * CUGeom::MAX_GEOMS];
         }
@@ -196,7 +197,7 @@ Mode& Analysis::compressCTU(CUData& ctu,
         compressIntraCU(ctu, cuGeom, zOrder, m_qp[0][0], 0);
         if (m_param->analysisMode == X265_ANALYSIS_SAVE && m_frame->m_analysisData.intraData)
         {
-            CUData *bestCU = &m_modeDepth[0].bestMode->cu;
+            CUData* bestCU = &m_modeDepth[0].bestMode->cu;
             memcpy(&m_reuseIntraDataCTU->depth[ctu.m_cuAddr * numPartition], bestCU->m_cuDepth, sizeof(uint8_t) * numPartition);
             memcpy(&m_reuseIntraDataCTU->modes[ctu.m_cuAddr * numPartition], bestCU->m_lumaIntraDir, sizeof(uint8_t) * numPartition);
             memcpy(&m_reuseIntraDataCTU->partSizes[ctu.m_cuAddr * numPartition], bestCU->m_partSize, sizeof(uint8_t) * numPartition);
@@ -225,7 +226,7 @@ Mode& Analysis::compressCTU(CUData& ctu,
             compressInterCU_rd5_6(ctu, cuGeom, zOrder, m_qp[0][0], 0);
             if (m_param->analysisMode == X265_ANALYSIS_SAVE && m_frame->m_analysisData.interData)
             {
-                CUData *bestCU = &m_modeDepth[0].bestMode->cu;
+                CUData* bestCU = &m_modeDepth[0].bestMode->cu;
                 memcpy(&m_reuseInterDataCTU->depth[ctu.m_cuAddr * numPartition], bestCU->m_cuDepth, sizeof(uint8_t) * numPartition);
                 memcpy(&m_reuseInterDataCTU->modes[ctu.m_cuAddr * numPartition], bestCU->m_predMode, sizeof(uint8_t) * numPartition);
             }
@@ -273,7 +274,7 @@ void Analysis::compressIntraCU(const CUD
     if (m_slice->m_pps->bUseDQP && depth && depth <= m_slice->m_pps->maxCuDQPDepth)
     {
         qp = m_qp[depth][partIdx];
-        this->setQP(*m_slice, qp);
+        setLambdaFromQP(*m_slice, qp);
         qp = x265_clip3(QP_MIN, QP_MAX_SPEC, qp);
     }
 
@@ -412,7 +413,7 @@ void Analysis::processPmode(PMODE& pmode
     {
         slave.m_slice = m_slice;
         slave.m_frame = m_frame;
-        slave.setQP(*m_slice, m_rdCost.m_qp);
+        slave.setLambdaFromQP(*m_slice, m_rdCost.m_qp);
         slave.invalidateContexts(0);
 
         if (m_param->rdLevel >= 5)
@@ -422,7 +423,6 @@ void Analysis::processPmode(PMODE& pmode
         }
     }
 
-
     /* perform Mode task, repeat until no more work is available */
     do
     {
@@ -549,7 +549,7 @@ void Analysis::compressInterCU_dist(cons
     if (m_slice->m_pps->bUseDQP && depth && depth <= m_slice->m_pps->maxCuDQPDepth)
     {
         qp = m_qp[depth][partIdx];
-        this->setQP(*m_slice, qp);
+        setLambdaFromQP(*m_slice, qp);
         qp = x265_clip3(QP_MIN, QP_MAX_SPEC, qp);
     }
 
@@ -805,7 +805,7 @@ void Analysis::compressInterCU_rd0_4(con
     if (m_slice->m_pps->bUseDQP && depth && depth <= m_slice->m_pps->maxCuDQPDepth)
     {
         qp = m_qp[depth][partIdx];
-        this->setQP(*m_slice, qp);
+        setLambdaFromQP(*m_slice, qp);
         qp = x265_clip3(QP_MIN, QP_MAX_SPEC, qp);
     }
 
@@ -1094,7 +1094,7 @@ void Analysis::compressInterCU_rd5_6(con
     if (m_slice->m_pps->bUseDQP && depth && depth <= m_slice->m_pps->maxCuDQPDepth)
     {
         qp = m_qp[depth][partIdx];
-        this->setQP(*m_slice, qp);
+        setLambdaFromQP(*m_slice, qp);
         qp = x265_clip3(QP_MIN, QP_MAX_SPEC, qp);
     }
 
diff -r 55eedcef3708 -r 4a7176bab742 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Fri Apr 24 19:22:48 2015 +0530
+++ b/source/encoder/frameencoder.cpp	Fri Apr 24 16:07:42 2015 -0500
@@ -856,7 +856,7 @@ void FrameEncoder::processRowEncoder(int
             curEncData.m_rowStat[row].sumQpAq += qp;
         }
         else
-            tld.analysis.setQP(*slice, slice->m_sliceQp);
+            tld.analysis.setLambdaFromQP(*slice, slice->m_sliceQp);
 
         if (m_param->bEnableWavefront && !col && row)
         {
diff -r 55eedcef3708 -r 4a7176bab742 source/encoder/search.cpp
--- a/source/encoder/search.cpp	Fri Apr 24 19:22:48 2015 +0530
+++ b/source/encoder/search.cpp	Fri Apr 24 16:07:42 2015 -0500
@@ -163,7 +163,7 @@ Search::~Search()
     X265_FREE(m_tsRecon);
 }
 
-void Search::setQP(const Slice& slice, int qp)
+void Search::setLambdaFromQP(const Slice& slice, int qp)
 {
     x265_emms(); /* TODO: if the lambda tables were ints, this would not be necessary */
     m_me.setQP(qp);
@@ -1888,7 +1888,7 @@ void Search::processPME(PME& pme, Search
     /* Setup slave Search instance for ME for master's CU */
     if (&slave != this)
     {
-        slave.setQP(*m_slice, m_rdCost.m_qp);
+        slave.setLambdaFromQP(*m_slice, m_rdCost.m_qp);
         slave.m_slice = m_slice;
         slave.m_frame = m_frame;
 
diff -r 55eedcef3708 -r 4a7176bab742 source/encoder/search.h
--- a/source/encoder/search.h	Fri Apr 24 19:22:48 2015 +0530
+++ b/source/encoder/search.h	Fri Apr 24 16:07:42 2015 -0500
@@ -287,7 +287,7 @@ public:
     ~Search();
 
     bool     initSearch(const x265_param& param, ScalingList& scalingList);
-    void     setQP(const Slice& slice, int qp);
+    void     setLambdaFromQP(const Slice& slice, int qp);
 
     // mark temp RD entropy contexts as uninitialized; useful for finding loads without stores
     void     invalidateContexts(int fromDepth);


More information about the x265-commits mailing list