Skip to content

Commit

Permalink
#3457 enable threading based on the number of cores
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Feb 15, 2022
1 parent 34971a2 commit c831652
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions xpra/codecs/avif/encoder.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import os

from libc.stdint cimport uint8_t, uint32_t, uint64_t, uintptr_t #pylint: disable=syntax-error
from libc.string cimport memset #pylint: disable=syntax-error
from xpra.buffers.membuf cimport buffer_context
Expand All @@ -27,12 +29,13 @@ from xpra.codecs.avif.avif cimport (
avifResultToString,
)

from xpra.util import envint
from xpra.net.compression import Compressed
from xpra.codecs.codec_debug import may_save_image
from xpra.log import Logger
log = Logger("encoder", "avif")


THREADS = envint("XPRA_AVIF_THREADS", min(4, max(1, os.cpu_count()//2)))
DEF AVIF_PLANE_COUNT_YUV = 3


Expand Down Expand Up @@ -103,7 +106,7 @@ def encode(coding, image, options=None):
raise Exception("failed to create avif encoder")
# Configure your encoder here (see avif/avif.h):
encoder.speed = 10
encoder.maxThreads = 2
encoder.maxThreads = THREADS
# * maxThreads
# * minQuantizer
# * maxQuantizer
Expand Down

0 comments on commit c831652

Please sign in to comment.