-
-
Notifications
You must be signed in to change notification settings - Fork 690
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
WebP Save: add argument for using "auto-filter"/"smart_deblock" encoding feature. #3852
Conversation
Adds the ability to configure whether or not the "auto-filter" feature from libwebp is used when encoding lossy WebPs. This is put behind a new optional argument/toggle called/named "smart_deblock" in libvips.
Hi @goodusername123, thanks for this! How about calling this switch We should have a test as well, but I can add that in another commit. The OS X CI test above isn't working, it looks like homebrew have broken something again, I'll fix that. |
My original intention behind naming it " Another reason for choosing the name " With all this in mind I do think there's some merit to the name I chose for those who don't know specifics about libwebp or video codecs and such, However maybe there's something I'm not taking into account or missing. |
After thinking about it a bit more and considering " Also as an aside some of the documentation for the parameters/arguments/switches that interact with libwebp are a bit vague or missing important information such as how both quality (exposed as |
I've been reflecting too, let's just stick with the name you picked. Thanks for this! I'll add a test and a line in the changelog in another commit. |
Ahem, now I test this, I can't get it to do anything, I've reverted this merge. I tried various combinations of RGB and RGBA, lossy and lossless, but Do you have a sample file where you expect to see a change? |
@jcupitt Sorry for the late reply.
Yes I do have this sample file here (also includes test encodes both with and without Autofilter along with the CMD output from cwebp): also here is a quick comparison image showcasing a part of the image with very noticeable differences: I assume a possible reason why you haven't gotten different outputs when testing on your end is due to how the Autofilter function doesn't change or modify the actual encoded blocks but rather changes the values that determine how the image is decoded meaning only a very small part the the final WebP file is different since in total the Autofilter can only change the values that determine the amount of filtering/deblocking done to each of the 4 segments that the VP8 spec allows, For example compare how in the cwebp CMD output the "filter level" values change quite a lot between the Autofilter's decision making being disabled or enabled and also this does depend on the source image used as well since depending on the input the Autofilter might determine that the default values are good and not change them. |
Any chance to revert the revert? While it absolutely depends on the source image, autofilter is able to make a subtle but essentially free quality gain, only costing additional encode time; and is well worth having available, in the same way an effort range is. It also seems to have the most impact on smaller images, which happen to be the ones where encoding time is the least concern! Since this was reverted due to a lack of example, I found an image1 with noticeable improvements. Despite sharing the exact same 11,250 byte size2, the image encoded with autofilter is noticeably less blocky, with a lot of weird sharp color changes removed. I've highlighted areas where it's more noticeable, but it does somewhat appear throughout the image. Footnotes |
Sorry, this dropped off my radar. I've reverted the revert and this will be in 8.16. Thanks for the test images. I've credited you in the changelog @goodusername123, I hope that's OK. |
Adds the ability to configure whether or not the "auto-filter" feature from libwebp is used when encoding lossy WebPs, This is put behind a new optional argument/toggle called/named "smart_deblock" in libvips.
It's described by Google as doing the following: "This algorithm will spend additional time optimizing the filtering strength to reach a well-balanced quality."
Note this process is quite slow for the quality gains it achieves.
Also a warning I must give that I apologize for is I am not in a proper position to actually compile libvips and test it with this new code, however this all seems straight forward enough and anyone who is able to can confirm if this works by checking the outputs when changing the
smart_deblock
boolean.If there's anything I missed or concerns about details in this pull request then feel free to say.