<div dir="ltr">Pushed to master.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 30, 2021 at 5:05 PM Pooja Venkatesan <<a href="mailto:pooja@multicorewareinc.com">pooja@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">From d4f147e357b63012736591a6b5eb58540e19a983 Mon Sep 17 00:00:00 2001<br>From: Praveen Karadugattu <<a href="mailto:praveenkumar@multicorewareinc.com" target="_blank">praveenkumar@multicorewareinc.com</a>><br>Date: Sun, 20 Jun 2021 21:20:50 +0530<br>Subject: [PATCH] Disable fall-back on traditional scenecut algorithm with<br> --hist-scenecut<br><br>---<br> doc/reST/cli.rst                 | 10 ++++++++--<br> source/CMakeLists.txt            |  2 +-<br> source/common/param.cpp          |  9 ++++++++-<br> source/encoder/encoder.cpp       | 17 ++++++++++++-----<br> source/encoder/slicetype.cpp     | 15 ++++++++++-----<br> source/test/regression-tests.txt |  1 +<br> source/x265.h                    |  4 ++++<br> source/x265cli.h                 |  2 ++<br> 8 files changed, 46 insertions(+), 14 deletions(-)<br><br>diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst<br>index 4154221af..b24fa72a9 100755<br>--- a/doc/reST/cli.rst<br>+++ b/doc/reST/cli.rst<br>@@ -1470,7 +1470,8 @@ Slice decision options<br> .. option:: --hist-scenecut, --no-hist-scenecut<br> <br>       Indicates that scenecuts need to be detected using luma edge and chroma histograms.<br>-  :option:`--hist-scenecut` enables scenecut detection using the histograms and disables the default scene cut algorithm.<br>+      :option:`--hist-scenecut` enables scenecut detection using the histograms.<br>+   It also uses the intra and inter cost info to arrive at a scenecut decision from the default scenecut method.<br>        :option:`--no-hist-scenecut` disables histogram based scenecut algorithm.<br>    <br> .. option:: --hist-threshold <0.0..1.0><br>@@ -1480,7 +1481,12 @@ Slice decision options<br>     greater than 0.2 against the previous frame as scenecut. <br>    Increasing the threshold reduces the number of scenecuts detected.<br>   Default 0.03.<br>-        <br>+<br>+.. option:: --traditional-scenecut, --no-traditional-scenecut<br>+<br>+       Enable traditional scenecut detection using intra and inter cost when :option:`--hist-scenecut` is used.<br>+     Default enabled.<br>+<br> .. option:: --radl <integer><br>    <br>     Number of RADL pictures allowed infront of IDR. Requires closed gop interval.<br>diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt<br>index b4e57b592..f4a9cb793 100755<br>--- a/source/CMakeLists.txt<br>+++ b/source/CMakeLists.txt<br>@@ -29,7 +29,7 @@ option(NATIVE_BUILD "Target the build CPU" OFF)<br> option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)<br> mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)<br> # X265_BUILD must be incremented each time the public API is changed<br>-set(X265_BUILD 200)<br>+set(X265_BUILD 201)<br> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265.def.in" target="_blank">x265.def.in</a>"<br>                "${PROJECT_BINARY_DIR}/x265.def")<br> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in" target="_blank">x265_config.h.in</a>"<br>diff --git a/source/common/param.cpp b/source/common/param.cpp<br>index 8a27aaef3..6751e0aa7 100755<br>--- a/source/common/param.cpp<br>+++ b/source/common/param.cpp<br>@@ -172,6 +172,7 @@ void x265_param_default(x265_param* param)<br>     param->scenecutThreshold = 40; /* Magic number pulled in from x264 */<br>     param->edgeTransitionThreshold = 0.03;<br>     param->bHistBasedSceneCut = 0;<br>+    param->bEnableTradScdInHscd = 1;<br>     param->lookaheadSlices = 8;<br>     param->lookaheadThreads = 0;<br>     param->scenecutBias = 5.0;<br>@@ -598,6 +599,7 @@ int x265_param_default_preset(x265_param* param, const char* preset, const char*<br>             param->lookaheadDepth = 0;<br>             param->scenecutThreshold = 0;<br>             param->bHistBasedSceneCut = 0;<br>+            param->bEnableTradScdInHscd = 1;<br>             param->rc.cuTree = 0;<br>             param->frameNumThreads = 1;<br>         }<br>@@ -953,6 +955,7 @@ int x265_param_parse(x265_param* p, const char* name, const char* value)<br>            bError = false;<br>            p->scenecutThreshold = atoi(value);<br>            p->bHistBasedSceneCut = 0;<br>+           p->bEnableTradScdInHscd = 1;<br>        }<br>     }<br>     OPT("temporal-layers") p->bEnableTemporalSubLayers = atobool(value);<br>@@ -1234,6 +1237,7 @@ int x265_param_parse(x265_param* p, const char* name, const char* value)<br>             }<br>         }<br>         OPT("hist-threshold") p->edgeTransitionThreshold = atof(value);<br>+        OPT("traditional-scenecut") p->bEnableTradScdInHscd = atobool(value);<br>         OPT("rskip-edge-threshold") p->edgeVarThreshold = atoi(value)/100.0f;<br>         OPT("lookahead-threads") p->lookaheadThreads = atoi(value);<br>         OPT("opt-cu-delta-qp") p->bOptCUDeltaQP = atobool(value);<br>@@ -2151,7 +2155,9 @@ char *x265_param2string(x265_param* p, int padx, int pady)<br>     s += sprintf(s, " rc-lookahead=%d", p->lookaheadDepth);<br>     s += sprintf(s, " lookahead-slices=%d", p->lookaheadSlices);<br>     s += sprintf(s, " scenecut=%d", p->scenecutThreshold);<br>-    s += sprintf(s, " hist-scenecut=%d", p->bHistBasedSceneCut);<br>+    BOOL(p->bHistBasedSceneCut, "hist-scenecut");<br>+    if (p->bHistBasedSceneCut)<br>+        BOOL(p->bEnableTradScdInHscd, "traditional-scenecut");<br>     s += sprintf(s, " radl=%d", p->radl);<br>     BOOL(p->bEnableHRDConcatFlag, "splice");<br>     BOOL(p->bIntraRefresh, "intra-refresh");<br>@@ -2467,6 +2473,7 @@ void x265_copy_params(x265_param* dst, x265_param* src)<br>     dst->lookaheadThreads = src->lookaheadThreads;<br>     dst->scenecutThreshold = src->scenecutThreshold;<br>     dst->bHistBasedSceneCut = src->bHistBasedSceneCut;<br>+    dst->bEnableTradScdInHscd = src->bEnableTradScdInHscd;<br>     dst->bIntraRefresh = src->bIntraRefresh;<br>     dst->maxCUSize = src->maxCUSize;<br>     dst->minCUSize = src->minCUSize;<br>diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>index c1e1cb46d..c079e94c4 100644<br>--- a/source/encoder/encoder.cpp<br>+++ b/source/encoder/encoder.cpp<br>@@ -3680,6 +3680,7 @@ void Encoder::configure(x265_param *p)<br>         p->keyframeMax = INT_MAX;<br>         p->scenecutThreshold = 0;<br>         p->bHistBasedSceneCut = 0;<br>+        p->bEnableTradScdInHscd = 1;<br>     }<br>     else if (p->keyframeMax <= 1)<br>     {<br>@@ -3694,6 +3695,7 @@ void Encoder::configure(x265_param *p)<br>         p->bframes = 0;<br>         p->scenecutThreshold = 0;<br>         p->bHistBasedSceneCut = 0;<br>+        p->bEnableTradScdInHscd = 1;<br>         p->bFrameAdaptive = 0;<br>         p->rc.cuTree = 0;<br>         p->bEnableWeightedPred = 0;<br>@@ -4421,12 +4423,17 @@ void Encoder::configure(x265_param *p)<br>             m_param->searchRange = m_param->hmeRange[2];<br>     }<br> <br>-   if (p->bHistBasedSceneCut && !p->edgeTransitionThreshold)<br>-   {<br>-       p->edgeTransitionThreshold = 0.03;<br>-       x265_log(p, X265_LOG_WARNING, "using  default threshold %.2lf for scene cut detection\n", p->edgeTransitionThreshold);<br>-   }<br>+    if (p->bHistBasedSceneCut && !p->edgeTransitionThreshold)<br>+    {<br>+        p->edgeTransitionThreshold = 0.03;<br>+        x265_log(p, X265_LOG_WARNING, "using  default threshold %.2lf for scene cut detection.\n", p->edgeTransitionThreshold);<br>+    }<br> <br>+    if (!p->bHistBasedSceneCut && !p->bEnableTradScdInHscd)<br>+    {<br>+        p->bEnableTradScdInHscd = 1;<br>+        x265_log(p, X265_LOG_WARNING, "option --no-traditional-scenecut requires --hist-scenecut to be enabled.\n");<br>+    }<br> }<br> <br> void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x265_picture* picIn, int paramBytes)<br>diff --git a/source/encoder/slicetype.cpp b/source/encoder/slicetype.cpp<br>index 0adb0d0db..e77f0ac70 100644<br>--- a/source/encoder/slicetype.cpp<br>+++ b/source/encoder/slicetype.cpp<br>@@ -2014,7 +2014,7 @@ void Lookahead::slicetypeAnalyse(Lowres **frames, bool bKeyframe)<br>     bool isScenecut = false;<br> <br>     /* Temporal computations for scenecut detection */<br>-    if (m_param->bHistBasedSceneCut)<br>+    if (m_param->bHistBasedSceneCut && m_param->bEnableTradScdInHscd)<br>     {<br>         for (int i = numFrames - 1; i > 0; i--)<br>         {<br>@@ -2047,8 +2047,10 @@ void Lookahead::slicetypeAnalyse(Lowres **frames, bool bKeyframe)<br>     }<br> <br>     /* When scenecut threshold is set, use scenecut detection for I frame placements */<br>-    if (!m_param->bHistBasedSceneCut || (m_param->bHistBasedSceneCut && frames[1]->bScenecut))<br>+    if (!m_param->bHistBasedSceneCut || (m_param->bHistBasedSceneCut && m_param->bEnableTradScdInHscd && frames[1]->bScenecut))<br>         isScenecut = scenecut(frames, 0, 1, true, origNumFrames);<br>+    else if (m_param->bHistBasedSceneCut && frames[1]->bScenecut)<br>+        isScenecut = true;<br> <br>     if (isScenecut && (m_param->bHistBasedSceneCut || m_param->scenecutThreshold))<br>     {<br>@@ -2061,14 +2063,17 @@ void Lookahead::slicetypeAnalyse(Lowres **frames, bool bKeyframe)<br>         m_extendGopBoundary = false;<br>         for (int i = m_param->bframes + 1; i < origNumFrames; i += m_param->bframes + 1)<br>         {<br>-            if (!m_param->bHistBasedSceneCut || (m_param->bHistBasedSceneCut && frames[i + 1]->bScenecut))<br>+            if (!m_param->bHistBasedSceneCut || (m_param->bHistBasedSceneCut && m_param->bEnableTradScdInHscd && frames[i + 1]->bScenecut))<br>                 scenecut(frames, i, i + 1, true, origNumFrames);<br> <br>             for (int j = i + 1; j <= X265_MIN(i + m_param->bframes + 1, origNumFrames); j++)<br>             {<br>-                if (frames[j]->bScenecut && scenecutInternal(frames, j - 1, j, true))<br>+                if (frames[j]->bScenecut)<br>                 {<br>-                    m_extendGopBoundary = true;<br>+                    if (m_param->bEnableTradScdInHscd)<br>+                        m_extendGopBoundary = scenecutInternal(frames, j - 1, j, true);<br>+                    else<br>+                        m_extendGopBoundary = true;<br>                     break;<br>                 }<br>             }<br>diff --git a/source/test/regression-tests.txt b/source/test/regression-tests.txt<br>index 971c854df..26d43b28a 100644<br>--- a/source/test/regression-tests.txt<br>+++ b/source/test/regression-tests.txt<br>@@ -160,6 +160,7 @@ Traffic_4096x2048_30p.y4m, --preset medium --frame-dup --dup-threshold 60 --hrd<br> Kimono1_1920x1080_24_400.yuv,--preset superfast --qp 28 --zones 0,139,q=32<br> 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<br> sintel_trailer_2k_1920x1080_24.yuv, --preset medium --hist-scenecut --hist-threshold 0.02<br>+sintel_trailer_2k_1920x1080_24.yuv, --preset medium --hist-scenecut --hist-threshold 0.02 --no-traditional-scenecut<br> sintel_trailer_2k_1920x1080_24.yuv, --preset ultrafast --hist-scenecut --hist-threshold 0.02<br> crowd_run_1920x1080_50.yuv, --preset faster --ctu 32 --rskip 2 --rskip-edge-threshold 5<br> crowd_run_1920x1080_50.yuv, --preset fast --ctu 64 --rskip 2 --rskip-edge-threshold 5 --aq-mode 4<br>diff --git a/source/x265.h b/source/x265.h<br>index 324f3163f..3f3133536 100644<br>--- a/source/x265.h<br>+++ b/source/x265.h<br>@@ -1963,6 +1963,10 @@ typedef struct x265_param<br>     /* Flag indicating whether the encoder should emit an End of Sequence<br>      * NAL at the end of every Coded Video Sequence. Default false */<br>     int      bEnableEndOfSequence;<br>+<br>+    /* Flag to turn on/off traditional scenecut detection in histogram based scenecut detection.<br>+     * When false, only spatial properties are used for scenecut detection. Default true */<br>+    int      bEnableTradScdInHscd;<br> } x265_param;<br> <br> /* x265_param_alloc:<br>diff --git a/source/x265cli.h b/source/x265cli.h<br>index 46a2b68ae..8fcf37b8a 100644<br>--- a/source/x265cli.h<br>+++ b/source/x265cli.h<br>@@ -144,6 +144,8 @@ static const struct option long_options[] =<br>     { "hist-scenecut",        no_argument, NULL, 0},<br>     { "no-hist-scenecut",     no_argument, NULL, 0},<br>     { "hist-threshold", required_argument, NULL, 0},<br>+    { "traditional-scenecut", no_argument, NULL, 0},<br>+    { "no-traditional-scenecut", no_argument, NULL, 0},<br>     { "fades",                no_argument, NULL, 0 },<br>     { "no-fades",             no_argument, NULL, 0 },<br>     { "scenecut-aware-qp", required_argument, NULL, 0 },<br>-- <br>2.24.0.windows.2<br><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 30, 2021 at 3:24 PM Pooja Venkatesan <<a href="mailto:pooja@multicorewareinc.com" target="_blank">pooja@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 30, 2021 at 2:18 PM Aruna Matheswaran <<a href="mailto:aruna@multicorewareinc.com" target="_blank">aruna@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 24, 2021 at 2:18 PM Pooja Venkatesan <<a href="mailto:pooja@multicorewareinc.com" target="_blank">pooja@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">From f6c1b86d99ab3a0dd57204f930e526a07e28fed7 Mon Sep 17 00:00:00 2001<br>From: Praveen Karadugattu <<a href="mailto:praveenkumar@multicorewareinc.com" target="_blank">praveenkumar@multicorewareinc.com</a>><br>Date: Sun, 20 Jun 2021 21:20:50 +0530<br>Subject: [PATCH] Disable fall-back on traditional scenecut algorithm with<br> --hist-scenecut<br><br>---<br> doc/reST/cli.rst                 |  9 +++++++--<br> source/CMakeLists.txt            |  2 +-<br> source/common/param.cpp          |  8 +++++++-<br> source/encoder/encoder.cpp       | 17 ++++++++++++-----<br> source/encoder/slicetype.cpp     | 15 ++++++++++-----<br> source/test/regression-tests.txt |  1 +<br> source/x265.h                    |  4 ++++<br> source/x265cli.h                 |  1 +<br> 8 files changed, 43 insertions(+), 14 deletions(-)<br><br>diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst<br>index 4154221af..280b734b3 100755<br>--- a/doc/reST/cli.rst<br>+++ b/doc/reST/cli.rst<br>@@ -1470,7 +1470,8 @@ Slice decision options<br> .. option:: --hist-scenecut, --no-hist-scenecut<br> <br>       Indicates that scenecuts need to be detected using luma edge and chroma histograms.<br>-  :option:`--hist-scenecut` enables scenecut detection using the histograms and disables the default scene cut algorithm.<br>+      :option:`--hist-scenecut` enables scenecut detection using the histograms.<br>+   It also uses the intra and inter cost info to arrive at a scenecut decision from the default scenecut method.<br>        :option:`--no-hist-scenecut` disables histogram based scenecut algorithm.<br>    <br> .. option:: --hist-threshold <0.0..1.0><br>@@ -1480,7 +1481,11 @@ Slice decision options<br>     greater than 0.2 against the previous frame as scenecut. <br>    Increasing the threshold reduces the number of scenecuts detected.<br>   Default 0.03.<br>-        <br>+<br>+.. option:: --disable-traditional-scenecut<br>+<br>+  Indicates that the usage of traditional scenecut detection using intra and inter cost should be disabled when :option:`--hist-scenecut` is used.<br>+<br> .. option:: --radl <integer><br>    <br>     Number of RADL pictures allowed infront of IDR. Requires closed gop interval.<br>diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt<br>index b4e57b592..f4a9cb793 100755<br>--- a/source/CMakeLists.txt<br>+++ b/source/CMakeLists.txt<br>@@ -29,7 +29,7 @@ option(NATIVE_BUILD "Target the build CPU" OFF)<br> option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)<br> mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)<br> # X265_BUILD must be incremented each time the public API is changed<br>-set(X265_BUILD 200)<br>+set(X265_BUILD 201)<br> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265.def.in" target="_blank">x265.def.in</a>"<br>                "${PROJECT_BINARY_DIR}/x265.def")<br> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in" target="_blank">x265_config.h.in</a>"<br>diff --git a/source/common/param.cpp b/source/common/param.cpp<br>index 8a27aaef3..3b84415c3 100755<br>--- a/source/common/param.cpp<br>+++ b/source/common/param.cpp<br>@@ -172,6 +172,7 @@ void x265_param_default(x265_param* param)<br>     param->scenecutThreshold = 40; /* Magic number pulled in from x264 */<br>     param->edgeTransitionThreshold = 0.03;<br>     param->bHistBasedSceneCut = 0;<br>+    param->bDisableTradScdInHscd = 0;<br>     param->lookaheadSlices = 8;<br>     param->lookaheadThreads = 0;<br>     param->scenecutBias = 5.0;<br>@@ -598,6 +599,7 @@ int x265_param_default_preset(x265_param* param, const char* preset, const char*<br>             param->lookaheadDepth = 0;<br>             param->scenecutThreshold = 0;<br>             param->bHistBasedSceneCut = 0;<br>+            param->bDisableTradScdInHscd = 0;<br>             param->rc.cuTree = 0;<br>             param->frameNumThreads = 1;<br>         }<br>@@ -953,6 +955,7 @@ int x265_param_parse(x265_param* p, const char* name, const char* value)<br>            bError = false;<br>            p->scenecutThreshold = atoi(value);<br>            p->bHistBasedSceneCut = 0;<br>+           p->bDisableTradScdInHscd = 0;<br>        }<br>     }<br>     OPT("temporal-layers") p->bEnableTemporalSubLayers = atobool(value);<br>@@ -1234,6 +1237,7 @@ int x265_param_parse(x265_param* p, const char* name, const char* value)<br>             }<br>         }<br>         OPT("hist-threshold") p->edgeTransitionThreshold = atof(value);<br>+        OPT("disable-traditional-scenecut") p->bDisableTradScdInHscd = atobool(value);<br>         OPT("rskip-edge-threshold") p->edgeVarThreshold = atoi(value)/100.0f;<br>         OPT("lookahead-threads") p->lookaheadThreads = atoi(value);<br>         OPT("opt-cu-delta-qp") p->bOptCUDeltaQP = atobool(value);<br>@@ -2151,7 +2155,8 @@ char *x265_param2string(x265_param* p, int padx, int pady)<br>     s += sprintf(s, " rc-lookahead=%d", p->lookaheadDepth);<br>     s += sprintf(s, " lookahead-slices=%d", p->lookaheadSlices);<br>     s += sprintf(s, " scenecut=%d", p->scenecutThreshold);<br>-    s += sprintf(s, " hist-scenecut=%d", p->bHistBasedSceneCut);<br>+    BOOL(p->bHistBasedSceneCut, "hist-scenecut");<br>+    BOOL(p->bDisableTradScdInHscd, "disable-traditional-scenecut");<br></div></blockquote><div>[AM] This will add invalid CLI option "no-disable-traditional-scenecut" to info-sei. Please fix this.</div></div></div></blockquote><div>[PV] Will modify CLI to take both options to enable/disable traditional scene cut and resend the patch. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">     s += sprintf(s, " radl=%d", p->radl);<br>     BOOL(p->bEnableHRDConcatFlag, "splice");<br>     BOOL(p->bIntraRefresh, "intra-refresh");<br>@@ -2467,6 +2472,7 @@ void x265_copy_params(x265_param* dst, x265_param* src)<br>     dst->lookaheadThreads = src->lookaheadThreads;<br>     dst->scenecutThreshold = src->scenecutThreshold;<br>     dst->bHistBasedSceneCut = src->bHistBasedSceneCut;<br>+    dst->bDisableTradScdInHscd = src->bDisableTradScdInHscd;<br>     dst->bIntraRefresh = src->bIntraRefresh;<br>     dst->maxCUSize = src->maxCUSize;<br>     dst->minCUSize = src->minCUSize;<br>diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>index c1e1cb46d..dfb872889 100644<br>--- a/source/encoder/encoder.cpp<br>+++ b/source/encoder/encoder.cpp<br>@@ -3680,6 +3680,7 @@ void Encoder::configure(x265_param *p)<br>         p->keyframeMax = INT_MAX;<br>         p->scenecutThreshold = 0;<br>         p->bHistBasedSceneCut = 0;<br>+        p->bDisableTradScdInHscd = 0;<br>     }<br>     else if (p->keyframeMax <= 1)<br>     {<br>@@ -3694,6 +3695,7 @@ void Encoder::configure(x265_param *p)<br>         p->bframes = 0;<br>         p->scenecutThreshold = 0;<br>         p->bHistBasedSceneCut = 0;<br>+        p->bDisableTradScdInHscd = 0;<br>         p->bFrameAdaptive = 0;<br>         p->rc.cuTree = 0;<br>         p->bEnableWeightedPred = 0;<br>@@ -4421,12 +4423,17 @@ void Encoder::configure(x265_param *p)<br>             m_param->searchRange = m_param->hmeRange[2];<br>     }<br> <br>-   if (p->bHistBasedSceneCut && !p->edgeTransitionThreshold)<br>-   {<br>-       p->edgeTransitionThreshold = 0.03;<br>-       x265_log(p, X265_LOG_WARNING, "using  default threshold %.2lf for scene cut detection\n", p->edgeTransitionThreshold);<br>-   }<br>+    if (p->bHistBasedSceneCut && !p->edgeTransitionThreshold)<br>+    {<br>+        p->edgeTransitionThreshold = 0.03;<br>+        x265_log(p, X265_LOG_WARNING, "using  default threshold %.2lf for scene cut detection.\n", p->edgeTransitionThreshold);<br>+    }<br> <br>+    if (!p->bHistBasedSceneCut && p->bDisableTradScdInHscd)<br>+    {<br>+        p->bDisableTradScdInHscd = 0;<br>+        x265_log(p, X265_LOG_WARNING, "option --disable-traditional-scenecut requires --hist-scenecut to be enabled.\n");<br>+    }<br> }<br> <br> void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x265_picture* picIn, int paramBytes)<br>diff --git a/source/encoder/slicetype.cpp b/source/encoder/slicetype.cpp<br>index 0adb0d0db..ace3b5469 100644<br>--- a/source/encoder/slicetype.cpp<br>+++ b/source/encoder/slicetype.cpp<br>@@ -2014,7 +2014,7 @@ void Lookahead::slicetypeAnalyse(Lowres **frames, bool bKeyframe)<br>     bool isScenecut = false;<br> <br>     /* Temporal computations for scenecut detection */<br>-    if (m_param->bHistBasedSceneCut)<br>+    if (m_param->bHistBasedSceneCut && !m_param->bDisableTradScdInHscd)<br>     {<br>         for (int i = numFrames - 1; i > 0; i--)<br>         {<br>@@ -2047,8 +2047,10 @@ void Lookahead::slicetypeAnalyse(Lowres **frames, bool bKeyframe)<br>     }<br> <br>     /* When scenecut threshold is set, use scenecut detection for I frame placements */<br>-    if (!m_param->bHistBasedSceneCut || (m_param->bHistBasedSceneCut && frames[1]->bScenecut))<br>+    if (!m_param->bHistBasedSceneCut || (m_param->bHistBasedSceneCut && !m_param->bDisableTradScdInHscd && frames[1]->bScenecut))<br>         isScenecut = scenecut(frames, 0, 1, true, origNumFrames);<br>+    else if (m_param->bHistBasedSceneCut && frames[1]->bScenecut)<br>+        isScenecut = true;<br> <br>     if (isScenecut && (m_param->bHistBasedSceneCut || m_param->scenecutThreshold))<br>     {<br>@@ -2061,14 +2063,17 @@ void Lookahead::slicetypeAnalyse(Lowres **frames, bool bKeyframe)<br>         m_extendGopBoundary = false;<br>         for (int i = m_param->bframes + 1; i < origNumFrames; i += m_param->bframes + 1)<br>         {<br>-            if (!m_param->bHistBasedSceneCut || (m_param->bHistBasedSceneCut && frames[i + 1]->bScenecut))<br>+            if (!m_param->bHistBasedSceneCut || (m_param->bHistBasedSceneCut && !m_param->bDisableTradScdInHscd && frames[i + 1]->bScenecut))<br>                 scenecut(frames, i, i + 1, true, origNumFrames);<br> <br>             for (int j = i + 1; j <= X265_MIN(i + m_param->bframes + 1, origNumFrames); j++)<br>             {<br>-                if (frames[j]->bScenecut && scenecutInternal(frames, j - 1, j, true))<br>+                if (frames[j]->bScenecut)<br>                 {<br>-                    m_extendGopBoundary = true;<br>+                    if (!m_param->bDisableTradScdInHscd)<br>+                        m_extendGopBoundary = scenecutInternal(frames, j - 1, j, true);<br>+                    else<br>+                        m_extendGopBoundary = true;<br>                     break;<br>                 }<br>             }<br>diff --git a/source/test/regression-tests.txt b/source/test/regression-tests.txt<br>index 971c854df..828157cab 100644<br>--- a/source/test/regression-tests.txt<br>+++ b/source/test/regression-tests.txt<br>@@ -160,6 +160,7 @@ Traffic_4096x2048_30p.y4m, --preset medium --frame-dup --dup-threshold 60 --hrd<br> Kimono1_1920x1080_24_400.yuv,--preset superfast --qp 28 --zones 0,139,q=32<br> 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<br> sintel_trailer_2k_1920x1080_24.yuv, --preset medium --hist-scenecut --hist-threshold 0.02<br>+sintel_trailer_2k_1920x1080_24.yuv, --preset medium --hist-scenecut --hist-threshold 0.02 --disable-traditional-scenecut<br> sintel_trailer_2k_1920x1080_24.yuv, --preset ultrafast --hist-scenecut --hist-threshold 0.02<br> crowd_run_1920x1080_50.yuv, --preset faster --ctu 32 --rskip 2 --rskip-edge-threshold 5<br> crowd_run_1920x1080_50.yuv, --preset fast --ctu 64 --rskip 2 --rskip-edge-threshold 5 --aq-mode 4<br>diff --git a/source/x265.h b/source/x265.h<br>index 324f3163f..3a65fdda6 100644<br>--- a/source/x265.h<br>+++ b/source/x265.h<br>@@ -1963,6 +1963,10 @@ typedef struct x265_param<br>     /* Flag indicating whether the encoder should emit an End of Sequence<br>      * NAL at the end of every Coded Video Sequence. Default false */<br>     int      bEnableEndOfSequence;<br>+<br>+    /* Flag to turn off traditional scenecut detection in histogram based scenecut detection so that<br>+     * only spatial properties are used for scenecut detection. Default false */<br>+    int      bDisableTradScdInHscd;<br> } x265_param;<br> <br> /* x265_param_alloc:<br>diff --git a/source/x265cli.h b/source/x265cli.h<br>index 46a2b68ae..86136fbfb 100644<br>--- a/source/x265cli.h<br>+++ b/source/x265cli.h<br>@@ -144,6 +144,7 @@ static const struct option long_options[] =<br>     { "hist-scenecut",        no_argument, NULL, 0},<br>     { "no-hist-scenecut",     no_argument, NULL, 0},<br>     { "hist-threshold", required_argument, NULL, 0},<br>+    { "disable-traditional-scenecut", no_argument, NULL, 0},<br>     { "fades",                no_argument, NULL, 0 },<br>     { "no-fades",             no_argument, NULL, 0 },<br>     { "scenecut-aware-qp", required_argument, NULL, 0 },<br>-- <br>2.24.0.windows.2<br><br><div><div dir="ltr"><div dir="ltr"><font color="#073763">Regards, <br><b>Pooja Venkatesan</b>, <br>Video Codec Engineer, <br>Media & AI analytics BU</font><br><font size="1"><img src="https://docs.google.com/uc?export=download&id=1d95Qlxmd7GpR09YzmNH0gdIVV6O9kvWD&revid=0B0mq5CBCJeT-Uk04LzZtMkJob0dUMTFsTjlkSzlQQkhFaTIwPQ" width="143" height="20" style="margin-right: 0px;"></font><br></div></div></div></div>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="georgia, serif">Regards,</font><div><b><font face="georgia, serif">Aruna Matheswaran,</font></b></div><div><font face="georgia, serif">Video Codec Engineer,</font></div><div><font face="georgia, serif">Media & AI analytics BU,</font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" width="96" height="36" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><font face="georgia, serif"><br></font></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div></div>
</blockquote></div>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="georgia, serif">Regards,</font><div><b><font face="georgia, serif">Aruna Matheswaran,</font></b></div><div><font face="georgia, serif">Video Codec Engineer,</font></div><div><font face="georgia, serif">Media & AI analytics BU,</font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" width="96" height="36" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><font face="georgia, serif"><br></font></div></div></div></div></div></div></div></div></div>