[x265] [PATCH 1 of 2] dynamic-refine: add cli and param options to support dynamic refinement

Ashok Kumar Mishra ashok at multicorewareinc.com
Fri Mar 9 16:16:02 CET 2018


On Fri, Mar 9, 2018 at 7:12 PM, <bhavna at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Bhavna Hariharan <bhavna at multicorewareinc.com>
> # Date 1520568893 -19800
> #      Fri Mar 09 09:44:53 2018 +0530
> # Node ID d292dacb81d8607ce0b2fb106b7383b360863e9d
> # Parent  b7c8bfabc808a933cf6bdcef63bf49c8177851a6
> dynamic-refine: add cli and param options to support dynamic refinement.
>
> diff -r b7c8bfabc808 -r d292dacb81d8 doc/reST/cli.rst
> --- a/doc/reST/cli.rst  Thu Mar 08 15:38:14 2018 +0530
> +++ b/doc/reST/cli.rst  Fri Mar 09 09:44:53 2018 +0530
> @@ -955,6 +955,12 @@
>         Level 3 - Perform analysis of inter modes while reusing depths
> from the save encode.
>
>         Default 0.
> +
> +.. option:: --dynamic-refine, --no-dynamic-refine
> +
> +       Dynamically switches :option:`--refine-inter` levels 0-3 based on
> the content and
> +       the encoder settings. It is recommended to use
> :option:`--refine-intra` 4 with dynamic
> +       refinement. Default disabled.
>
>  .. option:: --refine-mv
>
> diff -r b7c8bfabc808 -r d292dacb81d8 source/CMakeLists.txt
> --- a/source/CMakeLists.txt     Thu Mar 08 15:38:14 2018 +0530
> +++ b/source/CMakeLists.txt     Fri Mar 09 09:44:53 2018 +0530
> @@ -29,7 +29,7 @@
>  option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
>  mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
>  # X265_BUILD must be incremented each time the public API is changed
> -set(X265_BUILD 155)
> +set(X265_BUILD 156)
>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
>                 "${PROJECT_BINARY_DIR}/x265.def")
>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
> diff -r b7c8bfabc808 -r d292dacb81d8 source/common/param.cpp
> --- a/source/common/param.cpp   Thu Mar 08 15:38:14 2018 +0530
> +++ b/source/common/param.cpp   Fri Mar 09 09:44:53 2018 +0530
> @@ -289,6 +289,7 @@
>      param->scaleFactor = 0;
>      param->intraRefine = 0;
>      param->interRefine = 0;
> +    param->bDynamicRefine = 0;
>      param->mvRefine = 0;
>      param->bUseAnalysisFile = 1;
>      param->csvfpt = NULL;
> @@ -1015,6 +1016,7 @@
>          OPT("analysis-load") p->analysisLoad = strdup(value);
>          OPT("radl") p->radl = atoi(value);
>          OPT("max-ausize-factor") p->maxAUSizeFactor = atof(value);
> +        OPT("dynamic-refine") p->bDynamicRefine = atobool(value);
>          else
>              return X265_PARAM_BAD_NAME;
>      }
> @@ -1509,6 +1511,7 @@
>      TOOLVAL(param->bCTUInfo, "ctu-info=%d");
>      if (param->bMVType == AVC_INFO)
>          TOOLOPT(param->bMVType, "refine-mv-type=avc");
> +    TOOLOPT(param->bDynamicRefine, "dynamic-refine");
>      if (param->maxSlices > 1)
>          TOOLVAL(param->maxSlices, "slices=%d");
>      if (param->bEnableLoopFilter)
> @@ -1747,6 +1750,7 @@
>      s += sprintf(s, " refine-mv-type=%d", p->bMVType);
>      s += sprintf(s, " copy-pic=%d", p->bCopyPicToFrame);
>      s += sprintf(s, " max-ausize-factor=%.1f", p->maxAUSizeFactor);
> +    BOOL(p->bDynamicRefine, "dynamic-refine");
>  #undef BOOL
>      return buf;
>  }
> diff -r b7c8bfabc808 -r d292dacb81d8 source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp        Thu Mar 08 15:38:14 2018 +0530
> +++ b/source/encoder/encoder.cpp        Fri Mar 09 09:44:53 2018 +0530
> @@ -2688,7 +2688,21 @@
>          }
>      }
>
> -    if (p->limitTU && p->interRefine)
> +    if (p->bDynamicRefine)
> +    {
> +        if (!p->analysisLoad || p->analysisReuseLevel < 10 ||
> !p->scaleFactor)
> +        {
> +            x265_log(p, X265_LOG_WARNING, "Dynamic refinement requires
> analysis load, analysis-reuse-level 10, scale factor. Disabling dynamic
> refine.\n");
> +            p->bDynamicRefine = 0;
> +        }
> +        if (p->interRefine)
> +        {
> +            x265_log(p, X265_LOG_WARNING, "Inter refine cannot be used
> with dynamic refine. Disabling refine-inter.\n");
> +            p->interRefine = 0;
> +        }
> +    }
> +
> +    if (p->limitTU && (p->interRefine || p->bDynamicRefine))
>      {
>          x265_log(p, X265_LOG_WARNING, "Inter refinement does not support
> limitTU. Disabling limitTU.\n");
>          p->limitTU = 0;
> diff -r b7c8bfabc808 -r d292dacb81d8 source/x265.h
> --- a/source/x265.h     Thu Mar 08 15:38:14 2018 +0530
> +++ b/source/x265.h     Fri Mar 09 09:44:53 2018 +0530
> @@ -466,6 +466,8 @@
>
>  #define x265_ADAPT_RD_STRENGTH   4
>
> +#define X265_REFINE_INTER_LEVELS 4
> +
>  /* NOTE! For this release only X265_CSP_I420 and X265_CSP_I444 are
> supported */
>
>  /* Supported internal color space types (according to semantics of
> chroma_format_idc) */
> @@ -1562,6 +1564,9 @@
>      * at each IDR frame describing poc of the recovery point, exact
> matching flag
>      * and broken link flag. Default is disabled. */
>      int       bEmitIDRRecoverySEI;
> +
> +    /* Dynamically change refine-inter at block level*/
> +    int       bDynamicRefine;
>  } x265_param;
>
>  /* x265_param_alloc:
> diff -r b7c8bfabc808 -r d292dacb81d8 source/x265cli.h
> --- a/source/x265cli.h  Thu Mar 08 15:38:14 2018 +0530
> +++ b/source/x265cli.h  Fri Mar 09 09:44:53 2018 +0530
> @@ -263,6 +263,8 @@
>      { "scale-factor",   required_argument, NULL, 0 },
>      { "refine-intra",   required_argument, NULL, 0 },
>      { "refine-inter",   required_argument, NULL, 0 },
> +    { "dynamic-refine",       no_argument, NULL, 0 },
> +    { "no-dynamic-refine",    no_argument, NULL, 0 },
>      { "strict-cbr",           no_argument, NULL, 0 },
>      { "temporal-layers",      no_argument, NULL, 0 },
>      { "no-temporal-layers",   no_argument, NULL, 0 },
> @@ -492,6 +494,7 @@
>          "                                    - 2 : Functionality of (1) +
> irrespective of size restrict the modes evaluated when specific modes are
> decided as the best mode by the save encode.\n"
>          "                                    - 3 : Functionality of (1) +
> irrespective of size evaluate all inter modes.\n"
>          "                                Default:%d\n",
> param->interRefine);
> +    H0("   --[no-]dynamic-refine         Dynamically changes refine-inter
> level for each CU. Default %s\n", OPT(param->bDynamicRefine));
>      H0("   --[no-]refine-mv              Enable mv refinement for load
> mode. Default %s\n", OPT(param->mvRefine));
>      H0("   --aq-mode <integer>           Mode for Adaptive Quantization -
> 0:none 1:uniform AQ 2:auto variance 3:auto variance with bias to dark
> scenes. Default %d\n", param->rc.aqMode);
>      H0("   --aq-strength <float>         Reduces blocking and blurring in
> flat and textured areas (0 to 3.0). Default %.2f\n", param->rc.aqStrength);
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
>
Pushed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20180309/e54fecce/attachment-0001.html>


More information about the x265-devel mailing list