[FFmpeg-devel] [PATCH 1/2] lavc/dnxuc_parser: Adhere to av_fourcc_make_string API

2024-10-12 Thread Alexander Strasser via ffmpeg-devel
The documentation of av_fourcc_make_string states the passed in
buffer must be of at least the size of  AV_FOURCC_MAX_STRING_SIZE

Also move the buffer into inner scope where it is used.

Fixes: CID 1632380
---
 libavcodec/dnxuc_parser.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/dnxuc_parser.c b/libavcodec/dnxuc_parser.c
index 55d576345c..896758c794 100644
--- a/libavcodec/dnxuc_parser.c
+++ b/libavcodec/dnxuc_parser.c
@@ -68,7 +68,6 @@ static int dnxuc_parse(AVCodecParserContext *s,
 const uint8_t **poutbuf, int *poutbuf_size,
 const uint8_t *buf, int buf_size)
 {
-char fourcc_buf[5];
 const int HEADER_SIZE = 37;
 int icmp_offset = 0;

@@ -96,6 +95,8 @@ static int dnxuc_parse(AVCodecParserContext *s,
 pc->nr_bytes = AV_RL32(buf+29+icmp_offset) - 8;

 if (!avctx->codec_tag) {
+char fourcc_buf[AV_FOURCC_MAX_STRING_SIZE];
+
 av_fourcc_make_string(fourcc_buf, pc->fourcc_tag);
 av_log(avctx, AV_LOG_INFO, "dnxuc_parser: '%s' %dx%d %dbpp %d\n",
 fourcc_buf,
--
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: check return value of avcodec_parameters_copy()

2024-10-12 Thread Steven Liu
Marth64  于2024年10月13日周日 01:25写道:
>
> Written in the dominant style of the surrounding code block.
>
> Signed-off-by: Marth64 
> ---
>  libavformat/hlsenc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 571d6b2752..1b3f3ef2bb 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -887,7 +887,9 @@ static int hls_mux_init(AVFormatContext *s, VariantStream 
> *vs)
>
>  if (!(st = avformat_new_stream(loc, NULL)))
>  return AVERROR(ENOMEM);
> -avcodec_parameters_copy(st->codecpar, vs->streams[i]->codecpar);
> +ret = avcodec_parameters_copy(st->codecpar, 
> vs->streams[i]->codecpar);
> +if (ret < 0)
> +return ret;
>  if (!oc->oformat->codec_tag ||
>  av_codec_get_id (oc->oformat->codec_tag, 
> vs->streams[i]->codecpar->codec_tag) == st->codecpar->codec_id ||
>  av_codec_get_tag(oc->oformat->codec_tag, 
> vs->streams[i]->codecpar->codec_id) <= 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-requ...@ffmpeg.org with subject "unsubscribe".


LGTM


Thanks
Steven
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 07/24] lavfi/vf_il: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_il.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_il.c b/libavfilter/vf_il.c
index 9a3a9d47a9..5e5d4c16e8 100644
--- a/libavfilter/vf_il.c
+++ b/libavfilter/vf_il.c
@@ -83,11 +83,14 @@ static const AVOption il_options[] = {
 
 AVFILTER_DEFINE_CLASS(il);
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 int reject_flags = AV_PIX_FMT_FLAG_PAL | AV_PIX_FMT_FLAG_HWACCEL;
 
-return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, 
reject_flags));
+return ff_set_common_formats2(ctx, cfg_in, cfg_out,
+  ff_formats_pixdesc_filter(0, reject_flags));
 }
 
 static int config_input(AVFilterLink *inlink)
@@ -191,7 +194,7 @@ const AVFilter ff_vf_il = {
 .priv_size = sizeof(IlContext),
 FILTER_INPUTS(inputs),
 FILTER_OUTPUTS(ff_video_default_filterpad),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &il_class,
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
 .process_command = ff_filter_process_command,
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 09/24] lavfi/vf_libplacebo: convert to query_func2()

2024-10-12 Thread Anton Khirnov
Drop a redundant error message for out_format, as it is already
validated in init.
---
 libavfilter/vf_libplacebo.c | 24 +++-
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 5bf8b7e77a..77219b830a 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -1090,10 +1090,12 @@ static int libplacebo_activate(AVFilterContext *ctx)
 return FFERROR_NOT_READY;
 }
 
-static int libplacebo_query_format(AVFilterContext *ctx)
+static int libplacebo_query_format(const AVFilterContext *ctx,
+   AVFilterFormatsConfig **cfg_in,
+   AVFilterFormatsConfig **cfg_out)
 {
 int err;
-LibplaceboContext *s = ctx->priv;
+const LibplaceboContext *s = ctx->priv;
 const AVPixFmtDescriptor *desc = NULL;
 AVFilterFormats *infmts = NULL, *outfmts = NULL;
 
@@ -1139,29 +1141,25 @@ static int libplacebo_query_format(AVFilterContext *ctx)
 }
 
 if (!infmts || !outfmts) {
-if (s->out_format) {
-av_log(s, AV_LOG_ERROR, "Invalid output format '%s'!\n",
-   av_get_pix_fmt_name(s->out_format));
-}
 err = AVERROR(EINVAL);
 goto fail;
 }
 
 for (int i = 0; i < s->nb_inputs; i++)
-RET(ff_formats_ref(infmts, &ctx->inputs[i]->outcfg.formats));
-RET(ff_formats_ref(outfmts, &ctx->outputs[0]->incfg.formats));
+RET(ff_formats_ref(infmts, &cfg_in[i]->formats));
+RET(ff_formats_ref(outfmts, &cfg_out[0]->formats));
 
 /* Set colorspace properties */
-RET(ff_formats_ref(ff_all_color_spaces(), 
&ctx->inputs[0]->outcfg.color_spaces));
-RET(ff_formats_ref(ff_all_color_ranges(), 
&ctx->inputs[0]->outcfg.color_ranges));
+RET(ff_formats_ref(ff_all_color_spaces(), &cfg_in[0]->color_spaces));
+RET(ff_formats_ref(ff_all_color_ranges(), &cfg_in[0]->color_ranges));
 
 outfmts = s->colorspace > 0 ? ff_make_formats_list_singleton(s->colorspace)
 : ff_all_color_spaces();
-RET(ff_formats_ref(outfmts, &ctx->outputs[0]->incfg.color_spaces));
+RET(ff_formats_ref(outfmts, &cfg_out[0]->color_spaces));
 
 outfmts = s->color_range > 0 ? 
ff_make_formats_list_singleton(s->color_range)
  : ff_all_color_ranges();
-RET(ff_formats_ref(outfmts, &ctx->outputs[0]->incfg.color_ranges));
+RET(ff_formats_ref(outfmts, &cfg_out[0]->color_ranges));
 return 0;
 
 fail:
@@ -1464,7 +1462,7 @@ const AVFilter ff_vf_libplacebo = {
 .activate   = &libplacebo_activate,
 .process_command = &libplacebo_process_command,
 FILTER_OUTPUTS(libplacebo_outputs),
-FILTER_QUERY_FUNC(libplacebo_query_format),
+FILTER_QUERY_FUNC2(libplacebo_query_format),
 .priv_class = &libplacebo_class,
 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 .flags  = AVFILTER_FLAG_HWDEVICE | AVFILTER_FLAG_DYNAMIC_INPUTS,
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 12/24] lavfi/vf_mix: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_mix.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_mix.c b/libavfilter/vf_mix.c
index 16d6bf328c..f1e0cf617c 100644
--- a/libavfilter/vf_mix.c
+++ b/libavfilter/vf_mix.c
@@ -64,7 +64,9 @@ typedef struct MixContext {
 FFFrameSync fs;
 } MixContext;
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 unsigned reject_flags = AV_PIX_FMT_FLAG_BITSTREAM |
 AV_PIX_FMT_FLAG_HWACCEL   |
@@ -76,7 +78,8 @@ static int query_formats(AVFilterContext *ctx)
 else
 accept_flags |= AV_PIX_FMT_FLAG_BE;
 
-return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(accept_flags, 
reject_flags));
+return ff_set_common_formats2(ctx, cfg_in, cfg_out,
+  ff_formats_pixdesc_filter(accept_flags, 
reject_flags));
 }
 
 static int parse_weights(AVFilterContext *ctx)
@@ -462,7 +465,7 @@ const AVFilter ff_vf_mix = {
 .priv_size = sizeof(MixContext),
 .priv_class= &mix_class,
 FILTER_OUTPUTS(outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .init  = init,
 .uninit= uninit,
 .activate  = activate,
@@ -547,7 +550,7 @@ const AVFilter ff_vf_tmix = {
 .priv_class= &tmix_class,
 FILTER_OUTPUTS(outputs),
 FILTER_INPUTS(inputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .init  = init,
 .uninit= uninit,
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | 
AVFILTER_FLAG_SLICE_THREADS,
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 10/24] lavfi/vf_lut: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_lut.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index 7e7fd2fa4a..af7172dc01 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -145,14 +145,16 @@ static const enum AVPixelFormat yuv_pix_fmts[] = { 
YUV_FORMATS, AV_PIX_FMT_NONE
 static const enum AVPixelFormat rgb_pix_fmts[] = { RGB_FORMATS, 
AV_PIX_FMT_NONE };
 static const enum AVPixelFormat all_pix_fmts[] = { RGB_FORMATS, YUV_FORMATS, 
GRAY_FORMATS, AV_PIX_FMT_NONE };
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-LutContext *s = ctx->priv;
+const LutContext *s = ctx->priv;
 
 const enum AVPixelFormat *pix_fmts = s->is_rgb ? rgb_pix_fmts :
  s->is_yuv ? yuv_pix_fmts :
  all_pix_fmts;
-return ff_set_common_formats_from_list(ctx, pix_fmts);
+return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, pix_fmts);
 }
 
 /**
@@ -594,7 +596,7 @@ static const AVFilterPad inputs[] = {
 .uninit= uninit,\
 FILTER_INPUTS(inputs),  \
 FILTER_OUTPUTS(ff_video_default_filterpad), \
-FILTER_QUERY_FUNC(query_formats),   \
+FILTER_QUERY_FUNC2(query_formats),  \
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC |   \
  AVFILTER_FLAG_SLICE_THREADS,   \
 .process_command = process_command, \
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 06/24] lavfi/vf_hwupload_cuda: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_hwupload_cuda.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c
index 1d04045551..1b99b3fa60 100644
--- a/libavfilter/vf_hwupload_cuda.c
+++ b/libavfilter/vf_hwupload_cuda.c
@@ -52,7 +52,9 @@ static av_cold void cudaupload_uninit(AVFilterContext *ctx)
 av_buffer_unref(&s->hwdevice);
 }
 
-static int cudaupload_query_formats(AVFilterContext *ctx)
+static int cudaupload_query_formats(const AVFilterContext *ctx,
+AVFilterFormatsConfig **cfg_in,
+AVFilterFormatsConfig **cfg_out)
 {
 int ret;
 
@@ -71,13 +73,13 @@ static int cudaupload_query_formats(AVFilterContext *ctx)
 AVFilterFormats *in_fmts  = ff_make_format_list(input_pix_fmts);
 AVFilterFormats *out_fmts;
 
-ret = ff_formats_ref(in_fmts, &ctx->inputs[0]->outcfg.formats);
+ret = ff_formats_ref(in_fmts, &cfg_in[0]->formats);
 if (ret < 0)
 return ret;
 
 out_fmts = ff_make_format_list(output_pix_fmts);
 
-ret = ff_formats_ref(out_fmts, &ctx->outputs[0]->incfg.formats);
+ret = ff_formats_ref(out_fmts, &cfg_out[0]->formats);
 if (ret < 0)
 return ret;
 
@@ -196,7 +198,7 @@ const AVFilter ff_vf_hwupload_cuda = {
 FILTER_INPUTS(cudaupload_inputs),
 FILTER_OUTPUTS(cudaupload_outputs),
 
-FILTER_QUERY_FUNC(cudaupload_query_formats),
+FILTER_QUERY_FUNC2(cudaupload_query_formats),
 
 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 21/24] lavfi/vf_mergeplanes: remove redundant assignment

2024-10-12 Thread Anton Khirnov
It is already done in init.
---
 libavfilter/vf_mergeplanes.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c
index 8c1537e0bc..9f7930d44b 100644
--- a/libavfilter/vf_mergeplanes.c
+++ b/libavfilter/vf_mergeplanes.c
@@ -127,7 +127,6 @@ static int query_formats(AVFilterContext *ctx)
 AVFilterFormats *formats = NULL;
 int i, ret;
 
-s->outdesc = av_pix_fmt_desc_get(s->out_fmt);
 for (i = 0; av_pix_fmt_desc_get(i); i++) {
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i);
 if (desc->comp[0].depth == s->outdesc->comp[0].depth &&
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 08/24] lavfi/vf_libplacebo: move vulkan initialization to init

2024-10-12 Thread Anton Khirnov
avfilter API requires all the filter parameters, including hw context
(if present) to be available during init, so that is the proper place to
perform such setup.
---
 libavfilter/vf_libplacebo.c | 30 --
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 2176a7188c..5bf8b7e77a 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -194,6 +194,8 @@ typedef struct LibplaceboContext {
 int color_trc;
 AVDictionary *extra_opts;
 
+int have_hwdevice;
+
 /* pl_render_params */
 pl_options opts;
 char *upscaler;
@@ -493,11 +495,13 @@ static int parse_shader(AVFilterContext *avctx, const 
void *shader, size_t len)
 
 static void libplacebo_uninit(AVFilterContext *avctx);
 static int libplacebo_config_input(AVFilterLink *inlink);
+static int init_vulkan(AVFilterContext *avctx, const AVVulkanDeviceContext 
*hwctx);
 
 static int libplacebo_init(AVFilterContext *avctx)
 {
 int err = 0;
 LibplaceboContext *s = avctx->priv;
+const AVVulkanDeviceContext *vkhwctx = NULL;
 
 /* Create libplacebo log context */
 s->log = pl_log_create(PL_API_VER, pl_log_params(
@@ -559,7 +563,14 @@ static int libplacebo_init(AVFilterContext *avctx)
 if (strcmp(s->fps_string, "none") != 0)
 RET(av_parse_video_rate(&s->fps, s->fps_string));
 
-/* Note: s->vulkan etc. are initialized later, when hwctx is available */
+if (avctx->hw_device_ctx) {
+const AVHWDeviceContext *avhwctx = (void *) avctx->hw_device_ctx->data;
+if (avhwctx->type == AV_HWDEVICE_TYPE_VULKAN)
+vkhwctx = avhwctx->hwctx;
+}
+
+RET(init_vulkan(avctx, vkhwctx));
+
 return 0;
 
 fail:
@@ -648,6 +659,8 @@ static int init_vulkan(AVFilterContext *avctx, const 
AVVulkanDeviceContext *hwct
 err = AVERROR_EXTERNAL;
 goto fail;
 #endif
+
+s->have_hwdevice = 1;
 } else {
 s->vulkan = pl_vulkan_create(s->log, pl_vulkan_params(
 .queue_count = 0, /* enable all queues for parallelization */
@@ -1081,18 +1094,9 @@ static int libplacebo_query_format(AVFilterContext *ctx)
 {
 int err;
 LibplaceboContext *s = ctx->priv;
-const AVVulkanDeviceContext *vkhwctx = NULL;
 const AVPixFmtDescriptor *desc = NULL;
 AVFilterFormats *infmts = NULL, *outfmts = NULL;
 
-if (ctx->hw_device_ctx) {
-const AVHWDeviceContext *avhwctx = (void *) ctx->hw_device_ctx->data;
-if (avhwctx->type == AV_HWDEVICE_TYPE_VULKAN)
-vkhwctx = avhwctx->hwctx;
-}
-
-RET(init_vulkan(ctx, vkhwctx));
-
 while ((desc = av_pix_fmt_desc_next(desc))) {
 enum AVPixelFormat pixfmt = av_pix_fmt_desc_get_id(desc);
 
@@ -1103,10 +1107,8 @@ static int libplacebo_query_format(AVFilterContext *ctx)
 continue;
 #endif
 
-if (pixfmt == AV_PIX_FMT_VULKAN) {
-if (!vkhwctx || vkhwctx->act_dev != s->vulkan->device)
-continue;
-}
+if (pixfmt == AV_PIX_FMT_VULKAN && !s->have_hwdevice)
+continue;
 
 if (!pl_test_pixfmt(s->gpu, pixfmt))
 continue;
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 04/24] lavfi/vf_hwupload: validate the hw device in init

2024-10-12 Thread Anton Khirnov
Rather than query_formats(). Init is a more appropriate place, as
query_formats() is supposed to be free of side-effects.
---
 libavfilter/vf_hwupload.c | 49 ++-
 1 file changed, 28 insertions(+), 21 deletions(-)

diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c
index 3afd67012f..70ee262c09 100644
--- a/libavfilter/vf_hwupload.c
+++ b/libavfilter/vf_hwupload.c
@@ -39,6 +39,33 @@ typedef struct HWUploadContext {
 char *device_type;
 } HWUploadContext;
 
+static int hwupload_init(AVFilterContext *avctx)
+{
+HWUploadContext *ctx = avctx->priv;
+int err;
+
+if (!avctx->hw_device_ctx) {
+av_log(ctx, AV_LOG_ERROR, "A hardware device reference is required "
+   "to upload frames to.\n");
+return AVERROR(EINVAL);
+}
+
+if (ctx->device_type) {
+err = av_hwdevice_ctx_create_derived(
+&ctx->hwdevice_ref,
+av_hwdevice_find_type_by_name(ctx->device_type),
+avctx->hw_device_ctx, 0);
+if (err < 0)
+return err;
+} else {
+ctx->hwdevice_ref = av_buffer_ref(avctx->hw_device_ctx);
+if (!ctx->hwdevice_ref)
+return AVERROR(ENOMEM);
+}
+
+return 0;
+}
+
 static int hwupload_query_formats(AVFilterContext *avctx)
 {
 HWUploadContext *ctx = avctx->priv;
@@ -47,27 +74,6 @@ static int hwupload_query_formats(AVFilterContext *avctx)
 AVFilterFormats *input_formats = NULL;
 int err, i;
 
-if (ctx->hwdevice_ref) {
-/* We already have a specified device. */
-} else if (avctx->hw_device_ctx) {
-if (ctx->device_type) {
-err = av_hwdevice_ctx_create_derived(
-&ctx->hwdevice_ref,
-av_hwdevice_find_type_by_name(ctx->device_type),
-avctx->hw_device_ctx, 0);
-if (err < 0)
-return err;
-} else {
-ctx->hwdevice_ref = av_buffer_ref(avctx->hw_device_ctx);
-if (!ctx->hwdevice_ref)
-return AVERROR(ENOMEM);
-}
-} else {
-av_log(ctx, AV_LOG_ERROR, "A hardware device reference is required "
-   "to upload frames to.\n");
-return AVERROR(EINVAL);
-}
-
 constraints = av_hwdevice_get_hwframe_constraints(ctx->hwdevice_ref, NULL);
 if (!constraints) {
 err = AVERROR(EINVAL);
@@ -253,6 +259,7 @@ static const AVFilterPad hwupload_outputs[] = {
 const AVFilter ff_vf_hwupload = {
 .name  = "hwupload",
 .description   = NULL_IF_CONFIG_SMALL("Upload a normal frame to a hardware 
frame"),
+.init  = hwupload_init,
 .uninit= hwupload_uninit,
 .priv_size = sizeof(HWUploadContext),
 .priv_class= &hwupload_class,
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 03/24] lavfi/vf_hwdownload: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_hwdownload.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_hwdownload.c b/libavfilter/vf_hwdownload.c
index 0b70727b29..4a8a1a1d91 100644
--- a/libavfilter/vf_hwdownload.c
+++ b/libavfilter/vf_hwdownload.c
@@ -35,14 +35,16 @@ typedef struct HWDownloadContext {
 AVHWFramesContext *hwframes;
 } HWDownloadContext;
 
-static int hwdownload_query_formats(AVFilterContext *avctx)
+static int hwdownload_query_formats(const AVFilterContext *avctx,
+AVFilterFormatsConfig **cfg_in,
+AVFilterFormatsConfig **cfg_out)
 {
 int err;
 
 if ((err = 
ff_formats_ref(ff_formats_pixdesc_filter(AV_PIX_FMT_FLAG_HWACCEL, 0),
-  &avctx->inputs[0]->outcfg.formats))  ||
+  &cfg_in[0]->formats))  ||
 (err = ff_formats_ref(ff_formats_pixdesc_filter(0, 
AV_PIX_FMT_FLAG_HWACCEL),
-  &avctx->outputs[0]->incfg.formats)))
+  &cfg_out[0]->formats)))
 return err;
 
 return 0;
@@ -198,6 +200,6 @@ const AVFilter ff_vf_hwdownload = {
 .priv_class= &hwdownload_class,
 FILTER_INPUTS(hwdownload_inputs),
 FILTER_OUTPUTS(hwdownload_outputs),
-FILTER_QUERY_FUNC(hwdownload_query_formats),
+FILTER_QUERY_FUNC2(hwdownload_query_formats),
 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 01/24] lavfi/vf_frei0r: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_frei0r.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index 83ca9c98b1..d3d7b33c4d 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -330,9 +330,11 @@ static int config_input_props(AVFilterLink *inlink)
 return set_params(ctx, s->params);
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-Frei0rContext *s = ctx->priv;
+const Frei0rContext *s = ctx->priv;
 AVFilterFormats *formats = NULL;
 int ret;
 
@@ -352,7 +354,7 @@ static int query_formats(AVFilterContext *ctx)
 if (!formats)
 return AVERROR(ENOMEM);
 
-return ff_set_common_formats(ctx, formats);
+return ff_set_common_formats2(ctx, cfg_in, cfg_out, formats);
 }
 
 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
@@ -432,7 +434,7 @@ const AVFilter ff_vf_frei0r = {
 .priv_class= &frei0r_class,
 FILTER_INPUTS(avfilter_vf_frei0r_inputs),
 FILTER_OUTPUTS(ff_video_default_filterpad),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .process_command = process_command,
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
 };
@@ -521,5 +523,5 @@ const AVFilter ff_vsrc_frei0r_src = {
 .uninit= uninit,
 .inputs= NULL,
 FILTER_OUTPUTS(avfilter_vsrc_frei0r_src_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 02/24] lavfi/vf_hflip: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_hflip.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c
index 47870a167d..1f60e79bd7 100644
--- a/libavfilter/vf_hflip.c
+++ b/libavfilter/vf_hflip.c
@@ -37,7 +37,9 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/imgutils.h"
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 AVFilterFormats *pix_fmts = NULL;
 const AVPixFmtDescriptor *desc;
@@ -52,7 +54,7 @@ static int query_formats(AVFilterContext *ctx)
 return ret;
 }
 
-return ff_set_common_formats(ctx, pix_fmts);
+return ff_set_common_formats2(ctx, cfg_in, cfg_out, pix_fmts);
 }
 
 static int config_props(AVFilterLink *inlink)
@@ -150,6 +152,6 @@ const AVFilter ff_vf_hflip = {
 .priv_size = sizeof(FlipContext),
 FILTER_INPUTS(avfilter_vf_hflip_inputs),
 FILTER_OUTPUTS(ff_video_default_filterpad),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .flags = AVFILTER_FLAG_SLICE_THREADS | 
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 18/24] lavfi/vf_paletteuse: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_paletteuse.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index 0cd00d520e..100f462750 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -136,18 +136,20 @@ AVFILTER_DEFINE_CLASS(paletteuse);
 
 static int load_apply_palette(FFFrameSync *fs);
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 static const enum AVPixelFormat in_fmts[]= {AV_PIX_FMT_RGB32, 
AV_PIX_FMT_NONE};
 static const enum AVPixelFormat inpal_fmts[] = {AV_PIX_FMT_RGB32, 
AV_PIX_FMT_NONE};
 static const enum AVPixelFormat out_fmts[]   = {AV_PIX_FMT_PAL8,  
AV_PIX_FMT_NONE};
 int ret;
 if ((ret = ff_formats_ref(ff_make_format_list(in_fmts),
-  &ctx->inputs[0]->outcfg.formats)) < 0 ||
+  &cfg_in[0]->formats)) < 0 ||
 (ret = ff_formats_ref(ff_make_format_list(inpal_fmts),
-  &ctx->inputs[1]->outcfg.formats)) < 0 ||
+  &cfg_in[1]->formats)) < 0 ||
 (ret = ff_formats_ref(ff_make_format_list(out_fmts),
-  &ctx->outputs[0]->incfg.formats)) < 0)
+  &cfg_out[0]->formats)) < 0)
 return ret;
 return 0;
 }
