[x265] [PATCH] Fix artifacts issue in multi-pass-opt-distortion with VBV

aruna at multicorewareinc.com aruna at multicorewareinc.com
Tue Mar 28 16:05:08 CEST 2017


# HG changeset patch
# User Aruna Matheswaran <aruna at multicorewareinc.com>
# Date 1490598320 -19800
#      Mon Mar 27 12:35:20 2017 +0530
# Node ID 00f86c2423236d358fb38641abbe9edaeb525f5b
# Parent  6e1edafd6dc767ae84c93bca2ff9711f38056e08
Fix artifacts issue in multi-pass-opt-distortion with VBV

diff -r 6e1edafd6dc7 -r 00f86c242323 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Mon Mar 27 10:30:49 2017 +0530
+++ b/source/encoder/analysis.cpp	Mon Mar 27 12:35:20 2017 +0530
@@ -2942,6 +2942,15 @@
 {
     FrameData& curEncData = *m_frame->m_encData;
     double qp = baseQp >= 0 ? baseQp : curEncData.m_cuStat[ctu.m_cuAddr].baseQp;
+
+    if (m_param->analysisMultiPassDistortion && m_param->rc.bStatRead)
+    {
+        m_multipassAnalysis = (analysis2PassFrameData*)m_frame->m_analysis2Pass.analysisFramedata;
+        if ((m_multipassAnalysis->threshold[ctu.m_cuAddr] < 0.9 || m_multipassAnalysis->threshold[ctu.m_cuAddr] > 1.1)
+            && m_multipassAnalysis->highDistortionCtuCount && m_multipassAnalysis->lowDistortionCtuCount)
+            qp += m_multipassAnalysis->offset[ctu.m_cuAddr];
+    }
+
     int loopIncr;
     if (m_param->rc.qgSize == 8)
         loopIncr = 8;
diff -r 6e1edafd6dc7 -r 00f86c242323 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Mon Mar 27 10:30:49 2017 +0530
+++ b/source/encoder/frameencoder.cpp	Mon Mar 27 12:35:20 2017 +0530
@@ -1335,10 +1335,6 @@
             rowCoder.copyState(m_initSliceContext);
             rowCoder.loadContexts(m_rows[row - 1].bufferedEntropy);
         }
-        analysis2PassFrameData* analysisFrameData = (analysis2PassFrameData*)(m_frame->m_analysis2Pass).analysisFramedata;
-        if (analysisFrameData && m_param->rc.bStatRead && m_param->analysisMultiPassDistortion && (analysisFrameData->threshold[cuAddr] < 0.9 || analysisFrameData->threshold[cuAddr] > 1.1)
-            && analysisFrameData->highDistortionCtuCount && analysisFrameData->lowDistortionCtuCount)
-            curEncData.m_cuStat[cuAddr].baseQp += analysisFrameData->offset[cuAddr];
 
         if (m_param->dynamicRd && (int32_t)(m_rce.qpaRc - m_rce.qpNoVbv) > 0)
             ctu->m_vbvAffected = true;


More information about the x265-devel mailing list