[x265] [PATCH Alpha 1/10] Add support for Alpha channel CLI
Karam Singh
karam.singh at multicorewareinc.com
Tue Aug 6 07:25:35 UTC 2024
All the patches of Alpha are pushed to the master branch.
*__________________________*
*Karam Singh*
*Ph.D. IIT Guwahati*
Senior Software (Video Coding) Engineer
Mobile: +91 8011279030
Block 9A, 6th floor, DLF Cyber City
Manapakkam, Chennai 600 089
On Mon, Aug 5, 2024 at 4:19 PM Anusuya Kumarasamy <
anusuya.kumarasamy at multicorewareinc.com> wrote:
> From 58f011df8ce0c5ac2a333d1ee25f0843caf2ee07 Mon Sep 17 00:00:00 2001
> From: AnusuyaKumarasamy <anusuya.kumarasamy at multicorewareinc.com>
> Date: Fri, 5 Jul 2024 16:11:02 +0530
> Subject: [PATCH] Add support for Alpha channel CLI
>
> ---
> doc/reST/cli.rst | 11 +++++++++++
> source/CMakeLists.txt | 2 +-
> source/common/param.cpp | 16 ++++++++++++++++
> source/x265.h | 4 ++++
> source/x265cli.cpp | 1 +
> source/x265cli.h | 1 +
> 6 files changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
> index c57491b63..4d5ac1a15 100755
> --- a/doc/reST/cli.rst
> +++ b/doc/reST/cli.rst
> @@ -2882,4 +2882,15 @@ See section :ref:`svthevc <SvtHevc>` for more
> details.
>
> **CLI_ONLY**
>
> +Alpha Encode Options
> +===================
> +
> +.. option:: --alpha
> +
> + Enable alpha layer encoding support in x265.This option can be enabled
> + only when ENABLE_ALPHA is set during the make of x265.When enabled
> + --alpha always expects an input file in YUVA420 format.
> +
> +**CLI_ONLY**
> +
> .. vim: noet
> diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
> index bed98bb37..9a215cbbf 100755
> --- a/source/CMakeLists.txt
> +++ b/source/CMakeLists.txt
> @@ -31,7 +31,7 @@ option(NATIVE_BUILD "Target the build CPU" OFF)
> option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
> mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
> # X265_BUILD must be incremented each time the public API is changed
> -set(X265_BUILD 209)
> +set(X265_BUILD 210)
> configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
> "${PROJECT_BINARY_DIR}/x265.def")
> configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
> diff --git a/source/common/param.cpp b/source/common/param.cpp
> index 5b2922587..e05e79eaf 100755
> --- a/source/common/param.cpp
> +++ b/source/common/param.cpp
> @@ -392,6 +392,10 @@ void x265_param_default(x265_param* param)
> param->bEnableTemporalFilter = 0;
> param->temporalFilterStrength = 0.95;
>
> + /*Alpha Channel Encoding*/
> + param->bEnableAlpha = 0;
> + param->numScalableLayers = 1;
> +
> #ifdef SVT_HEVC
> param->svtHevcParam = svtParam;
> svt_param_default(param);
> @@ -1444,6 +1448,14 @@ int x265_param_parse(x265_param* p, const char*
> name, const char* value)
> OPT("film-grain") p->filmGrain = (char* )value;
> OPT("mcstf") p->bEnableTemporalFilter = atobool(value);
> OPT("sbrc") p->bEnableSBRC = atobool(value);
> + OPT("alpha")
> + {
> + if (atobool(value))
> + {
> + p->bEnableAlpha = 1;
> + p->numScalableLayers = 2;
> + }
> + }
> else
> return X265_PARAM_BAD_NAME;
> }
> @@ -2079,6 +2091,7 @@ void x265_print_params(x265_param* param)
> TOOLOPT(param->rc.bStatWrite, "stats-write");
> TOOLOPT(param->rc.bStatRead, "stats-read");
> TOOLOPT(param->bSingleSeiNal, "single-sei");
> + TOOLOPT(param->numScalableLayers > 1, "alpha");
> #if ENABLE_HDR10_PLUS
> TOOLOPT(param->toneMapFile != NULL, "dhdr10-info");
> #endif
> @@ -2343,6 +2356,7 @@ char *x265_param2string(x265_param* p, int padx, int
> pady)
> if (p->filmGrain)
> s += sprintf(s, " film-grain=%s", p->filmGrain); // Film grain
> characteristics model filename
> BOOL(p->bEnableTemporalFilter, "mcstf");
> + BOOL(p->bEnableAlpha, "alpha");
> BOOL(p->bEnableSBRC, "sbrc");
> #undef BOOL
> return buf;
> @@ -2864,6 +2878,8 @@ void x265_copy_params(x265_param* dst, x265_param*
> src)
> dst->confWinRightOffset = src->confWinRightOffset;
> dst->confWinBottomOffset = src->confWinBottomOffset;
> dst->bliveVBV2pass = src->bliveVBV2pass;
> + dst->bEnableAlpha = src->bEnableAlpha;
> + dst->numScalableLayers = src->numScalableLayers;
>
> if (src->videoSignalTypePreset) dst->videoSignalTypePreset =
> strdup(src->videoSignalTypePreset);
> else dst->videoSignalTypePreset = NULL;
> diff --git a/source/x265.h b/source/x265.h
> index c48b8648a..b6e410435 100644
> --- a/source/x265.h
> +++ b/source/x265.h
> @@ -2269,6 +2269,10 @@ typedef struct x265_param
> /*SBRC*/
> int bEnableSBRC;
> int mcstfFrameRange;
> +
> + /*Alpha channel encoding*/
> + int bEnableAlpha;
> + int numScalableLayers;
> } x265_param;
>
> /* x265_param_alloc:
> diff --git a/source/x265cli.cpp b/source/x265cli.cpp
> index 861595a5a..2f8a150d4 100755
> --- a/source/x265cli.cpp
> +++ b/source/x265cli.cpp
> @@ -374,6 +374,7 @@ namespace X265_NS {
> 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-]mcstf Enable GOP based temporal
> filter. Default %d\n", param->bEnableTemporalFilter);
> + H0(" --alpha Enable alpha channel
> support. Default %d\n", param->bEnableAlpha);
> #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 b5fe327a6..b4e91a137 100644
> --- a/source/x265cli.h
> +++ b/source/x265cli.h
> @@ -358,6 +358,7 @@ static const struct option long_options[] =
> { "dup-threshold", required_argument, NULL, 0 },
> { "mcstf", no_argument, NULL, 0 },
> { "no-mcstf", no_argument, NULL, 0 },
> + { "alpha", no_argument, NULL, 0 },
> #ifdef SVT_HEVC
> { "svt", no_argument, NULL, 0 },
> { "no-svt", no_argument, NULL, 0 },
> --
> 2.36.0.windows.1
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20240806/63a137b8/attachment.htm>
More information about the x265-devel
mailing list