Skip to content

Commit

Permalink
#4324 use bilinear filter when downscaling
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Aug 14, 2024
1 parent 3b90fc1 commit 5b2c89d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions xpra/codecs/libyuv/colorspace_converter.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@ cdef get_fiter_mode_str(FilterMode fm):
return "Box"
return "invalid"

cdef inline FilterMode get_filtermode(int speed):

cdef inline FilterMode get_filtermode(int speed, int downscaling):
if downscaling:
return kFilterBilinear
if speed>66:
return kFilterNone
elif speed>33:
if speed>33:
return kFilterBilinear
return kFilterBox

Expand Down Expand Up @@ -306,7 +309,8 @@ cdef class ColorspaceConverter:
self.src_format = src_format
self.dst_format = dst_format
cdef int speed = typedict(options or {}).intget("speed", 100)
self.filtermode = get_filtermode(speed)
cdef int downscaling = dst_width < src_width or dst_height < src_height
self.filtermode = get_filtermode(speed, downscaling)
self.src_width = src_width
self.src_height = src_height
self.dst_width = dst_width
Expand Down

0 comments on commit 5b2c89d

Please sign in to comment.