-
Notifications
You must be signed in to change notification settings - Fork 415
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
Use low-pass edge extension to pad images #82
Comments
Talked a bit with a DSP friend, and he informed me that you can compute a globally optimal linear filter for codecs with a fixed block size and non-lapped DCT, and no sample-domain prediction (i.e. JPEG). What this means is we can guarantee at least In hindsight, it seems obvious. But hindsight is 20:20. The prefiltering/edge extension algorithm would end up like: Given the original edge 8x8 block (pre-padding):
Start on the first row:
Let's label them:
So:
... yeah so, I'll work these out later 👅. Compute
Which gets us:
Compute for all rows to get:
Which is our final padded block. For bottom/top, you'd do cols instead of rows. I think I got this all right. Maybe @negge can comment? EDIT: Clarity. |
OK so I went through and tried what a listed above, and it had one issue: it was possible to generate dct coeffs larger than jpeg can handle. However, Tim Terriberry linked me to a paper he wrote which can probably be applied instead, which is somewhat similar. I will look into that. |
Nathan, are you still planning to submit a patch for this? |
I've been very busy with life/work. I'll revisit this early 2015. |
See mozilla#56 for discussion. Fixes mozilla#21, Fixes mozilla#29, Fixes mozilla#37, Closes mozilla#56, Fixes mozilla#58, Closes mozilla#73 Obviates mozilla#82 See also: https://sourceforge.net/p/libjpeg-turbo/feature-requests/5/ https://sourceforge.net/p/libjpeg-turbo/patches/5/
When encoding an image with dimensions that are not a multiple of 16, both mozjpeg and libjpeg-turbo use an edge extension that simply copies the pixels from the right and bottom edge into the padded area. Because this image data is not displayed we can use any edge extension we want. Both daala and theora use a low-pass filter to extend the frame and this is shown to have very modest compression gains, essentially for free.
The text was updated successfully, but these errors were encountered: