[x265] [PATCH] cli: add cli option max-tu-size and support for it

Steve Borho steve at borho.org
Wed Feb 11 06:39:50 CET 2015


On 02/11, santhoshini at multicorewareinc.com wrote:
> # HG changeset patch
> # User Santhoshini Sekar<santhoshini at multicorewareinc.com>
> # Date 1423630880 -19800
> #      Wed Feb 11 10:31:20 2015 +0530
> # Node ID 5320c5908a881abc477537a375a452ee663a3830
> # Parent  1ed7dd760d0f605c3426ff45288e62fd6a5654ae
> cli: add cli option max-tu-size and support for it

Looks good, I can keep this in a patch queue until the implementation is
ready.

> diff -r 1ed7dd760d0f -r 5320c5908a88 doc/reST/cli.rst
> --- a/doc/reST/cli.rst	Tue Feb 10 15:15:25 2015 -0600
> +++ b/doc/reST/cli.rst	Wed Feb 11 10:31:20 2015 +0530
> @@ -598,6 +598,15 @@
>  	partitions, in which case a TU split is implied and thus the
>  	residual quad-tree begins one layer below the CU quad-tree.
>  
> +.. option:: --max-tu-size <32|16|8|4>
> +
> +	Maximum TU size (width and height). The residual can be more
> +	efficiently compressed by the DCT transform when the max TU size
> +	is larger, but at the expense of more computation. Transform unit
> +	quad-tree begins at the same depth of the coded tree unit, but if the
> +	maximum TU size is smaller than the CU size then transform QT begins 
> +	at the depth of the max-tu-size. Default: 32.
> +
>  Temporal / motion search options
>  ================================
>  
> diff -r 1ed7dd760d0f -r 5320c5908a88 source/CMakeLists.txt
> --- a/source/CMakeLists.txt	Tue Feb 10 15:15:25 2015 -0600
> +++ b/source/CMakeLists.txt	Wed Feb 11 10:31:20 2015 +0530
> @@ -21,7 +21,7 @@
>  include(CheckCXXCompilerFlag)
>  
>  # X265_BUILD must be incremented each time the public API is changed
> -set(X265_BUILD 44)
> +set(X265_BUILD 45)
>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
>                 "${PROJECT_BINARY_DIR}/x265.def")
>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
> diff -r 1ed7dd760d0f -r 5320c5908a88 source/common/param.cpp
> --- a/source/common/param.cpp	Tue Feb 10 15:15:25 2015 -0600
> +++ b/source/common/param.cpp	Wed Feb 11 10:31:20 2015 +0530
> @@ -129,6 +129,7 @@
>      param->maxCUSize = 64;
>      param->tuQTMaxInterDepth = 1;
>      param->tuQTMaxIntraDepth = 1;
> +    param->maxTUSize = 32;
>  
>      /* Coding Structure */
>      param->keyframeMin = 0;
> @@ -572,6 +573,7 @@
>      OPT("ctu") p->maxCUSize = (uint32_t)atoi(value);
>      OPT("tu-intra-depth") p->tuQTMaxIntraDepth = (uint32_t)atoi(value);
>      OPT("tu-inter-depth") p->tuQTMaxInterDepth = (uint32_t)atoi(value);
> +    OPT("max-tu-size") p->maxTUSize = (uint32_t)atoi(value);
>      OPT("subme") p->subpelRefine = atoi(value);
>      OPT("merange") p->searchRange = atoi(value);
>      OPT("rect") p->bEnableRectInter = atobool(value);
> @@ -1012,7 +1014,8 @@
>            "QuadtreeTUMaxDepthIntra must be greater 0 and less than 5");
>      CHECK(maxLog2CUSize < tuQTMinLog2Size + param->tuQTMaxIntraDepth - 1,
>            "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1");
> -
> +    CHECK((param->maxTUSize != 32 && param->maxTUSize != 16 && param->maxTUSize != 8 && param->maxTUSize != 4) || param->maxTUSize > param->maxCUSize,
> +          "max TU size must be 4, 8, 16, or 32 and should be less than max CU size");
>      CHECK(param->maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater.");
>      CHECK(param->maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller.");
>  
> @@ -1194,8 +1197,10 @@
>      if (param->interlaceMode)
>          x265_log(param, X265_LOG_INFO, "Interlaced field inputs             : %s\n", x265_interlace_names[param->interlaceMode]);
>  
> -    x265_log(param, X265_LOG_INFO, "CTU size / RQT depth inter / intra  : %d / %d / %d\n",
> -             param->maxCUSize, param->tuQTMaxInterDepth, param->tuQTMaxIntraDepth);
> +    x265_log(param, X265_LOG_INFO, "Coding QT: max CU size, min CU size : %d / %d\n", param->maxCUSize, 8);
> +
> +    x265_log(param, X265_LOG_INFO, "Residual QT: max TU size, max depth : %d / %d inter / %d intra\n",
> +             param->maxTUSize, param->tuQTMaxInterDepth, param->tuQTMaxIntraDepth);
>  
>      x265_log(param, X265_LOG_INFO, "ME / range / subpel / merge         : %s / %d / %d / %d\n",
>               x265_motion_est_names[param->searchMethod], param->searchRange, param->subpelRefine, param->maxNumMergeCand);
> @@ -1291,6 +1296,7 @@
>      s += sprintf(s, " bitdepth=%d", p->internalBitDepth);
>      BOOL(p->bEnableWavefront, "wpp");
>      s += sprintf(s, " ctu=%d", p->maxCUSize);
> +    s += sprintf(s, " max-tu-size=%d", p->maxTUSize);
>      s += sprintf(s, " tu-intra-depth=%d", p->tuQTMaxIntraDepth);
>      s += sprintf(s, " tu-inter-depth=%d", p->tuQTMaxInterDepth);
>      s += sprintf(s, " me=%d", p->searchMethod);
> diff -r 1ed7dd760d0f -r 5320c5908a88 source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp	Tue Feb 10 15:15:25 2015 -0600
> +++ b/source/encoder/encoder.cpp	Wed Feb 11 10:31:20 2015 +0530
> @@ -1438,8 +1438,8 @@
>  
>      sps->log2MinCodingBlockSize = g_maxLog2CUSize - g_maxCUDepth;
>      sps->log2DiffMaxMinCodingBlockSize = g_maxCUDepth;
> -
> -    sps->quadtreeTULog2MaxSize = X265_MIN(g_maxLog2CUSize, 5);
> +    uint32_t maxLog2TUSize = (uint32_t)g_log2Size[m_param->maxTUSize];
> +    sps->quadtreeTULog2MaxSize = X265_MIN(g_maxLog2CUSize, maxLog2TUSize);
>      sps->quadtreeTULog2MinSize = 2;
>      sps->quadtreeTUMaxDepthInter = m_param->tuQTMaxInterDepth;
>      sps->quadtreeTUMaxDepthIntra = m_param->tuQTMaxIntraDepth;
> diff -r 1ed7dd760d0f -r 5320c5908a88 source/x265.h
> --- a/source/x265.h	Tue Feb 10 15:15:25 2015 -0600
> +++ b/source/x265.h	Wed Feb 11 10:31:20 2015 +0530
> @@ -507,6 +507,11 @@
>       * compressed by the DCT transforms, at the expense of much more compute */
>      uint32_t  tuQTMaxIntraDepth;
>  
> +    /* Maxiumum TU width and height in pixels.  The size must be 32, 16, 8 or 4.
> +     * The larger the size the more efficiently the residual can be
> +     * compressed by the DCT transforms, at the expense of more computation */
> +    uint32_t  maxTUSize;
> +
>      /*== GOP Structure and Lokoahead ==*/
>  
>      /* Enable open GOP - meaning I slices are not necessariy IDR and thus frames
> diff -r 1ed7dd760d0f -r 5320c5908a88 source/x265cli.h
> --- a/source/x265cli.h	Tue Feb 10 15:15:25 2015 -0600
> +++ b/source/x265cli.h	Wed Feb 11 10:31:20 2015 +0530
> @@ -71,6 +71,7 @@
>      { "no-wpp",               no_argument, NULL, 0 },
>      { "wpp",                  no_argument, NULL, 0 },
>      { "ctu",            required_argument, NULL, 's' },
> +    { "max-tu-size",    required_argument, NULL, 's' },
>      { "tu-intra-depth", required_argument, NULL, 0 },
>      { "tu-inter-depth", required_argument, NULL, 0 },
>      { "me",             required_argument, NULL, 0 },
> @@ -264,6 +265,7 @@
>      H0("                                 psnr, ssim, grain, zerolatency, fastdecode\n");
>      H0("\nQuad-Tree size and depth:\n");
>      H0("-s/--ctu <64|32|16>              Maximum CU size (WxH). Default %d\n", param->maxCUSize);
> +    H0("-s/--max-tu-size <32|16|8|4>     Maximum TU size (WxH). Default %d\n", param->maxTUSize);
>      H0("   --tu-intra-depth <integer>    Max TU recursive depth for intra CUs. Default %d\n", param->tuQTMaxIntraDepth);
>      H0("   --tu-inter-depth <integer>    Max TU recursive depth for inter CUs. Default %d\n", param->tuQTMaxInterDepth);
>      H0("\nAnalysis:\n");
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel

-- 
Steve Borho


More information about the x265-devel mailing list