[x265] [PATCH] common : Added new function x265_param2string

Steve Borho steve at borho.org
Thu Oct 17 10:37:27 CEST 2013


On Thu, Oct 17, 2013 at 2:05 AM, Gopu Govindaswamy <
gopu at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Gopu Govindaswamy <gopu at multicorewareinc.com>
> # Date 1381993509 -19800
> # Node ID 4cba7c453533731ef6bca965b6cebe7e6caff8bf
> # Parent  1d6b3626f1b3d4b8f8f181e66eaaa649f90bac02
> common : Added new function x265_param2string
>
> diff -r 1d6b3626f1b3 -r 4cba7c453533 source/common/common.cpp
> --- a/source/common/common.cpp  Wed Oct 16 20:38:44 2013 -0500
> +++ b/source/common/common.cpp  Thu Oct 17 12:35:09 2013 +0530
> @@ -543,3 +543,52 @@
>      berror |= valuewasnull;
>      return berror ? X265_PARAM_BAD_VALUE : 0;
>  }
> +
> +char *x265_param2string( x265_param_t *p)
> +{
> +    char *buf, *s;
> +    buf = s = (char *)X265_MALLOC(char, 2000);
> +    if (!buf)
> +        return NULL;
> +
> +    s += sprintf(s, " %s", p->bEnableWavefront ? "wpp" : "no-wpp");
>

it would be nice to have a macro that handled these bool parameters,
something that relied on C string constant concatenation like:

#define BOOL(param, cliopt) \
   s += sprintf(s, " %s", (param) ? cliopt : "no-"cliopt);

+    s += sprintf(s, " fps=%d", p->frameRate);
> +    s += sprintf(s, " threads=%d", p->poolNumThreads);
> +    s += sprintf(s, " frame-threads=%d", p->frameNumThreads);
> +    s += sprintf(s, " ctu=%d", p->maxCUSize);
> +    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);
> +    s += sprintf(s, " subme=%d", p->subpelRefine);
> +    s += sprintf(s, " merange=%d", p->searchRange);
> +    s += sprintf(s, " %s", p->bEnableRectInter ? "rect" : "no-rect");
> +    s += sprintf(s, " %s", p->bEnableAMP ? "amp" : "no-amp");
> +    s += sprintf(s, " max-merge=%d", p->maxNumMergeCand);
> +    s += sprintf(s, " %s", p->bEnableEarlySkip ? "early-skip" :
> "no-early-skip");
> +    s += sprintf(s, " %s", p->bEnableCbfFastMode ? "fast-cbf" :
> "no-fast-cbf");
> +    s += sprintf(s, " rdpenalty=%d", p->rdPenalty);
> +    s += sprintf(s, " %s", p->bEnableTransformSkip ? "tskip" :
> "no-tskip");
> +    s += sprintf(s, " %s", p->bEnableTSkipFast ? "tskip-fast" :
> "no-tskip-fast");
> +    s += sprintf(s, " bEnableStrongIntraSmoothing = %s",
> p->bEnableStrongIntraSmoothing ? "strong-intra-smoothing" :
> "no-strong-intra-smoothing");
>

this one is wrong


> +    s += sprintf(s, " %s", p->bEnableConstrainedIntra ?
> "constrained-intra" : "no-constrained-intra");
> +    s += sprintf(s, " refresh=%d", p->decodingRefreshType);
> +    s += sprintf(s, " keyint=%d", p->keyframeMax);
> +    s += sprintf(s, " rc-lookahead=%d", p->lookaheadDepth);
> +    s += sprintf(s, " bframes=%d", p->bframes);
> +    s += sprintf(s, " bframe-bias=%d", p->bFrameBias);
> +    s += sprintf(s, " b-adapt=%d", p->bFrameAdaptive);
> +    s += sprintf(s, " ref=%d", p->maxNumReferences);
> +    s += sprintf(s, " %s", p->bEnableWeightedPred ? "weightp" :
> "no-weightp");
> +    s += sprintf(s, " bitrate=%d", p->rc.bitrate);
> +    s += sprintf(s, " qp=%d", p->rc.qp);
> +    s += sprintf(s, " cbqpoffs=%d", p->cbQpOffset);
> +    s += sprintf(s, " crqpoffs=%d", p->crQpOffset);
> +    s += sprintf(s, " rd=%d", p->bRDLevel);
>

bRdLevel? ouch.  that parameter shouldn't have a b prefix.  Can you fix
that in a separate patch?


> +    s += sprintf(s, " %s", p->bEnableSignHiding ? "signhide" :
> "no-signhide");
> +    s += sprintf(s, " %s", p->bEnableLoopFilter ? "lft" : "no-lft");
> +    s += sprintf(s, " %s", p->bEnableSAO ? "sao" : "no-sao");
> +    s += sprintf(s, " sao-lcu-bounds=%d", p->saoLcuBoundary);
> +    s += sprintf(s, " sao-lcu-opt=%d", p->saoLcuBasedOptimization);
> +
> +    return buf;
> +}
> diff -r 1d6b3626f1b3 -r 4cba7c453533 source/common/common.h
> --- a/source/common/common.h    Wed Oct 16 20:38:44 2013 -0500
> +++ b/source/common/common.h    Thu Oct 17 12:35:09 2013 +0530
> @@ -114,5 +114,6 @@
>  int  x265_check_params(x265_param_t *param);
>  void x265_print_params(x265_param_t *param);
>  int x265_set_globals(x265_param_t *param);
> +char *x265_param2string( x265_param_t *p);
>
>  #endif // ifndef X265_COMMON_H
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>



-- 
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20131017/0d821e3b/attachment.html>


More information about the x265-devel mailing list