So I've recently been contemplating about ways to improve this...
What are 'good' chroma values?
When demosaicking a uniformly coloured image area at low iso, any algorithm is practically perfect. Problems arise in areas where pronounced and/or high frequency changes in luminance induce artefacts in chrominance. Then you get false colour artefacts. They are, typically, crazy high chroma values.
Areas of colour bleeding are also characterised by having chroma values that are much higher than they should ideally be.
So 'good' chroma values are basically chroma values that are as low as possible, without losing relevant image information.
This brought me to the idea to use also chroma values of the original Markesteijn algorithm. Why throw them away if you have them already?
So the idea is to use the chroma of either Markesteijn or of the frequency domain approach, depending on which of the two is less saturated.
So in other words, I tried using that chroma which has the lowest absolute value.
After saving the chroma of Markesteijn, this is as easy as two additional lines of code:
cbcr[0] = ((ABS(cbcr[0]) < ABS(cb)) ? cbcr[0] : cb);
cbcr[1] = ((ABS(cbcr[1]) < ABS(cr)) ? cbcr[1] : cr);
cbcr[1] = ((ABS(cbcr[1]) < ABS(cr)) ? cbcr[1] : cr);
The results are rather pleasing. For lower iso images, this yields very clean and artefact-free images. For higher iso images, from around 1.600 upwards, the original FDC approach is still better because this hybrid approach introduces more chroma noise.
This approach looks really promising, so I'll prepare a fork along these lines on my GitHub repository one of these days.
To be continued...