# HG changeset patch
# User Srikanth Kurapati
# Date 1579955883 -19800
#      Sat Jan 25 18:08:03 2020 +0530
# Node ID 802600c8e5dcc1eff03725af6f399a72c09d24f6
# Parent  acc5d16999e2faf6e75ecc1df9a01c1953ebaf8c
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.

diff -r acc5d16999e2 -r 802600c8e5dc source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp      Mon Jan 20 18:07:59 2020 +0530
+++ b/source/encoder/slicetype.cpp      Sat Jan 25 18:08:03 2020 +0530
@@ -1995,12 +1995,12 @@
     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 @@
         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 @@
         {
             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)))
                     {
diff -r acc5d16999e2 -r 802600c8e5dc source/test/regression-tests.txt
--- a/source/test/regression-tests.txt  Mon Jan 20 18:07:59 2020 +0530
+++ b/source/test/regression-tests.txt  Sat Jan 25 18:08:03 2020 +0530
@@ -161,6 +161,7 @@
 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
# HG changeset patch
# User Srikanth Kurapati
# Date 1579955883 -19800
#      Sat Jan 25 18:08:03 2020 +0530
# Node ID 802600c8e5dcc1eff03725af6f399a72c09d24f6
# Parent  acc5d16999e2faf6e75ecc1df9a01c1953ebaf8c
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.

diff -r acc5d16999e2 -r 802600c8e5dc source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Mon Jan 20 18:07:59 2020 +0530
+++ b/source/encoder/slicetype.cpp	Sat Jan 25 18:08:03 2020 +0530
@@ -1995,12 +1995,12 @@
     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 @@
         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 @@
         {
             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)))
                     {
diff -r acc5d16999e2 -r 802600c8e5dc source/test/regression-tests.txt
--- a/source/test/regression-tests.txt	Mon Jan 20 18:07:59 2020 +0530
+++ b/source/test/regression-tests.txt	Sat Jan 25 18:08:03 2020 +0530
@@ -161,6 +161,7 @@
 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
_______________________________________________
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel

Reply via email to