@@ -25,6 +25,9 @@
#include "codec_internal.h"
+/* Increase max threads for libvpx from 16 to 64 to benefit 4K/8K video encoding. */
+#define MAX_VPX_THREADS 64
+
void ff_vp9_init_static(FFCodec *codec);
#if 0
enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t img);
@@ -89,7 +89,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
const struct vpx_codec_iface *iface)
{
struct vpx_codec_dec_cfg deccfg = {
- .threads = FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 16)
+ .threads = FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), MAX_VPX_THREADS)
};
av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
@@ -939,7 +939,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
enccfg.g_timebase.num = avctx->time_base.num;
enccfg.g_timebase.den = avctx->time_base.den;
enccfg.g_threads =
- FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 16);
+ FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), MAX_VPX_THREADS);
enccfg.g_lag_in_frames= ctx->lag_in_frames;
if (avctx->flags & AV_CODEC_FLAG_PASS1)