Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu
@ 2023-12-15 13:05 Martin Storsjö
  2023-12-15 13:29 ` James Almer
  2023-12-15 16:36 ` Rémi Denis-Courmont
  0 siblings, 2 replies; 5+ messages in thread
From: Martin Storsjö @ 2023-12-15 13:05 UTC (permalink / raw)
  To: ffmpeg-devel

The names of the cpu flags are pased by the libavutil eval
functions - names with dashes are parsed as a subtraction.
Replace dashes with underscores.

Add these cpu flags to libavutil/tests/cpu, so that the detected
cpu flags also get printed when run, also as part of the
fate-cpu test.
---
 libavutil/cpu.c       | 10 +++++-----
 libavutil/tests/cpu.c | 10 ++++++++++
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 1e0607d581..8c1acc5e72 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -186,12 +186,12 @@ int av_parse_cpu_caps(unsigned *flags, const char *s)
         { "rvi",      NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVI      },    .unit = "flags" },
         { "rvf",      NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVF      },    .unit = "flags" },
         { "rvd",      NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVD      },    .unit = "flags" },
-        { "rvv-i32",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I32 },     .unit = "flags" },
-        { "rvv-f32",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 },     .unit = "flags" },
-        { "rvv-i64",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I64 },     .unit = "flags" },
+        { "rvv_i32",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I32 },     .unit = "flags" },
+        { "rvv_f32",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 },     .unit = "flags" },
+        { "rvv_i64",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I64 },     .unit = "flags" },
         { "rvv",      NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 },     .unit = "flags" },
-        { "rvb-addr",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_ADDR },   .unit = "flags" },
-        { "rvb-basic",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC },   .unit = "flags" },
+        { "rvb_addr",NULL, 0, AV_OPT_TYPE_CONST,  { .i64 = AV_CPU_FLAG_RVB_ADDR },   .unit = "flags" },
+        { "rvb_basic",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC },   .unit = "flags" },
 #endif
         { NULL },
     };
diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c
index 200f20388a..1cabd15b72 100644
--- a/libavutil/tests/cpu.c
+++ b/libavutil/tests/cpu.c
@@ -84,6 +84,16 @@ static const struct {
 #elif ARCH_LOONGARCH
     { AV_CPU_FLAG_LSX,       "lsx"        },
     { AV_CPU_FLAG_LASX,      "lasx"       },
+#elif ARCH_RISCV
+    { AV_CPU_FLAG_RVI,       "rvi"        },
+    { AV_CPU_FLAG_RVF,       "rvf"        },
+    { AV_CPU_FLAG_RVD,       "rvd"        },
+    { AV_CPU_FLAG_RVB_ADDR,  "rvb_addr"   },
+    { AV_CPU_FLAG_RVB_BASIC, "rvb_basic"  },
+    { AV_CPU_FLAG_RVV_I32,   "rvv_i32"    },
+    { AV_CPU_FLAG_RVV_F32,   "rvv_f32"    },
+    { AV_CPU_FLAG_RVV_I64,   "rvv_i64"    },
+    { AV_CPU_FLAG_RVV_F64,   "rvv"        },
 #endif
     { 0 }
 };
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu
  2023-12-15 13:05 [FFmpeg-devel] [PATCH] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu Martin Storsjö
@ 2023-12-15 13:29 ` James Almer
  2023-12-15 16:36 ` Rémi Denis-Courmont
  1 sibling, 0 replies; 5+ messages in thread
From: James Almer @ 2023-12-15 13:29 UTC (permalink / raw)
  To: ffmpeg-devel

