mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-28 10:04:37 +08:00
swscale/uops_macros_gen: use a per-backend header include guard
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
1 parent
2fab0667db
commit
6eb7510072
1 file changed
+9
-7
@@ -222,6 +222,7 @@ enum {
|
||||
|
||||
typedef struct Backend {
|
||||
const char *name;
|
||||
const char *guard; /* include guard for the generated C header */
|
||||
SwsUOpFlags flags[2]; /* all flag combinations used by the backend */
|
||||
} Backend;
|
||||
|
||||
@@ -229,6 +230,7 @@ static const Backend backends[] = {
|
||||
{
|
||||
/* Currently also covers all uops used by the x86 backend */
|
||||
.name = "c",
|
||||
.guard = "SWSCALE_UOPS_MACROS_H",
|
||||
.flags = {
|
||||
COMMON_FLAGS,
|
||||
COMMON_FLAGS | SWS_UOP_FLAG_PSHUFB | SWS_UOP_FLAG_FMA,
|
||||
@@ -387,7 +389,8 @@ fail:
|
||||
* Returns 0 or a negative error code. On success, an allocated string is
|
||||
* returned via `out_str`, and must be av_free()'d by the caller.
|
||||
*/
|
||||
static int print_macros(struct AVTreeNode *root, char **out_str)
|
||||
static int print_macros(struct AVTreeNode *root, const Backend *backend,
|
||||
char **out_str)
|
||||
{
|
||||
AVBPrint bprint, *const bp = &bprint;
|
||||
av_bprint_init(bp, 0, AV_BPRINT_SIZE_UNLIMITED);
|
||||
@@ -397,10 +400,9 @@ static int print_macros(struct AVTreeNode *root, char **out_str)
|
||||
" * This file is automatically generated. Do not edit manually.\n"
|
||||
" * To regenerate, run: make fate-sws-uops-macros GEN=1\n"
|
||||
" */\n"
|
||||
"\n"
|
||||
"#ifndef SWSCALE_UOPS_MACROS_H\n"
|
||||
"#define SWSCALE_UOPS_MACROS_H\n"
|
||||
"\n"
|
||||
"\n");
|
||||
av_bprintf(bp, "#ifndef %s\n#define %s\n\n", backend->guard, backend->guard);
|
||||
BPRINT_STR(
|
||||
"/**\n"
|
||||
" * Boilerplate helper macros, for template-based backends. These will be\n"
|
||||
" * instantiated like this, with parameters in struct order:\n"
|
||||
@@ -429,7 +431,7 @@ static int print_macros(struct AVTreeNode *root, char **out_str)
|
||||
}
|
||||
}
|
||||
|
||||
BPRINT_STR("\n#endif /* SWSCALE_UOPS_MACROS_H */");
|
||||
av_bprintf(bp, "\n#endif /* %s */", backend->guard);
|
||||
return av_bprint_finalize(bp, out_str);
|
||||
}
|
||||
|
||||
@@ -520,7 +522,7 @@ int main(int argc, char **argv)
|
||||
return ret;
|
||||
|
||||
char *macros = NULL;
|
||||
ret = print_macros(root, ¯os);
|
||||
ret = print_macros(root, backend, ¯os);
|
||||
if (ret >= 0)
|
||||
puts(macros);
|
||||
av_free(macros);
|
||||
|
||||
Reference in new issue
Block a user