mirror of
https://github.com/KrisKennaway/ii-pix.git
synced 2025-02-25 05:28:58 +00:00
Fix shift_pixel_window when shift_right_by > window_width
This commit is contained in:
parent
34ae40ac2d
commit
1010b64272
@ -66,7 +66,13 @@ cdef inline unsigned char shift_pixel_window(
|
||||
Returns: n-bit value representing shifted pixel window
|
||||
"""
|
||||
cdef unsigned char window_mask = 0xff >> (8 - window_width)
|
||||
return ((last_pixels >> shift_right_by) | (next_pixels << (window_width - shift_right_by))) & window_mask
|
||||
cdef unsigned int shifted_next_pixels
|
||||
|
||||
if window_width > shift_right_by:
|
||||
shifted_next_pixels = next_pixels << (window_width - shift_right_by)
|
||||
else:
|
||||
shifted_next_pixels = next_pixels >> (shift_right_by - window_width)
|
||||
return ((last_pixels >> shift_right_by) | shifted_next_pixels) & window_mask
|
||||
|
||||
|
||||
# Look ahead a number of pixels and compute choice for next pixel with lowest total squared error after dithering.
|
||||
|
Loading…
x
Reference in New Issue
Block a user