[x265] [PATCH] add support for aq-motion even when aq-mode is disabled

gopi.satykrishna at multicorewareinc.com gopi.satykrishna at multicorewareinc.com
Tue Jan 24 13:25:25 CET 2017


# HG changeset patch
# User Gopi Satykrishna Akisetty <gopi.satykrishna at multicorewareinc.com>
# Date 1484910843 -19800
#      Fri Jan 20 16:44:03 2017 +0530
# Node ID ff0aaf4f49f442feab66ed0eb9353491cbba759f
# Parent  58dddcf01b7dbfd6aaa6858b5218e6166afe4def
add support for aq-motion even when aq-mode is disabled

diff -r 58dddcf01b7d -r ff0aaf4f49f4 source/common/frame.cpp
--- a/source/common/frame.cpp	Mon Jan 23 09:50:33 2017 +0530
+++ b/source/common/frame.cpp	Fri Jan 20 16:44:03 2017 +0530
@@ -56,7 +56,7 @@
     CHECKED_MALLOC_ZERO(m_rcData, RcStats, 1);
 
     if (m_fencPic->create(param->sourceWidth, param->sourceHeight, param->internalCsp) &&
-        m_lowres.create(m_fencPic, param->bframes, !!param->rc.aqMode, param->rc.qgSize))
+        m_lowres.create(m_fencPic, param->bframes, !!param->rc.aqMode || !!param->bAQMotion, param->rc.qgSize))
     {
         X265_CHECK((m_reconColCount == NULL), "m_reconColCount was initialized");
         m_numRows = (m_fencPic->m_picHeight + g_maxCUSize - 1)  / g_maxCUSize;
diff -r 58dddcf01b7d -r ff0aaf4f49f4 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Mon Jan 23 09:50:33 2017 +0530
+++ b/source/encoder/encoder.cpp	Fri Jan 20 16:44:03 2017 +0530
@@ -1817,7 +1817,7 @@
 {
     bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;
 
-    if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv))
+    if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv || m_param->bAQMotion))
     {
         pps->bUseDQP = true;
         pps->maxCuDQPDepth = g_log2Size[m_param->maxCUSize] - g_log2Size[m_param->rc.qgSize];
@@ -2137,19 +2137,13 @@
         x265_log(p, X265_LOG_WARNING, "--opt-cu-delta-qp disabled, requires RD level > 4\n");
     }
 
-    if (p->bAQMotion && !p->rc.aqMode)
-    {
-        p->bAQMotion = false;
-        x265_log(p, X265_LOG_WARNING, "--aq-motion disabled, requires aq mode to be on\n");
-    }
-
     if (p->limitTU && p->tuQTMaxInterDepth < 2)
     {
         p->limitTU = 0;
         x265_log(p, X265_LOG_WARNING, "limit-tu disabled, requires tu-inter-depth > 1\n");
     }
     bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;
-    if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv))
+    if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv || m_param->bAQMotion))
     {
         if (p->rc.qgSize < X265_MAX(8, p->minCUSize))
         {
diff -r 58dddcf01b7d -r ff0aaf4f49f4 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Mon Jan 23 09:50:33 2017 +0530
+++ b/source/encoder/ratecontrol.cpp	Fri Jan 20 16:44:03 2017 +0530
@@ -2521,7 +2521,7 @@
     int64_t actualBits = bits;
     Slice *slice = curEncData.m_slice;
 
-    if (m_param->rc.aqMode || m_isVbv)
+    if (m_param->rc.aqMode || m_isVbv || m_param->bAQMotion)
     {
         if (m_isVbv && !(m_2pass && m_param->rc.rateControlMode == X265_RC_CRF))
         {
@@ -2535,7 +2535,7 @@
             rce->qpaRc = curEncData.m_avgQpRc;
         }
 
-        if (m_param->rc.aqMode)
+        if (m_param->rc.aqMode || m_param->bAQMotion)
         {
             double avgQpAq = 0;
             /* determine actual avg encoded QP, after AQ/cutree adjustments */
diff -r 58dddcf01b7d -r ff0aaf4f49f4 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Mon Jan 23 09:50:33 2017 +0530
+++ b/source/encoder/slicetype.cpp	Fri Jan 20 16:44:03 2017 +0530
@@ -563,7 +563,7 @@
     m_lastKeyframe = -m_param->keyframeMax;
     m_sliceTypeBusy = false;
     m_fullQueueSize = X265_MAX(1, m_param->lookaheadDepth);
-    m_bAdaptiveQuant = m_param->rc.aqMode || m_param->bEnableWeightedPred || m_param->bEnableWeightedBiPred;
+    m_bAdaptiveQuant = m_param->rc.aqMode || m_param->bEnableWeightedPred || m_param->bEnableWeightedBiPred || m_param->bAQMotion;
 
     /* If we have a thread pool and are using --b-adapt 2, it is generally
      * preferable to perform all motion searches for each lowres frame in large
@@ -872,7 +872,7 @@
         uint32_t widthInLowresCu = (uint32_t)m_8x8Width, heightInLowresCu = (uint32_t)m_8x8Height;
         double *qp_offset = 0;
         /* Factor in qpoffsets based on Aq/Cutree in CU costs */
-        if (m_param->rc.aqMode)
+        if (m_param->rc.aqMode || m_param->bAQMotion)
             qp_offset = (frames[b]->sliceType == X265_TYPE_B || !m_param->rc.cuTree) ? frames[b]->qpAqOffset : frames[b]->qpCuTreeOffset;
 
         for (uint32_t row = 0; row < numCuInHeight; row++)
@@ -1266,7 +1266,7 @@
     CostEstimateGroup estGroup(*this, frames);
     int64_t cost = estGroup.singleCost(p0, p1, b);
 
-    if (m_param->rc.aqMode)
+    if (m_param->rc.aqMode || m_param->bAQMotion)
     {
         if (m_param->rc.cuTree)
             return frameCostRecalculate(frames, p0, p1, b);


More information about the x265-devel mailing list