Frequency domain chroma interpolation for xtrans sensors: good enough?

darktable

(Sebastien Guyader) #1

The new release candidate of Darktable (2.4-rc0) introduces a new demosaicing algorithm for xtrans sensors, called “Frequency domain chroma” (FDC). At first, as a Fujifilm X-T2 owner I got really excited. So I compiled Darktable form source, and started to compare the Markesteijn and FDC algorithms.

So far I only tested the algorithms on X-T2 images, but I found that the FDC to be marginally better in some cases, with the improvements vsible only when pixel peeping at 200%, while I also found some adverse effects (color fringing and moiré) more visible in some cases (100% zoom).

I was initially thinking to send a feature request to RT devs to add this new algorithm to RT, but now I’m not sure anymore if it is worth it. This post is just to discuss about the pros and cons of adding this new algorithm to RT. I have seen more cons than pros so far.

Below is an example of an X-T2 chart from DPReview (Markesteijn algo top, FDC algo bottom, in Darktable at 200%):


Differences can be seen at the center of the wheel (hard to say which algo is better, I personally prefer the Markesteijn result), and also in the smaller text (here, the FDC algo is better here). Faint differences, at 200% zoom level…

Now, another comparison usin an X-T2 resolution chart from Imaging Resources (left: Markesteijn 3-pass, right: FDC, in Darktable at 100%):


Here you can see some color moiré visible in the FDC-interpolated image, while the Markesteijn onoe is clean.

Last, a real-world shot of mine (X-T2) showing what happens in a transition zone to highlights (Markesteijn 3-pass (top) vs. FDC (bottom), zoomed in at 200% in Darktable):


The strong fringing introduced by the FDC algorithm seems quite problematic to me.

I’ll see how both algorithms compare for older xtrans sensors.


(Jean-Christophe) #2

@sguyader Wrong software selected for this thread. Maybe selecting Darktable will bring more attention ?


(Sebastien Guyader) #3

@Hombre the algorithm is already in Darktable, but I don’t know if RT devs knew about it already.
My question is, basically: how does it compare to Markesteijn’s algorithm, i.e. is it worth implementing it in RT.
In my opinion it’s not worth it, I see more costs than benefits, but it’s just my opinion.


(Jean-Christophe) #4

I can’t comment on the work it require to implement this new demozaicing method, as I don’t touch this part of code. However given the artifacts we can see here, it might be interesting for X-Trans camera owners.

I’d also be curious about how the camera has processed the image regarding the artifacts you’re shown here.

Are you also sure that RT’s algo is exactly the same than in DT ? If not, please check what RT get with those images, with absolute neutral image except Color Profile.


(Ingo Weyrich) #5

RT’s implementation of Markesteijn’s algorithm is not exactly the same as DT’s implementation.
Have a look at https://github.com/Beep6581/RawTherapee/blob/dev/rtengine/demosaic_algos.cc#L4463 and
https://github.com/Beep6581/RawTherapee/blob/dev/rtengine/demosaic_algos.cc#L4492.

IIRC DT uses YPbPr for one- and three-pass whereas RT uses YPbPr for one-pass and CIELab for three-pass.


(Irving Medina) #6

Please, does anyone know if FDC improves on the worm-likes artifacts commonly seen on X-trans sensors?


(Sebastien Guyader) #7

If you have a raw file showing the so called worms, I’d be glad to test the 2 algorithms, including as RT’s implementation of the Markesteijn algorithm.


(Sebastien Guyader) #8

So far I haven’t seen any advantage in terms of “worms”, both algorithms seem to perform the same on foliage or rocky textures.

The only advantage I see with the FDC algorithm, is in some areas of fine diagonal patterns (such as fabric), but it comes at a cost in color bleeding/blooming and some color aberrations in some fine pattern cases.

Here are comparaisons of FDC and Markesteijn’s 3-pass algorithms from Darktable (“DT-FDC” and “DT-Mar”, respectively) as well as the Markesteijn implemention in RawTherapee (“RT-Mar”). I processed some files from X-T1 (16 Mp) and X-T2 (24 Mp), trying to get the same solor rendition between DT and RT by using the standard color matrix and disabling any tone curve. You can download the resultaing files there.

Here, I’ll show some animated images (I applied the same tone curve to each image in Gimp, to add some contrast).

Some benefits from FDC in fine patterns:

Some drawbacks of the FDC (color bleeding):

  • X-T1:
    XT1hSLI00200NR1_comp1

  • X-T2:
    XT2hSLI00200NR1_comp2

and color moiré:


YDSCF5282_comp

Form these test images, the difference between DT’s and RT’s implementation of the 3-pass Markesteijn is microscopic.


#9

Nice comparisons, thanks.


(darix) #10

Any Pros and Cons for CIELab vs YPbPr in the 3 pass mode?


(Ingo Weyrich) #11

CIELab is from original implementation in dcraw code. YPbPr is a tiny bit faster to calculate.


(Irving Medina) #12

Thank you, that’s very kind of you!

Please find the RAW at the link, and some discussion about similar SOOC JPEG, here:


https://www.dpreview.com/forums/thread/4209063

PS: I think the artifacts are more pronounced when in B/W.


(Sebastien Guyader) #13

@irving I didn’t see anything special in this file. I exported it to jpg in RT (neutral settings + acros simulation) and DT (with both algorithms). You can dinf the exported files here: https://filebin.net/p08xd3vggnjywwi4


(Irving Medina) #14

Thank you! Hm, both looks pretty much the same. Maybe FDC is teeny tiny bit cleaner…