Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect results during filter reversal #10

Open
Captain4LK opened this issue Sep 11, 2024 · 0 comments
Open

Incorrect results during filter reversal #10

Captain4LK opened this issue Sep 11, 2024 · 0 comments

Comments

@Captain4LK
Copy link

The filter reversal behavior seems to be incorrect, due to the type of out, x, a, b, c being int in

rpng/src/rpng.h

Line 2141 in 07d8459

int out = 0, x = 0, a = 0, b = 0, c = 0;
Changing the type to unsigned char causes the images to be loaded correctly. According to the png spec, all the filter operations are supposed to be modulo 256.

Here I've loaded an image with rpng_load_image and then saved the output using stb_image_write, gcc 14.2.1:

The input image:
logo3d

Output with unmodified rpng 1.5:
out_int

Output with type changed to unsigned char:
out_uchar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant