[x265] [PATCH 7 of 7] param: add function to print reconfigured param options

Steve Borho steve at borho.org
Tue May 5 18:19:50 CEST 2015


On Tue, May 5, 2015 at 10:51 AM,  <aarthi at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Aarthi Thirumalai
> # Date 1427796515 -19800
> #      Tue Mar 31 15:38:35 2015 +0530
> # Node ID 3285714d7c3bee8e5a843894a2b7daa0d6b7718b
> # Parent  89b32a040dda4cf836d9921a3d529b847f2791ab
> param: add function to print reconfigured param options
>
> diff -r 89b32a040dda -r 3285714d7c3b source/common/param.cpp
> --- a/source/common/param.cpp   Sun Mar 29 06:16:21 2015 +0530
> +++ b/source/common/param.cpp   Tue Mar 31 15:38:35 2015 +0530
> @@ -1335,6 +1335,42 @@
>      fflush(stderr);
>  }
>
> +void x265_print_reconfigured_params(x265_param* param, x265_param* reconfiguredParam)
> +{
> +    if (param && reconfiguredParam)

nit: I prefer early-out for sanity checks like this, to avoid the
entire function being indented

> +    {
> +        x265_log(param,X265_LOG_INFO, "Reconfigured param options :\n");
> +        char buf[80] = { 0 };
> +        char tmp[40];
> +#define TOOLCMP(COND1, COND2, STR, VAL)  if (COND1 != COND2) { sprintf(tmp, STR, VAL); appendtool(param, buf, sizeof(buf), tmp); }
> +        TOOLCMP(param->maxNumReferences, reconfiguredParam->maxNumReferences, "ref=%d", reconfiguredParam->maxNumReferences);
> +        TOOLCMP(param->maxTUSize, reconfiguredParam->maxTUSize, "max-tu-size=%d", reconfiguredParam->maxTUSize);
> +        TOOLCMP(param->searchRange, reconfiguredParam->searchRange, "merange=%d", reconfiguredParam->searchRange);
> +        TOOLCMP(param->subpelRefine, reconfiguredParam->subpelRefine, "subme= %d", reconfiguredParam->subpelRefine);
> +        TOOLCMP(param->rdLevel, reconfiguredParam->rdLevel, "rd=%d", reconfiguredParam->rdLevel);
> +        TOOLCMP(param->psyRd, reconfiguredParam->psyRd, "psy-rd=%.2lf", reconfiguredParam->psyRd);
> +        TOOLCMP(param->rdoqLevel, reconfiguredParam->rdoqLevel, "rdoq=%d", reconfiguredParam->rdoqLevel);
> +        TOOLCMP(param->psyRdoq, reconfiguredParam->psyRdoq, "psy-rdoq=%.2lf", reconfiguredParam->psyRdoq);
> +        TOOLCMP(param->noiseReductionIntra, reconfiguredParam->noiseReductionIntra, "nr-intra=%d", reconfiguredParam->noiseReductionIntra);
> +        TOOLCMP(param->noiseReductionInter, reconfiguredParam->noiseReductionInter, "nr-inter=%d", reconfiguredParam->noiseReductionInter);
> +        TOOLCMP(param->bEnableTSkipFast, reconfiguredParam->bEnableTSkipFast, "tskip-fast=%d", reconfiguredParam->bEnableTSkipFast);
> +        TOOLCMP(param->bEnableSignHiding, reconfiguredParam->bEnableSignHiding, "signhide=%d", reconfiguredParam->bEnableSignHiding);
> +        TOOLCMP(param->bEnableFastIntra, reconfiguredParam->bEnableFastIntra, "fast-intra=%d", reconfiguredParam->bEnableFastIntra);
> +        if (param->bEnableLoopFilter && (param->deblockingFilterBetaOffset != reconfiguredParam->deblockingFilterBetaOffset
> +            || param->deblockingFilterTCOffset != reconfiguredParam->deblockingFilterTCOffset))
> +        {
> +            sprintf(tmp, "deblock(tC=%d:B=%d)", param->deblockingFilterTCOffset, param->deblockingFilterBetaOffset);
> +            appendtool(param, buf, sizeof(buf), tmp);
> +        }
> +        else
> +            TOOLCMP(param->bEnableLoopFilter,  reconfiguredParam->bEnableLoopFilter, "deblock=%d", reconfiguredParam->bEnableLoopFilter);
> +
> +        TOOLCMP(param->bEnableTemporalMvp, reconfiguredParam->bEnableTemporalMvp, "tmvp=%d", reconfiguredParam->bEnableTemporalMvp);
> +        TOOLCMP(param->bEnableEarlySkip, reconfiguredParam->bEnableEarlySkip, "early-skip=%d", reconfiguredParam->bEnableEarlySkip);
> +        x265_log(param, X265_LOG_INFO, "tools:%s\n", buf);
> +    }
> +}
> +
>  char *x265_param2string(x265_param* p)
>  {
>      char *buf, *s;
> diff -r 89b32a040dda -r 3285714d7c3b source/common/param.h
> --- a/source/common/param.h     Sun Mar 29 06:16:21 2015 +0530
> +++ b/source/common/param.h     Tue Mar 31 15:38:35 2015 +0530
> @@ -28,6 +28,7 @@
>  int   x265_check_params(x265_param *param);
>  int   x265_set_globals(x265_param *param);
>  void  x265_print_params(x265_param *param);
> +void  x265_print_reconfigured_params(x265_param* param, x265_param* reconfiguredParam);
>  void  x265_param_apply_fastfirstpass(x265_param *p);
>  char* x265_param2string(x265_param *param);
>  int   x265_atoi(const char *str, bool& bError);
> diff -r 89b32a040dda -r 3285714d7c3b source/encoder/api.cpp
> --- a/source/encoder/api.cpp    Sun Mar 29 06:16:21 2015 +0530
> +++ b/source/encoder/api.cpp    Tue Mar 31 15:38:35 2015 +0530
> @@ -133,7 +133,10 @@
>      memcpy(safe, encoder->m_latestParam, sizeof(x265_param));
>      int ret = encoder->reconfigureParam(encoder->m_latestParam, param_in);
>      if (!ret)
> +    {
>          encoder->m_reconfigured = true;
> +        x265_print_reconfigured_params(safe, encoder->m_latestParam);
> +    }
>      else
>          memcpy(encoder->m_latestParam, safe, sizeof(x265_param));
>      X265_FREE(safe);
> _______________________________________________
> 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