This commit is contained in:
Ryan Oldenburg 2022-06-15 14:27:25 -05:00
parent 5afa5720db
commit 4c100a2554

View file

@ -138,11 +138,11 @@ proc unfilter(
for x in 0 ..< rowBytes: for x in 0 ..< rowBytes:
var var
value = uncompressed.readUint8(uncompressedStartIdx + x) value = uncompressed.readUint8(uncompressedStartIdx + x)
left, up: int left, up: uint32
if x - bpp >= 0: if x - bpp >= 0:
left = result[unfilteredStartIx + x - bpp].int left = result[unfilteredStartIx + x - bpp]
if y - 1 >= 0: if y - 1 >= 0:
up = result[unfilteredStartIx + x - rowBytes].int up = result[unfilteredStartIx + x - rowBytes]
value += ((left + up) div 2).uint8 value += ((left + up) div 2).uint8
result[unfilteredStartIx + x] = value result[unfilteredStartIx + x] = value
of 4: # Paeth of 4: # Paeth