changeset 12647:75fa5a7636b7 Release_3.3

Fix bug in frame-dup +- multi pass
author Akil Ayyappan R <akil@multicorewareinc.com>
date Thu, 30 Apr 2020 15:01:09 +0530
parents d2496437286a
children 87b405d142ae
files source/encoder/encoder.cpp source/encoder/ratecontrol.cpp source/x265.h
diffstat 3 files changed, 4 insertions(+-), 1 deletions(-) [+]
line wrap: on
line diff
--- a/source/encoder/encoder.cpp	Tue Mar 17 13:01:14 2020 +0530
+++ b/source/encoder/encoder.cpp	Thu Apr 30 15:01:09 2020 +0530
@@ -5039,6 +5039,7 @@ int Encoder::validateAnalysisData(x265_a
     X265_PARAM_VALIDATE(saveParam->chunkEnd, sizeof(int), 1, &m_param->chunkEnd, chunk-end);
     X265_PARAM_VALIDATE(saveParam->cuTree,sizeof(int),1,&m_param->rc.cuTree, cutree - offset);
     X265_PARAM_VALIDATE(saveParam->ctuDistortionRefine, sizeof(int), 1, &m_param->ctuDistortionRefine, ctu - distortion);
+    X265_PARAM_VALIDATE(saveParam->frameDuplication, sizeof(int), 1, &m_param->bEnableFrameDuplication, frame - dup);
 
     int sourceHeight, sourceWidth;
     if (writeFlag)
--- a/source/encoder/ratecontrol.cpp	Tue Mar 17 13:01:14 2020 +0530
+++ b/source/encoder/ratecontrol.cpp	Thu Apr 30 15:01:09 2020 +0530
@@ -509,6 +509,7 @@ bool RateControl::init(const SPS& sps)
                 CMP_OPT_FIRST_PASS(" keyint", m_param->keyframeMax);
                 CMP_OPT_FIRST_PASS("scenecut", m_param->scenecutThreshold);
                 CMP_OPT_FIRST_PASS("intra-refresh", m_param->bIntraRefresh);
+                CMP_OPT_FIRST_PASS("frame-dup", m_param->bEnableFrameDuplication);
                 if (m_param->bMultiPassOptRPS)
                 {
                     CMP_OPT_FIRST_PASS("multi-pass-opt-rps", m_param->bMultiPassOptRPS);
@@ -546,7 +547,7 @@ bool RateControl::init(const SPS& sps)
                 x265_log(m_param, X265_LOG_WARNING, "2nd pass has fewer frames than 1st pass (%d vs %d)\n",
                          m_param->totalFrames, m_numEntries);
             }
-            if (m_param->totalFrames > m_numEntries)
+            if (m_param->totalFrames > m_numEntries && !m_param->bEnableFrameDuplication)
             {
                 x265_log(m_param, X265_LOG_ERROR, "2nd pass has more frames than 1st pass (%d vs %d)\n",
                          m_param->totalFrames, m_numEntries);
--- a/source/x265.h	Tue Mar 17 13:01:14 2020 +0530
+++ b/source/x265.h	Thu Apr 30 15:01:09 2020 +0530
@@ -134,6 +134,7 @@ typedef struct x265_analysis_validate
     int     ctuDistortionRefine;
     int     rightOffset;
     int     bottomOffset;
+    int     frameDuplication;
 }x265_analysis_validate;
 
 /* Stores intra analysis data for a single frame. This struct needs better packing */