Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upcheck-ref needs to comapre pixel data but not PNG metadata #1178
Comments
|
Yikes. I'll try to track this down. |
|
We could just write out PPM instead of PNG. The format is trivial and it's still viewable in standard image programs (and easily convertible to PNG). |
|
We could, but I assume it's a simple fix. |
|
Could check-ref load the two PNGs using rust-png and compare the the resulting |
|
We write these pngs ourselves, so we should be able to control the metadata that appears. |
|
We do have the pixel data before we write these PNG files, right? How about comparing that, and maybe only writing PNG files on failure, for troubleshooting? |
|
I still think the right answer is to write PPM, which is just raw pixel data with a tiny header, but is also a standard format supported by lots of tools. |
|
PPM or PNG, I still think we should compare raw pixel data in memory before exporting them into any format :) |
|
How would we compare it in memory? We run servo twice to generate two PNGs, then compare the SHAs. Are you proposing instead that we write a another program that loads two PNGs and then compares their pixels? Or are you proposing we use a single invocation of Servo that will load two pages simultaneously and then compare textures or something? The reason I push back on PPM is because it seems like this is a bug in our PNG stuff (or our pixel dumping) and we should fix that. Otherwise I don't much care what format we spit out. |
|
Sorry, I didn’t remember that we spawn a new Servo process for every test. (I was thinking of WeasyPrint that runs its whole test suite in one process.) If we eventually want to do fuzzy matching like Gecko does we’ll need to compare pixel data anyway, but that can come later. But yes, if something seems buggy we should also fix that. By the way, is there a reason to compare SHAs rather than comparing the files? |
|
SHA seemed like a convenient way to compare the files. |
|
The reftest harness does not actually compute SHAs:
|
|
Hmm. Someone must have changed that. We shouldn't be shelling out to call cmp. We can probably just do that easily in Rust and save the fork. |
|
@kmcallister You can use ImageMagick to compare the metadata and see if they are actually different:
|
|
@metajack I changed it to use I don't think there's a performance concern here. This just isn't something we need to optimize so let's stick with the current solution which is also very little code. |
|
This isn't an issue with metadata, but rather the rust-png library writing more data to the file than it should. Occasionally it writes out 1+MiB files instead of 16KiB ones, sometimes almost 5MiB. Converting or truncating those files to the same size as the smaller one results in an image that compares correctly. |
|
Fixed by #1544 |
Apparently our PNG encoding is not a deterministic function of just the pixel data: