Dual demosaic for 5.4#19128
Conversation
|
@jenshannoschwalm yes I can do some testing. Funny you should be looking at this, just yesterday I implemented a demosaic method by Boris van Schooten from ~2004. Website (13thmonkey.org/~boris) is now incomplete, it was an interesting idea which performed admirably at the time. It's not as good as the other available methods now, but, it got me wishing:
Okay enough rambling thoughts. I'll have a look at the new demosaicing code and how it performs with some of my test images. |
Actually, I never used dual-demosaicing and I never pixel-peeped to the point where I saw problems with the default demosaicer, so my eyes might not be well-trained to look out for demosaicing issues. |
f030486 to
ce39211
Compare
|
I have done some testing and see less noise in the flat areas giving also a bit more sharpness. That being said I haven't tested with the previous version, and I probably don't have a good setup to check for difference as all this is very subtle. @weltyj : Please report about your testing when you're done. I can also confirm that the integration tests for dual demosaic are failing. The diff image is scary :) All read as if all pixels have been changed. For
But the expected vs output seems almost identical when looking at them: Expected:
Output:
|
|
@TurboGit @jenshannoschwalm Yes I too think the changes are going to be subtle. When I was testing the pixeldeblur code last year, I wrote a perl script to generate an XMP file and change parameters in loops in the perl script, so I could do automated generation of tiff images for comparison via the darktable-cli. What I'd like to do for this is a similar idea, looking at red,green,blue channels separately for old vs new version, at various levels of the "dual threshold" parameter. I have a few specific areas of a small number of images picked to look at. |
|
Yes, differences new-vs-old algorithm are mostly very subtle.
so using vng as flat-content demosaicer can lead to bad artefacts on xtrans
|
If we use the VNG demosaicer (for some good reason like maze patterns) we want best quality for details mask or capture sharpening so let's always use the second part of the algorithm. Some performance gain in OpenCL code as a buffer copy could be avoided by refactoring. Note: This is also done for dual demosaicers low frequency content because doing only the linear interpolations works good for the vast majority of images, in some cases this leads to a stronger local color cast. This unfortunately got un-noticed for 5.2.
Refactor and re-implement dual demosaicing. Instead of using VNG for the low-frequency content this implements an efficient demosaicer doing gaussian weighted averaging from photosites in a 9x9 area not even trying to provide any details. 1. No subtle local color casts as sometimes observed with VNG/4 resulting in a better transition with details content from rcd, amaze or markesteijn3. 2. stable against maze patterns and a slightly better resistance against noise. 3. improved performance and less memory footprint as both the gaussian blur of details mask and the low-frequency demosaicer can be done inside the dual phase due to refactoring and the new algorithm. (We could possibly expose the sigma of blurring the low-frequency content in UI)
ce39211 to
07673dd
Compare
Just a progress report -- my automated perl script seems to work fine now -- I can take any image and push it through the master branch code and Hanno's new code altering demosaic parameters directly through the perl script and then manually compare the resulting tiff images ((new-old)*scalefactor+127) to look for differences.
Image is an example of rcd dual, with dual threshold set to 0.90 I put the perl code here (such as it is...) Top level code is very simple: my $sharpen_radius=0.50 ; print "method:$demosaic_method\n" ; my @test_parms = ( my $infile="DSC09586.ARW" ; my $outfile="old_test.tif" ; $outfile="new_test.tif" ; |
|
I've noticed some changes in edges, which are I think are not because of the dual algorithm but because of the RCD algorithm itself. The changes cause more color fringing in the newer version. Hard to quanitfy but I'll try to get some comparitive images up in a few days. Been busy with other stuff... |
|
RCD has not changed at all . |
|
not to be merged right now, there is more important demosaicer work pending ... |
|
Thanks a lot, that's exactly what i was looking for. I think i understand the reason for the problem and fortunately have an idea how that can be fixed. |
@jenshannoschwalm -- sounds good. I have this all automated so I can turn around the analysis very quickly now whenever you have a new version to try. |
|
@weltyj thanks for your testing again. I checked my "idea" and must confess, it works just somehow but leaves maze patterns that we don't have when using VNG. So not a good way ... Closed this for now ... |
|
@jenshannoschwalm Maybe you'll wake up in the middle of the night and have another idea. That's how it works for me. Thanks for your efforts so far... |
|
Right, so far no productive night-awakes :-) |













While working on capture sharpen i did a huge amount of pixel-peep-testing a lot of images, low & high noise, xtrans and bayer looking for artefacts, moire handling and introduced maze patterns in low-contrast areas, thanks to many people sharing images with special problems btw.
As a result of those tests i reimplemented dual demosaicing (@TurboGit so we have differences with integration tests) leading to an improved quality for low frequency content (better response for noisy signals, no color casts, no mazing).
While doing so dual demosaicing performance has been improved quite a lot, it's performance now is only ~10-20% worse (instead of >50%) than it's main demosaicer and it uses less memory (important for tiling) both for CPU and OpenCL code paths.
@da-phil @weltyj when working on capture i saw you both use dual demosaicing. Would you be able to test?