News for hackers. Stuff that matters.
Re:Jpegli: A New JPEG Coding Library by simonw on Wednesday April 03, 2024 @02:45PM (#39921349)
> High quality results. When images are compressed or decompressed through Jpegli, more precise and psychovisually effective computations are performed and images will look clearer and have fewer observable artifacts.

Does anyone have a link to any example images that illustrate this improvement? I guess the examples would need to be encoded in some other lossless image format so I can reliably view them on my computer.

Re:Jpegli: A New JPEG Coding Library by n2d4 on Wednesday April 03, 2024 @02:52PM (#39921448)
You can find them in the mucped23.zip file linked here (encoded as PNG): https://github.com/google-research/google-research/tree/mast...
Re:Jpegli: A New JPEG Coding Library by simonw on Wednesday April 03, 2024 @03:14PM (#39921744)
Thanks - I downloaded that zip file (460MB!) and extracted one of the examples into a Gist: https://gist.github.com/simonw/5a8054f18f9ea3c560b628b16b00f...

Here's an original: https://gist.githubusercontent.com/simonw/5a8054f18f9ea3c560...

And the jpegli-q95- version: https://gist.githubusercontent.com/simonw/5a8054f18f9ea3c560...

And the same thing with mozjpeg-a95 https://gist.githubusercontent.com/simonw/5a8054f18f9ea3c560...

Re:Jpegli: A New JPEG Coding Library by modeless on Wednesday April 03, 2024 @04:03PM (#39922354)
You shouldn't compare the same quality setting across encoders as it's not standardized. You have to compare based on file size.
Re:Jpegli: A New JPEG Coding Library by IshKebab on Wednesday April 03, 2024 @03:57PM (#39922278)
They're far too high quality to tell anything. There's no point comparing visually lossless images (inb4 "I am amazing and can easily tell...").
Re:Jpegli: A New JPEG Coding Library by deanresin on Wednesday April 03, 2024 @10:49PM (#39926035)
Right? I had all 3 open and quickly flipped over them saw no difference. Maybe I'm just uncultured.
Re:Jpegli: A New JPEG Coding Library by tedunangst on Wednesday April 03, 2024 @03:35PM (#39922008)
What are the file sizes for those two?
Re:Jpegli: A New JPEG Coding Library by simonw on Wednesday April 03, 2024 @04:00PM (#39922319)
The zip file doesn't have the originals, just the PNGs.
Re:Jpegli: A New JPEG Coding Library by edflsafoiewq on Wednesday April 03, 2024 @03:40PM (#39922067)
Edit: I'm dumb.
Re:Jpegli: A New JPEG Coding Library by tedunangst on Wednesday April 03, 2024 @03:48PM (#39922170)
I would hope the jpegs compress better than png does.
Re:Jpegli: A New JPEG Coding Library by pseudosavant on Wednesday April 03, 2024 @05:50PM (#39923678)
Perhaps try quality settings in the 70 range, and comparable output file sizes. 95 will be high-quality by definition.
Re:Jpegli: A New JPEG Coding Library by simonw on Wednesday April 03, 2024 @05:53PM (#39923718)
Re:Jpegli: A New JPEG Coding Library by masfuerte on Wednesday April 03, 2024 @03:15PM (#39921751)
You said linked but like a fool I went looking for a zip in the repository. This is the link:

https://cloudinary.com/labs/cid22/mucped23.zip (460MB)

Re:Jpegli: A New JPEG Coding Library by n2d4 on Wednesday April 03, 2024 @03:18PM (#39921791)
I can't blame you, my comment originally didn't have the word "linked", I edited that in after I realized the potential misunderstanding. Maybe you saw it before the edit. My bad.
Re:Jpegli: A New JPEG Coding Library by masfuerte on Wednesday April 03, 2024 @03:29PM (#39921939)
Ha ha! No worries. I thought it had changed but I frequently skim read and miss things so I wasn't sure.
Re:Jpegli: A New JPEG Coding Library by JyrkiAlakuijala on Wednesday April 03, 2024 @03:52PM (#39922214)
https://twitter.com/jyzg/status/1622890389068718080

Some earlier results. Perhaps these were with XYB color space, I don't remember ...

Re:Jpegli: A New JPEG Coding Library by andrewla on Wednesday April 03, 2024 @03:49PM (#39922175)
As an aside, jpeg is lossless on decode -- once encoded, all decoders will render the same pixels. Since this library produces a valid jpeg file, it should be possible to directly compare the two jpegs.
Re:Jpegli: A New JPEG Coding Library by JyrkiAlakuijala on Wednesday April 03, 2024 @03:54PM (#39922229)
It is approximately correct. The rendering is standards compliant without pixel perfection and most decoders make different compromises and render slightly different pixels.
Re:Jpegli: A New JPEG Coding Library by nigeltao on Wednesday April 03, 2024 @10:42PM (#39926004)
> all decoders will render the same pixels

Not true. Even just within libjpeg, there are three different IDCT implementations (jidctflt.c, jidctfst.c, jidctint.c) and they produce different pixels (it's a classic speed vs quality trade-off). It's spec-compliant to choose any of those.

A few years ago, in libjpeg-turbo, they changed the smoothing kernel used for decoding (incomplete) progressive JPEGs, from a 3x3 window to 5x5. This meant the decoder produced different pixels, but again, that's still valid:

https://github.com/libjpeg-turbo/libjpeg-turbo/commit/6d91e9...

Re:Jpegli: A New JPEG Coding Library by JyrkiAlakuijala on Thursday April 04, 2024 @12:18AM (#39926476)
Moritz, the author of that improvement, implemented the same for jpegli.

I believe the standard does not specify what the intermediate progressive renderings should look like.

I developed that interpolation mechanism originally for Pik, and Moritz was able to formulate it directly in the DCT space so that we don't need to go into pixels for the smoothing to happen, but he computed it using a few of the low frequency DCT coefficients.

Re:Jpegli: A New JPEG Coding Library by nigeltao on Thursday April 04, 2024 @09:42PM (#39937879)
> I believe the standard does not specify what the intermediate progressive renderings should look like.

This is possibly getting too academic, but IIUC for a progressive JPEG, e.g. encoded by cjpeg to have 10 0xDA Start Of Scan markers, it's actually legitimate to post-process the file, truncating to fewer scans (but re-appending the 0xD9 End Of Image marker). The shorter file is still a valid JPEG, and so still relevant for discussing whether all decoders will render the same pixels.

I might be wrong about validity, though. It's been a while since I've studied the JPEG spec.

Re:Jpegli: A New JPEG Coding Library by andrewla on Thursday April 04, 2024 @02:13PM (#39933988)
I was not aware of that; I thought that it was pretty deterministic.

Nonetheless, for this particular case, comparing jpegs decoded into lossless formats is unnecessary -- you can simply compare the two jpegs directly based on the default renderer in your browser.

Re:Jpegli: A New JPEG Coding Library by iggldiggl on Friday April 05, 2024 @10:33AM (#39942860)
And nowadays, for subsampled images libjpeg post classic version 6 insists on doing the chroma upscaling using DCT where possible, so for classic 4:2:0 subsampled images (i.e. chroma resolution is half the luma resolution both horizontally and vertically) each subsampled 8x8 chroma block is now upscaled individually to 16x16 for the final image, which can and does introduce additional artefacts at the boundaries between each 16x16 px block in the final image. But the current libjpeg maintainer insists on that new algorithm because it is mathematically more beautiful…

Granted, the introduced artefacts aren't massive, but under certain circumstances they are noticeable, which is how I stumbled across that topic in the first place.

Thankfully, most software that isn't still stuck on libjpeg 6 has switched to libjpeg-turbo or some other library instead which continues using a more sensible algorithm for chroma upscaling.