Stories
Slash Boxes
Comments

SoylentNews is people

posted by Fnord666 on Sunday March 19 2017, @10:09PM   Printer-friendly
from the just-use-a-photocopier-multiple-times dept.

Google has developed and open-sourced a new JPEG algorithm that reduces file size by about 35 percent—or alternatively, image quality can be significantly improved while keeping file size constant. Importantly, and unlike some of its other efforts in image compression (WebP, WebM), Google's new JPEGs are completely compatible with existing browsers, devices, photo editing apps, and the JPEG standard.

The new JPEG encoder is called Guetzli, which is Swiss German for cookie (the project was led by Google Research's Zurich office). Don't pay too much attention to the name: after extensive analysis, I can't find anything in the Github repository related to cookies or indeed any other baked good.

There are numerous ways of tweaking JPEG image quality and file size, but Guetzli focuses on the quantization stage of compression. Put simply, quantization is a process that tries to reduce a large amount of disordered data, which is hard to compress, into ordered data, which is very easy to compress. In JPEG encoding, this process usually reduces gentle colour gradients to single blocks of colour and often obliterates small details entirely.

The difficult bit is finding a balance between removing detail, and keeping file size down. Every lossy encoder (libjpeg, x264, lame) does it differently.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 2) by shortscreen on Monday March 20 2017, @08:41AM (1 child)

    by shortscreen (2252) on Monday March 20 2017, @08:41AM (#481405) Journal

    A JPEG quantization table is just an array of 64 bytes. After you've run an 8x8 block of pixels through a Discrete Cosine Transform then you divide each coefficient by the corresponding value in the quantization table. Since you're doing integer math, dividing by a larger number is basically throwing away more data. Pretty soon you have an array of mostly zeros, which compresses very well, but image quality suffers. It should be noted that you won't get the best image quality by using a quantization table filled with 1s. If you open a high-quality JPEG from a camera in a hex editor and look at what is in the tables (there are generally two, one for the chroma channels and one for the luma channel) you will see 2s, 3s, 4s, and 5s in there. And I'd say you can take those tables and triple all the values, encode the same image again and cut your file size in half without a noticable difference.

    It sounds plausible that Google may have found gains by tweaking quantization tables. Then again, it's strange to think that nobody in the world in the past 25 years bothered to try it before. Like, the JPEGroup came up with their table and everyone else just copied it.

    The really weird part is where TFA says "Guetzli, due to the more involved quantization process, is slower than libjpeg." This makes no sense. Since the quantization table is just a predefined array of bytes, changing it has a negligible effect on encoding speed. So maybe the description of what Google did here is not even accurate.

    I don't know how many different JPEG implementations are out there, but I know that at least one (the only one I tested) uses static Huffman tables. Maybe this is a common weakness in JPEG encoders. Maybe Google's encoder generates its own Huffman tables and this is why their files are smaller. (Would have been nice if TFA had some test files so I could compare the output with other programs)

    Starting Score:    1  point
    Karma-Bonus Modifier   +1  

    Total Score:   2  
  • (Score: 1, Informative) by Anonymous Coward on Monday March 20 2017, @01:18PM

    by Anonymous Coward on Monday March 20 2017, @01:18PM (#481476)

    They tune the quantization table to the image, instead of using the same quantization table for all images. This is slower.