What is Dithering?
Dithering is a technique you can use to make a lower bit-depth blend colors by introducing random noise to the image in strategic locations. When is dithering useful? - When you need to represent an image with lower bit depth than you captured it at, or when you need to use a low bit depth in general. Sometimes a lower bit depth doesn't have enough colors to express the image well. In such cases, you'll see sharp lines or bands of color in places where the color shifts from one shade to another. This makes the image look less realistic, and lower quality.
Here's an example:
See how the high bit depth on the left image (24-bit) allows for a more seamless transition between gradients of color. However in the right image (8-bit), you see sharp delineation between the bands of color. By dithering, or applying random noise to these areas, you can soften the delineation. For images, you can often create an approximation of a color by choosing the right colors from a palette and placing them next to each other. The human eye will see the colors mixed together as the desired color even though the palette doesn't contain this color. For example, say you have a color palette that doesn't have purple as a choice. You could approximate purple by placing very tiny red and blue pixels next to each other in the pattern of a checkerboard. If fine enough, your eye won't notice it's created with red and blue, and simply see purple as desired.
Sometimes a limited color palette is ideal because the image will take less space. Remember that for bit depth, for each pixel enough space has to be available for whatever choice you might make. So in 8-bit color, a space that can handle up to 256 values is stored per pixel. In 10-bit color, a space that can handle up to 1024 values is stored per pixel. Sometimes it's not efficient to store the higher quality option, and this is where dithering is useful.
Here's an image showing how dithering works. You can see that at first, with big patches of red and blue, you see the colors separately. But as the patches become smaller and smaller, you see more and more purple!
Dithering is used in many different codecs to improve efficiency and storage of image and video. This technique is not limited to video - it's also used on the audio portion of video codecs and it can be applied to images as well.