Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3355,6 +3355,10 @@ scale_npp_filter_deps="ffnvcodec libnpp"
scale2ref_npp_filter_deps="ffnvcodec libnpp"
scale_cuda_filter_deps="ffnvcodec"
scale_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
lut3d_cuda_filter_deps="ffnvcodec"
lut3d_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
tonemap_cuda_filter_deps="ffnvcodec"
tonemap_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
thumbnail_cuda_filter_deps="ffnvcodec"
thumbnail_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
transpose_npp_filter_deps="ffnvcodec libnpp"
Expand Down
5 changes: 5 additions & 0 deletions libavfilter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ OBJS-$(CONFIG_QSVVPP) += qsvvpp.o
OBJS-$(CONFIG_SCENE_SAD) += scene_sad.o
OBJS-$(CONFIG_DNN) += dnn_filter_common.o


# audio filters
OBJS-$(CONFIG_AAP_FILTER) += af_aap.o
OBJS-$(CONFIG_ABENCH_FILTER) += f_bench.o
Expand Down Expand Up @@ -379,6 +380,8 @@ OBJS-$(CONFIG_LUT1D_FILTER) += vf_lut3d.o
OBJS-$(CONFIG_LUT_FILTER) += vf_lut.o
OBJS-$(CONFIG_LUT2_FILTER) += vf_lut2.o framesync.o
OBJS-$(CONFIG_LUT3D_FILTER) += vf_lut3d.o framesync.o
OBJS-$(CONFIG_LUT3D_CUDA_FILTER) += vf_lut3d_cuda.o \
vf_lut3d_cuda.ptx.o cuda/load_helper.o
OBJS-$(CONFIG_LUTRGB_FILTER) += vf_lut.o
OBJS-$(CONFIG_LUTYUV_FILTER) += vf_lut.o
OBJS-$(CONFIG_MASKEDCLAMP_FILTER) += vf_maskedclamp.o framesync.o
Expand Down Expand Up @@ -530,6 +533,8 @@ OBJS-$(CONFIG_TMEDIAN_FILTER) += vf_xmedian.o framesync.o
OBJS-$(CONFIG_TMIDEQUALIZER_FILTER) += vf_tmidequalizer.o
OBJS-$(CONFIG_TMIX_FILTER) += vf_mix.o framesync.o
OBJS-$(CONFIG_TONEMAP_FILTER) += vf_tonemap.o
OBJS-$(CONFIG_TONEMAP_CUDA_FILTER) += vf_tonemap_cuda.o \
vf_tonemap_cuda.ptx.o cuda/load_helper.o
OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o opencl.o \
opencl/tonemap.o opencl/colorspace_common.o
OBJS-$(CONFIG_TONEMAP_VAAPI_FILTER) += vf_tonemap_vaapi.o vaapi_vpp.o
Expand Down
2 changes: 2 additions & 0 deletions libavfilter/allfilters.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ extern const FFFilter ff_vf_lut;
extern const FFFilter ff_vf_lut1d;
extern const FFFilter ff_vf_lut2;
extern const FFFilter ff_vf_lut3d;
extern const FFFilter ff_vf_lut3d_cuda;
extern const FFFilter ff_vf_lutrgb;
extern const FFFilter ff_vf_lutyuv;
extern const FFFilter ff_vf_maskedclamp;
Expand Down Expand Up @@ -499,6 +500,7 @@ extern const FFFilter ff_vf_tmedian;
extern const FFFilter ff_vf_tmidequalizer;
extern const FFFilter ff_vf_tmix;
extern const FFFilter ff_vf_tonemap;
extern const FFFilter ff_vf_tonemap_cuda;
extern const FFFilter ff_vf_tonemap_opencl;
extern const FFFilter ff_vf_tonemap_vaapi;
extern const FFFilter ff_vf_tpad;
Expand Down
122 changes: 119 additions & 3 deletions libavfilter/avfiltergraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,85 @@ static int formats_declared(AVFilterContext *f)
* was made and the negotiation is stuck;
* a negative error code if some other error happened
*/
static void describe_link_formats_cfg(AVFilterLink *link, AVFilterFormatsConfig *cfg, AVBPrint *bp)
{
if (!link || !cfg)
return;

av_bprintf(bp, "formats=");
if (cfg->formats && cfg->formats->nb_formats > 0) {
av_bprintf(bp, "[");
for (unsigned i = 0; i < cfg->formats->nb_formats; i++) {
if (i > 0) av_bprintf(bp, ", ");
if (link->type == AVMEDIA_TYPE_VIDEO) {
av_bprintf(bp, "%s", av_get_pix_fmt_name(cfg->formats->formats[i]));
} else if (link->type == AVMEDIA_TYPE_AUDIO) {
av_bprintf(bp, "%s", av_get_sample_fmt_name(cfg->formats->formats[i]));
} else {
av_bprintf(bp, "%d", cfg->formats->formats[i]);
}
}
av_bprintf(bp, "]");
} else {
av_bprintf(bp, "none");
}

if (link->type == AVMEDIA_TYPE_AUDIO) {
av_bprintf(bp, ", sample_rates=");
if (cfg->samplerates && cfg->samplerates->nb_formats > 0) {
av_bprintf(bp, "[");
for (unsigned i = 0; i < cfg->samplerates->nb_formats; i++) {
if (i > 0) av_bprintf(bp, ", ");
av_bprintf(bp, "%d", cfg->samplerates->formats[i]);
}
av_bprintf(bp, "]");
} else {
av_bprintf(bp, "none");
}

av_bprintf(bp, ", channel_layouts=");
if (cfg->channel_layouts && cfg->channel_layouts->nb_channel_layouts > 0) {
av_bprintf(bp, "[");
for (int i = 0; i < cfg->channel_layouts->nb_channel_layouts; i++) {
if (i > 0) av_bprintf(bp, ", ");
char buf[256];
av_channel_layout_describe(&cfg->channel_layouts->channel_layouts[i], buf, sizeof(buf));
av_bprintf(bp, "%s", buf);
}
av_bprintf(bp, "]");
} else if (cfg->channel_layouts && cfg->channel_layouts->all_layouts) {
av_bprintf(bp, "all");
} else {
av_bprintf(bp, "none");
}
} else if (link->type == AVMEDIA_TYPE_VIDEO) {
av_bprintf(bp, ", color_spaces=");
if (cfg->color_spaces && cfg->color_spaces->nb_formats > 0) {
av_bprintf(bp, "[");
for (unsigned i = 0; i < cfg->color_spaces->nb_formats; i++) {
if (i > 0) av_bprintf(bp, ", ");
av_bprintf(bp, "%s", av_color_space_name(cfg->color_spaces->formats[i]));
}
av_bprintf(bp, "]");
} else {
av_bprintf(bp, "none");
}

av_bprintf(bp, ", color_ranges=");
if (cfg->color_ranges && cfg->color_ranges->nb_formats > 0) {
av_bprintf(bp, "[");
for (unsigned i = 0; i < cfg->color_ranges->nb_formats; i++) {
if (i > 0) av_bprintf(bp, ", ");
av_bprintf(bp, "%s", av_color_range_name(cfg->color_ranges->formats[i]));
}
av_bprintf(bp, "]");
} else {
av_bprintf(bp, "none");
}
}
}