On 12/15/2023 10:05 AM, Martin Storsjö wrote:
> The names of the cpu flags are pased by the libavutil eval
> functions - names with dashes are parsed as a subtraction.
> Replace dashes with underscores.
> 
> Add these cpu flags to libavutil/tests/cpu, so that the detected
> cpu flags also get printed when run, also as part of the
> fate-cpu test.
> ---
>   libavutil/cpu.c       | 10 +++++-----
>   libavutil/tests/cpu.c | 10 ++++++++++
>   2 files changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/libavutil/cpu.c b/libavutil/cpu.c
> index 1e0607d581..8c1acc5e72 100644
> --- a/libavutil/cpu.c
> +++ b/libavutil/cpu.c
> @@ -186,12 +186,12 @@ int av_parse_cpu_caps(unsigned *flags, const char *s)
>           { "rvi",      NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVI      },    .unit = "flags" },
>           { "rvf",      NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVF      },    .unit = "flags" },
>           { "rvd",      NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVD      },    .unit = "flags" },
> -        { "rvv-i32",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I32 },     .unit = "flags" },
> -        { "rvv-f32",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 },     .unit = "flags" },
> -        { "rvv-i64",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I64 },     .unit = "flags" },
> +        { "rvv_i32",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I32 },     .unit = "flags" },
> +        { "rvv_f32",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 },     .unit = "flags" },
> +        { "rvv_i64",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I64 },     .unit = "flags" },
>           { "rvv",      NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 },     .unit = "flags" },
> -        { "rvb-addr",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_ADDR },   .unit = "flags" },
> -        { "rvb-basic",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC },   .unit = "flags" },
> +        { "rvb_addr",NULL, 0, AV_OPT_TYPE_CONST,  { .i64 = AV_CPU_FLAG_RVB_ADDR },   .unit = "flags" },
> +        { "rvb_basic",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC },   .unit = "flags" },

Use this change to add some vertical alignment while at it.

>   #endif
>           { NULL },
>       };
> diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c
> index 200f20388a..1cabd15b72 100644
> --- a/libavutil/tests/cpu.c
> +++ b/libavutil/tests/cpu.c
> @@ -84,6 +84,16 @@ static const struct {
>   #elif ARCH_LOONGARCH
>       { AV_CPU_FLAG_LSX,       "lsx"        },
>       { AV_CPU_FLAG_LASX,      "lasx"       },
> +#elif ARCH_RISCV
> +    { AV_CPU_FLAG_RVI,       "rvi"        },
> +    { AV_CPU_FLAG_RVF,       "rvf"        },
> +    { AV_CPU_FLAG_RVD,       "rvd"        },
> +    { AV_CPU_FLAG_RVB_ADDR,  "rvb_addr"   },
> +    { AV_CPU_FLAG_RVB_BASIC, "rvb_basic"  },
> +    { AV_CPU_FLAG_RVV_I32,   "rvv_i32"    },
> +    { AV_CPU_FLAG_RVV_F32,   "rvv_f32"    },
> +    { AV_CPU_FLAG_RVV_I64,   "rvv_i64"    },
> +    { AV_CPU_FLAG_RVV_F64,   "rvv"        },
>   #endif
>       { 0 }
>   };
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu
  2023-12-15 13:05 [FFmpeg-devel] [PATCH] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu Martin Storsjö
  2023-12-15 13:29 ` James Almer
@ 2023-12-15 16:36 ` Rémi Denis-Courmont
  2023-12-15 16:39   ` Martin Storsjö
  1 sibling, 1 reply; 5+ messages in thread
From: Rémi Denis-Courmont @ 2023-12-15 16:36 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



Le 15 décembre 2023 15:05:10 GMT+02:00, "Martin Storsjö" <martin@martin.st> a écrit :
>The names of the cpu flags are pased by the libavutil eval

PaSsed

>functions - names with dashes are parsed as a subtraction.
>Replace dashes with underscores.

My personal preference would be to use official extension names, doubly so if we switch to underscore separators (which matches official syntax), rather than the made-up FFmpeg names. But that's just my opinion.


>
>Add these cpu flags to libavutil/tests/cpu, so that the detected
>cpu flags also get printed when run, also as part of the
>fate-cpu test.
>---
> libavutil/cpu.c       | 10 +++++-----
> libavutil/tests/cpu.c | 10 ++++++++++
> 2 files changed, 15 insertions(+), 5 deletions(-)
>
>diff --git a/libavutil/cpu.c b/libavutil/cpu.c
>index 1e0607d581..8c1acc5e72 100644
>--- a/libavutil/cpu.c
>+++ b/libavutil/cpu.c
>@@ -186,12 +186,12 @@ int av_parse_cpu_caps(unsigned *flags, const char *s)
>         { "rvi",      NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVI      },    .unit = "flags" },
>         { "rvf",      NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVF      },    .unit = "flags" },
>         { "rvd",      NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVD      },    .unit = "flags" },
>-        { "rvv-i32",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I32 },     .unit = "flags" },
>-        { "rvv-f32",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 },     .unit = "flags" },
>-        { "rvv-i64",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I64 },     .unit = "flags" },
>+        { "rvv_i32",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I32 },     .unit = "flags" },
>+        { "rvv_f32",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 },     .unit = "flags" },
>+        { "rvv_i64",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I64 },     .unit = "flags" },
>         { "rvv",      NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 },     .unit = "flags" },
>-        { "rvb-addr",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_ADDR },   .unit = "flags" },
>-        { "rvb-basic",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC },   .unit = "flags" },
>+        { "rvb_addr",NULL, 0, AV_OPT_TYPE_CONST,  { .i64 = AV_CPU_FLAG_RVB_ADDR },   .unit = "flags" },
>+        { "rvb_basic",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC },   .unit = "flags" },
> #endif
>         { NULL },
>     };
>diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c
>index 200f20388a..1cabd15b72 100644
>--- a/libavutil/tests/cpu.c
>+++ b/libavutil/tests/cpu.c
>@@ -84,6 +84,16 @@ static const struct {
> #elif ARCH_LOONGARCH
>     { AV_CPU_FLAG_LSX,       "lsx"        },
>     { AV_CPU_FLAG_LASX,      "lasx"       },
>+#elif ARCH_RISCV
>+    { AV_CPU_FLAG_RVI,       "rvi"        },
>+    { AV_CPU_FLAG_RVF,       "rvf"        },
>+    { AV_CPU_FLAG_RVD,       "rvd"        },
>+    { AV_CPU_FLAG_RVB_ADDR,  "rvb_addr"   },
>+    { AV_CPU_FLAG_RVB_BASIC, "rvb_basic"  },
>+    { AV_CPU_FLAG_RVV_I32,   "rvv_i32"    },
>+    { AV_CPU_FLAG_RVV_F32,   "rvv_f32"    },
>+    { AV_CPU_FLAG_RVV_I64,   "rvv_i64"    },
>+    { AV_CPU_FLAG_RVV_F64,   "rvv"        },
> #endif
>     { 0 }
> };
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu
  2023-12-15 16:36 ` Rémi Denis-Courmont
