On Fri, Oct 21, 2016 at 3:45 PM, <[email protected]> wrote:
> # HG changeset patch > # User Gopi Satykrishna Akisetty <[email protected]> > # Date 1477033375 -19800 > # Fri Oct 21 12:32:55 2016 +0530 > # Node ID 51a81cb49d988b890040a4e8254b3159258ae89e > # Parent 0e9e5264054606a38a3fe6c87272a1737b340b1a > slicetype: Add bias used in scenecut detection as param option. > > diff -r 0e9e52640546 -r 51a81cb49d98 doc/reST/cli.rst > --- a/doc/reST/cli.rst Wed Oct 12 17:58:49 2016 +0530 > +++ b/doc/reST/cli.rst Fri Oct 21 12:32:55 2016 +0530 > @@ -1163,6 +1163,13 @@ > :option:`--scenecut` 0 or :option:`--no-scenecut` disables adaptive > I frame placement. Default 40 > > +.. option:: --bias-for-scenecut <5..10.0> > + > + This value represents the percentage difference between the inter > cost and > + intra cost of a frame used in scenecut detection. For example, a > value of 5 indicates, > + if the inter cost of a frame is greater than or equal to 95 > percent of the intra cost of the frame, > + then detect this frame as scenecut. Default 5. > + > Why not expose the range as 0..100 so that the user has the option of being more aggressive wrt scenecut decisions? > .. option:: --intra-refresh > > Enables Periodic Intra Refresh(PIR) instead of keyframe insertion. > diff -r 0e9e52640546 -r 51a81cb49d98 source/CMakeLists.txt > --- a/source/CMakeLists.txt Wed Oct 12 17:58:49 2016 +0530 > +++ b/source/CMakeLists.txt Fri Oct 21 12:32:55 2016 +0530 > @@ -30,7 +30,7 @@ > mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD) > > # X265_BUILD must be incremented each time the public API is changed > -set(X265_BUILD 98) > +set(X265_BUILD 99) > configure_file("${PROJECT_SOURCE_DIR}/x265.def.in" > "${PROJECT_BINARY_DIR}/x265.def") > configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in" > diff -r 0e9e52640546 -r 51a81cb49d98 source/common/param.cpp > --- a/source/common/param.cpp Wed Oct 12 17:58:49 2016 +0530 > +++ b/source/common/param.cpp Fri Oct 21 12:32:55 2016 +0530 > @@ -149,6 +149,7 @@ > param->bBPyramid = 1; > param->scenecutThreshold = 40; /* Magic number pulled in from x264 */ > param->lookaheadSlices = 8; > + param->bBiasForScenecut = 5.0; > > /* Intra Coding Tools */ > param->bEnableConstrainedIntra = 0; > @@ -915,6 +916,7 @@ > OPT("limit-tu") p->limitTU = atoi(value); > OPT("opt-qp-pps") p->bOptQpPPS = atobool(value); > OPT("opt-ref-list-length-pps") p->bOptRefListLengthPPS = > atobool(value); > + OPT("bias-for-scenecut") p->bBiasForScenecut = atof(value); > else > return X265_PARAM_BAD_NAME; > } > @@ -1217,6 +1219,8 @@ > "Valid Logging level -1:none 0:error 1:warning 2:info 3:debug > 4:full"); > CHECK(param->scenecutThreshold < 0, > "scenecutThreshold must be greater than 0"); > + CHECK(param->bBiasForScenecut < 5 || 10 < param->bBiasForScenecut, > + "bias-for-scenecut must be between 5 and 10"); > Check will have to change based on proposed new range. CHECK(param->rdPenalty < 0 || param->rdPenalty > 2, > "Valid penalty for 32x32 intra TU in non-I slices. 0:disabled > 1:RD-penalty 2:maximum"); > CHECK(param->keyframeMax < -1, > @@ -1467,6 +1471,7 @@ > s += sprintf(s, " keyint=%d", p->keyframeMax); > s += sprintf(s, " min-keyint=%d", p->keyframeMin); > s += sprintf(s, " scenecut=%d", p->scenecutThreshold); > + s += sprintf(s, " bias-for-scenecut=%.2f", p->bBiasForScenecut); > s += sprintf(s, " rc-lookahead=%d", p->lookaheadDepth); > s += sprintf(s, " lookahead-slices=%d", p->lookaheadSlices); > s += sprintf(s, " bframes=%d", p->bframes); > diff -r 0e9e52640546 -r 51a81cb49d98 source/encoder/encoder.cpp > --- a/source/encoder/encoder.cpp Wed Oct 12 17:58:49 2016 +0530 > +++ b/source/encoder/encoder.cpp Fri Oct 21 12:32:55 2016 +0530 > @@ -1921,6 +1921,7 @@ > m_bframeDelay = p->bframes ? (p->bBPyramid ? 2 : 1) : 0; > > p->bFrameBias = X265_MIN(X265_MAX(-90, p->bFrameBias), 100); > + p->bBiasForScenecut = (double)(p->bBiasForScenecut / 100); > > if (p->logLevel < X265_LOG_INFO) > { > diff -r 0e9e52640546 -r 51a81cb49d98 source/encoder/slicetype.cpp > --- a/source/encoder/slicetype.cpp Wed Oct 12 17:58:49 2016 +0530 > +++ b/source/encoder/slicetype.cpp Fri Oct 21 12:32:55 2016 +0530 > @@ -1617,7 +1617,7 @@ > > /* magic numbers pulled out of thin air */ > float threshMin = (float)(threshMax * 0.25); > - double bias = 0.05; > + double bias = m_param->bBiasForScenecut; > if (bRealScenecut) > { > if (m_param->keyframeMin == m_param->keyframeMax) > diff -r 0e9e52640546 -r 51a81cb49d98 source/x265.h > --- a/source/x265.h Wed Oct 12 17:58:49 2016 +0530 > +++ b/source/x265.h Fri Oct 21 12:32:55 2016 +0530 > @@ -775,6 +775,10 @@ > * should detect scene cuts. The default (40) is recommended. */ > int scenecutThreshold; > > + /* This value represents the percentage difference between the inter > cost and > + * intra cost of a frame used in scenecut detection. Default 5. */ > + double bBiasForScenecut; > + > Please add all new params only to the end of the x265_param_t structure to allow for backwards compatibility with existing applications that just want to use the new .dll as a drop-in replacement without recompiling the entire application. > /* Replace keyframes by using a column of intra blocks that move > across the video > * from one side to the other, thereby "refreshing" the image. In > effect, instead of a > * big keyframe, the keyframe is "spread" over many frames. */ > diff -r 0e9e52640546 -r 51a81cb49d98 source/x265cli.h > --- a/source/x265cli.h Wed Oct 12 17:58:49 2016 +0530 > +++ b/source/x265cli.h Fri Oct 21 12:32:55 2016 +0530 > @@ -121,6 +121,7 @@ > { "min-keyint", required_argument, NULL, 'i' }, > { "scenecut", required_argument, NULL, 0 }, > { "no-scenecut", no_argument, NULL, 0 }, > + { "bias-for-scenecut", required_argument, NULL, 0 }, > { "intra-refresh", no_argument, NULL, 0 }, > { "rc-lookahead", required_argument, NULL, 0 }, > { "lookahead-slices", required_argument, NULL, 0 }, > @@ -365,6 +366,7 @@ > H0("-i/--min-keyint <integer> Scenecuts closer together than > this are coded as I, not IDR. Default: auto\n"); > H0(" --no-scenecut Disable adaptive I-frame > decision\n"); > H0(" --scenecut <integer> How aggressively to insert extra > I-frames. Default %d\n", param->scenecutThreshold); > + H1(" --bias-for-scenecut<5..10.0> Bias for scenecut detection. > Default %.2f\n", param->bBiasForScenecut); > H0(" --intra-refresh Use Periodic Intra Refresh > instead of IDR frames\n"); > H0(" --rc-lookahead <integer> Number of frames for frame-type > lookahead (determines encoder latency) Default %d\n", > param->lookaheadDepth); > H1(" --lookahead-slices <0..16> Number of slices to use per > lookahead cost estimate. Default %d\n", param->lookaheadSlices); > _______________________________________________ > x265-devel mailing list > [email protected] > https://mailman.videolan.org/listinfo/x265-devel >
_______________________________________________ x265-devel mailing list [email protected] https://mailman.videolan.org/listinfo/x265-devel
