Message ID | AM7PR03MB666041524F63A1BBED3C5B888FA59@AM7PR03MB6660.eurprd03.prod.outlook.com |
---|---|
State | Accepted |
Commit | f348a967a35c0946de0d9f6bedb1f4025b09b334 |
Headers | show |
Series | [FFmpeg-devel,1/3] avfilter/vf_swaprect: Use ff_formats_pixdesc_filter() | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
Andreas Rheinhardt (12021-09-26): > Up until now, the list of pixfmts is reallocated every time an entry > is added to it; there are currently 196 pixel formats, so this matters: > It causes 5541704 calls to av_realloc_array() in a typical FATE run, > which is the majority for said function (8095768 calls) and even > a large chunk of the calls to av_realloc() itself (12589508 calls). > > Fix this by using ff_formats_pixdesc_filter() instead. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > libavfilter/formats.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) All three look good to me, but I have not looked that carefully at each individual change in the second patch. Regards,
diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 59ea966424..1d2a51c0af 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -435,11 +435,7 @@ AVFilterFormats *ff_all_formats(enum AVMediaType type) AVFilterFormats *ret = NULL; if (type == AVMEDIA_TYPE_VIDEO) { - const AVPixFmtDescriptor *desc = NULL; - while ((desc = av_pix_fmt_desc_next(desc))) { - if (ff_add_format(&ret, av_pix_fmt_desc_get_id(desc)) < 0) - return NULL; - } + return ff_formats_pixdesc_filter(0, 0); } else if (type == AVMEDIA_TYPE_AUDIO) { enum AVSampleFormat fmt = 0; while (av_get_sample_fmt_name(fmt)) {
Up until now, the list of pixfmts is reallocated every time an entry is added to it; there are currently 196 pixel formats, so this matters: It causes 5541704 calls to av_realloc_array() in a typical FATE run, which is the majority for said function (8095768 calls) and even a large chunk of the calls to av_realloc() itself (12589508 calls). Fix this by using ff_formats_pixdesc_filter() instead. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavfilter/formats.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)