Skip to content

Commit 6f0ecba

Browse files
yit-bWyatt BorsosWyattfdintino
authored
fix: limit maxThreads to 64 for AOM encodes
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>
1 parent 53732f0 commit 6f0ecba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/pillow_avif/_avif.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,11 @@ AvifEncoderNew(PyObject *self_, PyObject *args) {
448448
init_max_threads();
449449
}
450450

451-
encoder->maxThreads = max_threads;
451+
int is_aom_encode = strcmp(codec, "aom") == 0 ||
452+
(strcmp(codec, "auto") == 0 &&
453+
_codec_available("aom", AVIF_CODEC_FLAG_CAN_ENCODE));
454+
455+
encoder->maxThreads = is_aom_encode && max_threads > 64 ? 64 : max_threads;
452456
#if AVIF_VERSION >= 1000000
453457
if (enc_options.qmin != -1 && enc_options.qmax != -1) {
454458
encoder->minQuantizer = enc_options.qmin;

0 commit comments

Comments
 (0)