[FFmpeg-devel] [PATCH v7 11/12] tests/swscale: add a benchmarking mode

Michael Niedermayer michael at niedermayer.cc
Thu Nov 21 03:22:26 EET 2024


On Sat, Nov 16, 2024 at 12:25:06PM +0100, Niklas Haas wrote:
> From: Niklas Haas <git at haasn.dev>
> 
> With the ability to set the thread count as well. This benchmark includes
> the constant overhead of context initialization.
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Niklas Haas <git at haasn.dev>
> ---
>  libswscale/tests/swscale.c | 93 ++++++++++++++++++++++++++++----------
>  1 file changed, 68 insertions(+), 25 deletions(-)

[...]

> @@ -131,23 +130,28 @@ static int scale_legacy(AVFrame *dst, const AVFrame *src, struct mode mode)
>      sws_legacy->dst_format = dst->format;
>      sws_legacy->flags      = mode.flags;
>      sws_legacy->dither     = mode.dither;
> +    sws_legacy->threads    = opts.threads;
> +
> +    if ((ret = sws_init_context(sws_legacy, NULL, NULL)) < 0)
> +        goto error;
>  
> -    ret = sws_init_context(sws_legacy, NULL, NULL);
> -    if (!ret)

> +    for (int i = 0; i < opts.iters; i++)
>          ret = sws_scale_frame(sws_legacy, dst, src);

what if the first iteration of the loop has an error ?
teh 2nd would overwrite ret

otherwise ok

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241121/4f62a821/attachment.sig>


More information about the ffmpeg-devel mailing list