Skip to content

Commit

Permalink
Merge pull request #1221 from strukturag/aom-default-threadcount
Browse files Browse the repository at this point in the history
aom: Use all available CPUs for encoding by default.
  • Loading branch information
farindk authored Jul 4, 2024
2 parents 29bc4c3 + 8ddaa74 commit e42b01f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libheif/plugins/encoder_aom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <cassert>
#include <vector>
#include <string>
#include <thread>
#include <memory>
#include "encoder_aom.h"

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e42b01f

Please sign in to comment.