Skip to content

Do not use DEFAULT_MAX_THREADS when saving AVIF images #8928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

radarhere
Copy link
Member

At the moment, DEFAULT_MAX_THREADS may be used when saving an AVIF image.

def _get_default_max_threads() -> int:
if DEFAULT_MAX_THREADS:
return DEFAULT_MAX_THREADS

max_threads = info.get("max_threads", _get_default_max_threads())

However, I don't think that's indicated by comments.

# Decoder options as module globals, until there is a way to pass parameters
# to Image.open (see https://github.com/python-pillow/Pillow/issues/569)
DECODE_CODEC_CHOICE = "auto"
# Decoding is only affected by this for libavif **0.8.4** or greater.
DEFAULT_MAX_THREADS = 0

And it's not mentioned in the docs - https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#avif

max_threads
Limit the number of active threads used. By default, there is no limit. If the aom codec is used, there is a maximum of 64.

So this PR suggests not using it when saving. The user can specify it through im.save(max_threads=...).

cc @fdintino

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant