mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
tools/cl2c: change to tools/source2c and allow non-OpenCL source files
This commit is contained in:
parent
7cfd7e4af4
commit
88e2cca3db
@ -651,10 +651,17 @@ TESTPROGS = drawutils filtfmts formats integral
|
||||
TOOLS-$(CONFIG_LIBZMQ) += zmqsend
|
||||
|
||||
clean::
|
||||
$(RM) $(CLEANSUFFIXES:%=libavfilter/dnn/%) $(CLEANSUFFIXES:%=libavfilter/opencl/%)
|
||||
$(RM) $(CLEANSUFFIXES:%=libavfilter/dnn/%) $(CLEANSUFFIXES:%=libavfilter/opencl/%) \
|
||||
$(CLEANSUFFIXES:%=libavfilter/vulkan/%)
|
||||
|
||||
OPENCL = $(subst $(SRC_PATH)/,,$(wildcard $(SRC_PATH)/libavfilter/opencl/*.cl))
|
||||
.SECONDARY: $(OPENCL:.cl=.c)
|
||||
libavfilter/opencl/%.c: TAG = OPENCL
|
||||
libavfilter/opencl/%.c: $(SRC_PATH)/libavfilter/opencl/%.cl
|
||||
$(M)$(SRC_PATH)/tools/cl2c $< $@
|
||||
$(M)$(SRC_PATH)/tools/source2c $< $@
|
||||
|
||||
VULKAN = $(subst $(SRC_PATH)/,,$(wildcard $(SRC_PATH)/libavfilter/vulkan/*.comp))
|
||||
.SECONDARY: $(VULKAN:.comp=.c)
|
||||
libavfilter/vulkan/%.c: TAG = OPENCL
|
||||
libavfilter/vulkan/%.c: $(SRC_PATH)/libavfilter/vulkan/%.comp
|
||||
$(M)$(SRC_PATH)/tools/source2c $< $@
|
||||
|
@ -19,19 +19,19 @@
|
||||
#ifndef AVFILTER_OPENCL_SOURCE_H
|
||||
#define AVFILTER_OPENCL_SOURCE_H
|
||||
|
||||
extern const char *ff_opencl_source_avgblur;
|
||||
extern const char *ff_opencl_source_colorkey;
|
||||
extern const char *ff_opencl_source_colorspace_common;
|
||||
extern const char *ff_opencl_source_convolution;
|
||||
extern const char *ff_opencl_source_deshake;
|
||||
extern const char *ff_opencl_source_neighbor;
|
||||
extern const char *ff_opencl_source_nlmeans;
|
||||
extern const char *ff_opencl_source_overlay;
|
||||
extern const char *ff_opencl_source_pad;
|
||||
extern const char *ff_opencl_source_remap;
|
||||
extern const char *ff_opencl_source_tonemap;
|
||||
extern const char *ff_opencl_source_transpose;
|
||||
extern const char *ff_opencl_source_unsharp;
|
||||
extern const char *ff_opencl_source_xfade;
|
||||
extern const char *ff_source_avgblur_cl;
|
||||
extern const char *ff_source_colorkey_cl;
|
||||
extern const char *ff_source_colorspace_common_cl;
|
||||
extern const char *ff_source_convolution_cl;
|
||||
extern const char *ff_source_deshake_cl;
|
||||
extern const char *ff_source_neighbor_cl;
|
||||
extern const char *ff_source_nlmeans_cl;
|
||||
extern const char *ff_source_overlay_cl;
|
||||
extern const char *ff_source_pad_cl;
|
||||
extern const char *ff_source_remap_cl;
|
||||
extern const char *ff_source_tonemap_cl;
|
||||
extern const char *ff_source_transpose_cl;
|
||||
extern const char *ff_source_unsharp_cl;
|
||||
extern const char *ff_source_xfade_cl;
|
||||
|
||||
#endif /* AVFILTER_OPENCL_SOURCE_H */
|
||||
|
@ -59,7 +59,7 @@ static int avgblur_opencl_init(AVFilterContext *avctx)
|
||||
cl_int cle;
|
||||
int err;
|
||||
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_opencl_source_avgblur, 1);
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_source_avgblur_cl, 1);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
|
@ -52,7 +52,7 @@ static int colorkey_opencl_init(AVFilterContext *avctx)
|
||||
cl_int cle;
|
||||
int err;
|
||||
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_opencl_source_colorkey, 1);
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_source_colorkey_cl, 1);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
|
@ -62,7 +62,7 @@ static int convolution_opencl_init(AVFilterContext *avctx)
|
||||
cl_int cle;
|
||||
int err;
|
||||
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_opencl_source_convolution, 1);
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_source_convolution_cl, 1);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
|
@ -1251,7 +1251,7 @@ static int deshake_opencl_init(AVFilterContext *avctx)
|
||||
}
|
||||
ctx->sw_format = hw_frames_ctx->sw_format;
|
||||
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_opencl_source_deshake, 1);
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_source_deshake_cl, 1);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
|
@ -55,7 +55,7 @@ static int neighbor_opencl_init(AVFilterContext *avctx)
|
||||
cl_int cle;
|
||||
int err;
|
||||
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_opencl_source_neighbor, 1);
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_source_neighbor_cl, 1);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
|
@ -98,7 +98,7 @@ static int nlmeans_opencl_init(AVFilterContext *avctx, int width, int height)
|
||||
if (!ctx->patch_size_uv)
|
||||
ctx->patch_size_uv = ctx->patch_size;
|
||||
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_opencl_source_nlmeans, 1);
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_source_nlmeans_cl, 1);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
|
@ -51,7 +51,7 @@ static int overlay_opencl_load(AVFilterContext *avctx,
|
||||
{
|
||||
OverlayOpenCLContext *ctx = avctx->priv;
|
||||
cl_int cle;
|
||||
const char *source = ff_opencl_source_overlay;
|
||||
const char *source = ff_source_overlay_cl;
|
||||
const char *kernel;
|
||||
const AVPixFmtDescriptor *main_desc, *overlay_desc;
|
||||
int err, i, main_planes, overlay_planes;
|
||||
|
@ -93,7 +93,7 @@ static int pad_opencl_init(AVFilterContext *avctx, AVFrame *input_frame)
|
||||
ctx->hsub = desc->log2_chroma_w;
|
||||
ctx->vsub = desc->log2_chroma_h;
|
||||
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_opencl_source_pad, 1);
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_source_pad_cl, 1);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
|
@ -73,7 +73,7 @@ static int remap_opencl_load(AVFilterContext *avctx,
|
||||
{
|
||||
RemapOpenCLContext *ctx = avctx->priv;
|
||||
cl_int cle;
|
||||
const char *source = ff_opencl_source_remap;
|
||||
const char *source = ff_source_remap_cl;
|
||||
const char *kernel = kernels[ctx->interp];
|
||||
const AVPixFmtDescriptor *main_desc;
|
||||
int err, main_planes;
|
||||
|
@ -240,8 +240,8 @@ static int tonemap_opencl_init(AVFilterContext *avctx)
|
||||
|
||||
av_log(avctx, AV_LOG_DEBUG, "Generated OpenCL header:\n%s\n", header.str);
|
||||
opencl_sources[0] = header.str;
|
||||
opencl_sources[1] = ff_opencl_source_tonemap;
|
||||
opencl_sources[2] = ff_opencl_source_colorspace_common;
|
||||
opencl_sources[1] = ff_source_tonemap_cl;
|
||||
opencl_sources[2] = ff_source_colorspace_common_cl;
|
||||
err = ff_opencl_filter_load_program(avctx, opencl_sources, OPENCL_SOURCE_NB);
|
||||
|
||||
av_bprint_finalize(&header, NULL);
|
||||
|
@ -44,7 +44,7 @@ static int transpose_opencl_init(AVFilterContext *avctx)
|
||||
cl_int cle;
|
||||
int err;
|
||||
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_opencl_source_transpose, 1);
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_source_transpose_cl, 1);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
|
@ -69,7 +69,7 @@ static int unsharp_opencl_init(AVFilterContext *avctx)
|
||||
cl_int cle;
|
||||
int err;
|
||||
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_opencl_source_unsharp, 1);
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_source_unsharp_cl, 1);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
|
@ -93,7 +93,7 @@ static int xfade_opencl_load(AVFilterContext *avctx,
|
||||
if (ctx->transition == CUSTOM) {
|
||||
err = ff_opencl_filter_load_program_from_file(avctx, ctx->source_file);
|
||||
} else {
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_opencl_source_xfade, 1);
|
||||
err = ff_opencl_filter_load_program(avctx, &ff_source_xfade_cl, 1);
|
||||
}
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
1
libavfilter/vulkan/.gitignore
vendored
Normal file
1
libavfilter/vulkan/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.c
|
@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Convert an OpenCL source file into a C source file containing the
|
||||
# OpenCL source as a C string. Also adds a #line directive so that
|
||||
# compiler messages are useful.
|
||||
# Convert a source file into a C source file containing the
|
||||
# source code as a C string.
|
||||
|
||||
# This file is part of FFmpeg.
|
||||
#
|
||||
@ -22,12 +21,11 @@
|
||||
input="$1"
|
||||
output="$2"
|
||||
|
||||
name=$(basename "$input" | sed 's/.cl$//')
|
||||
name=$(basename "$input" | sed 's/\./_/')
|
||||
|
||||
cat >$output <<EOF
|
||||
// Generated from $input
|
||||
const char *ff_opencl_source_$name =
|
||||
"#line 1 \"$input\"\n"
|
||||
const char *ff_source_$name =
|
||||
EOF
|
||||
|
||||
# Convert \ to \\ and " to \", then add " to the start and end of the line.
|
Loading…
Reference in New Issue
Block a user