@ 2023-12-15 16:39   ` Martin Storsjö
  2023-12-15 16:44     ` Rémi Denis-Courmont
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Storsjö @ 2023-12-15 16:39 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Fri, 15 Dec 2023, Rémi Denis-Courmont wrote:

> Le 15 décembre 2023 15:05:10 GMT+02:00, "Martin Storsjö" <martin@martin.st> a écrit :
>> The names of the cpu flags are pased by the libavutil eval
>
> PaSsed

Actually, I meant "parsed"

>> functions - names with dashes are parsed as a subtraction.
>> Replace dashes with underscores.
>
> My personal preference would be to use official extension names, doubly 
> so if we switch to underscore separators (which matches official 
> syntax), rather than the made-up FFmpeg names. But that's just my 
> opinion.

Sure - which are those names? Do you want to suggest a patch yourself?

// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu
  2023-12-15 16:39   ` Martin Storsjö
@ 2023-12-15 16:44     ` Rémi Denis-Courmont
  0 siblings, 0 replies; 5+ messages in thread
From: Rémi Denis-Courmont @ 2023-12-15 16:44 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



Le 15 décembre 2023 18:39:28 GMT+02:00, "Martin Storsjö" <martin@martin.st> a écrit :
>On Fri, 15 Dec 2023, Rémi Denis-Courmont wrote:
>
>> Le 15 décembre 2023 15:05:10 GMT+02:00, "Martin Storsjö" <martin@martin.st> a écrit :
>>> The names of the cpu flags are pased by the libavutil eval
>> 
>> PaSsed
>
>Actually, I meant "parsed"
>
>>> functions - names with dashes are parsed as a subtraction.
>>> Replace dashes with underscores.
>> 
>> My personal preference would be to use official extension names, doubly so if we switch to underscore separators (which matches official syntax), rather than the made-up FFmpeg names. But that's just my opinion.
>
>Sure - which are those names? Do you want to suggest a patch yourself?

On top of my head, those would be Zve32x Zve64x Zve32f Zve64d Zba and Zbb. Whatever shows up in the existing `func` macros' second parameter.


>
>// Martin
>_______________________________________________
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-15 16:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-15 13:05 [FFmpeg-devel] [PATCH] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu Martin Storsjö
2023-12-15 13:29 ` James Almer
2023-12-15 16:36 ` Rémi Denis-Courmont
2023-12-15 16:39   ` Martin Storsjö
2023-12-15 16:44     ` Rémi Denis-Courmont

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git