[x265] [PATCH 1 of 4] cli: add option to specify scale-factor

Pradeep Ramachandran pradeep at multicorewareinc.com
Mon Jun 5 07:02:55 CEST 2017


On Fri, Jun 2, 2017 at 10:58 PM, <kavitha at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Kavitha Sampath
> # Date 1495595385 -19800
> #      Wed May 24 08:39:45 2017 +0530
> # Node ID 404253434d33e99955aac29480ee16b8e939a64c
> # Parent  f850cdbe381c196758fd445a367487416fef62f9
> cli: add option to specify scale-factor
>

Pushed full set to default branch


>
> diff -r f850cdbe381c -r 404253434d33 doc/reST/cli.rst
> --- a/doc/reST/cli.rst  Tue May 23 12:42:54 2017 +0530
> +++ b/doc/reST/cli.rst  Wed May 24 08:39:45 2017 +0530
> @@ -855,6 +855,11 @@
>         +--------+-----------------------------------------+
>         | 10     | Level 5 + Full CU analysis-info         |
>         +--------+-----------------------------------------+
> +.. option:: --scale-factor
> +
> +       Factor by which input video is scaled down for analysis save mode.
> +       This option should be coupled with analysis-mode option,
> --refine-level 10.
> +       The ctu size of load should be double the size of save. Default 0.
>
>  Options which affect the transform unit quad-tree, sometimes referred to
>  as the residual quad-tree (RQT).
> diff -r f850cdbe381c -r 404253434d33 source/CMakeLists.txt
> --- a/source/CMakeLists.txt     Tue May 23 12:42:54 2017 +0530
> +++ b/source/CMakeLists.txt     Wed May 24 08:39:45 2017 +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 118)
> +set(X265_BUILD 119)
>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
>                 "${PROJECT_BINARY_DIR}/x265.def")
>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
> diff -r f850cdbe381c -r 404253434d33 source/common/param.cpp
> --- a/source/common/param.cpp   Tue May 23 12:42:54 2017 +0530
> +++ b/source/common/param.cpp   Wed May 24 08:39:45 2017 +0530
> @@ -277,6 +277,7 @@
>      param->bDhdr10opt = 0;
>      param->bCTUInfo = 0;
>      param->bUseRcStats = 0;
> +    param->scaleFactor = 0;
>  }
>
>  int x265_param_default_preset(x265_param* param, const char* preset,
> const char* tune)
> @@ -957,6 +958,7 @@
>          OPT("dhdr10-info") p->toneMapFile = strdup(value);
>          OPT("dhdr10-opt") p->bDhdr10opt = atobool(value);
>          OPT("ctu-info") p->bCTUInfo = atoi(value);
> +        OPT("scale-factor") p->scaleFactor = atoi(value);
>          else
>              return X265_PARAM_BAD_NAME;
>      }
> @@ -1291,6 +1293,7 @@
>          "Invalid analysis mode. Analysis mode 0: OFF 1: SAVE : 2 LOAD");
>      CHECK(param->analysisMode && (param->analysisRefineLevel < 1 ||
> param->analysisRefineLevel > 10),
>          "Invalid analysis refine level. Value must be between 1 and 10
> (inclusive)");
> +    CHECK(param->scaleFactor > 2, "Invalid scale-factor. Supports factor
> <= 2");
>      CHECK(param->rc.qpMax < QP_MIN || param->rc.qpMax > QP_MAX_MAX,
>          "qpmax exceeds supported range (0 to 69)");
>      CHECK(param->rc.qpMin < QP_MIN || param->rc.qpMin > QP_MAX_MAX,
> @@ -1675,6 +1678,7 @@
>      BOOL(p->bHDROpt, "hdr-opt");
>      BOOL(p->bDhdr10opt, "dhdr10-opt");
>      s += sprintf(s, " refine-level=%d", p->analysisRefineLevel);
> +       s += sprintf(s, " scale-factor=%d", p->scaleFactor);
>      BOOL(p->bLimitSAO, "limit-sao");
>      s += sprintf(s, " ctu-info=%d", p->bCTUInfo);
>  #undef BOOL
> diff -r f850cdbe381c -r 404253434d33 source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp        Tue May 23 12:42:54 2017 +0530
> +++ b/source/encoder/encoder.cpp        Wed May 24 08:39:45 2017 +0530
> @@ -2273,6 +2273,18 @@
>              "Disabling Analysis load/save and
> multi-pass-opt-analysis/multi-pass-opt-distortion\n");
>          p->analysisMode = p->analysisMultiPassRefine =
> p->analysisMultiPassDistortion = 0;
>      }
> +    if (p->scaleFactor)
> +    {
> +        if (p->scaleFactor == 1)
> +        {
> +            p->scaleFactor = 0;
> +        }
> +        else if (!p->analysisMode || p->analysisRefineLevel < 10)
> +        {
> +            x265_log(p, X265_LOG_WARNING, "Input scaling works with
> analysis-mode, refine-level 10. Disabling scale-factor.\n");
> +            p->scaleFactor = 0;
> +        }
> +    }
>
>      if ((p->analysisMultiPassRefine || p->analysisMultiPassDistortion)
> && (p->bDistributeModeAnalysis || p->bDistributeMotionEstimation))
>      {
> diff -r f850cdbe381c -r 404253434d33 source/x265.h
> --- a/source/x265.h     Tue May 23 12:42:54 2017 +0530
> +++ b/source/x265.h     Wed May 24 08:39:45 2017 +0530
> @@ -1438,6 +1438,9 @@
>
>      /* Use ratecontrol statistics from pic_in, if available*/
>      int       bUseRcStats;
> +
> +    /* Factor by which input video is scaled down for analysis save mode.
> Default is 0 */
> +    int       scaleFactor;
>  } x265_param;
>  /* x265_param_alloc:
>   *  Allocates an x265_param instance. The returned param structure is not
> diff -r f850cdbe381c -r 404253434d33 source/x265cli.h
> --- a/source/x265cli.h  Tue May 23 12:42:54 2017 +0530
> +++ b/source/x265cli.h  Wed May 24 08:39:45 2017 +0530
> @@ -251,6 +251,7 @@
>      { "analysis-mode",  required_argument, NULL, 0 },
>      { "analysis-file",  required_argument, NULL, 0 },
>      { "refine-level",   required_argument, NULL, 0 },
> +    { "scale-factor",   required_argument, NULL, 0 },
>      { "strict-cbr",           no_argument, NULL, 0 },
>      { "temporal-layers",      no_argument, NULL, 0 },
>      { "no-temporal-layers",   no_argument, NULL, 0 },
> @@ -440,6 +441,7 @@
>      H0("   --analysis-mode <string|int>  save - Dump analysis info into
> file, load - Load analysis buffers from the file. Default %d\n",
> param->analysisMode);
>      H0("   --analysis-file <filename>    Specify file name used for
> either dumping or reading analysis data.\n");
>      H0("   --refine-level <1..10>        Level of analysis refinement
> indicates amount of info stored/reused in save/load mode,
> 1:least....10:most. Default %d\n", param->analysisRefineLevel);
> +    H0("   --scale-factor <int>          Specify factor by which input
> video is scaled down for analysis save mode. Default %d\n",
> param->scaleFactor);
>      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);
>      H0("   --[no-]aq-motion              Adaptive Quantization based on
> the relative motion of each CU w.r.t., frame. Default %s\n",
> OPT(param->bOptCUDeltaQP));
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20170605/0c718c66/attachment-0001.html>


More information about the x265-devel mailing list