I don't understand why you need LED flashes during exposure and can't drive LED with PWM passed through low pass filter?
Because I get a signal from the PLC and need to capture 2 images in fast sequence, with 2 different brightnesses.
So at the moment I set the PWM value that will change in 1/50000 of a second after the command. And then start the camera trigger by software. Between setting the PWM value and the CCD exposure starting is about 1 ms or even shorter (and probably not constant, the trigger is send over USB)
So the time is too short for LP filter to settle at a constant value during the exposure.
P.S. I can get away with the 10 bits I have now. Always on the lookout for a better solution.
You could divide the LEDs into two or more banks that you can control independently, adding another level of brightness control without needing more bits of PWM. (For example, alternate every LED between 2 banks, so that for lower brightnesses, you just disable one bank.)
Another thing you could consider is not using PWM, but some other encoding like PDM (pulse density modulation, which is almost the same thing as delta-sigma modulation). This would reduce the brightness error by spreading out the pulses within a 16-bit value.
It also seems to me you could use a DAC to control a constant-current LED driver. Modern audio DACs, for example, are often 24-bit at 48, 96, and 192kHz, more than enough. The question I don’t know off the top of my head is how long the latency is.