@@ -1004,6 +1006,6 @@ const AVFilter ff_vf_paletteuse = {
 .activate  = activate,
 FILTER_INPUTS(paletteuse_inputs),
 FILTER_OUTPUTS(paletteuse_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &paletteuse_class,
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 22/24] lavfi/vf_mergeplanes: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_mergeplanes.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c
index 9f7930d44b..d97438a2c4 100644
--- a/libavfilter/vf_mergeplanes.c
+++ b/libavfilter/vf_mergeplanes.c
@@ -121,9 +121,11 @@ static av_cold int init(AVFilterContext *ctx)
 return 0;
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-MergePlanesContext *s = ctx->priv;
+const MergePlanesContext *s = ctx->priv;
 AVFilterFormats *formats = NULL;
 int i, ret;
 
@@ -137,12 +139,12 @@ static int query_formats(AVFilterContext *ctx)
 }
 
 for (i = 0; i < s->nb_inputs; i++)
-if ((ret = ff_formats_ref(formats, &ctx->inputs[i]->outcfg.formats)) < 
0)
+if ((ret = ff_formats_ref(formats, &cfg_in[i]->formats)) < 0)
 return ret;
 
 formats = NULL;
 if ((ret = ff_add_format(&formats, s->out_fmt)) < 0 ||
-(ret = ff_formats_ref(formats, &ctx->outputs[0]->incfg.formats)) < 0)
+(ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 return 0;
@@ -318,6 +320,6 @@ const AVFilter ff_vf_mergeplanes = {
 .activate  = activate,
 .inputs= NULL,
 FILTER_OUTPUTS(mergeplanes_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .flags = AVFILTER_FLAG_DYNAMIC_INPUTS,
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 17/24] lavfi/vf_palettegen: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_palettegen.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c
index 666bb6e349..d1ac5fcf34 100644
--- a/libavfilter/vf_palettegen.c
+++ b/libavfilter/vf_palettegen.c
@@ -100,15 +100,17 @@ static const AVOption palettegen_options[] = {
 
 AVFILTER_DEFINE_CLASS(palettegen);
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 static const enum AVPixelFormat in_fmts[]  = {AV_PIX_FMT_RGB32, 
AV_PIX_FMT_NONE};
 static const enum AVPixelFormat out_fmts[] = {AV_PIX_FMT_RGB32, 
AV_PIX_FMT_NONE};
 int ret;
 
-if ((ret = ff_formats_ref(ff_make_format_list(in_fmts) , 
&ctx->inputs[0]->outcfg.formats)) < 0)
+if ((ret = ff_formats_ref(ff_make_format_list(in_fmts) , 
&cfg_in[0]->formats)) < 0)
 return ret;
-if ((ret = ff_formats_ref(ff_make_format_list(out_fmts), 
&ctx->outputs[0]->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(ff_make_format_list(out_fmts), 
&cfg_out[0]->formats)) < 0)
 return ret;
 return 0;
 }
@@ -579,6 +581,6 @@ const AVFilter ff_vf_palettegen = {
 .uninit= uninit,
 FILTER_INPUTS(palettegen_inputs),
 FILTER_OUTPUTS(palettegen_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &palettegen_class,
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 11/24] lavfi/vf_lut2: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_lut2.c | 25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/libavfilter/vf_lut2.c b/libavfilter/vf_lut2.c
index 2488c9fdc2..88b45f45e5 100644
--- a/libavfilter/vf_lut2.c
+++ b/libavfilter/vf_lut2.c
@@ -140,9 +140,11 @@ static av_cold void uninit(AVFilterContext *ctx)
 AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, \
 AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_GRAY16,
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-LUT2Context *s = ctx->priv;
+const LUT2Context *s = ctx->priv;
 static const enum AVPixelFormat all_pix_fmts[] = {
 BIT8_FMTS
 BIT9_FMTS
@@ -178,9 +180,9 @@ static int query_formats(AVFilterContext *ctx)
 int ret;
 
 if (s->tlut2 || !s->odepth)
-return ff_set_common_formats_from_list(ctx, all_pix_fmts);
+return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, 
all_pix_fmts);
 
-ret = ff_formats_ref(ff_make_format_list(all_pix_fmts), 
&ctx->inputs[0]->outcfg.formats);
+ret = ff_formats_ref(ff_make_format_list(all_pix_fmts), 
&cfg_in[0]->formats);
 if (ret < 0)
 return ret;
 
@@ -191,11 +193,10 @@ static int query_formats(AVFilterContext *ctx)
 case 12: pix_fmts = bit12_pix_fmts; break;
 case 14: pix_fmts = bit14_pix_fmts; break;
 case 16: pix_fmts = bit16_pix_fmts; break;
-default: av_log(ctx, AV_LOG_ERROR, "Unsupported output bit depth %d.\n", 
s->odepth);
- return AVERROR(EINVAL);
+default: av_assert0(0);
 }
 
-return ff_formats_ref(ff_make_format_list(pix_fmts), 
&ctx->outputs[0]->incfg.formats);
+return ff_formats_ref(ff_make_format_list(pix_fmts), &cfg_out[0]->formats);
 }
 
 static int config_inputx(AVFilterLink *inlink)
@@ -573,7 +574,7 @@ const AVFilter ff_vf_lut2 = {
 .activate  = activate,
 FILTER_INPUTS(inputs),
 FILTER_OUTPUTS(outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
  AVFILTER_FLAG_SLICE_THREADS,
 .process_command = process_command,
@@ -587,6 +588,12 @@ static av_cold int init(AVFilterContext *ctx)
 
 s->tlut2 = !strcmp(ctx->filter->name, "tlut2");
 
+if (!(s->odepth == 0 || s->odepth == 8 || s->odepth == 9 || s->odepth == 
10 ||
+  s->odepth == 12 || s->odepth == 14 || s->odepth == 16)) {
+av_log(ctx, AV_LOG_ERROR, "Unsupported output bit depth %d.\n", 
s->odepth);
+return AVERROR(EINVAL);
+}
+
 return 0;
 }
 
@@ -663,7 +670,7 @@ const AVFilter ff_vf_tlut2 = {
 .uninit= uninit,
 FILTER_INPUTS(tlut2_inputs),
 FILTER_OUTPUTS(tlut2_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
  AVFILTER_FLAG_SLICE_THREADS,
 .process_command = process_command,
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 14/24] lavfi/vf_overlay: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_overlay.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 03b48bf681..f0f0961ed2 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -161,9 +161,11 @@ static const enum AVPixelFormat alpha_pix_fmts[] = {
 AV_PIX_FMT_BGRA, AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE
 };
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-OverlayContext *s = ctx->priv;
+const OverlayContext *s = ctx->priv;
 
 /* overlay formats contains alpha, for avoiding conversion with alpha 
information loss */
 static const enum AVPixelFormat main_pix_fmts_yuv420[] = {
@@ -268,18 +270,18 @@ static int query_formats(AVFilterContext *ctx)
 overlay_formats = overlay_pix_fmts_gbrp;
 break;
 case OVERLAY_FORMAT_AUTO:
-return ff_set_common_formats_from_list(ctx, alpha_pix_fmts);
+return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, 
alpha_pix_fmts);
 default:
 av_assert0(0);
 }
 
 formats = ff_make_format_list(main_formats);
-if ((ret = ff_formats_ref(formats, &ctx->inputs[MAIN]->outcfg.formats)) < 
0 ||
-(ret = ff_formats_ref(formats, &ctx->outputs[MAIN]->incfg.formats)) < 
0)
+if ((ret = ff_formats_ref(formats, &cfg_in[MAIN]->formats)) < 0 ||
+(ret = ff_formats_ref(formats, &cfg_out[MAIN]->formats)) < 0)
 return ret;
 
 return ff_formats_ref(ff_make_format_list(overlay_formats),
-  &ctx->inputs[OVERLAY]->outcfg.formats);
+  &cfg_in[OVERLAY]->formats);
 }
 
 static int config_input_overlay(AVFilterLink *inlink)
@@ -1010,7 +1012,7 @@ const AVFilter ff_vf_overlay = {
 .process_command = process_command,
 FILTER_INPUTS(avfilter_vf_overlay_inputs),
 FILTER_OUTPUTS(avfilter_vf_overlay_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
  AVFILTER_FLAG_SLICE_THREADS,
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 16/24] lavfi/vf_pad: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_pad.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index e0cf84002b..dc9ffaa46d 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -72,9 +72,12 @@ enum var_name {
 VARS_NB
 };
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0));
+return ff_set_common_formats2(ctx, cfg_in, cfg_out,
+  ff_draw_supported_pixel_formats(0));
 }
 
 enum EvalMode {
@@ -458,5 +461,5 @@ const AVFilter ff_vf_pad = {
 .priv_class= &pad_class,
 FILTER_INPUTS(avfilter_vf_pad_inputs),
 FILTER_OUTPUTS(avfilter_vf_pad_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 13/24] lavfi/vf_noise: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_noise.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c
index b5ef416dec..5a4ed9795d 100644
--- a/libavfilter/vf_noise.c
+++ b/libavfilter/vf_noise.c
@@ -131,7 +131,9 @@ static av_cold int init_noise(NoiseContext *n, int comp)
 return 0;
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 AVFilterFormats *formats = NULL;
 int fmt, ret;
@@ -143,7 +145,7 @@ static int query_formats(AVFilterContext *ctx)
 return ret;
 }
 
-return ff_set_common_formats(ctx, formats);
+return ff_set_common_formats2(ctx, cfg_in, cfg_out, formats);
 }
 
 static int config_input(AVFilterLink *inlink)
@@ -339,7 +341,7 @@ const AVFilter ff_vf_noise = {
 .uninit= uninit,
 FILTER_INPUTS(noise_inputs),
 FILTER_OUTPUTS(ff_video_default_filterpad),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &noise_class,
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | 
AVFILTER_FLAG_SLICE_THREADS,
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 24/24] lavfi/vf_scale: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_scale.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 3319428d9c..a89ebe8c47 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -471,9 +471,11 @@ static av_cold void uninit(AVFilterContext *ctx)
 scale->sws = NULL;
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-ScaleContext *scale = ctx->priv;
+const ScaleContext *scale = ctx->priv;
 AVFilterFormats *formats;
 const AVPixFmtDescriptor *desc;
 enum AVPixelFormat pix_fmt;
@@ -489,7 +491,7 @@ static int query_formats(AVFilterContext *ctx)
 return ret;
 }
 }
-if ((ret = ff_formats_ref(formats, &ctx->inputs[0]->outcfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0)
 return ret;
 
 desc= NULL;
@@ -502,29 +504,29 @@ static int query_formats(AVFilterContext *ctx)
 return ret;
 }
 }
-if ((ret = ff_formats_ref(formats, &ctx->outputs[0]->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 /* accept all supported inputs, even if user overrides their properties */
 if ((ret = ff_formats_ref(ff_make_format_list(sws_colorspaces),
-  &ctx->inputs[0]->outcfg.color_spaces)) < 0)
+  &cfg_in[0]->color_spaces)) < 0)
 return ret;
 
 if ((ret = ff_formats_ref(ff_all_color_ranges(),
-  &ctx->inputs[0]->outcfg.color_ranges)) < 0)
+  &cfg_in[0]->color_ranges)) < 0)
 return ret;
 
 /* propagate output properties if overridden */
 formats = scale->out_color_matrix != AVCOL_SPC_UNSPECIFIED
 ? ff_make_formats_list_singleton(scale->out_color_matrix)
 : ff_make_format_list(sws_colorspaces);
-if ((ret = ff_formats_ref(formats, &ctx->outputs[0]->incfg.color_spaces)) 
< 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->color_spaces)) < 0)
 return ret;
 
 formats = scale->out_range != AVCOL_RANGE_UNSPECIFIED
 ? ff_make_formats_list_singleton(scale->out_range)
 : ff_all_color_ranges();
-if ((ret = ff_formats_ref(formats, &ctx->outputs[0]->incfg.color_ranges)) 
< 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->color_ranges)) < 0)
 return ret;
 
 return 0;
@@ -1331,7 +1333,7 @@ const AVFilter ff_vf_scale = {
 .priv_class  = &scale_class,
 FILTER_INPUTS(avfilter_vf_scale_inputs),
 FILTER_OUTPUTS(avfilter_vf_scale_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .activate= activate,
 .process_command = process_command,
 .flags   = AVFILTER_FLAG_DYNAMIC_INPUTS,
@@ -1400,6 +1402,6 @@ const AVFilter ff_vf_scale2ref = {
 .priv_class  = &scale2ref_class,
 FILTER_INPUTS(avfilter_vf_scale2ref_inputs),
 FILTER_OUTPUTS(avfilter_vf_scale2ref_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .process_command = process_command,
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 20/24] lavfi/vf_quirc: use FILTER_PIXFMTS_ARRAY() instead of query_formats()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_quirc.c | 31 +--
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/libavfilter/vf_quirc.c b/libavfilter/vf_quirc.c
index afd172fa34..d44233af5c 100644
--- a/libavfilter/vf_quirc.c
+++ b/libavfilter/vf_quirc.c
@@ -71,23 +71,6 @@ static int config_input(AVFilterLink *inlink)
 return 0;
 }
 
-static int query_formats(AVFilterContext *ctx)
-{
-static const enum AVPixelFormat pix_fmts[] = {
-AV_PIX_FMT_GRAY8,
-AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
-AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
-AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,
-AV_PIX_FMT_NV12, AV_PIX_FMT_NV21,
-AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUVJ420P,
-AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P,
-AV_PIX_FMT_YUVJ440P,
-AV_PIX_FMT_NONE
-};
-
-return ff_set_common_formats_from_list(ctx, pix_fmts);
-}
-
 static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
 {
 FilterLink *inl = ff_filter_link(inlink);
@@ -154,6 +137,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 return ff_filter_frame(outlink, frame);
 }
 
+static const enum AVPixelFormat pix_fmts[] = {
+AV_PIX_FMT_GRAY8,
+AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
+AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
+AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,
+AV_PIX_FMT_NV12, AV_PIX_FMT_NV21,
+AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUVJ420P,
+AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P,
+AV_PIX_FMT_YUVJ440P,
+AV_PIX_FMT_NONE
+};
+
 static const AVClass quirc_class = {
 .class_name = "quirc",
 .version= LIBAVUTIL_VERSION_INT,
@@ -178,7 +173,7 @@ const AVFilter ff_vf_quirc = {
 .uninit  = uninit,
 FILTER_INPUTS(inputs),
 FILTER_OUTPUTS(ff_video_default_filterpad),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_PIXFMTS_ARRAY(pix_fmts),
 .flags   = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC |
AVFILTER_FLAG_METADATA_ONLY,
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 19/24] lavfi/vf_premultiply: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_premultiply.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c
index 30be869919..22dfbd52c4 100644
--- a/libavfilter/vf_premultiply.c
+++ b/libavfilter/vf_premultiply.c
@@ -63,9 +63,11 @@ static const AVOption options[] = {
 
 AVFILTER_DEFINE_CLASS_EXT(premultiply, "(un)premultiply", options);
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-PreMultiplyContext *s = ctx->priv;
+const PreMultiplyContext *s = ctx->priv;
 
 static const enum AVPixelFormat no_alpha_pix_fmts[] = {
 AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P,
@@ -86,7 +88,8 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_NONE
 };
 
-return ff_set_common_formats_from_list(ctx, s->inplace ? alpha_pix_fmts : 
no_alpha_pix_fmts);
+return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out,
+s->inplace ? alpha_pix_fmts : 
no_alpha_pix_fmts);
 }
 
 static void premultiply8(const uint8_t *msrc, const uint8_t *asrc,
@@ -830,7 +833,7 @@ const AVFilter ff_vf_premultiply = {
 .activate  = activate,
 .inputs= NULL,
 FILTER_OUTPUTS(premultiply_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &premultiply_class,
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
  AVFILTER_FLAG_DYNAMIC_INPUTS |
@@ -851,7 +854,7 @@ const AVFilter ff_vf_unpremultiply = {
 .activate  = activate,
 .inputs= NULL,
 FILTER_OUTPUTS(premultiply_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
  AVFILTER_FLAG_DYNAMIC_INPUTS |
  AVFILTER_FLAG_SLICE_THREADS,
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 05/24] lavfi/vf_hwupload: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_hwupload.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c
index 70ee262c09..97d50d7877 100644
--- a/libavfilter/vf_hwupload.c
+++ b/libavfilter/vf_hwupload.c
@@ -66,9 +66,11 @@ static int hwupload_init(AVFilterContext *avctx)
 return 0;
 }
 
-static int hwupload_query_formats(AVFilterContext *avctx)
+static int hwupload_query_formats(const AVFilterContext *avctx,
+  AVFilterFormatsConfig **cfg_in,
+  AVFilterFormatsConfig **cfg_out)
 {
-HWUploadContext *ctx = avctx->priv;
+const HWUploadContext *ctx = avctx->priv;
 AVHWFramesConstraints *constraints = NULL;
 const enum AVPixelFormat *input_pix_fmts, *output_pix_fmts;
 AVFilterFormats *input_formats = NULL;
@@ -96,16 +98,15 @@ static int hwupload_query_formats(AVFilterContext *avctx)
 }
 }
 
-if ((err = ff_formats_ref(input_formats, 
&avctx->inputs[0]->outcfg.formats)) < 0 ||
+if ((err = ff_formats_ref(input_formats, &cfg_in[0]->formats)) < 0 ||
 (err = ff_formats_ref(ff_make_format_list(output_pix_fmts),
-  &avctx->outputs[0]->incfg.formats)) < 0)
+  &cfg_out[0]->formats)) < 0)
 goto fail;
 
 av_hwframe_constraints_free(&constraints);
 return 0;
 
 fail:
-av_buffer_unref(&ctx->hwdevice_ref);
 av_hwframe_constraints_free(&constraints);
 return err;
 }
@@ -265,7 +266,7 @@ const AVFilter ff_vf_hwupload = {
 .priv_class= &hwupload_class,
 FILTER_INPUTS(hwupload_inputs),
 FILTER_OUTPUTS(hwupload_outputs),
-FILTER_QUERY_FUNC(hwupload_query_formats),
+FILTER_QUERY_FUNC2(hwupload_query_formats),
 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 .flags  = AVFILTER_FLAG_HWDEVICE,
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 23/24] lavfi/vf_remap: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_remap.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavfilter/vf_remap.c b/libavfilter/vf_remap.c
index df81c247eb..cc83aa7ffe 100644
--- a/libavfilter/vf_remap.c
+++ b/libavfilter/vf_remap.c
@@ -82,9 +82,11 @@ typedef struct ThreadData {
 int step;
 } ThreadData;
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-RemapContext *s = ctx->priv;
+const RemapContext *s = ctx->priv;
 static const enum AVPixelFormat pix_fmts[] = {
 AV_PIX_FMT_YUVA444P,
 AV_PIX_FMT_YUV444P,
@@ -116,14 +118,14 @@ static int query_formats(AVFilterContext *ctx)
 int ret;
 
 pix_formats = ff_make_format_list(s->format ? gray_pix_fmts : pix_fmts);
-if ((ret = ff_formats_ref(pix_formats, &ctx->inputs[0]->outcfg.formats)) < 
0 ||
-(ret = ff_formats_ref(pix_formats, &ctx->outputs[0]->incfg.formats)) < 
0)
+if ((ret = ff_formats_ref(pix_formats, &cfg_in[0]->formats)) < 0 ||
+(ret = ff_formats_ref(pix_formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 map_formats = ff_make_format_list(map_fmts);
-if ((ret = ff_formats_ref(map_formats, &ctx->inputs[1]->outcfg.formats)) < 
0)
+if ((ret = ff_formats_ref(map_formats, &cfg_in[1]->formats)) < 0)
 return ret;
-return ff_formats_ref(map_formats, &ctx->inputs[2]->outcfg.formats);
+return ff_formats_ref(map_formats, &cfg_in[2]->formats);
 }
 
 /**
@@ -403,7 +405,7 @@ const AVFilter ff_vf_remap = {
 .activate  = activate,
 FILTER_INPUTS(remap_inputs),
 FILTER_OUTPUTS(remap_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &remap_class,
 .flags = AVFILTER_FLAG_SLICE_THREADS,
 };
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 15/24] lavfi/vf_overlay_qsv: switch to query_func2()

2024-10-12 Thread Anton Khirnov
---
 libavfilter/vf_overlay_qsv.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_overlay_qsv.c b/libavfilter/vf_overlay_qsv.c
index 39bc700637..17da4a4d1a 100644
--- a/libavfilter/vf_overlay_qsv.c
+++ b/libavfilter/vf_overlay_qsv.c
@@ -366,7 +366,9 @@ static int activate(AVFilterContext *ctx)
 return ff_framesync_activate(&s->fs);
 }
 
-static int overlay_qsv_query_formats(AVFilterContext *ctx)
+static int overlay_qsv_query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 int i;
 int ret;
@@ -386,12 +388,12 @@ static int overlay_qsv_query_formats(AVFilterContext *ctx)
 };
 
 for (i = 0; i < ctx->nb_inputs; i++) {
-ret = ff_formats_ref(ff_make_format_list(main_in_fmts), 
&ctx->inputs[i]->outcfg.formats);
+ret = ff_formats_ref(ff_make_format_list(main_in_fmts), 
&cfg_in[i]->formats);
 if (ret < 0)
 return ret;
 }
 
-ret = ff_formats_ref(ff_make_format_list(out_pix_fmts), 
&ctx->outputs[0]->incfg.formats);
+ret = ff_formats_ref(ff_make_format_list(out_pix_fmts), 
&cfg_out[0]->formats);
 if (ret < 0)
 return ret;
 
@@ -431,7 +433,7 @@ const AVFilter ff_vf_overlay_qsv = {
 .activate   = activate,
 FILTER_INPUTS(overlay_qsv_inputs),
 FILTER_OUTPUTS(overlay_qsv_outputs),
-FILTER_QUERY_FUNC(overlay_qsv_query_formats),
+FILTER_QUERY_FUNC2(overlay_qsv_query_formats),
 .priv_class = &overlay_qsv_class,
 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 .flags  = AVFILTER_FLAG_HWDEVICE,
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] fftools/ffmpeg_filter: treat apad filter as a source

2024-10-12 Thread Anton Khirnov
Ideally lavfi should have a dedicated API for detecting this.

Fixes #11168 and #11061
---
 fftools/ffmpeg_filter.c | 21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 4524a3e535..741a8482c3 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1104,8 +1104,9 @@ int fg_create(FilterGraph **pfg, char *graph_desc, 
Scheduler *sch)
 
 for (unsigned i = 0; i < graph->nb_filters; i++) {
 const AVFilter *f = graph->filters[i]->filter;
-if (!avfilter_filter_pad_count(f, 0) &&
-!(f->flags & AVFILTER_FLAG_DYNAMIC_INPUTS)) {
+if ((!avfilter_filter_pad_count(f, 0) &&
+ !(f->flags & AVFILTER_FLAG_DYNAMIC_INPUTS)) ||
+!strcmp(f->name, "apad")) {
 fgp->have_sources = 1;
 break;
 }
@@ -1502,7 +1503,7 @@ static int insert_filter(AVFilterContext **last_filter, 
int *pad_idx,
 return 0;
 }
 
-static int configure_output_video_filter(FilterGraph *fg, AVFilterGraph *graph,
+static int configure_output_video_filter(FilterGraphPriv *fgp, AVFilterGraph 
*graph,
  OutputFilter *ofilter, AVFilterInOut 
*out)
 {
 OutputFilterPriv *ofp = ofp_from_ofilter(ofilter);
@@ -1581,7 +1582,7 @@ static int configure_output_video_filter(FilterGraph *fg, 
AVFilterGraph *graph,
 return 0;
 }
 
-static int configure_output_audio_filter(FilterGraph *fg, AVFilterGraph *graph,
+static int configure_output_audio_filter(FilterGraphPriv *fgp, AVFilterGraph 
*graph,
  OutputFilter *ofilter, AVFilterInOut 
*out)
 {
 OutputFilterPriv *ofp = ofp_from_ofilter(ofilter);
@@ -1644,8 +1645,10 @@ static int configure_output_audio_filter(FilterGraph 
*fg, AVFilterGraph *graph,
 pad_idx = 0;
 }
 
-if (ofilter->apad)
+if (ofilter->apad) {
 AUTO_INSERT_FILTER("-apad", "apad", ofilter->apad);
+fgp->have_sources = 1;
+}
 
 snprintf(name, sizeof(name), "trim for output %s", ofp->name);
 ret = insert_trim(ofp->trim_start_us, ofp->trim_duration_us,
@@ -1661,12 +1664,12 @@ fail:
 return ret;
 }
 
-static int configure_output_filter(FilterGraph *fg, AVFilterGraph *graph,
+static int configure_output_filter(FilterGraphPriv *fgp, AVFilterGraph *graph,
OutputFilter *ofilter, AVFilterInOut *out)
 {
 switch (ofilter->type) {
-case AVMEDIA_TYPE_VIDEO: return configure_output_video_filter(fg, graph, 
ofilter, out);
-case AVMEDIA_TYPE_AUDIO: return configure_output_audio_filter(fg, graph, 
ofilter, out);
+case AVMEDIA_TYPE_VIDEO: return configure_output_video_filter(fgp, graph, 
ofilter, out);
+case AVMEDIA_TYPE_AUDIO: return configure_output_audio_filter(fgp, graph, 
ofilter, out);
 default: av_assert0(0); return 0;
 }
 }
@@ -1944,7 +1947,7 @@ static int configure_filtergraph(FilterGraph *fg, 
FilterGraphThread *fgt)
 avfilter_inout_free(&inputs);
 
 for (cur = outputs, i = 0; cur; cur = cur->next, i++) {
-ret = configure_output_filter(fg, fgt->graph, fg->outputs[i], cur);
+ret = configure_output_filter(fgp, fgt->graph, fg->outputs[i], cur);
 if (ret < 0) {
 avfilter_inout_free(&outputs);
 goto fail;
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avcodec/codec_par: ensure the target AVCodecContext doesn't have stale allocations on error

2024-10-12 Thread James Almer
This copies the behavior of avcodec_parameters_from_context().

Signed-off-by: James Almer 
---
 libavcodec/codec_par.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c
index 790ea01d10..d178b02ff1 100644
--- a/libavcodec/codec_par.c
+++ b/libavcodec/codec_par.c
@@ -205,6 +205,11 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
 {
 int ret;
 
+av_channel_layout_uninit(&codec->ch_layout);
+av_packet_side_data_free(&codec->coded_side_data, 
&codec->nb_coded_side_data);
+av_freep(&codec->extradata);
+codec->extradata_size = 0;
+
 codec->codec_type = par->codec_type;
 codec->codec_id   = par->codec_id;
 codec->codec_tag  = par->codec_tag;
@@ -249,8 +254,6 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
 break;
 }
 
-av_freep(&codec->extradata);
-codec->extradata_size = 0;
 if (par->extradata) {
 codec->extradata = av_mallocz(par->extradata_size + 
AV_INPUT_BUFFER_PADDING_SIZE);
 if (!codec->extradata)
@@ -259,7 +262,6 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
 codec->extradata_size = par->extradata_size;
 }
 
-av_packet_side_data_free(&codec->coded_side_data, 
&codec->nb_coded_side_data);
 ret = codec_parameters_copy_side_data(&codec->coded_side_data, 
&codec->nb_coded_side_data,
   par->coded_side_data, 
par->nb_coded_side_data);
 if (ret < 0)
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH] avformat/smoothstreamingenc: check return value of avcodec_parameters_copy()

2024-10-12 Thread Marth64
Written in the dominant style of the surrounding code block.

Signed-off-by: Marth64 
---
 libavformat/smoothstreamingenc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index 9547419d31..adf3008003 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -331,7 +331,9 @@ static int ism_write_header(AVFormatContext *s)
 if (!(st = avformat_new_stream(ctx, NULL))) {
 return AVERROR(ENOMEM);
 }
-avcodec_parameters_copy(st->codecpar, s->streams[i]->codecpar);
+if ((ret = avcodec_parameters_copy(st->codecpar, 
s->streams[i]->codecpar)) < 0) {
+return ret;
+}
 st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
 st->time_base = s->streams[i]->time_base;
 
-- 
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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avformat/riff: map Y410 fourcc to RAWVIDEO decoder

2024-10-12 Thread James Almer
md5 values change because the nut container now reports rawvideo as encoder
and Y410 as codec type instead of the bogus RGB[15].

Signed-off-by: James Almer 
---
 libavcodec/raw.c | 1 +
 libavformat/riff.c   | 1 +
 tests/ref/fate/filter-pixdesc-xv30le | 2 +-
 tests/ref/fate/filter-pixfmts-copy   | 2 +-
 tests/ref/fate/filter-pixfmts-crop   | 2 +-
 tests/ref/fate/filter-pixfmts-field  | 2 +-
 tests/ref/fate/filter-pixfmts-fieldorder | 2 +-
 tests/ref/fate/filter-pixfmts-hflip  | 2 +-
 tests/ref/fate/filter-pixfmts-il | 2 +-
 tests/ref/fate/filter-pixfmts-null   | 2 +-
 tests/ref/fate/filter-pixfmts-scale  | 2 +-
 tests/ref/fate/filter-pixfmts-transpose  | 2 +-
 tests/ref/fate/filter-pixfmts-vflip  | 2 +-
 13 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index adc189b26a..b6c1dea8c1 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -73,6 +73,7 @@ static const PixelFormatTag raw_pix_fmt_tags[] = {
 { AV_PIX_FMT_NV12,MKTAG('N', 'V', '1', '2') },
 { AV_PIX_FMT_NV21,MKTAG('N', 'V', '2', '1') },
 { AV_PIX_FMT_VUYA,MKTAG('A', 'Y', 'U', 'V') }, /* MS 4:4:4:4 */
+{ AV_PIX_FMT_XV30LE,  MKTAG('Y', '4', '1', '0') },
 
 /* nut */
 { AV_PIX_FMT_RGB555LE, MKTAG('R', 'G', 'B', 15) },
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 88c4d6cbe9..a882602220 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -222,6 +222,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'Y', '2') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', '2') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('V', '4', '2', '2') },
+{ AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '1', '0') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'N', 'V') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'N', 'V') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'N', 'Y') },
diff --git a/tests/ref/fate/filter-pixdesc-xv30le 
b/tests/ref/fate/filter-pixdesc-xv30le
index 9b5ad5417e..5960dc34eb 100644
--- a/tests/ref/fate/filter-pixdesc-xv30le
+++ b/tests/ref/fate/filter-pixdesc-xv30le
@@ -1 +1 @@
-pixdesc-xv30le  fb76a14d6d5cf3a0b48f30b2fb59becd
+pixdesc-xv30le  701d821940e3f837864393e1c7878843
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index 51bc3d8a83..dbc9947a47 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -105,7 +105,7 @@ vuyx0af13a42f9d0932c5a9bb6a8a5d1c5ee
 vyu444  93912234400a4373b1a6b5c4e4b1a4ef
 x2bgr10le   550c0d190cf695afa4eaacb644db6b75
 x2rgb10le   c1e3ac21be04a16bb157b22784524520
-xv30le  c14b5a953bf3be56346f66ca174a5b1b
+xv30le  718bf036d13f9f1ea8804c2658dd53fa
 xv36le  6b8e46832aa8537a774e93dd7503c700
 xyz12be a1ef56bf746d71f59669c28e48fc8450
 xyz12le 831ff03c1ba4ef19374686f16a064d8c
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index 8423d3ed92..ef2fa68db0 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -102,7 +102,7 @@ vuyx615241c5406eb556fca0ad8606c23a02
 vyu444  5d976b25782ff69e4b3b18453fa1447b
 x2bgr10le   84de725b85662c362862820dc4a309aa
 x2rgb10le   f4265aca7a67dbfa9354370098ca6f33
-xv30le  a9edb820819b900a4a897fee4562a4fb
+xv30le  efebde9ca614024cd7ed95c7c02e9281
 xv36le  567af630bf0209e026e0909b3ca9c436
 xyz12be cb4571f9aaa7b59f999ef327276104b7
 xyz12le cd6aae8d26b18bdb4b9d068586276d91
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index 8037e3206c..6e500bdff7 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -105,7 +105,7 @@ vuyx3d02eeab336d0a8106f6fdd91be61073
 vyu444  b139fb4ddaef12a7542a68277211efa7
 x2bgr10le   dbe21538d7cb1744914f6bd46ec09b55
 x2rgb10le   a18bc4ae5274e0a8cca9137ecd50c677
-xv30le  e940366c78efc9e292e9de28cf04dba9
+xv30le  298f6f14c5bfc18587cd1c3225287a39
 xv36le  e05a99fc3edc8f26cb2dbd287c0a0fcf
 xyz12be d2fa69ec91d3ed862f2dac3f8e7a3437
 xyz12le 02bccd5e0b6824779a1f848b0ea3e3b5
diff --git a/tests/ref/fate/filter-pixfmts-fieldorder 
b/tests/ref/fate/filter-pixfmts-fieldorder
index 948001feff..890b9191c6 100644
--- a/tests/ref/fate/filter-pixfmts-fieldorder
+++ b/tests/ref/fate/filter-pixfmts-fieldorder
@@ -94,7 +94,7 @@ vuyx9e4480c5fcb7c091ec3e517420764ef3
 vyu444  3ddab207d561a3ee5efae09e504207f2
 x2bgr10le   86474d84f26c5c51d6f75bf7e1de8da8
 x2rgb10le   cdf6a9e8a8d081aa768c6ae2e6221676
-xv30le  25aac48128d94010a3660839500caee5
+xv30le  b

Re: [FFmpeg-devel] [PATCH 1/2] configure: suggest installing nasm/yasm before using --disable-x86asm

2024-10-12 Thread vip
On Wed, Oct 9, 2024 at 3:51 PM  wrote:

>
>
> On 9 Oct 2024, at 22:15, Alexander Strasser via ffmpeg-devel wrote:
>
> > On 2024-10-03 04:04 +0200, Lynne via ffmpeg-devel wrote:
> >> On 01/10/2024 15:24, vipyne wrote:
> >>> ---
> >>>   configure | 2 +-
> >>>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/configure b/configure
> >>> index c8fb49a7a4..d178ef59dc 100755
> >>> --- a/configure
> >>> +++ b/configure
> >>> @@ -6460,7 +6460,7 @@ EOF
> >>>   for program in $x86asmexe nasm yasm; do
> >>>   probe_x86asm $program && break
> >>>   done
> >>> -disabled x86asm && die "nasm/yasm not found or too old. Use
> --disable-x86asm for a crippled build."
> >>> +disabled x86asm && die "nasm/yasm not found or too old.
> Please install/update nasm or yasm or use --disable-x86asm for a slower
> build."
> >>>   X86ASMFLAGS="-f $objformat"
> >>>   test -n "$extern_prefix"  && append X86ASMFLAGS "-DPREFIX"
> >>>   case "$objformat" in
> >>
> >> Could you remove the yasm mention? Its been holding us back and we've
> >> discussed dropping support for it enough in recent time to go ahead and
> do
> >> it any day now.
> >> Otherwise LGTM.
> >
> > No opinion on yasm, but IMHO the new wording proposal regarding the
> > build is a little bit ambigous.
> >
> > What do you think about the following?
> >
> > ...use --disable-x86asm for a build without hand-optimized assembly.
> >
> > I would hope it's clearer and more precise.
> >
>
> +1 from me, as „slower build“ could be understood as the process of
> building FFmpeg
> will be slower.
>
>
ah, that's actually what I thought it meant, so thank you for
clarification.  "without hand-optimized assembly" seems like the right
phrase here.

>
> > Best regards,
> >   Alexander
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".
>


-- 
|||*|*****
**
v  a  n  e  s  s  a p  y  n  e   | 610.420.4483 | @vipyne
|||*|*****
**
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v3] configure: suggest installing nasm before using --disable-x86asm

2024-10-12 Thread vipyne
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index e8f6d2e2b6..8803148ab7 100755
--- a/configure
+++ b/configure
@@ -6448,7 +6448,7 @@ EOF
 for program in $x86asmexe nasm; do
 probe_x86asm $program && break
 done
-disabled x86asm && die "nasm not found or too old. Use 
--disable-x86asm for a crippled build."
+disabled x86asm && die "nasm not found or too old. Please 
install/update nasm or use --disable-x86asm for a build without hand-optimized 
assembly."
 X86ASMFLAGS="-f $objformat"
 test -n "$extern_prefix"  && append X86ASMFLAGS "-DPREFIX"
 case "$objformat" in
-- 
2.39.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/2] libavcodec/dnxuc_parser: Use av_fourcc2str instead of av_fourcc_make_string

2024-10-12 Thread Alexander Strasser via ffmpeg-devel
The string representation of the FourCC is only used once for logging.
---

Could also merge this with the first patch in this series and make
it a single patch.

Or drop this one.

I don't have a strong opinion on these details.

 libavcodec/dnxuc_parser.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libavcodec/dnxuc_parser.c b/libavcodec/dnxuc_parser.c
index 896758c794..12472c7a2d 100644
--- a/libavcodec/dnxuc_parser.c
+++ b/libavcodec/dnxuc_parser.c
@@ -95,11 +95,8 @@ static int dnxuc_parse(AVCodecParserContext *s,
 pc->nr_bytes = AV_RL32(buf+29+icmp_offset) - 8;

 if (!avctx->codec_tag) {
-char fourcc_buf[AV_FOURCC_MAX_STRING_SIZE];
-
-av_fourcc_make_string(fourcc_buf, pc->fourcc_tag);
 av_log(avctx, AV_LOG_INFO, "dnxuc_parser: '%s' %dx%d %dbpp %d\n",
-fourcc_buf,
+av_fourcc2str(pc->fourcc_tag),
 pc->width, pc->height,
 (pc->nr_bytes*8)/(pc->width*pc->height),
 pc->nr_bytes);
--
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 2/2] libavcodec/dnxuc_parser: Use av_fourcc2str instead of av_fourcc_make_string

2024-10-12 Thread epirat07



On 12 Oct 2024, at 23:08, Alexander Strasser via ffmpeg-devel wrote:

> The string representation of the FourCC is only used once for logging.
> ---
>
> Could also merge this with the first patch in this series and make
> it a single patch.
>
> Or drop this one.
>
> I don't have a strong opinion on these details.

LGTM, thanks.

Maybe just squash them into one commit.

>
>  libavcodec/dnxuc_parser.c | 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/libavcodec/dnxuc_parser.c b/libavcodec/dnxuc_parser.c
> index 896758c794..12472c7a2d 100644
> --- a/libavcodec/dnxuc_parser.c
> +++ b/libavcodec/dnxuc_parser.c
> @@ -95,11 +95,8 @@ static int dnxuc_parse(AVCodecParserContext *s,
>  pc->nr_bytes = AV_RL32(buf+29+icmp_offset) - 8;
>
>  if (!avctx->codec_tag) {
> -char fourcc_buf[AV_FOURCC_MAX_STRING_SIZE];
> -
> -av_fourcc_make_string(fourcc_buf, pc->fourcc_tag);
>  av_log(avctx, AV_LOG_INFO, "dnxuc_parser: '%s' %dx%d %dbpp %d\n",
> -fourcc_buf,
> +av_fourcc2str(pc->fourcc_tag),
>  pc->width, pc->height,
>  (pc->nr_bytes*8)/(pc->width*pc->height),
>  pc->nr_bytes);
> --
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/2] libavcodec/dnxuc_parser: Use av_fourcc2str instead of av_fourcc_make_string

2024-10-12 Thread martin schitter




On 12.10.24 23:18, epira...@gmail.com wrote:

Maybe just squash them into one commit.


Yes -- this looks like the most desirable solution.

And thanks to Alex for the suggested improvement!

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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/3] avfilter/vsdc_testsrc: simplify yuvtest_fill_picture

2024-10-12 Thread James Almer
Copy what's done for rgbtest_fill_picture.
It will be useful for the following commit.

Signed-off-by: James Almer 
---
 libavfilter/drawutils.c|  48 +++-
 libavfilter/drawutils.h|   1 +
 libavfilter/vsrc_testsrc.c | 145 +++--
 3 files changed, 75 insertions(+), 119 deletions(-)

diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c
index 95525d38b4..b86f666f1f 100644
--- a/libavfilter/drawutils.c
+++ b/libavfilter/drawutils.c
@@ -32,19 +32,17 @@
 
 enum { RED = 0, GREEN, BLUE, ALPHA };
 
-int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
+static int fill_map(const AVPixFmtDescriptor *desc, uint8_t *map)
 {
-const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
-if (!(desc->flags & AV_PIX_FMT_FLAG_RGB))
-return AVERROR(EINVAL);
-if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
+if (desc->flags & (AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_HWACCEL |
+   AV_PIX_FMT_FLAG_BAYER | AV_PIX_FMT_FLAG_XYZ | 
AV_PIX_FMT_FLAG_PAL))
 return AVERROR(EINVAL);
 av_assert0(desc->nb_components == 3 + !!(desc->flags & 
AV_PIX_FMT_FLAG_ALPHA));
 if (desc->flags & AV_PIX_FMT_FLAG_PLANAR) {
-rgba_map[RED]   = desc->comp[0].plane;
-rgba_map[GREEN] = desc->comp[1].plane;
-rgba_map[BLUE]  = desc->comp[2].plane;
-rgba_map[ALPHA] = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) ? 
desc->comp[3].plane : 3;
+map[RED]   = desc->comp[0].plane;
+map[GREEN] = desc->comp[1].plane;
+map[BLUE]  = desc->comp[2].plane;
+map[ALPHA] = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) ? 
desc->comp[3].plane : 3;
 } else {
 int had0 = 0;
 unsigned depthb = 0;
@@ -60,24 +58,40 @@ int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat 
pix_fmt)
 return AVERROR(ENOSYS);
 
 had0 |= pos == 0;
-rgba_map[i] = pos;
+map[i] = pos;
 depthb = db;
 }
 
 if (desc->nb_components == 3)
-rgba_map[ALPHA] = had0 ? 3 : 0;
+map[ALPHA] = had0 ? 3 : 0;
 }
 
-av_assert0(rgba_map[RED]   != rgba_map[GREEN]);
-av_assert0(rgba_map[GREEN] != rgba_map[BLUE]);
-av_assert0(rgba_map[BLUE]  != rgba_map[RED]);
-av_assert0(rgba_map[RED]   != rgba_map[ALPHA]);
-av_assert0(rgba_map[GREEN] != rgba_map[ALPHA]);
-av_assert0(rgba_map[BLUE]  != rgba_map[ALPHA]);
+av_assert0(map[RED]   != map[GREEN]);
+av_assert0(map[GREEN] != map[BLUE]);
+av_assert0(map[BLUE]  != map[RED]);
+av_assert0(map[RED]   != map[ALPHA]);
+av_assert0(map[GREEN] != map[ALPHA]);
+av_assert0(map[BLUE]  != map[ALPHA]);
 
 return 0;
 }
 
+int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
+{
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+if (!(desc->flags & AV_PIX_FMT_FLAG_RGB))
+return AVERROR(EINVAL);
+return fill_map(desc, rgba_map);
+}
+
+int ff_fill_ayuv_map(uint8_t *ayuv_map, enum AVPixelFormat pix_fmt)
+{
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+if (desc->flags & AV_PIX_FMT_FLAG_RGB)
+return AVERROR(EINVAL);
+return fill_map(desc, ayuv_map);
+}
+
 int ff_draw_init2(FFDrawContext *draw, enum AVPixelFormat format, enum 
AVColorSpace csp,
   enum AVColorRange range, unsigned flags)
 {
diff --git a/libavfilter/drawutils.h b/libavfilter/drawutils.h
index 90df55107a..f4903d1a86 100644
--- a/libavfilter/drawutils.h
+++ b/libavfilter/drawutils.h
@@ -29,6 +29,7 @@
 #include "libavutil/pixfmt.h"
 
 int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt);
