[x265] [PATCH] Removed maxCUDepth parameter from CLI option
Steve Borho
steve at borho.org
Fri Jun 28 08:55:24 CEST 2013
On Fri, Jun 28, 2013 at 1:48 AM, <sumalatha at multicorewareinc.com> wrote:
> # HG changeset patch
> # User sumalatha
> # Date 1372402128 -19800
> # Node ID f2cf6222811960215ddd67a1b3789613fff5d180
> # Parent 02cb4e55ad54c789ee3c1b19a4e32db839b8ba96
> Removed maxCUDepth parameter from CLI option
>
Looks good, but a few comments.
> diff -r 02cb4e55ad54 -r f2cf62228119 source/common/common.cpp
> --- a/source/common/common.cpp Fri Jun 28 12:11:14 2013 +0530
> +++ b/source/common/common.cpp Fri Jun 28 12:18:48 2013 +0530
> @@ -39,6 +39,7 @@
> #include <sys/time.h>
> #endif
> #include <time.h>
> +#include <cmath>
>
Better to include math.h here and use log() below
> #if HIGH_BIT_DEPTH
> const int x265_bit_depth = 10;
> @@ -88,7 +89,6 @@
> param->bipredSearchRange = 4;
> param->internalBitDepth = 8;
> param->maxCUSize = 64;
> - param->maxCUDepth = 4;
> param->tuQTMaxLog2Size = 5;
> param->tuQTMinLog2Size = 2;
> param->tuQTMaxInterDepth = 3;
> @@ -152,6 +152,11 @@
> return 1;
> }
>
> +uint32_t getMaxCuDepth(uint32_t maxCuSize)
> +{
> + return (uint32_t)(log10(maxCuSize)/log10(2)) - 2;
> +}
> +
> int x265_check_params(x265_param_t *param)
> {
> #define CONFIRM(expr, msg) check_failed |= _confirm(param, expr, msg)
> @@ -177,7 +182,7 @@
>
it would be better to declare: uint32_t maxCUDepth = getMaxCuDepth();
then re-use that variable for all these checks
> "Search Range must be more than 0");
> CONFIRM(param->keyframeInterval < -1,
> "Keyframe interval must be -1 (open-GOP) 0 (auto) 1
> (intra-only) or greater than 1");
> - CONFIRM(param->maxCUdQPDepth > param->maxCUDepth - 1,
> + CONFIRM(param->maxCUdQPDepth > getMaxCuDepth(param->maxCUSize) - 1,
> "Absolute depth for a minimum CuDQP exceeds maximum coding
> unit depth");
>
> CONFIRM(param->cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12");
> @@ -187,13 +192,11 @@
>
> CONFIRM(param->qpAdaptionRange <= 0,
> "QP Adaptation Range must be more than 0");
> - CONFIRM((param->maxCUSize >> param->maxCUDepth) < 4,
> - "Minimum partition width size should be larger than or equal
> to 8");
> CONFIRM(param->maxCUSize < 16,
> "Maximum partition width size should be larger than or equal
> to 16");
> - CONFIRM((param->sourceWidth % (param->maxCUSize >>
> (param->maxCUDepth - 1))) != 0,
> + CONFIRM((param->sourceWidth % (param->maxCUSize >>
> (getMaxCuDepth(param->maxCUSize) - 1))) != 0,
> "Resulting coded frame width must be a multiple of the
> minimum CU size");
> - CONFIRM((param->sourceHeight % (param->maxCUSize >>
> (param->maxCUDepth - 1))) != 0,
> + CONFIRM((param->sourceHeight % (param->maxCUSize >>
> (getMaxCuDepth(param->maxCUSize) - 1))) != 0,
> "Resulting coded frame height must be a multiple of the
> minimum CU size");
>
> CONFIRM(param->tuQTMinLog2Size < 2,
> @@ -205,13 +208,13 @@
>
> CONFIRM(param->tuQTMaxLog2Size < param->tuQTMinLog2Size,
> "QuadtreeTULog2MaxSize must be greater than or equal to
> m_uiQuadtreeTULog2MinSize.");
> - CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >>
> (param->maxCUDepth - 1)),
> + CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >>
> (getMaxCuDepth(param->maxCUSize) - 1)),
> "QuadtreeTULog2MinSize must not be greater than minimum CU
> size"); // HS
> - CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >>
> (param->maxCUDepth - 1)),
> + CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >>
> (getMaxCuDepth(param->maxCUSize) - 1)),
> "QuadtreeTULog2MinSize must not be greater than minimum CU
> size"); // HS
> - CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >>
> param->maxCUDepth),
> + CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >>
> getMaxCuDepth(param->maxCUSize)),
> "Minimum CU width must be greater than minimum transform
> size.");
> - CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >>
> param->maxCUDepth),
> + CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >>
> getMaxCuDepth(param->maxCUSize)),
> "Minimum CU height must be greater than minimum transform
> size.");
> CONFIRM(param->tuQTMaxInterDepth < 1,
> "QuadtreeTUMaxDepthInter must be greater than or equal to 1");
> @@ -264,14 +267,15 @@
>
> // compute actual CU depth with respect to config depth and max
> transform size
> g_uiAddCUDepth = 0;
> - while ((param->maxCUSize >> param->maxCUDepth) > (1u <<
> (param->tuQTMinLog2Size + g_uiAddCUDepth)))
> + while ((param->maxCUSize >> getMaxCuDepth(param->maxCUSize)) > (1u <<
> (param->tuQTMinLog2Size + g_uiAddCUDepth)))
> {
> g_uiAddCUDepth++;
> }
>
> - param->maxCUDepth += g_uiAddCUDepth;
> + uint32_t cuDepth = getMaxCuDepth(param->maxCUSize);
> + cuDepth += g_uiAddCUDepth;
> g_uiAddCUDepth++;
> - g_uiMaxCUDepth = param->maxCUDepth;
> + g_uiMaxCUDepth = cuDepth;
>
> // set internal bit-depth and constants
> #if HIGH_BIT_DEPTH
> @@ -293,7 +297,7 @@
> #if HIGH_BIT_DEPTH
> x265_log(param, X265_LOG_INFO, "Internal bit depth : %d\n",
> param->internalBitDepth);
> #endif
> - x265_log(param, X265_LOG_INFO, "CU size / depth : %d /
> %d\n", param->maxCUSize, param->maxCUDepth);
> + x265_log(param, X265_LOG_INFO, "CU size : %d /
> %d\n", param->maxCUSize);
>
You forgot to remove the second %d
> x265_log(param, X265_LOG_INFO, "RQT trans. size (min / max) : %d /
> %d\n", 1 << param->tuQTMinLog2Size, 1 << param->tuQTMaxLog2Size);
> x265_log(param, X265_LOG_INFO, "Max RQT depth inter / intra : %d /
> %d\n", param->tuQTMaxInterDepth, param->tuQTMaxIntraDepth);
>
> diff -r 02cb4e55ad54 -r f2cf62228119 source/common/common.h
> --- a/source/common/common.h Fri Jun 28 12:11:14 2013 +0530
> +++ b/source/common/common.h Fri Jun 28 12:18:48 2013 +0530
> @@ -119,7 +119,7 @@
> void x265_set_globals(x265_param_t *param, uint32_t inputBitDepth);
> int64_t x265_mdate(void);
> int dumpBuffer(void * pbuf, size_t bufsize, const char * filename);
> -
> +uint32_t getMaxCuDepth(uint32_t maxCuSize);
>
This doesn't need to be defined here, it can be a file-static routine in
common.cpp
> /* defined in primitives.cpp */
> void x265_setup_primitives(x265_param_t *param, int cpuid = 0);
>
> diff -r 02cb4e55ad54 -r f2cf62228119 source/x265.h
> --- a/source/x265.h Fri Jun 28 12:11:14 2013 +0530
> +++ b/source/x265.h Fri Jun 28 12:18:48 2013 +0530
> @@ -171,7 +171,7 @@
>
> // coding unit (CU) definition
> uint32_t maxCUSize; ///< max. CU width and
> height in pixels
> - uint32_t maxCUDepth; ///< max. CU
> recursion/split depth
> +
>
> // transform unit (TU) definition
> uint32_t tuQTMaxLog2Size;
> diff -r 02cb4e55ad54 -r f2cf62228119 source/x265opts.h
> --- a/source/x265opts.h Fri Jun 28 12:11:14 2013 +0530
> +++ b/source/x265opts.h Fri Jun 28 12:18:48 2013 +0530
> @@ -28,7 +28,6 @@
> OPT("wpp", param->bEnableWavefront, no_argument, 0,
> "Enable Wavefront Parallel Processing")
> OPT("no-wpp", param->bEnableWavefront, no_argument, 0,
> "Disable Wavefront Parallel Processing")
> OPT("ctu", param->maxCUSize, required_argument, 's',
> "Maximum CU size (default: 64x64)")
> -OPT("cu-depth", param->maxCUDepth, required_argument, 'd',
> "Maximum CU recursion depth (default: 4)")
> OPT("tu-maxlog2", param->tuQTMaxLog2Size, required_argument, 0,
> "Maximum TU size in logarithm base 2")
> OPT("tu-minlog2", param->tuQTMinLog2Size, required_argument, 0,
> "Minimum TU size in logarithm base 2")
> OPT("tu-intra-depth", param->tuQTMaxIntraDepth, required_argument, 0,
> "Max TU recursive depth for intra CUs")
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> http://mailman.videolan.org/listinfo/x265-devel
>
>
--
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130628/c0c707c6/attachment-0001.html>
More information about the x265-devel
mailing list