-
Notifications
You must be signed in to change notification settings - Fork 275
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
Flate png filters #114
Merged
Merged
Flate png filters #114
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…canline. Fix dict key.
…anline reconstructed
… to X conversion but instead it returns array.array('B')
…as they require at least 2 scanlines. Simplify UP filter.
…e_fil_png.html f01n2c08, f02n2c08, f03n2c08, f04n2c08
…sters) used/produced by test_flate_png.py tests: requires matplotlib
…king PDF War of the Worlds) when png data was compressed and filtered using Sub (f=1). New flate_png also generates correct looking PDF War of the Worlds.
Generating xxxx.png.logModify (e.g. void /* PRIVATE */
png_read_filter_row(png_structrp pp, png_row_infop row_info, png_bytep row,
png_const_bytep prev_row, int filter)
{
/* OPTIMIZATION: DO NOT MODIFY THIS FUNCTION, instead #define
* PNG_FILTER_OPTIMIZATIONS to a function that overrides the generic
* implementations. See png_init_filter_functions above.
*/
printf("width = %d\n", row_info->width);
printf("bit_depth = %d\n", row_info->bit_depth);
printf("channels = %d\n", row_info->channels);
printf("color_type = %d\n", row_info->color_type);
printf("pixel_depth = %d\n", row_info->pixel_depth);
printf("rowbytes = %zu\n", row_info->rowbytes);
printf("filter = %d\n", filter);
printf("data = [ ");
for (int i = 0; i < row_info->rowbytes; i++) {
printf("0x%.2x,", row[i] & 0xff);
}
printf(" ]\n");
if (filter > PNG_FILTER_VALUE_NONE && filter < PNG_FILTER_VALUE_LAST)
{
if (pp->read_filter[0] == NULL)
png_init_filter_functions(pp);
pp->read_filter[filter-1](row_info, row, prev_row);
}
else
png_debug1(1, "no filter %d", filter);
printf("expected = [ ");
for (int i = 0; i < row_info->rowbytes; i++) {
printf("0x%.2x,", row[i] & 0xff);
}
printf(" ]\n");
} Recompile and run. For Mac OSX, https://github.com/IGRSoft/libpng-xcode-project is available if you prefer Xcode.Visualizing Rasters (loaded from
|
…d basn0g08.png.log and its test
…id hash, the test is expected to pass and produce a file with same hash. Revert all PDFs with Encrypted content to 'skip' because the roundtrip PDF is 'blank'
Closes #113 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#113
Flate PNG reverse filters: Up, Average and Paeth