Fix a bug with palette depths < 8

This commit is contained in:
kris 2021-11-02 22:14:42 +00:00
parent 0f1ec6f6f2
commit 1ed565ff8d
1 changed files with 1 additions and 1 deletions

View File

@ -66,7 +66,7 @@ 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 << (8 - shift_right_by))) & window_mask
return ((last_pixels >> shift_right_by) | (next_pixels << (window_width - shift_right_by))) & window_mask
# Look ahead a number of pixels and compute choice for next pixel with lowest total squared error after dithering.