Skip to content

Commit

Permalink
#3592 never use zlib for pixel data
Browse files Browse the repository at this point in the history
lz4 should always be available
  • Loading branch information
totaam committed Jul 22, 2022
1 parent 7883af4 commit e65f351
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 4 additions & 4 deletions xpra/codecs/argb/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,19 @@ def encode(coding : str, image, options : dict):
algo = "not"
l = len(pixels)
lz4 = options.get("lz4", False)
if l>=512 and (lz4 or speed<100):
if not lz4:
level = 0
elif l>=512 and (lz4 or speed<100):
if l>=4096:
level = 1+max(0, min(7, int(100-speed)//14))
else:
#fewer pixels, make it more likely we won't bother compressing
#and use a lower level (max=3)
level = max(0, min(3, int(125-speed)//35))
if level>0:
zlib = options.get("zlib", False)
can_inline = l<=32768
cwrapper = compressed_wrapper(coding, pixels, level=level,
zlib=zlib, lz4=lz4,
brotli=False, none=False,
lz4=lz4,
can_inline=can_inline)
if isinstance(cwrapper, LevelCompressed):
#add compressed marker:
Expand Down
3 changes: 0 additions & 3 deletions xpra/server/window/window_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ def __init__(self,
self.picture_encodings = () #non-video only
self.rgb_formats = rgb_formats #supported RGB formats (RGB, RGBA, ...) - used by mmap
self.encoding_options = encoding_options #extra options which may be specific to the encoder (ie: x264)
self.rgb_zlib = use("zlib") and encoding_options.boolget("rgb_zlib", True) #server and client support zlib pixel compression
self.rgb_lz4 = use("lz4") and encoding_options.boolget("rgb_lz4", False) #server and client support lz4 pixel compression
self.client_render_size = encoding_options.get("render-size")
self.client_bit_depth = encoding_options.intget("bit-depth", 24)
Expand Down Expand Up @@ -426,7 +425,6 @@ def init_vars(self):
self.full_csc_modes = typedict()
self.client_refresh_encodings = ()
self.encoding_options = {}
self.rgb_zlib = False
self.rgb_lz4 = False
self.supports_transparency = False
self.full_frames_only = False
Expand Down Expand Up @@ -1885,7 +1883,6 @@ def assign_sq_options(self, options, speed_pct=100, quality_pct=100):
"quality" : quality,
"speed" : speed,
"rgb_formats" : self.rgb_formats,
"zlib" : self.rgb_zlib,
"lz4" : self.rgb_lz4,
})
if self.encoding=="grayscale":
Expand Down

0 comments on commit e65f351

Please sign in to comment.