[FFmpeg-devel] [PATCH v3] lavc/libvpx: remove thread limit

Tomas Härdin git at haerdin.se
Thu Jan 5 19:14:57 EET 2023


tor 2023-01-05 klockan 11:41 +0100 skrev Dmitrii Ovchinnikov:
> From: Dmitrii Ovchinnikov <ovchinnikov.dmitrii at gmail.com>
> 
> This change improves the performance and multicore
>  scalability of the vp9 codec for streaming single-pass encoded
> videos. The
>  current thread limit for ffmpeg codecs is 16 (MAX_AUTO_THREADS in
>  pthread_internal.h) due to a limitation in H.264 codec that prevents
> more
>  than 16 threads being used.

This limitation should be restricted to H.264 IMO, not applied to all
codecs wholesale. I ran into this issue with jpeg2000dec.

> 
> Increasing the thread limit to 64 for vp9 improves
> the performance for encoding 4K raw videos for streaming by up to 47%
> compared to 16 threads, and from 20-30% for 32 threads, with the same
> quality
> as measured by the VMAF score.
> 
> Did not need to add a check for limit in libvpx as it is already
> present 
> in libvpx/vp9/vp9_cx_iface.c:
>   RANGE_CHECK_HI(cfg, g_threads, 64);

Perhaps we should have a table of known max number of threads per
codec?

/Tomas



More information about the ffmpeg-devel mailing list