static int query_formats(AVFilterGraph *graph, void *log_ctx)
{
int i, j, ret;
Expand Down Expand Up @@ -526,6 +605,26 @@ static int query_formats(AVFilterGraph *graph, void *log_ctx)
}

/* couldn't merge format lists. auto-insert conversion filter */
{
AVBPrint src_formats, dst_formats;
av_bprint_init(&src_formats, 0, AV_BPRINT_SIZE_AUTOMATIC);
av_bprint_init(&dst_formats, 0, AV_BPRINT_SIZE_AUTOMATIC);

describe_link_formats_cfg(link, &link->outcfg, &src_formats);
describe_link_formats_cfg(link, &link->incfg, &dst_formats);

av_log(log_ctx, AV_LOG_INFO,
"Auto-inserting filter '%s' between filters '%s' and '%s'\n"
"Source link supports: %s\n"
"Destination link supports: %s\n",
neg->conversion_filter, link->src->name, link->dst->name,
src_formats.str ? src_formats.str : "unknown",
dst_formats.str ? dst_formats.str : "unknown");

av_bprint_finalize(&src_formats, NULL);
av_bprint_finalize(&dst_formats, NULL);
}

if (!(filter = avfilter_get_by_name(neg->conversion_filter))) {
av_log(log_ctx, AV_LOG_ERROR,
"'%s' filter not present, cannot convert formats.\n",
Expand Down Expand Up @@ -578,9 +677,26 @@ static int query_formats(AVFilterGraph *graph, void *log_ctx)
(ret = MERGE(m, outlink)) <= 0) {
if (ret < 0)
return ret;
av_log(log_ctx, AV_LOG_ERROR,
"Impossible to convert between the formats supported by the filter "
"'%s' and the filter '%s'\n", link->src->name, link->dst->name);
{
AVBPrint inlink_formats, outlink_formats;
av_bprint_init(&inlink_formats, 0, AV_BPRINT_SIZE_AUTOMATIC);
av_bprint_init(&outlink_formats, 0, AV_BPRINT_SIZE_AUTOMATIC);

describe_link_formats_cfg(inlink, &inlink->outcfg, &inlink_formats);
describe_link_formats_cfg(outlink, &outlink->incfg, &outlink_formats);

av_log(log_ctx, AV_LOG_ERROR,
"Impossible to convert between the formats supported by the filter "
"'%s' and the filter '%s'\n"
"Input link %s supports: %s\n"
"Output link %s supports: %s\n",
link->src->name, link->dst->name,
link->src->name, inlink_formats.str ? inlink_formats.str : "unknown",
link->dst->name, outlink_formats.str ? outlink_formats.str : "unknown");

av_bprint_finalize(&inlink_formats, NULL);
av_bprint_finalize(&outlink_formats, NULL);
}
return AVERROR(ENOSYS);
}
}
Expand Down
Loading