[x265] [PATCH] cleanup - runtime flag to enable/disable avx512
Pradeep Ramachandran
pradeep at multicorewareinc.com
Mon Apr 30 14:08:55 CEST 2018
On Wed, Apr 25, 2018 at 10:26 AM, <jayashree.c at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Jayashree <jayashree.c at multicorewareinc.com>
> # Date 1524546422 -19800
> # Tue Apr 24 10:37:02 2018 +0530
> # Branch stable
> # Node ID afb9323648ec1d3c7d465ecc8729a8df1a451b4a
> # Parent 930e3cc385df412a227b2671856a6ea871696694
> cleanup - runtime flag to enable/disable avx512
>
Pushed to stable branch.
>
> diff -r 930e3cc385df -r afb9323648ec source/common/param.cpp
> --- a/source/common/param.cpp Thu Apr 19 22:57:59 2018 +0200
> +++ b/source/common/param.cpp Tue Apr 24 10:37:02 2018 +0530
> @@ -99,13 +99,13 @@
> {
> x265_free(p);
> }
> -bool benableavx512 = false;
> +
> void x265_param_default(x265_param* param)
> {
> memset(param, 0, sizeof(x265_param));
>
> /* Applying default values to all elements in the param structure */
> - param->cpuid = X265_NS::cpu_detect(benableavx512);
> + param->cpuid = X265_NS::cpu_detect(false);
> param->bEnableWavefront = 1;
> param->frameNumThreads = 0;
>
> @@ -618,20 +618,20 @@
> #if X265_ARCH_X86
> if (!strcasecmp(value, "avx512"))
> {
> - p->bEnableavx512 = 1;
> - benableavx512 = true;
> - p->cpuid = X265_NS::cpu_detect(benableavx512);
> + p->bEnableavx512 = true;
> +
> + p->cpuid = X265_NS::cpu_detect(p->bEnableavx512);
> if (!(p->cpuid & X265_CPU_AVX512))
> x265_log(p, X265_LOG_WARNING, "AVX512 is not
> supported\n");
> }
> else
> {
> - p->bEnableavx512 = 0;
> - benableavx512 = false;
> + p->bEnableavx512 = false;
> +
> if (bValueWasNull)
> p->cpuid = atobool(value);
> else
> - p->cpuid = parseCpuName(value, bError);
> + p->cpuid = parseCpuName(value, bError, p->bEnableavx512);
> }
> #else
> if (bValueWasNull)
> @@ -1089,7 +1089,7 @@
> * false || no - disabled
> * integer bitmap value
> * comma separated list of SIMD names, eg: SSE4.1,XOP */
> -int parseCpuName(const char* value, bool& bError)
> +int parseCpuName(const char* value, bool& bError, bool bEnableavx512)
> {
> if (!value)
> {
> @@ -1100,7 +1100,7 @@
> if (isdigit(value[0]))
> cpu = x265_atoi(value, bError);
> else
> - cpu = !strcmp(value, "auto") || x265_atobool(value, bError) ?
> X265_NS::cpu_detect(benableavx512) : 0;
> + cpu = !strcmp(value, "auto") || x265_atobool(value, bError) ?
> X265_NS::cpu_detect(bEnableavx512) : 0;
>
> if (bError)
> {
> diff -r 930e3cc385df -r afb9323648ec source/common/param.h
> --- a/source/common/param.h Thu Apr 19 22:57:59 2018 +0200
> +++ b/source/common/param.h Tue Apr 24 10:37:02 2018 +0530
> @@ -33,7 +33,7 @@
> char* x265_param2string(x265_param *param, int padx, int pady);
> int x265_atoi(const char *str, bool& bError);
> double x265_atof(const char *str, bool& bError);
> -int parseCpuName(const char *value, bool& bError);
> +int parseCpuName(const char *value, bool& bError, bool bEnableavx512);
> void setParamAspectRatio(x265_param *p, int width, int height);
> void getParamAspectRatio(x265_param *p, int& width, int& height);
> bool parseLambdaFile(x265_param *param);
> diff -r 930e3cc385df -r afb9323648ec source/test/testbench.cpp
> --- a/source/test/testbench.cpp Thu Apr 19 22:57:59 2018 +0200
> +++ b/source/test/testbench.cpp Tue Apr 24 10:37:02 2018 +0530
> @@ -118,7 +118,7 @@
> if (!strncmp(name, "cpuid", strlen(name)))
> {
> bool bError = false;
> - cpuid = parseCpuName(value, bError);
> + cpuid = parseCpuName(value, bError, enableavx512);
> if (bError)
> {
> printf("Invalid CPU name: %s\n", value);
> diff -r 930e3cc385df -r afb9323648ec source/x265.h
> --- a/source/x265.h Thu Apr 19 22:57:59 2018 +0200
> +++ b/source/x265.h Tue Apr 24 10:37:02 2018 +0530
> @@ -635,7 +635,8 @@
> * hence the encoding will happen without avx512 assembly primitives
> even if the cpu has
> * avx512 capabilities.
> * Ensure to use --asm avx512 if you need to encode with avx512
> assembly primitives*/
> - int bEnableavx512;
> +
> + bool bEnableavx512;
> /*== Parallelism Features ==*/
>
> /* Number of concurrently encoded frames between 1 and
> X265_MAX_FRAME_THREADS
>
> _______________________________________________
> 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/20180430/627f3022/attachment.html>
More information about the x265-devel
mailing list