[HN Gopher] How to (and how not to) fix color banding
       ___________________________________________________________________
        
       How to (and how not to) fix color banding
        
       Author : asicsp
       Score  : 101 points
       Date   : 2023-12-27 06:54 UTC (1 days ago)
        
 (HTM) web link (blog.frost.kiwi)
 (TXT) w3m dump (blog.frost.kiwi)
        
       | Pathogen-David wrote:
       | > Many Laptop screens are in fact 6-bit panels performing
       | dithering to fake an 8-bit output. This includes even high-priced
       | workstations replacements, like the HP Zbook Fury 15 G7 and its
       | 6-bit LCD panel, that I sit in front of right now.
       | 
       | This made me double-check the date of the article (it's from
       | 2023.)
       | 
       | The author's laptop appears to have launched in 2020. I'm
       | astounded any manufacturer would think this is even remotely
       | acceptable this day and age, much less on such a high-end device.
       | (Going off the current generation, these laptops start around
       | $3k.)
       | 
       | Is this actually that common or did the author just get unlucky?
        
         | jeffbee wrote:
         | The "panel lottery" is still a thing, especially from the major
         | brands like HP, Lenovo, and Dell. They don't say what you are
         | going to get, they change panel suppliers without changing the
         | model number, and in general they don't give a damn about how
         | the thing looks. I guess it's why people buy Apple.
        
           | cma wrote:
           | Apple at least used to often use multiple suppliers, I
           | remember people saying one was better than the other, maybe
           | somewhere back in the first few generations of laptops with
           | retina displays.
        
         | dspillett wrote:
         | It is surprisingly common even on desktop monitors, though not
         | high-end ones.
         | 
         | The panel is something that will often get changed over time in
         | given laptop model without any visible change in the model
         | number etc. and there have been cases of early versions
         | (including review models, of course) having better panels and
         | later revisions having 6-bit ones. I'd be really irritated if
         | it happened in a high-end model but I'd not be surprised to
         | discover there are examples where it has.
        
           | matheusmoreira wrote:
           | > there have been cases of early versions (including review
           | models, of course) having better panels and later revisions
           | having 6-bit ones
           | 
           | How is this not fraud?
        
             | dspillett wrote:
             | They are very careful not to state parts of the panel spec
             | that they don't absolutely have to, then they can legally
             | (though obviously not morally) change the unstated parts
             | without any issue. With early review units there are other
             | extra excuses available to them.
             | 
             | It is rare that a screen will get such a significant
             | downgrade, though it has happened. More common is
             | downgrades in RAM and drive performance. Drive makers
             | themselves play fast and lose with this sort of trick,
             | sometimes changing both controllers and memory to the
             | detriment of performance multiple times without outward
             | change in product codes.
        
       | some1else wrote:
       | Apple UI blur & vibrancy[1] look smooth without having to
       | introduce noise. They have the advantage of owning the entire
       | pipeline with phones & laptops, but the effect is decent even on
       | budget external displays.
       | 
       | 1: https://developer.apple.com/design/human-interface-
       | guideline...
        
       | londons_explore wrote:
       | This is great... but it's at the wrong level.
       | 
       | The LCD itself should ideally be a nice HDR LCD, but if it isn't,
       | it should apply time-dependant error diffusion dithering. Ie. if
       | you took a photograph, you would see a 6-bit or whatever error
       | diffused image, but that dither pattern changes at 60fps. That
       | should happen entirely within the firmware of the screen, and is
       | actually easy to do (some types of dithering require no RAM,
       | others require 1 line of pixels as a buffer).
        
         | zokier wrote:
         | Plenty of displays use various temporal and spatial dithering
         | methods
        
           | londons_explore wrote:
           | I guess we only notice the ones that don't do it properly...
        
         | tedunangst wrote:
         | We draw on the screens we have, not the screens we want.
        
       | rsaxvc wrote:
       | Another GPU friendly approach is mixing with blue noise. I used
       | it in a display driver with XRGB8888 framebuffer and Y2 pixels,
       | and it worked great.
        
         | quag wrote:
         | When generating images also mix in a little blue noise to avoid
         | banding effects. A simple lookup table goes a long way. I found
         | it worked much better than adding uniformly random noise (white
         | noise) to each pixel.
        
       | lynndotpy wrote:
       | Are there any debanding methods that add a point to the color
       | channels?
       | 
       | E.g. A delta of +(1, 1, 1) in RGB space would have six
       | intermediary (but not perceptually evenly spaced) values, e.g.
       | (1,0,0), (0,0,1), (0,1,0), (1,0,1), (0,1,1), and (1,1,0).
       | 
       | This might be something dithering already does (and I just don't
       | understand it).
        
         | klodolph wrote:
         | It's more or less linear--what you can do is dither in each of
         | the R,G,B channels separately. To remove banding in an image,
         | you dither in R, dither in G, dither in B.
         | 
         | If you take a gray value that is 50% between two gray values,
         | and you use uncorrelated noise to dither, then the result will
         | contain all (+-0.5,+-0.5,+-0.5) delta from the original gray.
         | If you use ordered (correlated) dither, you'll get a subset of
         | those 8 colors.
        
         | mpabst wrote:
         | Something similar is used in visual psychophysics:
         | https://www.spiedigitallibrary.org/conference-proceedings-of...
        
       | petermcneeley wrote:
       | This can also be done temporally not simply spatially.
       | https://www.shadertoy.com/view/tslfz4
        
       | kevingadd wrote:
       | My recommendation is to do the equivalent of FRC in your shaders.
       | I use one of the dither functions from
       | https://developer.oculus.com/blog/tech-note-shader-snippets-...
       | to break up banding in my geometry rasterization shaders that I
       | use for rendering all my UI elements. It looks good in static
       | images and fantastic in motion since the dithering pattern shifts
       | every frame.
       | 
       | One thing to watch out for is that if you're alpha blending, you
       | need to be fairly cautious about how you dither and multiply.
       | Premultiplied alpha does not get along with dithering, so the
       | output from your shaders needs to be dithered but NOT
       | premultiplied, with premultiplication performed by the GPU's ROPs
       | (they typically seem to operate above 8 bits of precision.) If
       | you don't do this you will get really nasty banding on alpha
       | fades even though you dither. Also, counter-intuitively, you may
       | not want to dither the alpha channel (test it yourself, ymmv)
       | 
       | When dealing with sRGB and linear space it can also be important
       | whether you dither before or after the color-space conversion.
        
         | Sunspark wrote:
         | Changing the dither pattern every frame subjectively increases
         | noise so I have change dither pattern every frame off for
         | videos.
         | 
         | I also turn off colored noise as well, because even though
         | having colored noise on lowers luma noise, it does increase
         | chroma noise.
         | 
         | I don't want to see noisy colors moving around on videos, esp.
         | anime.
         | 
         | My monitor does do FRC, so all this software stuff is added
         | noise which is why I like to turn it off.
        
       ___________________________________________________________________
       (page generated 2023-12-28 23:00 UTC)