mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:17:35 +00:00
LibPDF: Use PNG::paeth_predictor() in png decoding path
No behavior change. Ideally, the PDF code would just call a function PNGLoader to do the PNG unfiltering, but let's first try to make the implementations look more similar.
This commit is contained in:
parent
6b2c60404d
commit
7e4fe8e610
1 changed files with 2 additions and 9 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <LibCompress/Deflate.h>
|
||||
#include <LibCompress/LZWDecoder.h>
|
||||
#include <LibGfx/ImageFormats/JPEGLoader.h>
|
||||
#include <LibGfx/ImageFormats/PNGShared.h>
|
||||
#include <LibPDF/CommonNames.h>
|
||||
#include <LibPDF/Filter.h>
|
||||
#include <LibPDF/Reader.h>
|
||||
|
@ -191,15 +192,7 @@ PDFErrorOr<ByteBuffer> Filter::decode_png_prediction(Bytes bytes, int bytes_per_
|
|||
upper_left = previous_row[i - 1];
|
||||
}
|
||||
u8 above = previous_row[i];
|
||||
u8 p = left + above - upper_left;
|
||||
|
||||
int left_distance = abs(p - left);
|
||||
int above_distance = abs(p - above);
|
||||
int upper_left_distance = abs(p - upper_left);
|
||||
|
||||
u8 paeth = min(left_distance, min(above_distance, upper_left_distance));
|
||||
|
||||
row[i] += paeth;
|
||||
row[i] += Gfx::PNG::paeth_predictor(left, above, upper_left);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue