Skip to content

Commit

Permalink
fix: limit maxThreads to 64 for AOM encodes
Browse files Browse the repository at this point in the history
Fixes #23

Co-authored-by: Frankie Dintino <fdintino@gmail.com>

---------

Co-authored-by: Wyatt Borsos <yitb@fb.com>
Co-authored-by: Wyatt <wab32@pitt.edu>
Co-authored-by: Frankie Dintino <fdintino@gmail.com>
  • Loading branch information
4 people authored Feb 7, 2024
1 parent 53732f0 commit 6f0ecba
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pillow_avif/_avif.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,11 @@ AvifEncoderNew(PyObject *self_, PyObject *args) {
init_max_threads();
}

encoder->maxThreads = max_threads;
int is_aom_encode = strcmp(codec, "aom") == 0 ||
(strcmp(codec, "auto") == 0 &&
_codec_available("aom", AVIF_CODEC_FLAG_CAN_ENCODE));

encoder->maxThreads = is_aom_encode && max_threads > 64 ? 64 : max_threads;
#if AVIF_VERSION >= 1000000
if (enc_options.qmin != -1 && enc_options.qmax != -1) {
encoder->minQuantizer = enc_options.qmin;
Expand Down

0 comments on commit 6f0ecba

Please sign in to comment.