You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One problem when viewing manga is the heavy presence of aliasing artifacts (also known as moiré patterns), mainly due to the presence of halftone shading in many manga. To solve this problem, the image must be low-pass filtered when being resized to screen space, using something like a Lanczos or Mitchell kernel.
Currently, subsampling-scale-image-view uses this library to resize down an image in powers of two (currently using box filtering) and then draws to the screen using Android's native image resizing (which probably uses bilinear interpolation). So it is necessary to implement a low-pass filter in this library. (But note that this is not enough—it would still be necessary to replace Android's image resizing with a custom one, probably using an OpenGL/Vulkan shader. However, just implementing the filtering here should bring some improvement.)
Implementing low-pass filtering is not trivial, especially since this library handles partial decoding of images. @AntsyLich has mentioned using libvips for this (mihonapp/mihon#42 (comment)). Since then, I have tried to do just that, and you can see my progress here: Rodrigodd#1.
Using libvips has the following advantages/disadvantages:
Already supports many decoders, so there is no need to maintain the interface for each decoder here.
Takes care of decoding isolated regions of an image.
Not sure if this works when resizing the image; I need to confirm that.
Doesn’t work well with the "crop borders" feature, which decodes the entire image anyway. At least this library, for some decoders, only decodes one channel of the image, but I am not sure if this is possible with libvips.
Handles ICC profiles (although it cannot load output ICC profiles from memory, only from files).
I have already got most things to work; I just need to check for performance optimizations and refactor the code to drop the other decoders. The only issue I am facing is handling ICC profiles, because libvips does not support loading profiles from memory (but I think I can work around that using files), but main problem is that I don’t fully understand how image-decoder is currently handling it. For now I am just converting the images to sRGB.
From my early testing, implementing filtering here didn’t help at all with the aliasing artifacts, but I hope the work done here is still valuable.
I thought it would be better to open an issue about this here beforehand, instead of just submitting a PR when everything is done.
The text was updated successfully, but these errors were encountered:
Yeah, he did (here). He is already aware of the changes I want to make, so I will just open my PR against that repo when ready. In any case, anyone is free to pull the changes from my fork if they would like those.
One problem when viewing manga is the heavy presence of aliasing artifacts (also known as moiré patterns), mainly due to the presence of halftone shading in many manga. To solve this problem, the image must be low-pass filtered when being resized to screen space, using something like a Lanczos or Mitchell kernel.
Currently, subsampling-scale-image-view uses this library to resize down an image in powers of two (currently using box filtering) and then draws to the screen using Android's native image resizing (which probably uses bilinear interpolation). So it is necessary to implement a low-pass filter in this library. (But note that this is not enough—it would still be necessary to replace Android's image resizing with a custom one, probably using an OpenGL/Vulkan shader. However, just implementing the filtering here should bring some improvement.)
Implementing low-pass filtering is not trivial, especially since this library handles partial decoding of images. @AntsyLich has mentioned using libvips for this (mihonapp/mihon#42 (comment)). Since then, I have tried to do just that, and you can see my progress here: Rodrigodd#1.
Using libvips has the following advantages/disadvantages:
I have already got most things to work; I just need to check for performance optimizations and refactor the code to drop the other decoders. The only issue I am facing is handling ICC profiles, because libvips does not support loading profiles from memory (but I think I can work around that using files), but main problem is that I don’t fully understand how image-decoder is currently handling it. For now I am just converting the images to sRGB.
From my early testing, implementing filtering here didn’t help at all with the aliasing artifacts, but I hope the work done here is still valuable.
I thought it would be better to open an issue about this here beforehand, instead of just submitting a PR when everything is done.
The text was updated successfully, but these errors were encountered: