[FFmpeg-cvslog] lavfi: regroup formats lists in a single structure.
ffmpeg | branch: master | Nicolas George | Mon Aug 24 12:16:34 2020 +0200| [2f76476549a01ae2c4ec2a440e4b14c5aba64869] | committer: Nicolas George lavfi: regroup formats lists in a single structure. It will allow to refernce it as a whole without clunky macros. Most of the changes have been automatically made with sed: sed -i ' s/-> *in_formats/->incfg.formats/g; s/-> *out_formats/->outcfg.formats/g; s/-> *in_channel_layouts/->incfg.channel_layouts/g; s/-> *out_channel_layouts/->outcfg.channel_layouts/g; s/-> *in_samplerates/->incfg.samplerates/g; s/-> *out_samplerates/->outcfg.samplerates/g; ' src/libavfilter/*(.) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2f76476549a01ae2c4ec2a440e4b14c5aba64869 --- libavfilter/aeval.c| 4 +- libavfilter/af_afir.c | 8 +- libavfilter/af_agate.c | 10 +- libavfilter/af_aiir.c | 2 +- libavfilter/af_amerge.c| 12 +-- libavfilter/af_anequalizer.c | 14 +-- libavfilter/af_aresample.c | 12 +-- libavfilter/af_asetrate.c | 2 +- libavfilter/af_channelmap.c| 4 +- libavfilter/af_channelsplit.c | 4 +- libavfilter/af_hdcd.c | 4 +- libavfilter/af_headphone.c | 8 +- libavfilter/af_join.c | 4 +- libavfilter/af_ladspa.c| 6 +- libavfilter/af_loudnorm.c | 4 +- libavfilter/af_lv2.c | 6 +- libavfilter/af_pan.c | 4 +- libavfilter/af_resample.c | 12 +-- libavfilter/af_sidechaincompress.c | 10 +- libavfilter/af_sofalizer.c | 4 +- libavfilter/af_surround.c | 4 +- libavfilter/avf_abitscope.c| 8 +- libavfilter/avf_ahistogram.c | 8 +- libavfilter/avf_aphasemeter.c | 14 +-- libavfilter/avf_avectorscope.c | 8 +- libavfilter/avf_concat.c | 12 +-- libavfilter/avf_showcqt.c | 8 +- libavfilter/avf_showfreqs.c| 8 +- libavfilter/avf_showspatial.c | 8 +- libavfilter/avf_showspectrum.c | 8 +- libavfilter/avf_showvolume.c | 8 +- libavfilter/avf_showwaves.c| 8 +- libavfilter/avfilter.c | 30 +++--- libavfilter/avfilter.h | 60 +++ libavfilter/avfiltergraph.c| 216 ++--- libavfilter/f_drawgraph.c | 2 +- libavfilter/f_ebur128.c| 14 +-- libavfilter/f_graphmonitor.c | 2 +- libavfilter/formats.c | 6 +- libavfilter/src_movie.c| 8 +- libavfilter/tests/filtfmts.c | 6 +- libavfilter/vaapi_vpp.c| 4 +- libavfilter/vaf_spectrumsynth.c| 10 +- libavfilter/vf_alphamerge.c| 6 +- libavfilter/vf_ciescope.c | 4 +- libavfilter/vf_colorspace.c| 4 +- libavfilter/vf_coreimage.m | 6 +- libavfilter/vf_elbg.c | 4 +- libavfilter/vf_extractplanes.c | 12 +-- libavfilter/vf_fieldmatch.c| 6 +- libavfilter/vf_fieldorder.c| 4 +- libavfilter/vf_histogram.c | 12 +-- libavfilter/vf_hwdownload.c| 4 +- libavfilter/vf_hwmap.c | 4 +- libavfilter/vf_hwupload.c | 4 +- libavfilter/vf_hwupload_cuda.c | 4 +- libavfilter/vf_lut2.c | 4 +- libavfilter/vf_mergeplanes.c | 4 +- libavfilter/vf_overlay.c | 6 +- libavfilter/vf_overlay_qsv.c | 4 +- libavfilter/vf_palettegen.c| 4 +- libavfilter/vf_paletteuse.c| 6 +- libavfilter/vf_remap.c | 8 +- libavfilter/vf_scale.c | 4 +- libavfilter/vf_showpalette.c | 4 +- libavfilter/vf_vectorscope.c | 12 +-- libavfilter/vf_vpp_qsv.c | 4 +- libavfilter/vf_waveform.c | 14 +-- libavfilter/vf_yadif_cuda.c| 4 +- libavfilter/vf_zscale.c| 4 +- 70 files changed, 386 insertions(+), 364 deletions(-) diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c index c7a8cd6550..4c62c98097 100644 --- a/libavfilter/aeval.c +++ b/libavfilter/aeval.c @@ -362,7 +362,7 @@ static int aeval_query_formats(AVFilterContext *ctx) // inlink supports any channel layout layouts = ff_all_channel_counts(); -if ((ret = ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts)) < 0) +if ((ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts)) < 0) return ret; if (eval->same_chlayout) { @@ -376,7 +376,7 @@ static int aeval_query_formats(AVFilterContext *ctx) eval->out_channel_layout ? eval->out_channel_layout : FF_COUNT2LAYOUT(eval->nb_channels))) < 0) return ret; -if ((ret = ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts)) < 0) +if ((ret = ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts)) < 0) retu
[FFmpeg-cvslog] lavfi/formats: simplify a macro parameters.
ffmpeg | branch: master | Nicolas George | Thu Aug 13 11:59:19 2020 +0200| [6479f40afa3c706ada2e2c0b05de473285d6a926] | committer: Nicolas George lavfi/formats: simplify a macro parameters. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6479f40afa3c706ada2e2c0b05de473285d6a926 --- libavfilter/formats.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 0a351d4174..695d28ea8e 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -535,15 +535,15 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref) FORMATS_CHANGEREF(oldref, newref); } -#define SET_COMMON_FORMATS(ctx, fmts, in_fmts, out_fmts, ref_fn, unref_fn) \ +#define SET_COMMON_FORMATS(ctx, fmts, ref_fn, unref_fn) \ int count = 0, i; \ \ if (!fmts) \ return AVERROR(ENOMEM); \ \ for (i = 0; i < ctx->nb_inputs; i++) { \ -if (ctx->inputs[i] && !ctx->inputs[i]->out_fmts) { \ -int ret = ref_fn(fmts, &ctx->inputs[i]->out_fmts); \ +if (ctx->inputs[i] && !ctx->inputs[i]->outcfg.fmts) { \ +int ret = ref_fn(fmts, &ctx->inputs[i]->outcfg.fmts); \ if (ret < 0) { \ return ret; \ } \ @@ -551,8 +551,8 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref) } \ } \ for (i = 0; i < ctx->nb_outputs; i++) { \ -if (ctx->outputs[i] && !ctx->outputs[i]->in_fmts) { \ -int ret = ref_fn(fmts, &ctx->outputs[i]->in_fmts); \ +if (ctx->outputs[i] && !ctx->outputs[i]->incfg.fmts) { \ +int ret = ref_fn(fmts, &ctx->outputs[i]->incfg.fmts); \ if (ret < 0) { \ return ret; \ } \ @@ -567,16 +567,16 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref) return 0; int ff_set_common_channel_layouts(AVFilterContext *ctx, - AVFilterChannelLayouts *layouts) + AVFilterChannelLayouts *channel_layouts) { -SET_COMMON_FORMATS(ctx, layouts, incfg.channel_layouts, outcfg.channel_layouts, +SET_COMMON_FORMATS(ctx, channel_layouts, ff_channel_layouts_ref, ff_channel_layouts_unref); } int ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates) { -SET_COMMON_FORMATS(ctx, samplerates, incfg.samplerates, outcfg.samplerates, +SET_COMMON_FORMATS(ctx, samplerates, ff_formats_ref, ff_formats_unref); } @@ -587,7 +587,7 @@ int ff_set_common_samplerates(AVFilterContext *ctx, */ int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats) { -SET_COMMON_FORMATS(ctx, formats, incfg.formats, outcfg.formats, +SET_COMMON_FORMATS(ctx, formats, ff_formats_ref, ff_formats_unref); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi: check the validity of formats lists.
ffmpeg | branch: master | Nicolas George | Thu Aug 13 13:18:15 2020 +0200| [69f5f6ea375950b4845b241ee27054bfc8f00343] | committer: Nicolas George lavfi: check the validity of formats lists. Part of the code expects valid lists, in particular no duplicates. These tests allow to catch bugs in filters (unlikely but possible) and to give a clear message when the error comes from the user ((a)formats) or the application (buffersink). If we decide to switch to a more efficient merging algorithm, possibly sorting the lists, these functions will be the preferred place for pre-processing, and can be renamed accordingly. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69f5f6ea375950b4845b241ee27054bfc8f00343 --- libavfilter/avfiltergraph.c | 50 libavfilter/formats.c | 70 + libavfilter/formats.h | 28 ++ 3 files changed, 148 insertions(+) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 7a85d94971..f6b572b3de 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -313,6 +313,53 @@ static void sanitize_channel_layouts(void *log, AVFilterChannelLayouts *l) } } +static int filter_link_check_formats(void *log, AVFilterLink *link, AVFilterFormatsConfig *cfg) +{ +int ret; + +switch (link->type) { + +case AVMEDIA_TYPE_VIDEO: +if ((ret = ff_formats_check_pixel_formats(log, cfg->formats)) < 0) +return ret; +break; + +case AVMEDIA_TYPE_AUDIO: +if ((ret = ff_formats_check_sample_formats(log, cfg->formats)) < 0 || +(ret = ff_formats_check_sample_rates(log, cfg->samplerates)) < 0 || +(ret = ff_formats_check_channel_layouts(log, cfg->channel_layouts)) < 0) +return ret; +break; + +default: +av_assert0(!"reached"); +} +return 0; +} + +/** + * Check the validity of the formats / etc. lists set by query_formats(). + * + * In particular, check they do not contain any redundant element. + */ +static int filter_check_formats(AVFilterContext *ctx) +{ +unsigned i; +int ret; + +for (i = 0; i < ctx->nb_inputs; i++) { +ret = filter_link_check_formats(ctx, ctx->inputs[i], &ctx->inputs[i]->outcfg); +if (ret < 0) +return ret; +} +for (i = 0; i < ctx->nb_outputs; i++) { +ret = filter_link_check_formats(ctx, ctx->outputs[i], &ctx->outputs[i]->incfg); +if (ret < 0) +return ret; +} +return 0; +} + static int filter_query_formats(AVFilterContext *ctx) { int ret, i; @@ -329,6 +376,9 @@ static int filter_query_formats(AVFilterContext *ctx) ctx->name, av_err2str(ret)); return ret; } +ret = filter_check_formats(ctx); +if (ret < 0) +return ret; for (i = 0; i < ctx->nb_inputs; i++) sanitize_channel_layouts(ctx, ctx->inputs[i]->outcfg.channel_layouts); diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 695d28ea8e..95361170c5 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -662,3 +662,73 @@ int ff_parse_channel_layout(int64_t *ret, int *nret, const char *arg, return 0; } + +static int check_list(void *log, const char *name, const AVFilterFormats *fmts) +{ +unsigned i, j; + +if (!fmts) +return 0; +if (!fmts->nb_formats) { +av_log(log, AV_LOG_ERROR, "Empty %s list\n", name); +return AVERROR(EINVAL); +} +for (i = 0; i < fmts->nb_formats; i++) { +for (j = i + 1; j < fmts->nb_formats; j++) { +if (fmts->formats[i] == fmts->formats[j]) { +av_log(log, AV_LOG_ERROR, "Duplicated %s\n", name); +return AVERROR(EINVAL); +} +} +} +return 0; +} + +int ff_formats_check_pixel_formats(void *log, const AVFilterFormats *fmts) +{ +return check_list(log, "pixel format", fmts); +} + +int ff_formats_check_sample_formats(void *log, const AVFilterFormats *fmts) +{ +return check_list(log, "sample format", fmts); +} + +int ff_formats_check_sample_rates(void *log, const AVFilterFormats *fmts) +{ +if (!fmts || !fmts->nb_formats) +return 0; +return check_list(log, "sample rate", fmts); +} + +static int layouts_compatible(uint64_t a, uint64_t b) +{ +return a == b || + (KNOWN(a) && !KNOWN(b) && av_get_channel_layout_nb_channels(a) == FF_LAYOUT2COUNT(b)) || + (KNOWN(b) && !KNOWN(a) && av_get_channel_layout_nb_channels(b) == FF_LAYOUT2COUNT(a)); +} + +int ff_formats_check_channel_layouts(void *log, const AVFilterChannelLayouts *fmts) +{ +unsigned i, j; + +if (!fmts) +return 0; +if (fmts->all_layouts < fmts->all_counts) { +av_log(log, AV_LOG_ERROR, "Inconsistent generic list\n"); +return AVERROR(EINVAL); +} +if (!fmts->all_layouts && !fmts->nb_channel_layouts) { +av_log(log
[FFmpeg-cvslog] lavfi/buffersink: remove redundant channel layouts.
ffmpeg | branch: master | Nicolas George | Fri Aug 14 10:53:38 2020 +0200| [0d942357f6ea918473ab0140b8deb37af84b094d] | committer: Nicolas George lavfi/buffersink: remove redundant channel layouts. The channel_layouts and channel_counts options set what buffersink is supposed to accept. If channel_counts contains 2, then stereo is already accepted, there is no point in having it in channel_layouts too. This was not properly documented until now, so only print a warning. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0d942357f6ea918473ab0140b8deb37af84b094d --- libavfilter/buffersink.c | 24 1 file changed, 24 insertions(+) diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 76a46f6678..9338969bf1 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -62,6 +62,29 @@ typedef struct BufferSinkContext { #define NB_ITEMS(list) (list ## _size / sizeof(*list)) +static void cleanup_redundant_layouts(AVFilterContext *ctx) +{ +BufferSinkContext *buf = ctx->priv; +int nb_layouts = NB_ITEMS(buf->channel_layouts); +int nb_counts = NB_ITEMS(buf->channel_counts); +uint64_t counts = 0; +int i, lc, n; + +for (i = 0; i < nb_counts; i++) +if (buf->channel_counts[i] < 64) +counts |= 1 << buf->channel_counts[i]; +for (i = lc = 0; i < nb_layouts; i++) { +n = av_get_channel_layout_nb_channels(buf->channel_layouts[i]); +if (n < 64 && (counts & (1 << n))) +av_log(ctx, AV_LOG_WARNING, + "Removing channel layout 0x%"PRIx64", redundant with %d channels\n", + buf->channel_layouts[i], n); +else +buf->channel_layouts[lc++] = buf->channel_layouts[i]; +} +buf->channel_layouts_size = lc * sizeof(*buf->channel_layouts); +} + int attribute_align_arg av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame) { return av_buffersink_get_frame_flags(ctx, frame, 0); @@ -253,6 +276,7 @@ static int asink_query_formats(AVFilterContext *ctx) if (buf->channel_layouts_size || buf->channel_counts_size || buf->all_channel_counts) { +cleanup_redundant_layouts(ctx); for (i = 0; i < NB_ITEMS(buf->channel_layouts); i++) if ((ret = ff_add_channel_layout(&layouts, buf->channel_layouts[i])) < 0) return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] ffmpeg: add auto_conversion_filters option.
ffmpeg | branch: master | Nicolas George | Fri Aug 14 13:06:34 2020 +0200| [697fb09e3dd187b76f1bc57516fcbe482b4d89e2] | committer: Nicolas George ffmpeg: add auto_conversion_filters option. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=697fb09e3dd187b76f1bc57516fcbe482b4d89e2 --- doc/ffmpeg.texi | 10 ++ fftools/ffmpeg.h| 1 + fftools/ffmpeg_filter.c | 2 ++ fftools/ffmpeg_opt.c| 3 +++ 4 files changed, 16 insertions(+) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 267ddfe8b5..c054aedf3f 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1746,6 +1746,16 @@ this buffer, in packets, for the matching output stream. The default value of this option should be high enough for most uses, so only touch this option if you are sure that you need it. +@item -auto_conversion_filters (@emph{global}) +Enable automatically inserting format conversion filters in all filter +graphs, including those defined by @option{-vf}, @option{-af}, +@option{-filter_complex} and @option{-lavfi}. If filter format negotiation +requires a conversion, the initialization of the filters will fail. +Conversions can still be performed by inserting the relevant conversion +filter (scale, aresample) in the graph. +On by default, to explicitly disable it you need to specify +@code{-noauto_conversion_filters}. + @end table As a special exception, you can use a bitmap subtitle stream as input: it diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 6e3f2545c7..908bc73fca 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -613,6 +613,7 @@ extern char *videotoolbox_pixfmt; extern int filter_nbthreads; extern int filter_complex_nbthreads; extern int vstats_version; +extern int auto_conversion_filters; extern const AVIOInterruptCB int_cb; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 4784e8a575..3c507f8c1d 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1104,6 +1104,8 @@ int configure_filtergraph(FilterGraph *fg) configure_output_filter(fg, fg->outputs[i], cur); avfilter_inout_free(&outputs); +if (!auto_conversion_filters) +avfilter_graph_set_auto_convert(fg->graph, AVFILTER_AUTO_CONVERT_NONE); if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0) goto fail; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 853550a142..19f719e3ff 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -172,6 +172,7 @@ float max_error_rate = 2.0/3; int filter_nbthreads = 0; int filter_complex_nbthreads = 0; int vstats_version = 2; +int auto_conversion_filters = 1; static int intra_only = 0; @@ -3545,6 +3546,8 @@ const OptionDef options[] = { "create a complex filtergraph", "graph_description" }, { "filter_complex_script", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex_script }, "read complex filtergraph description from a file", "filename" }, +{ "auto_conversion_filters", OPT_BOOL | OPT_EXPERT, { &auto_conversion_filters }, +"enable automatic conversion filters globally" }, { "stats", OPT_BOOL,{ &print_stats }, "print progress report during encoding", }, { "attach", HAS_ARG | OPT_PERFILE | OPT_EXPERT | ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/formats: more logical testing of inputs and outputs.
ffmpeg | branch: master | Nicolas George | Sun Aug 23 11:52:16 2020 +0200| [fe964d80fec17f043763405f5804f397279d6b27] | committer: Nicolas George lavfi/formats: more logical testing of inputs and outputs. ff_set_common_formats() is currently only called after graph_check_validity(), guaranteeing that inputs and outputs are connected. If we want to support configuring partially-connected graphs, we will have a lot of redesign to do anyway. Fix CID 1466262 / 1466263. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fe964d80fec17f043763405f5804f397279d6b27 --- libavfilter/formats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 95361170c5..c54aff688f 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -594,8 +594,8 @@ int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats) int ff_default_query_formats(AVFilterContext *ctx) { int ret; -enum AVMediaType type = ctx->inputs && ctx->inputs [0] ? ctx->inputs [0]->type : -ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type : +enum AVMediaType type = ctx->nb_inputs ? ctx->inputs [0]->type : +ctx->nb_outputs ? ctx->outputs[0]->type : AVMEDIA_TYPE_VIDEO; ret = ff_set_common_formats(ctx, ff_all_formats(type)); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] doc: include general in *-all pages.
ffmpeg | branch: master | Nicolas George | Sat Aug 22 12:41:15 2020 +0200| [e6d625d008df9392dc34cf5493c21768d002f827] | committer: Nicolas George doc: include general in *-all pages. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e6d625d008df9392dc34cf5493c21768d002f827 --- doc/ffmpeg.texi | 1 + doc/ffplay.texi | 1 + doc/ffprobe.texi | 1 + 3 files changed, 3 insertions(+) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index c054aedf3f..96b3257e79 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -2050,6 +2050,7 @@ ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext @ifset config-avfilter @include filters.texi @end ifset +@include general_contents.texi @end ifset @chapter See Also diff --git a/doc/ffplay.texi b/doc/ffplay.texi index f3761bb12e..e187b5852e 100644 --- a/doc/ffplay.texi +++ b/doc/ffplay.texi @@ -295,6 +295,7 @@ Toggle full screen. @ifset config-avfilter @include filters.texi @end ifset +@include general_contents.texi @end ifset @chapter See Also diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi index 28371cee59..d7fab4ff40 100644 --- a/doc/ffprobe.texi +++ b/doc/ffprobe.texi @@ -642,6 +642,7 @@ DV, GXF and AVI timecodes are available in format metadata @ifset config-avfilter @include filters.texi @end ifset +@include general_contents.texi @end ifset @chapter See Also ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] doc/texi2pod: support @float.
ffmpeg | branch: master | Nicolas George | Sat Aug 22 12:40:56 2020 +0200| [7d7e44a3aab1b14d80ec9c6ba32dff88d230eb70] | committer: Nicolas George doc/texi2pod: support @float. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d7e44a3aab1b14d80ec9c6ba32dff88d230eb70 --- doc/texi2pod.pl | 9 + 1 file changed, 9 insertions(+) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 9a9b34fc15..c7f67afe8c 100644 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -172,6 +172,9 @@ INF: while(<$inf>) { } elsif ($ended =~ /^(?:itemize|enumerate|(?:multi|[fv])?table)$/) { $_ = "\n=back\n"; $ic = pop @icstack; +} elsif ($ended =~ /^float$/) { +$_ = "\n=back\n"; +$ic = pop @icstack; } else { die "unknown command \@end $ended at line $.\n"; } @@ -297,6 +300,12 @@ INF: while(<$inf>) { $_ = "";# need a paragraph break }; +/^\@(float)\s+\w+/ and do { +push @endwstack, $endw; +$endw = $1; +$_ = "\n=over 4\n"; +}; + /^\@item\s+(.*\S)\s*$/ and $endw eq "multitable" and do { my $columns = $1; $columns =~ s/\@tab/ : /; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/vsrc_testsrc: switch to activate.
ffmpeg | branch: master | Nicolas George | Thu Jun 25 20:45:53 2020 +0200| [ddba05afe4d325bf8e545b8f1777d6010cc25e93] | committer: Nicolas George lavfi/vsrc_testsrc: switch to activate. Allow to set the EOF timestamp. Also: doc/filters/testsrc*: specify the rounding of the duration option. The changes in the ref files are right. For filter-fps-down, the graph is testsrc2=r=7:d=3.5,fps=3. 3.5=24.5/7, so the EOF of testsrc2 will have PTS 25/7. 25/7=(10+5/7)/3, so the EOF PTS for fps should be 11/7, and the output should contain a frame at PTS 10. For filter-fps-up, the graph is testsrc2=r=3:d=2,fps=7, for filter-fps-up-round-down and filter-fps-up-round-up it is the same with explicit rounding options. But there is no rounding: testsrc2 produces exactly 6 frames and 2 seconds, fps converts it into exactly 14 frames. The tests should probably be adjusted to restore them to a useful coverage. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ddba05afe4d325bf8e545b8f1777d6010cc25e93 --- doc/filters.texi| 4 libavfilter/vsrc_testsrc.c | 37 - tests/ref/fate/filter-fps-down | 1 + tests/ref/fate/filter-fps-up| 2 ++ tests/ref/fate/filter-fps-up-round-down | 3 +++ tests/ref/fate/filter-fps-up-round-up | 2 ++ tests/ref/fate/filter-mpdecimate| 1 + 7 files changed, 36 insertions(+), 14 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index d0ff3d470f..cbb16f22b2 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -22979,6 +22979,10 @@ for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. +Since the frame rate is used as time base, all frames including the last one +will have their full duration. If the specified duration is not a multiple +of the frame duration, it will be rounded up. + @item sar Set the sample aspect ratio of the sourced video. diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index e8c33b00a0..cf9fa4b2b2 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -45,6 +45,7 @@ #include "libavutil/xga_font_data.h" #include "avfilter.h" #include "drawutils.h" +#include "filters.h" #include "formats.h" #include "internal.h" #include "video.h" @@ -138,14 +139,19 @@ static int config_props(AVFilterLink *outlink) return 0; } -static int request_frame(AVFilterLink *outlink) +static int activate(AVFilterContext *ctx) { -TestSourceContext *test = outlink->src->priv; +AVFilterLink *outlink = ctx->outputs[0]; +TestSourceContext *test = ctx->priv; AVFrame *frame; +if (!ff_outlink_frame_wanted(outlink)) +return FFERROR_NOT_READY; if (test->duration >= 0 && -av_rescale_q(test->pts, test->time_base, AV_TIME_BASE_Q) >= test->duration) -return AVERROR_EOF; +av_rescale_q(test->pts, test->time_base, AV_TIME_BASE_Q) >= test->duration) { +ff_outlink_set_status(outlink, AVERROR_EOF, test->pts); +return 0; +} if (test->draw_once) { if (test->draw_once_reset) { @@ -250,7 +256,6 @@ static const AVFilterPad color_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, -.request_frame = request_frame, .config_props = color_config_props, }, { NULL } @@ -263,6 +268,7 @@ AVFilter ff_vsrc_color = { .priv_size = sizeof(TestSourceContext), .init= color_init, .uninit = uninit, +.activate= activate, .query_formats = color_query_formats, .inputs = NULL, .outputs = color_outputs, @@ -384,7 +390,6 @@ static const AVFilterPad haldclutsrc_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, -.request_frame = request_frame, .config_props = haldclutsrc_config_props, }, { NULL } @@ -398,6 +403,7 @@ AVFilter ff_vsrc_haldclutsrc = { .init = haldclutsrc_init, .uninit= uninit, .query_formats = haldclutsrc_query_formats, +.activate = activate, .inputs= NULL, .outputs = haldclutsrc_outputs, }; @@ -422,7 +428,6 @@ static const AVFilterPad nullsrc_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, -.request_frame = request_frame, .config_props = config_props, }, { NULL }, @@ -433,6 +438,7 @@ AVFilter ff_vsrc_nullsrc = { .description = NULL_IF_CONFIG_SMALL("Null video source, return unprocessed video frames."), .init= nullsrc_init, .uninit = uninit, +.activate= activate, .priv_size = sizeof(TestSourceContext), .priv_class = &nullsrc_class, .inputs = NULL, @@ -658,7 +664,6 @@ static const AVFilterPad avfilter_vsrc_testsrc_outpu
[FFmpeg-cvslog] Revert "avfilter/src_movie: switch to activate"
ffmpeg | branch: master | Nicolas George | Tue Sep 8 14:57:53 2020 +0200| [d1f3d721df32680e9904f3c5b2c666eb5830c89a] | committer: Nicolas George Revert "avfilter/src_movie: switch to activate" This reverts commit abc884bcc005c450a34e56cd1f4b8b6fa17ea768. This patch was pushed without actual review. An actual review would have revealed that the switch to activate was not done correctly because the logic between request_frame() and frame_wanted is not as direct with filters with multiple outputs than with a single output. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d1f3d721df32680e9904f3c5b2c666eb5830c89a --- libavfilter/src_movie.c | 37 ++--- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index b0294ca79b..6e210d1df0 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -44,7 +44,6 @@ #include "audio.h" #include "avfilter.h" -#include "filters.h" #include "formats.h" #include "internal.h" #include "video.h" @@ -98,6 +97,7 @@ static const AVOption movie_options[]= { }; static int movie_config_output_props(AVFilterLink *outlink); +static int movie_request_frame(AVFilterLink *outlink); static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec) { @@ -309,6 +309,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); pad.config_props = movie_config_output_props; +pad.request_frame = movie_request_frame; if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { av_freep(&pad.name); return ret; @@ -594,33 +595,17 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) return pkt_out_id == out_id; } -static int activate(AVFilterContext *ctx) +static int movie_request_frame(AVFilterLink *outlink) { -MovieContext *movie = ctx->priv; -int nb_eofs = 0; - -for (int i = 0; i < ctx->nb_outputs; i++) { -AVFilterLink *outlink = ctx->outputs[i]; - -nb_eofs += !!ff_outlink_get_status(outlink); -if (ff_outlink_frame_wanted(outlink)) { -int ret = movie_push_frame(ctx, i); - -if (ret == AVERROR_EOF) { -ff_outlink_set_status(outlink, AVERROR_EOF, movie->st[i].last_pts); -return 0; -} else if (ret) { -return FFMIN(ret, 0); -} -} -} +AVFilterContext *ctx = outlink->src; +unsigned out_id = FF_OUTLINK_IDX(outlink); +int ret; -if (nb_eofs != ctx->nb_outputs) { -ff_filter_set_ready(ctx, 100); -return 0; +while (1) { +ret = movie_push_frame(ctx, out_id); +if (ret) +return FFMIN(ret, 0); } - -return FFERROR_NOT_READY; } static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, @@ -681,7 +666,6 @@ AVFilter ff_avsrc_movie = { .inputs= NULL, .outputs = NULL, -.activate = activate, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, .process_command = process_command }; @@ -703,7 +687,6 @@ AVFilter ff_avsrc_amovie = { .inputs = NULL, .outputs= NULL, -.activate = activate, .priv_class = &amovie_class, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, .process_command = process_command, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] ffplay: fix autoexit doesn't work in the case of pb->error
ffmpeg | branch: master | Zhao Zhili | Thu Aug 27 00:44:56 2020 +0800| [99e12b5736bd4a63186a4fc71b69ca3ec0c9fa34] | committer: Marton Balint ffplay: fix autoexit doesn't work in the case of pb->error Signed-off-by: Marton Balint > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99e12b5736bd4a63186a4fc71b69ca3ec0c9fa34 --- fftools/ffplay.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 6c9c041e9a..9ff0425163 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -3028,8 +3028,12 @@ static int read_thread(void *arg) packet_queue_put_nullpacket(&is->subtitleq, is->subtitle_stream); is->eof = 1; } -if (ic->pb && ic->pb->error) -break; +if (ic->pb && ic->pb->error) { +if (autoexit) +goto fail; +else +break; +} SDL_LockMutex(wait_mutex); SDL_CondWaitTimeout(is->continue_read_thread, wait_mutex, 10); SDL_UnlockMutex(wait_mutex); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/libopusenc: add option to set inband FEC
ffmpeg | branch: master | Gyan Doshi | Sun Sep 6 12:42:46 2020 +0530| [1e5b3f77d9f6f6827b5755763ef041d360969d0c] | committer: Gyan Doshi avcodec/libopusenc: add option to set inband FEC > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1e5b3f77d9f6f6827b5755763ef041d360969d0c --- doc/encoders.texi | 5 + libavcodec/libopusenc.c | 9 + 2 files changed, 14 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 69bf742c2d..a48b15eb1b 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -953,6 +953,11 @@ The default is 20ms. @item packet_loss (@emph{expect-loss}) Set expected packet loss percentage. The default is 0. +@item fec (@emph{n/a}) +Enable inband forward error correction. @option{packet_loss} must be non-zero +to take advantage - frequency of FEC 'side-data' is proportional to expected packet loss. +Default is disabled. + @item application (N.A.) Set intended application type. Valid options are listed below: diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c index 13017ac323..bf2d04b4fb 100644 --- a/libavcodec/libopusenc.c +++ b/libavcodec/libopusenc.c @@ -34,6 +34,7 @@ typedef struct LibopusEncOpts { int vbr; int application; int packet_loss; +int fec; int complexity; float frame_duration; int packet_size; @@ -149,6 +150,13 @@ static int libopus_configure_encoder(AVCodecContext *avctx, OpusMSEncoder *enc, "Unable to set expected packet loss percentage: %s\n", opus_strerror(ret)); +ret = opus_multistream_encoder_ctl(enc, + OPUS_SET_INBAND_FEC(opts->fec)); +if (ret != OPUS_OK) +av_log(avctx, AV_LOG_WARNING, + "Unable to set inband FEC: %s\n", + opus_strerror(ret)); + if (avctx->cutoff) { ret = opus_multistream_encoder_ctl(enc, OPUS_SET_MAX_BANDWIDTH(opts->max_bandwidth)); @@ -544,6 +552,7 @@ static const AVOption libopus_options[] = { { "lowdelay", "Restrict to only the lowest delay modes", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_RESTRICTED_LOWDELAY }, 0, 0, FLAGS, "application" }, { "frame_duration", "Duration of a frame in milliseconds", OFFSET(frame_duration), AV_OPT_TYPE_FLOAT, { .dbl = 20.0 }, 2.5, 120.0, FLAGS }, { "packet_loss","Expected packet loss percentage", OFFSET(packet_loss),AV_OPT_TYPE_INT, { .i64 = 0 },0, 100, FLAGS }, +{ "fec", "Enable inband FEC. Expected packet loss must be non-zero", OFFSET(fec),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { "vbr","Variable bit rate mode", OFFSET(vbr), AV_OPT_TYPE_INT, { .i64 = 1 },0, 2,FLAGS, "vbr" }, { "off","Use constant bit rate", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "vbr" }, { "on", "Use variable bit rate", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "vbr" }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] dnn_backend_native.c: parse options in native backend
ffmpeg | branch: master | Xu Jun | Sun Sep 6 20:28:51 2020 +0800| [235e01f5a0b6218590eff2377574046c684143e8] | committer: Guo, Yejun dnn_backend_native.c: parse options in native backend Signed-off-by: Xu Jun Signed-off-by: Guo, Yejun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=235e01f5a0b6218590eff2377574046c684143e8 --- libavfilter/dnn/dnn_backend_native.c | 22 +++--- libavfilter/dnn/dnn_backend_native.h | 6 ++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c index a8fe6b94eb..a9ecbdc88b 100644 --- a/libavfilter/dnn/dnn_backend_native.c +++ b/libavfilter/dnn/dnn_backend_native.c @@ -28,10 +28,17 @@ #include "dnn_backend_native_layer_conv2d.h" #include "dnn_backend_native_layers.h" -static const AVClass dnn_native_class = { +#define OFFSET(x) offsetof(NativeContext, x) +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM +static const AVOption dnn_native_options[] = { +{ "conv2d_threads", "threads num for conv2d layer", OFFSET(options.conv2d_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS }, +{ NULL }, +}; + +const AVClass dnn_native_class = { .class_name = "dnn_native", .item_name = av_default_item_name, -.option = NULL, +.option = dnn_native_options, .version= LIBAVUTIL_VERSION_INT, .category = AV_CLASS_CATEGORY_FILTER, }; @@ -174,8 +181,18 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, const char *optio } native_model->ctx.class = &dnn_native_class; +model->options = options; +if (av_opt_set_from_string(&native_model->ctx, model->options, NULL, "=", "&") < 0) +goto fail; model->model = (void *)native_model; +#if !HAVE_PTHREAD_CANCEL +if (native_model->ctx.options.conv2d_threads > 1){ +av_log(&native_model->ctx, AV_LOG_WARNING, "'conv2d_threads' option was set but it is not supported " + "on this build (pthread support is required)\n"); +} +#endif + avio_seek(model_file_context, file_size - 8, SEEK_SET); native_model->layers_num = (int32_t)avio_rl32(model_file_context); native_model->operands_num = (int32_t)avio_rl32(model_file_context); @@ -248,7 +265,6 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, const char *optio model->set_input = &set_input_native; model->get_input = &get_input_native; -model->options = options; return model; diff --git a/libavfilter/dnn/dnn_backend_native.h b/libavfilter/dnn/dnn_backend_native.h index 197f557dee..b1f8f3d6bf 100644 --- a/libavfilter/dnn/dnn_backend_native.h +++ b/libavfilter/dnn/dnn_backend_native.h @@ -29,6 +29,7 @@ #include "../dnn_interface.h" #include "libavformat/avio.h" +#include "libavutil/opt.h" /** * the enum value of DNNLayerType should not be changed, @@ -106,8 +107,13 @@ typedef struct InputParams{ int height, width, channels; } InputParams; +typedef struct NativeOptions{ +uint32_t conv2d_threads; +} NativeOptions; + typedef struct NativeContext { const AVClass *class; +NativeOptions options; } NativeContext; // Represents simple feed-forward convolutional network. ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] dnn_backend_native_layer_conv2d.c:Add mutithread function
ffmpeg | branch: master | Xu Jun | Sun Sep 6 20:28:53 2020 +0800| [3c7cad69f233252e5178f7732baa0da950d74bbd] | committer: Guo, Yejun dnn_backend_native_layer_conv2d.c:Add mutithread function Use pthread to multithread dnn_execute_layer_conv2d. Can be tested with command "./ffmpeg_g -i input.png -vf \ format=yuvj420p,dnn_processing=dnn_backend=native:model= \ espcn.model:input=x:output=y:options=conv2d_threads=23 \ -y sr_native.jpg -benchmark" before patch: utime=11.238s stime=0.005s rtime=11.248s after patch: utime=20.817s stime=0.047s rtime=1.051s on my 3900X 12c24t @4.2GHz About the increase of utime, it's because that CPU HyperThreading technology makes logical cores twice of physical cores while cpu's counting performance improves less than double. And utime sums all cpu's logical cores' runtime. As a result, using threads num near cpu's logical core's number will double utime, while reduce rtime less than half for HyperThreading CPUs. Signed-off-by: Xu Jun Signed-off-by: Guo, Yejun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3c7cad69f233252e5178f7732baa0da950d74bbd --- libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 107 +++--- tests/dnn/dnn-layer-conv2d-test.c | 14 ++- 2 files changed, 108 insertions(+), 13 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c index d079795bf8..777a54db43 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c @@ -19,10 +19,27 @@ */ #include "libavutil/avassert.h" +#include "libavutil/thread.h" +#include "libavutil/cpu.h" #include "dnn_backend_native_layer_conv2d.h" #define CLAMP_TO_EDGE(x, w) ((x) < 0 ? 0 : ((x) >= (w) ? (w - 1) : (x))) +//struct to pass parameters +typedef struct thread_common_param{ +DnnOperand *operands; +const int32_t *input_operand_indexes; +int32_t output_operand_index; +const void *parameters; +NativeContext *ctx; +int thread_num; +} thread_common_param; + +typedef struct thread_param{ +thread_common_param *thread_common_param; +int thread_index; +} thread_param; + int dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num) { ConvolutionalParams *conv_params; @@ -88,17 +105,20 @@ int dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int fil return dnn_size; } -int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_indexes, - int32_t output_operand_index, const void *parameters, NativeContext *ctx) +static void * dnn_execute_layer_conv2d_thread(void *threadarg) { +//pass parameters +thread_param *thread_param = (struct thread_param *)threadarg; +thread_common_param *thread_common_param = thread_param->thread_common_param; +DnnOperand *operands = thread_common_param->operands; float *output; -int32_t input_operand_index = input_operand_indexes[0]; +int32_t input_operand_index = thread_common_param->input_operand_indexes[0]; int number = operands[input_operand_index].dims[0]; int height = operands[input_operand_index].dims[1]; int width = operands[input_operand_index].dims[2]; int channel = operands[input_operand_index].dims[3]; const float *input = operands[input_operand_index].data; -const ConvolutionalParams *conv_params = (const ConvolutionalParams *)parameters; +const ConvolutionalParams *conv_params = (const ConvolutionalParams *)(thread_common_param->parameters); int radius = conv_params->kernel_size >> 1; int src_linesize = width * conv_params->input_num; @@ -106,7 +126,11 @@ int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_ int filter_size = conv_params->kernel_size * filter_linesize; int pad_size = (conv_params->padding_method == VALID) ? (conv_params->kernel_size - 1) / 2 * conv_params->dilation : 0; -DnnOperand *output_operand = &operands[output_operand_index]; +int thread_stride = (height - pad_size * 2) / thread_common_param->thread_num; +int thread_start = thread_stride * thread_param->thread_index + pad_size; +int thread_end = (thread_param->thread_index == thread_common_param->thread_num - 1) ? (height - pad_size) : (thread_start + thread_stride); + +DnnOperand *output_operand = &operands[thread_common_param->output_operand_index]; output_operand->dims[0] = number; output_operand->dims[1] = height - pad_size * 2; output_operand->dims[2] = width - pad_size * 2; @@ -114,19 +138,21 @@ int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_ output_operand->data_type = operands[input_operand_index].data_type; output_operand->length = calculate_operand_data_length(output_operand); if (output_operand->length <= 0) { -av_log(ctx, AV_LOG_ERROR, "The