Ordered dithering with Bayer Matrix
This requires a 2-dimensional C array.
Instead of using a random value added to the pixel values, it uses one from a grid pasted over the entire image, that follows a specific recursive pattern.


Here it is with level 12

And here it is with level 2

There is a dithering level for each image where it looks the best, and beyond that seems to make no real difference.