Live data from Hacker News

Fighting JPEG color banding

uploadcare.com

1–10 of 53 posts

Re: Fighting JPEG color banding

#4
Does this mean default quantization tables were badly picked after all? And someone only noticed after 30 years?

It sounds like the employed solution only modifies first element from [16,17] to [10,16].

Re: Fighting JPEG color banding

#6
post #4

Does this mean default quantization tables were badly picked after all? And someone only noticed after 30 years? It sounds like the employed solution only modifies first element from [16,17] to [10,16].

It was not badly picked for regular use cases. Just, before the retina displays appeared no one was interested in extreme low bitrate and no one knew that different artifacts had different impact with high density.

At least this problem was highlighted by Kornel, one of the mozjpeg author here: https://github.com/mozilla/mozjpeg/issues/76

> the employed solution only modifies first element from [16,17] to [10,16].

Correction: 16 and 17 are values from the base tables, which means this table is used with q=50. With q=25 it will be [32, 22, 24, 28, 24, 20, 32, 28…] (in zigzag order). The employed solution is to always limit the first value by 10 regardless of q: [10, 22, 24, 28, 24, 20, 32, 28…]

mozjpeg chosen the different approach: it still scales all values based on q, but has significantly changed the default base table. It helps, but doesn't eliminate color banding completely (you can still see it on the example from issues/76).

Re: Fighting JPEG color banding

#7
The original JPEG, retroactively named JPEG1, totally lacked loop filters and the quantization factor of DC coefficient matters much more than modern formats. As an example, libjpeg q89 is noticably worse than q90 because the DC quantization factor changes from 3 to 4 (smaller factor means less quantization thus higher quality), quite a big jump.

Re: Fighting JPEG color banding

#10
Thing I'd love to try if I had time - a compressor which derives the best table for the image. I'm imagining a loop of: start with the default, compress, calculate the difference from the original, dct the error to see which patterns are missed, adjust the table, repeat. Stop on some given error/size-increase ratio. (yes, I'm trying to get someone else nerd sniped into doing this)

Edit: something like this https://www.imaging.org/site/PDFS/Papers/2003/PICS-0-287/849...

So from the older known ones there DCTune and DCTex methods, but it seems neither is available for download anywhere.

Post reply on HN