changeset 12614:fdbd4e4a2aff

hist-scenecut: Fixes output change introduced by hist-scenecut in ultrafast mode. Output change was due to absence of non-I scenecut frames. Enabled the old flow for scenecut functions in lookahead so that non-I scenecut frames are present.
author Srikanth Kurapati
date Sat, 25 Jan 2020 18:08:03 +0530
parents 0aa6c346df23
children b11042b384af c2769ac5fa9d
files source/encoder/slicetype.cpp source/test/regression-tests.txt
diffstat 2 files changed, 10 insertions(+-), 9 deletions(-) [+]
line wrap: on
line diff
--- a/source/encoder/slicetype.cpp	Fri Jan 24 00:27:37 2020 +0530
+++ b/source/encoder/slicetype.cpp	Sat Jan 25 18:08:03 2020 +0530
@@ -1995,12 +1995,12 @@ void Lookahead::slicetypeAnalyse(Lowres 
     bool isScenecut = false;
 
     /* When scenecut threshold is set, use scenecut detection for I frame placements */
-    if (m_param->scenecutThreshold)
-         isScenecut = scenecut(frames, 0, 1, true, origNumFrames);
-    else if (m_param->bHistBasedSceneCut)
-         isScenecut = frames[1]->bScenecut;
-
-    if (isScenecut)
+    if (m_param->bHistBasedSceneCut)
+        isScenecut = frames[1]->bScenecut;
+    else
+        isScenecut = scenecut(frames, 0, 1, true, origNumFrames);
+
+    if (isScenecut && (m_param->bHistBasedSceneCut || m_param->scenecutThreshold))
     {
         frames[1]->sliceType = X265_TYPE_I;
         return;
@@ -2011,12 +2011,12 @@ void Lookahead::slicetypeAnalyse(Lowres 
         m_extendGopBoundary = false;
         for (int i = m_param->bframes + 1; i < origNumFrames; i += m_param->bframes + 1)
         {
-            if (m_param->scenecutThreshold)
+            if (!m_param->bHistBasedSceneCut)
                 scenecut(frames, i, i + 1, true, origNumFrames);
 
             for (int j = i + 1; j <= X265_MIN(i + m_param->bframes + 1, origNumFrames); j++)
             {
-                if (( m_param->scenecutThreshold && frames[j]->bScenecut && scenecutInternal(frames, j - 1, j, true)) || 
+                if ((!m_param->bHistBasedSceneCut && frames[j]->bScenecut && scenecutInternal(frames, j - 1, j, true)) || 
                     (m_param->bHistBasedSceneCut && frames[j]->bScenecut))
                     {
                         m_extendGopBoundary = true;
@@ -2126,7 +2126,7 @@ void Lookahead::slicetypeAnalyse(Lowres 
         {
             for (int j = 1; j < numBFrames + 1; j++)
             {
-                if ((m_param->scenecutThreshold && scenecut(frames, j, j + 1, false, origNumFrames)) ||
+                if ((!m_param->bHistBasedSceneCut && scenecut(frames, j, j + 1, false, origNumFrames)) ||
                     (m_param->bHistBasedSceneCut && frames[j + 1]->bScenecut) ||
                     (bForceRADL && (frames[j]->frameNum == preRADL)))
                     {
--- a/source/test/regression-tests.txt	Fri Jan 24 00:27:37 2020 +0530
+++ b/source/test/regression-tests.txt	Sat Jan 25 18:08:03 2020 +0530
@@ -161,6 +161,7 @@ Kimono1_1920x1080_24_400.yuv,--preset su
 Island_960x540_24.yuv,--no-cutree --aq-mode 0 --bitrate 6000 --scenecut-aware-qp
 sintel_trailer_2k_1920x1080_24.yuv, --preset medium --hist-scenecut --hist-threshold 0.02 --frame-dup --dup-threshold 60 --hrd --bitrate 10000 --vbv-bufsize 15000 --vbv-maxrate 12000
 sintel_trailer_2k_1920x1080_24.yuv, --preset medium --hist-scenecut --hist-threshold 0.02
+sintel_trailer_2k_1920x1080_24.yuv, --preset ultrafast --hist-scenecut --hist-threshold 0.02
 
 # Main12 intraCost overflow bug test
 720p50_parkrun_ter.y4m,--preset medium