aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-09-20 22:30:35 -0300
committerJames Almer <jamrial@gmail.com>2021-11-05 21:38:37 -0300
commit61ed1182eeb2c38cba9cf09522423ad1ae70b413 (patch)
treecf08919a59d1a69ed9746beda9fa0f52a8ca8df2
parent7e0d640edf6c3eee1816b105c2f7498c4f948e74 (diff)
downloadffmpeg-61ed1182eeb2c38cba9cf09522423ad1ae70b413.tar.gz
avcodec/libdav1d: pass auto threads value to libdav1d
libdav1d 1.0.0 will be the first version supporting Dav1dSettings.n_threads == 0. Signed-off-by: James Almer <jamrial@gmail.com> (cherry picked from commit d873b5fffc8292242549c4c026023e370e15c05b)
-rw-r--r--libavcodec/libdav1d.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index a9c983eaca..ac9214c830 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -127,7 +127,11 @@ static av_cold int libdav1d_init(AVCodecContext *c)
{
Libdav1dContext *dav1d = c->priv_data;
Dav1dSettings s;
+#if FF_DAV1D_VERSION_AT_LEAST(6,0)
+ int threads = c->thread_count;
+#else
int threads = (c->thread_count ? c->thread_count : av_cpu_count()) * 3 / 2;
+#endif
int res;
av_log(c, AV_LOG_INFO, "libdav1d %s\n", dav1d_version());