From 8ddaa7458fdd470d93210fd9f3a875ecf2d8b171 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Thu, 4 Jul 2024 13:58:34 +0200 Subject: [PATCH] aom: Use all available CPUs for encoding by default. --- libheif/plugins/encoder_aom.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libheif/plugins/encoder_aom.cc b/libheif/plugins/encoder_aom.cc index 8b6abd27fb..0eeb9177c6 100644 --- a/libheif/plugins/encoder_aom.cc +++ b/libheif/plugins/encoder_aom.cc @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "encoder_aom.h" @@ -237,7 +238,12 @@ static void aom_init_parameters() p->version = 2; p->name = kParam_threads; p->type = heif_encoder_parameter_type_integer; - p->integer.default_value = 4; + unsigned int threads = std::thread::hardware_concurrency(); + if (threads == 0) { + // Could not autodetect, use previous default value. + threads = 4; + } + p->integer.default_value = threads; p->has_default = true; p->integer.have_minimum_maximum = true; p->integer.minimum = 1;