[x265] [PATCH 1/14] Add command line parameter for mcstf feature
Snehaa Giridharan
snehaa at multicorewareinc.com
Wed Oct 19 07:26:57 UTC 2022
>From c6a826d9c98a4328a605cba8c216c38754db22dc Mon Sep 17 00:00:00 2001
From: ashok2022 <ashok at multicorewareinc.com>
Date: Wed, 21 Sep 2022 17:16:10 +0530
Subject: [PATCH] Add command line parameter for mcstf feature
---
source/common/param.cpp | 14 +++++++++++++-
source/x265.h | 4 ++++
source/x265cli.cpp | 1 +
source/x265cli.h | 2 ++
4 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/source/common/param.cpp b/source/common/param.cpp
index ed6973d9c..0bc9f7f74 100755
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -380,6 +380,10 @@ void x265_param_default(x265_param* param)
param->bEnableSvtHevc = 0;
param->svtHevcParam = NULL;
+ /* MCTF */
+ param->bEnableGopBasedTemporalFilter = 0;
+ param->temporalFilterStrength = 0.95;
+
#ifdef SVT_HEVC
param->svtHevcParam = svtParam;
svt_param_default(param);
@@ -1464,6 +1468,7 @@ int x265_param_parse(x265_param* p, const char* name,
const char* value)
OPT("eos") p->bEnableEndOfSequence = atobool(value);
/* Film grain characterstics model filename */
OPT("film-grain") p->filmGrain = (char* )value;
+ OPT("mctf") p->bEnableGopBasedTemporalFilter = atobool(value);
else
return X265_PARAM_BAD_NAME;
}
@@ -1916,6 +1921,11 @@ int x265_check_params(x265_param* param)
param->bSingleSeiNal = 0;
x265_log(param, X265_LOG_WARNING, "None of the SEI messages are
enabled. Disabling Single SEI NAL\n");
}
+ if (param->bEnableGopBasedTemporalFilter && (param->frameNumThreads >
1))
+ {
+ param->bEnableGopBasedTemporalFilter = 0;
+ x265_log(param, X265_LOG_WARNING, "MCTF can be enabled with frame
thread = 1 only. Disabling MCTF\n");
+ }
CHECK(param->confWinRightOffset < 0, "Conformance Window Right Offset
must be 0 or greater");
CHECK(param->confWinBottomOffset < 0, "Conformance Window Bottom
Offset must be 0 or greater");
CHECK(param->decoderVbvMaxRate < 0, "Invalid Decoder Vbv Maxrate.
Value can not be less than zero");
@@ -2359,6 +2369,7 @@ char *x265_param2string(x265_param* p, int padx, int
pady)
BOOL(p->bliveVBV2pass, "vbv-live-multi-pass");
if (p->filmGrain)
s += sprintf(s, " film-grain=%s", p->filmGrain); // Film grain
characteristics model filename
+ BOOL(p->bEnableGopBasedTemporalFilter, "mctf");
#undef BOOL
return buf;
}
@@ -2722,7 +2733,8 @@ void x265_copy_params(x265_param* dst, x265_param*
src)
dst->bwdRefQpDelta = src->bwdRefQpDelta;
dst->bwdNonRefQpDelta = src->bwdNonRefQpDelta;
dst->bField = src->bField;
-
+ dst->bEnableGopBasedTemporalFilter =
src->bEnableGopBasedTemporalFilter;
+ dst->temporalFilterStrength = src->temporalFilterStrength;
dst->confWinRightOffset = src->confWinRightOffset;
dst->confWinBottomOffset = src->confWinBottomOffset;
dst->bliveVBV2pass = src->bliveVBV2pass;
diff --git a/source/x265.h b/source/x265.h
index 5d242d653..4b3177a94 100644
--- a/source/x265.h
+++ b/source/x265.h
@@ -1992,6 +1992,10 @@ typedef struct x265_param
/* Film Grain Characteristic file */
char* filmGrain;
+
+ /*Motion compensated temporal filter*/
+ int bEnableGopBasedTemporalFilter;
+ double temporalFilterStrength;
} x265_param;
/* x265_param_alloc:
diff --git a/source/x265cli.cpp b/source/x265cli.cpp
index f6ba0ab30..69d77e7bf 100755
--- a/source/x265cli.cpp
+++ b/source/x265cli.cpp
@@ -370,6 +370,7 @@ namespace X265_NS {
H0(" --lowpass-dct Use low-pass subband dct
approximation. Default %s\n", OPT(param->bLowPassDct));
H0(" --[no-]frame-dup Enable Frame duplication.
Default %s\n", OPT(param->bEnableFrameDuplication));
H0(" --dup-threshold <integer> PSNR threshold for Frame
duplication. Default %d\n", param->dupThreshold);
+ H0(" --[no-]mctf Enable GOP based temporal
filter. Default %d\n", param->bEnableGopBasedTemporalFilter);
#ifdef SVT_HEVC
H0(" --[no]svt Enable SVT HEVC encoder
%s\n", OPT(param->bEnableSvtHevc));
H0(" --[no-]svt-hme Enable Hierarchial motion
estimation(HME) in SVT HEVC encoder \n");
diff --git a/source/x265cli.h b/source/x265cli.h
index 7072f7616..29d85f96f 100644
--- a/source/x265cli.h
+++ b/source/x265cli.h
@@ -356,6 +356,8 @@ static const struct option long_options[] =
{ "frame-dup", no_argument, NULL, 0 },
{ "no-frame-dup", no_argument, NULL, 0 },
{ "dup-threshold", required_argument, NULL, 0 },
+ { "mctf", no_argument, NULL, 0 },
+ { "no-mctf", no_argument, NULL, 0 },
#ifdef SVT_HEVC
{ "svt", no_argument, NULL, 0 },
{ "no-svt", no_argument, NULL, 0 },
--
2.34.1.windows.1
*Thanks and Regards,*
*Snehaa.GVideo Codec Engineer,Media & AI analytics
<https://multicorewareinc.com/>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20221019/54420c3b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcstf_patch_01.diff
Type: application/octet-stream
Size: 4842 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20221019/54420c3b/attachment.obj>
More information about the x265-devel
mailing list