darktable: coarse picture in editor

The editor preview show much coarser picture than the exported one (in the red rectangles: exported image):


I used the same PPG for export as for

plugins/darkroom/demosaic/quality=at most PPG (reasonable)

As far as I know, I do not have any setting enabled that would affect preview quality:

preview_downsampling=original
ui/performance=FALSE

Is there anything else I should check?

Viewing both the darkroom image and the exported one at 100%, there is no difference (well, a very small difference, due to JPG compression and an auto-applied dither that’s part of my export):
image

The pixel interpolator setting selected in settings under processing might some effect. I know that setting is definitely used within the pipeline by lens correction and rotation, but it might also be used for scaling previews in the editor? I think bilinear would probably have the least coarse looking edges, maybe with some loss of sharpness.

plugins/lighttable/export/pixel_interpolator=lanczos3

3.5.0+816~g6ecf808b9, Linux
OpenCL on/off makes no difference.
Enabling plugins/darkroom/demosaic/quality=full (possibly slow) and switching to RCD does not influence the jagged lines or the sharp dark lines around the number plate.

Do the sharp dark lines go away if the pixel_interpolator is changed from lanczos3 to bilinear?

Also, turning on defringe or turning off “preserve chrominance” in filmic rgb might help with the sharp edges in the 100% view / export.

It’s not the 100% view or the export that’s problematic, but the zoomed out preview.

I suspect that the pixel interpolator setting in settings may be used when downscaling the image to produce those zoomed out previews, in addition to being used in lens correction and crop and rotate modules.

And you are correct, thanks.
However, resizing the final output (exported to lossless TIFF) to 50% at the command line using Lánczos gives pleasing results:

convert -filter Lanczos *tif -resize 50% 50.png

image image

Hmm, switching to Lanczos2 also gives OK-ish results, but still worse than IM.
Darkroom (lanczos2) vs IM resized version:
image image

image image

I think that the difference is that Darktable is applying the interpolation to scene-linear RGB data, while IM is probably applying the interpolation to gamma encoded data. In the linear data the difference between the bright and dark areas would be much greater and the ringing from the interpolation is more likely to be visible.

The issue is discussed on page 35 of the Cinematic Color white paper. It recommends performing the interpolation in log space instead of linear space to avoid the artifacts.

An option was added to RawTherapee lens correction to use log encoding for the interpolation.
I had been experimenting with doing this in Darktable and it seems to work well enough. It might be useful to have an option that only controls the interpolation used for preview having no effect on the final pipeline output, and separate control over the interpolation to be used for lens correction and rotation.

Darktable is applying the interpolation to scene-linear RGB data, while IM is probably applying the interpolation to gamma encoded data

One can use -gamma to work around that (see Resizing or Scaling -- IM v6 Examples; and yes, I know that sRGB is not a pure-gamma-2.2 space). I tried that and it did not change the outcome considerably. Plus, I don’t think that ImageMagic’s output is wrong; I think it’s quite evident that darktable produces jagged lines and harsh transitions in the scaled preview that are (thankfully) not present in the unscaled version.

I can live with this, of course, but then if the same algorithms are used in rotations and lens correction, maybe those produce artefacts as well. I’ll test that later.

The option you mentioned can only be used for transformations like lens corrections, straightening etc.

For a simple resize RT uses Lanczos on Lab space per default