[x265] [PATCH 1 of 4] param: auto-wrap tools list, add more tool options and group by category
Steve Borho
steve at borho.org
Wed Mar 18 01:31:28 CET 2015
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1426638294 18000
# Tue Mar 17 19:24:54 2015 -0500
# Node ID e7dabcfdc06698781c2bef5a2d85cad3e8ddac85
# Parent a593af2995788a3c6762f51d56c5f7d32e3ebce9
param: auto-wrap tools list, add more tool options and group by category
diff -r a593af299578 -r e7dabcfdc066 source/common/param.cpp
--- a/source/common/param.cpp Tue Mar 17 16:46:48 2015 -0500
+++ b/source/common/param.cpp Tue Mar 17 19:24:54 2015 -0500
@@ -1210,6 +1210,22 @@
return 0;
}
+static void appendtool(x265_param* param, char* buf, size_t size, const char* toolstr)
+{
+ static const int overhead = strlen("x265 [info]: tools: ");
+
+ if (strlen(buf) + strlen(toolstr) + overhead >= size)
+ {
+ x265_log(param, X265_LOG_INFO, "tools:%s\n", buf);
+ sprintf(buf, " %s", toolstr);
+ }
+ else
+ {
+ strcat(buf, " ");
+ strcat(buf, toolstr);
+ }
+}
+
void x265_print_params(x265_param *param)
{
if (param->logLevel < X265_LOG_INFO)
@@ -1266,40 +1282,43 @@
x265_log(param, X265_LOG_INFO, "VBV/HRD buffer / max-rate / init : %d / %d / %.3f\n",
param->rc.vbvBufferSize, param->rc.vbvMaxBitrate, param->rc.vbvBufferInit);
- x265_log(param, X265_LOG_INFO, "tools: ");
-#define TOOLOPT(FLAG, STR) if (FLAG) fprintf(stderr, "%s ", STR)
+ char buf[80] = { 0 };
+ char tmp[40];
+#define TOOLOPT(FLAG, STR) if (FLAG) appendtool(param, buf, sizeof(buf), STR);
+#define TOOLVAL(VAL, STR) if (VAL) { sprintf(tmp, STR, VAL); appendtool(param, buf, sizeof(buf), tmp); }
TOOLOPT(param->bEnableRectInter, "rect");
TOOLOPT(param->bEnableAMP, "amp");
- fprintf(stderr, "rd=%d rdoq=%d ", param->rdLevel, param->rdoqLevel);
- if (param->psyRd > 0.)
- fprintf(stderr, "psy-rd=%.2lf ", param->psyRd);
- if (param->psyRdoq > 0.)
- fprintf(stderr, "psy-rdoq=%.2lf ", param->psyRdoq);
+ TOOLVAL(param->rdLevel, "rd=%d");
+ TOOLVAL(param->psyRd, "psy-rd=%.2lf");
+ TOOLVAL(param->rdoqLevel, "rdoq=%d");
+ TOOLVAL(param->psyRdoq, "psy-rdoq=%.2lf");
TOOLOPT(param->bEnableEarlySkip, "early-skip");
- if (param->noiseReductionIntra)
- fprintf(stderr, "nr-intra=%d ", param->noiseReductionIntra);
- if (param->noiseReductionInter)
- fprintf(stderr, "nr-inter=%d ", param->noiseReductionInter);
+ TOOLVAL(param->noiseReductionIntra, "nr-intra=%d");
+ TOOLVAL(param->noiseReductionInter, "nr-inter=%d");
+ TOOLOPT(param->bEnableTSkipFast, "tskip-fast");
+ TOOLOPT(!param->bEnableTSkipFast && param->bEnableTransformSkip, "tskip");
+ TOOLOPT(param->bCULossless, "cu-lossless");
+ TOOLOPT(param->bEnableSignHiding, "signhide");
+ TOOLOPT(param->bEnableTemporalMvp, "tmvp");
+ TOOLOPT(param->bEnableConstrainedIntra, "cip");
+ TOOLOPT(param->bIntraInBFrames, "b-intra");
+ TOOLOPT(param->bEnableFastIntra, "fast-intra");
+ TOOLOPT(param->bEnableStrongIntraSmoothing, "strong-intra-smoothing");
if (param->bEnableLoopFilter)
{
if (param->deblockingFilterBetaOffset || param->deblockingFilterTCOffset)
- fprintf(stderr, "deblock(tC=%d:B=%d) ", param->deblockingFilterTCOffset, param->deblockingFilterBetaOffset);
+ {
+ sprintf(tmp, "deblock(tC=%d:B=%d)", param->deblockingFilterTCOffset, param->deblockingFilterBetaOffset);
+ appendtool(param, buf, sizeof(buf), tmp);
+ }
else
TOOLOPT(param->bEnableLoopFilter, "deblock");
}
- if (param->bEnableSAO)
- fprintf(stderr, "sao%s ", param->bSaoNonDeblocked ? "-non-deblock" : "");
- TOOLOPT(param->bEnableSignHiding, "signhide");
- TOOLOPT(param->bEnableConstrainedIntra, "cip");
- TOOLOPT(param->bIntraInBFrames, "b-intra");
- TOOLOPT(param->bEnableFastIntra, "fast-intra");
- TOOLOPT(param->bEnableTemporalMvp, "tmvp");
- if (param->bEnableTransformSkip)
- fprintf(stderr, "tskip%s ", param->bEnableTSkipFast ? "-fast" : "");
- TOOLOPT(param->bCULossless, "cu-lossless");
+ TOOLOPT(param->bSaoNonDeblocked, "sao-non-deblock");
+ TOOLOPT(!param->bSaoNonDeblocked && param->bEnableSAO, "sao");
TOOLOPT(param->rc.bStatWrite, "stats-write");
TOOLOPT(param->rc.bStatRead, "stats-read");
- fprintf(stderr, "\n");
+ x265_log(param, X265_LOG_INFO, "tools:%s\n", buf);
fflush(stderr);
}
More information about the x265-devel
mailing list