Message ID | CAL5fy0a=vmLLk7M93fufrorWs5BXz14DDPC-TGmLYg7rXbYBoA@mail.gmail.com |
---|---|
State | Superseded |
Headers | show |
On 11/15/2018 4:45 PM, Chirag Lathia wrote: > libvpx supports a maximum of 16 encoder threads. > > Signed-off-by: Chirag Lathia <clathia@google.com> > --- > libavcodec/libvpxenc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c > index ad440a9c21..dda4b96fb2 100644 > --- a/libavcodec/libvpxenc.c > +++ b/libavcodec/libvpxenc.c > @@ -497,7 +497,8 @@ static av_cold int vpx_init(AVCodecContext *avctx, > enccfg.g_h = avctx->height; > enccfg.g_timebase.num = avctx->time_base.num; > enccfg.g_timebase.den = avctx->time_base.den; > - enccfg.g_threads = avctx->thread_count ? avctx->thread_count > : av_cpu_count(); > + enccfg.g_threads = > + avctx->thread_count ? avctx->thread_count : FFMIN(av_cpu_count(), 16); > enccfg.g_lag_in_frames= ctx->lag_in_frames; The FFMIN should also cover the case where the value is set to avctx->thread_count, as it may also be > 16. See the libvpx decoder wrapper. > > if (avctx->flags & AV_CODEC_FLAG_PASS1) > -- > > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >
2018-11-15 20:45 GMT+01:00, Chirag Lathia <clathia-at-google.com@ffmpeg.org>: > libvpx supports a maximum of 16 encoder threads. > > Signed-off-by: Chirag Lathia <clathia@google.com> > --- > libavcodec/libvpxenc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c > index ad440a9c21..dda4b96fb2 100644 > --- a/libavcodec/libvpxenc.c > +++ b/libavcodec/libvpxenc.c > @@ -497,7 +497,8 @@ static av_cold int vpx_init(AVCodecContext *avctx, > enccfg.g_h = avctx->height; > enccfg.g_timebase.num = avctx->time_base.num; > enccfg.g_timebase.den = avctx->time_base.den; > - enccfg.g_threads = avctx->thread_count ? avctx->thread_count > : av_cpu_count(); > + enccfg.g_threads = > + avctx->thread_count ? avctx->thread_count : FFMIN(av_cpu_count(), > 16); Sorry for being late: What does this fix? Does the vp9 specification forbid more than 16 threads? Or does libvpx only implement 16 but never check the provided number? Is there some fundamental limit that makes it impossible that future libvpx supports more than 16 threads? Carl Eugen
From c5c9d0c8bbd80e2eda324d73a96d750ea09ab2b4 Mon Sep 17 00:00:00 2001 From: Chirag Lathia <clathia@google.com> Date: Thu, 15 Nov 2018 10:51:32 -0800 Subject: [PATCH] Add a maximum constraint of 16 encoder threads. Signed-off-by: Chirag Lathia <clathia@google.com> --- libavcodec/libvpxenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index ad440a9c21..dda4b96fb2 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -497,7 +497,8 @@ static av_cold int vpx_init(AVCodecContext *avctx, enccfg.g_h = avctx->height; enccfg.g_timebase.num = avctx->time_base.num; enccfg.g_timebase.den = avctx->time_base.den; - enccfg.g_threads = avctx->thread_count ? avctx->thread_count : av_cpu_count(); + enccfg.g_threads = + avctx->thread_count ? avctx->thread_count : FFMIN(av_cpu_count(), 16); enccfg.g_lag_in_frames= ctx->lag_in_frames; if (avctx->flags & AV_CODEC_FLAG_PASS1) -- 2.19.1.1215.g8438c0b245-goog
libvpx supports a maximum of 16 encoder threads. Signed-off-by: Chirag Lathia <clathia@google.com> --- libavcodec/libvpxenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) if (avctx->flags & AV_CODEC_FLAG_PASS1) --