+int ff_fill_ayuv_map(uint8_t *ayuv_map, enum AVPixelFormat pix_fmt);
 
 #define MAX_PLANES 4
 
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index b004d2d0e0..b182abea0f 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -71,6 +71,9 @@ typedef struct TestSourceContext {
 /* only used by testsrc2 */
 int alpha;
 
+/* only used by yuvtest */
+uint8_t ayuv_map[4];
+
 /* only used by colorspectrum */
 int type;
 
@@ -1141,118 +1144,56 @@ const AVFilter ff_vsrc_rgbtestsrc = {
 
 #if CONFIG_YUVTESTSRC_FILTER
 
-static void yuvtest_fill_picture8(AVFilterContext *ctx, AVFrame *frame)
-{
-int x, y, w = frame->width, h = frame->height / 3;
-const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
-const int factor = 1 << desc->comp[0].depth;
-const int mid = 1 << (desc->comp[0].depth - 1);
-uint8_t *ydst = frame->data[0];
-uint8_t *udst = frame->data[1];
-uint8_t *vdst = frame->data[2];
-ptrdiff_t ylinesize = frame->linesize[0];
-ptrdiff_t ulinesize = frame->linesize[1];
-ptrdiff_t vlinesize = frame->linesize[2];
-
-for (y = 0; y < h; y++) {
-for (x = 0; x < w; x++) {
-int c = factor * x / w;
-
-ydst[x] = c;
-udst[x] = mid;
-  

[FFmpeg-devel] [PATCH 3/3] fate/filter-video: add tests for packed YUV in yuvtestsrc

2024-10-12 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/filter-video.mak   |  6 ++
 tests/ref/fate/filter-yuvtestsrc-ayuv | 10 ++
 tests/ref/fate/filter-yuvtestsrc-vuyx | 10 ++
 3 files changed, 26 insertions(+)
 create mode 100644 tests/ref/fate/filter-yuvtestsrc-ayuv
 create mode 100644 tests/ref/fate/filter-yuvtestsrc-vuyx

diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 5b8a294afd..0b478ef14c 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -112,6 +112,12 @@ fate-filter-yuvtestsrc-yuv444p: CMD = framecrc -lavfi 
yuvtestsrc=rate=5:duration
 FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC SCALE) += 
fate-filter-yuvtestsrc-yuv444p12
 fate-filter-yuvtestsrc-yuv444p12: CMD = framecrc -lavfi 
yuvtestsrc=rate=5:duration=1,format=yuv444p12,scale -pix_fmt yuv444p12le
 
+FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-ayuv
+fate-filter-yuvtestsrc-ayuv: CMD = framecrc -lavfi 
yuvtestsrc=rate=5:duration=1 -pix_fmt ayuv
+
+FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-vuyx
+fate-filter-yuvtestsrc-vuyx: CMD = framecrc -lavfi 
yuvtestsrc=rate=5:duration=1 -pix_fmt vuyx
+
 FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC FORMAT CONCAT SCALE, LAVFI_INDEV 
FILE_PROTOCOL) += fate-filter-lavd-scalenorm
 fate-filter-lavd-scalenorm: tests/data/filtergraphs/scalenorm
 fate-filter-lavd-scalenorm: CMD = framecrc -f lavfi -graph_file 
$(TARGET_PATH)/tests/data/filtergraphs/scalenorm -i dummy
diff --git a/tests/ref/fate/filter-yuvtestsrc-ayuv 
b/tests/ref/fate/filter-yuvtestsrc-ayuv
new file mode 100644
index 00..91c15bebb9
--- /dev/null
+++ b/tests/ref/fate/filter-yuvtestsrc-ayuv
@@ -0,0 +1,10 @@
+#tb 0: 1/5
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 320x240
+#sar 0: 1/1
+0,  0,  0,1,   307200, 0xd4270fd4
+0,  1,  1,1,   307200, 0xd4270fd4
+0,  2,  2,1,   307200, 0xd4270fd4
+0,  3,  3,1,   307200, 0xd4270fd4
+0,  4,  4,1,   307200, 0xd4270fd4
diff --git a/tests/ref/fate/filter-yuvtestsrc-vuyx 
b/tests/ref/fate/filter-yuvtestsrc-vuyx
new file mode 100644
index 00..f91ef558d7
--- /dev/null
+++ b/tests/ref/fate/filter-yuvtestsrc-vuyx
@@ -0,0 +1,10 @@
+#tb 0: 1/5
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 320x240
+#sar 0: 1/1
+0,  0,  0,1,   307200, 0x4df60fd4
+0,  1,  1,1,   307200, 0x4df60fd4
+0,  2,  2,1,   307200, 0x4df60fd4
+0,  3,  3,1,   307200, 0x4df60fd4
+0,  4,  4,1,   307200, 0x4df60fd4
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH 2/3] avfilter/vsrc_testsrc: add support for packed YUV formats in yuvtestsrc

2024-10-12 Thread James Almer
Signed-off-by: James Almer 
---
 libavfilter/vsrc_testsrc.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index b182abea0f..0df857c766 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -1155,6 +1155,13 @@ static void yuvtest_put_pixel(uint8_t *dstp[4], int 
dst_linesizep[4],
 uint32_t n;
 
 switch (fmt) {
+case AV_PIX_FMT_UYVA:
+case AV_PIX_FMT_VUYA:
+case AV_PIX_FMT_VUYX:
+case AV_PIX_FMT_AYUV:
+n = (y << (ayuv_map[Y]*8)) + (u << (ayuv_map[U]*8)) + (v << 
(ayuv_map[V]*8)) + (255U << (ayuv_map[A]*8));
+AV_WL32(&dstp[0][i*4 + j*dst_linesizep[0]], n);
+break;
 case AV_PIX_FMT_YUV444P:
 case AV_PIX_FMT_YUVJ444P:
 dstp[0][i + j*dst_linesizep[0]] = y;
@@ -1210,6 +1217,8 @@ static const enum AVPixelFormat yuvtest_pix_fmts[] = {
 AV_PIX_FMT_YUV444P9, AV_PIX_FMT_YUV444P10,
 AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV444P14,
 AV_PIX_FMT_YUV444P16,
+AV_PIX_FMT_AYUV, AV_PIX_FMT_UYVA,
+AV_PIX_FMT_VUYA, AV_PIX_FMT_VUYX,
 AV_PIX_FMT_NONE
 };
 
-- 
2.46.2

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

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


Re: [FFmpeg-devel] [PATCH 05/10] avcodec/vvc/thread: Check frame to be non NULL

2024-10-12 Thread Nuo Mi
On Thu, Oct 10, 2024 at 3:40 AM Michael Niedermayer 
wrote:

> Hi Nuo mi
>
> On Sun, Sep 22, 2024 at 11:56:40PM +0200, Michael Niedermayer wrote:
> > Fixes: NULL pointer dereference
> > Fixes:
> 71303/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-4875859050168320
> >
> > Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/vvc/thread.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/vvc/thread.c b/libavcodec/vvc/thread.c
> > index 86a7753c6a4..2bf9adc462e 100644
> > --- a/libavcodec/vvc/thread.c
> > +++ b/libavcodec/vvc/thread.c
> > @@ -837,7 +837,8 @@ int ff_vvc_frame_wait(VVCContext *s, VVCFrameContext
> *fc)
> >  ff_cond_wait(&ft->cond, &ft->lock);
> >
> >  ff_mutex_unlock(&ft->lock);
> > -ff_vvc_report_frame_finished(fc->ref);
> > +if (fc->ref)
> > +ff_vvc_report_frame_finished(fc->ref);
>
> Is this correct ?
> or is there some other issue ?
> i can provide the fuzzer sample if you want to have a look?
>
Hi Michael,
Sorry for the delay.
The NULL fc->ref might need to be handled earlier.
Please provide the fuzz data, and I'll check it out.
Thank you


> libavcodec/vvc/refs.c:587:31: runtime error: member access within null
> pointer of type 'VVCFrame' (aka 'struct VVCFrame')
> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
> libavcodec/vvc/refs.c:587:31 in
> AddressSanitizer:DEADLYSIGNAL
> =
> ==1106370==ERROR: AddressSanitizer: SEGV on unknown address 0x0058
> (pc 0x008e05c3 bp 0x7fffa0862730 sp 0x7fffa08625c0 T0)
> ==1106370==The signal is caused by a READ memory access.
> ==1106370==Hint: address points to the zero page.
> #0 0x8e05c3 in ff_vvc_report_progress libavcodec/vvc/refs.c:587:31
> #1 0x8e0476 in ff_vvc_report_frame_finished libavcodec/vvc/refs.c:547:5
> #2 0x8e887d in ff_vvc_frame_wait libavcodec/vvc/thread.c:822:5
> #3 0x6f260d in wait_delayed_frame libavcodec/vvc/dec.c:927:32
> #4 0x6db9ec in get_decoded_frame libavcodec/vvc/dec.c:963:20
> #5 0x6db9ec in vvc_decode_frame libavcodec/vvc/dec.c:992:16
> #6 0x58285b in decode_simple_internal libavcodec/decode.c:442:16
> #7 0x58285b in decode_simple_receive_frame libavcodec/decode.c:612:15
> #8 0x58285b in ff_decode_receive_frame_internal
> libavcodec/decode.c:648:15
> #9 0x588d4b in decode_receive_frame_internal libavcodec/decode.c:665:15
> #10 0x58a861 in ff_decode_receive_frame libavcodec/decode.c:825:15
> #11 0x55fc6d in audio_video_handler tools/target_dec_fuzzer.c:98:15
> #12 0x55d79d in LLVMFuzzerTestOneInput tools/target_dec_fuzzer.c:602:9
> #13 0x16bf1ac in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*,
> unsigned long) (tools/target_dec_vvc_fuzzer+0x16bf1ac)
> #14 0x16a981f in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*,
> unsigned long) (tools/target_dec_vvc_fuzzer+0x16a981f)
> #15 0x16aee7f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned
> char const*, unsigned long)) (tools/target_dec_vvc_fuzzer+0x16aee7f)
> #16 0x16a94bb in main (tools/target_dec_vvc_fuzzer+0x16a94bb)
> #17 0x7f5835026082 in __libc_start_main
> /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:308:16
> #18 0x4a9ecd in _start (tools/target_dec_vvc_fuzzer+0x4a9ecd)
>
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Good people do not need laws to tell them to act responsibly, while bad
> people will find a way around the laws. -- Plato
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] doc/bitstream_filters: elaborate on h264_redundant_pps

2024-10-12 Thread Marth64
As explained by jkqxz on IRC (thanks).

Signed-off-by: Marth64 
---
 doc/bitstream_filters.texi | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index e1cb87a522..1e625ac913 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -423,9 +423,21 @@ Please note that this filter is auto-inserted for MPEG-TS 
(muxer
 
 @section h264_redundant_pps
 
-This applies a specific fixup to some Blu-ray streams which contain
-redundant PPSs modifying irrelevant parameters of the stream which
-confuse other transformations which require correct extradata.
+This applies a specific fixup to some Blu-ray BDMV H264 streams
+which contain redundant PPSs. The PPSs modify irrelevant parameters
+of the stream, confusing other transformations which require
+the correct extradata.
+
+The encoder used on these impacted streams adds extra PPSs throughout
+the stream, varying the initial QP and whether weighted prediction
+was enabled. This causes issues after copying the stream into
+a global header container, as the starting PPS is not suitable
+for the rest of the stream. One side effect, for example,
+is seeking will return garbled output until a new PPS appears.
+
+This BSF removes the extra PPSs and rewrites the slice headers
+such that the stream uses a single leading PPS in the global header,
+which resolves the issue.
 
 @section hevc_metadata
 
-- 
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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avformat/hlsenc: check return value of avcodec_parameters_copy()

2024-10-12 Thread Marth64
Written in the dominant style of the surrounding code block.

Signed-off-by: Marth64 
---
 libavformat/hlsenc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 571d6b2752..1b3f3ef2bb 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -887,7 +887,9 @@ static int hls_mux_init(AVFormatContext *s, VariantStream 
*vs)
 
 if (!(st = avformat_new_stream(loc, NULL)))
 return AVERROR(ENOMEM);
-avcodec_parameters_copy(st->codecpar, vs->streams[i]->codecpar);
+ret = avcodec_parameters_copy(st->codecpar, vs->streams[i]->codecpar);
+if (ret < 0)
+return ret;
 if (!oc->oformat->codec_tag ||
 av_codec_get_id (oc->oformat->codec_tag, 
vs->streams[i]->codecpar->codec_tag) == st->codecpar->codec_id ||
 av_codec_get_tag(oc->oformat->codec_tag, 
vs->streams[i]->codecpar->codec_id) <= 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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avformat/sapdec: check return value of avcodec_parameters_copy()

2024-10-12 Thread Marth64
Written in the dominant style of the surrounding code block.

Signed-off-by: Marth64 
---
 libavformat/sapdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c
index d5b5d71c02..22db3803c9 100644
--- a/libavformat/sapdec.c
+++ b/libavformat/sapdec.c
@@ -179,7 +179,9 @@ static int sap_read_header(AVFormatContext *s)
 goto fail;
 }
 st->id = i;
-avcodec_parameters_copy(st->codecpar, 
sap->sdp_ctx->streams[i]->codecpar);
+ret = avcodec_parameters_copy(st->codecpar, 
sap->sdp_ctx->streams[i]->codecpar);
+if (ret < 0)
+goto fail;
 st->time_base = sap->sdp_ctx->streams[i]->time_base;
 }
 
-- 
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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 01/24] lavfi/vf_frei0r: switch to query_func2()

2024-10-12 Thread Nicolas George
Anton Khirnov (12024-10-12):
>  1 file changed, 7 insertions(+), 5 deletions(-)
>  1 file changed, 5 insertions(+), 3 deletions(-)
>  1 file changed, 6 insertions(+), 4 deletions(-)
>  1 file changed, 7 insertions(+), 6 deletions(-)
>  1 file changed, 6 insertions(+), 4 deletions(-)
>  1 file changed, 6 insertions(+), 3 deletions(-)
>  1 file changed, 6 insertions(+), 4 deletions(-)
>  1 file changed, 16 insertions(+), 9 deletions(-)
>  1 file changed, 7 insertions(+), 4 deletions(-)
>  1 file changed, 5 insertions(+), 3 deletions(-)
>  1 file changed, 9 insertions(+), 7 deletions(-)
>  1 file changed, 6 insertions(+), 4 deletions(-)
>  1 file changed, 6 insertions(+), 3 deletions(-)
>  1 file changed, 6 insertions(+), 4 deletions(-)
>  1 file changed, 7 insertions(+), 5 deletions(-)
>  1 file changed, 8 insertions(+), 5 deletions(-)
>  1 file changed, 7 insertions(+), 5 deletions(-)
>  1 file changed, 9 insertions(+), 7 deletions(-)
>  1 file changed, 12 insertions(+), 10 deletions(-)

How are this series and the previous similar ones considered
enhancements? They just add boilerplate code with no gain of features.

When adding a new more powerful but more verbose mechanism for some
feature, the proper way of doing things is to have the framework emulate
the needs of the new mechanism from the code currently there, so that
components that just work and do not need the extra power do not need to
be fastidiously changed.

This is making the code worse. Please stop and do better.

-- 
  Nicolas George
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avcodec/mpeg12dec: set FF_CODEC_PROPERTY_CLOSED_CAPTIONS in mpeg_set_cc_format()

2024-10-12 Thread Marth64
When Closed Captions are discovered, this method is always invoked.
Therefore, use it to set the property instead of repeating the statement.

Signed-off-by: Marth64 
---
 libavcodec/mpeg12dec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 4f784611de..c0ed6a9d5b 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1917,6 +1917,8 @@ static void mpeg_set_cc_format(AVCodecContext *avctx, 
enum Mpeg2ClosedCaptionsFo
 
 av_log(avctx, AV_LOG_DEBUG, "CC: first seen substream is %s format\n", 
label);
 }
+
+avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 }
 
 static int mpeg_decode_a53_cc(AVCodecContext *avctx,
@@ -1943,7 +1945,6 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 if (ret >= 0)
 memcpy(s1->a53_buf_ref->data + old_size, p + 7, cc_count * 
UINT64_C(3));
 
-avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 mpeg_set_cc_format(avctx, CC_FORMAT_A53_PART4, "A/53 Part 4");
 }
 return 1;
@@ -1993,7 +1994,6 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 }
 }
 
-avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 mpeg_set_cc_format(avctx, CC_FORMAT_SCTE20, "SCTE-20");
 }
 return 1;
@@ -2056,7 +2056,6 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 }
 }
 
-avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 mpeg_set_cc_format(avctx, CC_FORMAT_DVD, "DVD");
 }
 return 1;
-- 
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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [Uncompressed MP4] RFC - Draft Encoder

2024-10-12 Thread Tomas Härdin
ons 2024-10-09 klockan 20:08 -0600 skrev Devon Sookhoo:
> Sounds good, I'll look into adding rawvideo to the list of
> movcodec_tags.
> 
> Looking at the AVPixFmtDescriptor, I noticed: AVComponentDescriptor
> comp[4]; Does this line limit the component count to only four?
> Encoding
> video with many components is an important use case.

I am aware of no pixel format with more than 4 components so probably.
I've never seen hyperspectral imagery used in this project. I've worked
with it before though

> Complex pixels are used in applications that involve both amplitude
> and
> phase information, particularly in signal processing and imaging
> techniques
> where the Fourier transform is frequently applied. Examples include
> Synthetic Aperture Radar (SAR), MRI scans, and radio astronomy.

Yep, suspected as much

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

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


Re: [FFmpeg-devel] [PATCH 2/2] lavc/vvc_mc: R-V V dmvr

2024-10-12 Thread flow gg
Fixed asm through `dmvr_hv\vlen\w:` to `func dmvr_hv\vlen\w, zve32x, zbb,
zba`

Rémi Denis-Courmont  于2024年10月12日周六 14:33写道:

> Hi,
>
> This fails to assemble here (binutils 2.43.1).
>
> --
> 雷米‧德尼-库尔蒙
> http://www.remlab.net/
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/2] lavc/vvc_mc: R-V V dmvr

2024-10-12 Thread uk7b
From: sunyuechi 

 k230   banana_f3
dmvr_8_12x20_c:   619.3 ( 1.00x)624.1 ( 1.00x)
dmvr_8_12x20_rvv_i32: 128.6 ( 4.82x)103.4 ( 6.04x)
dmvr_8_20x12_c:   610.0 ( 1.00x)665.6 ( 1.00x)
dmvr_8_20x12_rvv_i32: 137.6 ( 4.44x)92.9 ( 7.17x)
dmvr_8_20x20_c:  1008.0 ( 1.00x)1082.7 ( 1.00x)
dmvr_8_20x20_rvv_i32: 221.1 ( 4.56x)155.4 ( 6.97x)
dmvr_h_8_12x20_c:2008.0 ( 1.00x)2009.7 ( 1.00x)
dmvr_h_8_12x20_rvv_i32:   239.6 ( 8.38x)186.7 (10.77x)
dmvr_h_8_20x12_c:1989.5 ( 1.00x)2009.4 ( 1.00x)
dmvr_h_8_20x12_rvv_i32:   230.3 ( 8.64x)155.4 (12.93x)
dmvr_h_8_20x20_c:3304.1 ( 1.00x)3342.9 ( 1.00x)
dmvr_h_8_20x20_rvv_i32:   378.3 ( 8.73x)248.9 (13.43x)
dmvr_hv_8_12x20_c:   3609.8 ( 1.00x)3603.4 ( 1.00x)
dmvr_hv_8_12x20_rvv_i32:  369.1 ( 9.78x)322.1 (11.19x)
dmvr_hv_8_20x12_c:   3628.3 ( 1.00x)3624.2 ( 1.00x)
dmvr_hv_8_20x12_rvv_i32:  322.8 (11.24x)238.7 (15.19x)
dmvr_hv_8_20x20_c:   5933.8 ( 1.00x)5936.6 ( 1.00x)
dmvr_hv_8_20x20_rvv_i32:  526.5 (11.27x)374.1 (15.87x)
dmvr_v_8_12x20_c:2156.3 ( 1.00x)2155.4 ( 1.00x)
dmvr_v_8_12x20_rvv_i32:   239.6 ( 9.00x)176.2 (12.24x)
dmvr_v_8_20x12_c:2137.6 ( 1.00x)2165.9 ( 1.00x)
dmvr_v_8_20x12_rvv_i32:   230.3 ( 9.28x)155.2 (13.96x)
dmvr_v_8_20x20_c:4183.8 ( 1.00x)3592.9 ( 1.00x)
dmvr_v_8_20x20_rvv_i32:   369.3 (11.33x)249.2 (14.42x)
---
 libavcodec/riscv/vvc/vvc_mc_rvv.S  | 122 +
 libavcodec/riscv/vvc/vvcdsp_init.c |  22 ++
 2 files changed, 144 insertions(+)

diff --git a/libavcodec/riscv/vvc/vvc_mc_rvv.S 
b/libavcodec/riscv/vvc/vvc_mc_rvv.S
index 18532616d9..1dcbaf7d5b 100644
--- a/libavcodec/riscv/vvc/vvc_mc_rvv.S
+++ b/libavcodec/riscv/vvc/vvc_mc_rvv.S
@@ -285,3 +285,125 @@ endfunc
 func_w_avg 128
 func_w_avg 256
 #endif
+
+func dmvr zve32x, zbb, zba
+lpad0
+lit0, 4
+1:
+add   t1, a1, a2
+addi  t4, a0, 128*2
+vle8.vv0, (a1)
+vle8.vv4, (t1)
+addi  a3, a3, -2
+vwmulu.vx v16, v0, t0
+vwmulu.vx v20, v4, t0
+vse16.v   v16, (a0)
+vse16.v   v20, (t4)
+sh1adda1, a2, a1
+add   a0, a0, 128*2*2
+bnez  a3, 1b
+ret
+endfunc
+
+.macro dmvr_h_v mn, type, w, vlen
+func dmvr_\type\vlen\w, zve32x, zbb, zba
+lla   t4, ff_vvc_inter_luma_dmvr_filters
+sh1addt4, \mn, t4
+lbu   t5, (t4)
+lbu   t6, 1(t4)
+1:
+vsetvlstatic8 \w, \vlen
+.ifc \type,h
+addi  t0, a1, 1
+addi  t1, a1, 2
+.else
+add   t0, a1, a2
+add   t1, t0, a2
+.endif
+vle8.vv0, (a1)
+vle8.vv4, (t0)
+vle8.vv8, (t1)
+addi  a3, a3, -2
+addi  t2, a0, 128*2
+vwmulu.vx v12, v0, t5
+vwmulu.vx v24, v4, t5
+vwmaccu.vxv12, t6, v4
+vwmaccu.vxv24, t6, v8
+vsetvlstatic16\w, \vlen
+vssrl.vi  v12, v12, 2
+vssrl.vi  v24, v24, 2
+vse16.v   v12, (a0)
+vse16.v   v24, (t2)
+add   a0, a0, 128*4
+sh1adda1, a2, a1
+bnez  a3, 1b
+ret
+endfunc
+.endm
+
+.macro dmvr_load_h dst, filter0, filter1, w, vlen
+vsetvlstatic8 \w, \vlen
+addi  a6, a1, 1
+vle8.v\dst, (a1)
+vle8.vv2, (a6)
+vwmulu.vx v4, \dst, \filter0
+vwmaccu.vxv4, \filter1, v2
+vsetvlstatic16\w, \vlen
+vssrl.vi  \dst, v4, 2
+.endm
+
+.macro dmvr_hv w, vlen
+func dmvr_hv\vlen\w, zve32x, zbb, zba
+lla   t0, ff_vvc_inter_luma_dmvr_filters
+sh1addt1, a4, t0
+sh1addt2, a5, t0
+lbu   t3, (t1)  // filter[mx][0]
+lbu   t4, 1(t1) // filter[mx][1]
+lbu   t5, (t2)  // filter[my][0]
+lbu   t6, 1(t2) // filter[my][1]
+dmvr_load_h   v12, t3, t4, \w, \vlen
+add   a1, a1, a2
+1:
+vmul.vx   v28, v12, t5
+addi  a3, a3, -1
+dmvr_load_h   v12, t3, t4, \w, \vlen
+vmacc