Project

General

Profile

Bug #8821

Noise in Preview when using OpenCL and High ISO / Noise Reduction

Added by Matthias Jansen almost 8 years ago.

Status:
Fixed
Priority:
Medium
Category:
Darkroom
Target version:
Start date:
07/09/2012
Due date:
% Done:

100%

Estimated time:
40.00 h
Affected Version:
git development version
System:
bitness:
64-bit
hardware architecture:
amd64/x86

Description

When editing High ISO images (e.g. ISO 2500) the preview is quite noisy when using OpenCL. Exported images are OK even when using OpenCL and look the same as with only CPU usage.

Attached are example screenshots with 1.0.4 and current git master. Current git master looks better but still has some differences.

Camera: 60D

Darktable_OpenCL_vs_Non-OpenCL_Noise.jpg (780 KB) Darktable_OpenCL_vs_Non-OpenCL_Noise.jpg Version 1.0.4 comparison Matthias Jansen, 07/09/2012 08:07 AM
Darktable_OpenCL_vs_Non-OpenCL_Noise_latest_git.jpg (545 KB) Darktable_OpenCL_vs_Non-OpenCL_Noise_latest_git.jpg current git master Matthias Jansen, 07/09/2012 08:08 AM
noise.jpeg (207 KB) noise.jpeg Ulrich Pegelow, 07/12/2012 08:34 PM
darktable_git_noise.jpg (272 KB) darktable_git_noise.jpg Matthias Jansen, 07/13/2012 07:21 AM
darktable_git_noise_detail.jpg (327 KB) darktable_git_noise_detail.jpg Matthias Jansen, 07/13/2012 07:21 AM
darktable_noise_compare_ISO_320.jpg (138 KB) darktable_noise_compare_ISO_320.jpg Matthias Jansen, 07/13/2012 07:46 AM
darktablerc (12.7 KB) darktablerc Matthias Jansen, 07/13/2012 09:27 AM

Associated revisions

History

#2 Updated by Ulrich Pegelow almost 8 years ago

  • Target version set to Candidate for next minor release
  • Assignee set to Ulrich Pegelow

Can this effect be attributed to one of the active modules?

#3 Updated by Matthias Jansen almost 8 years ago

Ulrich, I made a test removing each module step by step and it's the resize module. I did not rotate or anything, just crop. I now remember that I've seen this exact behavior in the past but didn't really linked this to OpenCL.

So its the OpenCL version of the crop and rotate module.

Best regards,

Matthias

#4 Updated by Ulrich Pegelow almost 8 years ago

That's a little bit surprising. I would have expected non-local means to be the cause as there were some recent changes, which might have introduced the difference between cpu and gpu. I still would not exclude this as the root cause; maybe you just trigger the effect by different levels of scaling when you crop&rotate.

Anyhow, could you please upload the incumbant CR2 file plus the XMP, so I can try to reproduce?

Last question: what interpolation mode is set for you in preferences?

#5 Updated by Simon Spannagel almost 8 years ago

  • % Done changed from 0 to 20
  • Status changed from New to Triaged

#6 Updated by Matthias Jansen almost 8 years ago

I checked with disabling everything except crop and the noise is still in. Of course sharpening makes it worse, de-noising doesn't change much.

You can download the files here: http://www.supermaz.de/noise_issue.zip

#7 Updated by Ulrich Pegelow almost 8 years ago

I checked with your raw file + xmp file. On my system with current git master there is no visible difference between cpu and opencl path (see file attached). As previously said, I think there is a small issue with module nlmeans but that's hardly visible.

Could you please check if running DT with '-d opencl' indicates any problems on your side?

#8 Updated by Matthias Jansen almost 8 years ago

Hi Ulrich,

here is the log:

./darktable -d opencl
[opencl_init] trying to load opencl library: '<system default>'
[opencl_init] opencl library 'libOpenCL' found on your system and loaded
[opencl_init] found 1 device
[opencl_init] device 0 `GeForce GTS 450' supports image sizes of 32768 x 32768
[opencl_init] device 0 `GeForce GTS 450' allows GPU memory allocations of up to 255MB
[opencl_init] device 0: GeForce GTS 450
GLOBAL_MEM_SIZE: 1023MB
MAX_WORK_GROUP_SIZE: 1024
MAX_WORK_ITEM_DIMENSIONS: 3
MAX_WORK_ITEM_SIZES: [ 1024 1024 64 ]
[opencl_init] compiling program `demosaic_ppg.cl' ..
[opencl_load_program] successfully loaded program from `/local/maz/temp/darktable_install/share/darktable/kernels/demosaic_ppg.cl'
[opencl_build_program] successfully built program
[opencl_init] compiling program `atrous.cl' ..
[opencl_load_program] successfully loaded program from `/local/maz/temp/darktable_install/share/darktable/kernels/atrous.cl'
[opencl_build_program] successfully built program
[opencl_init] compiling program `basic.cl' ..
[opencl_load_program] successfully loaded program from `/local/maz/temp/darktable_install/share/darktable/kernels/basic.cl'
[opencl_build_program] successfully built program
[opencl_init] compiling program `blendop.cl' ..
[opencl_load_program] successfully loaded program from `/local/maz/temp/darktable_install/share/darktable/kernels/blendop.cl'
[opencl_build_program] successfully built program
[opencl_init] compiling program `highpass.cl' ..
[opencl_load_program] successfully loaded program from `/local/maz/temp/darktable_install/share/darktable/kernels/highpass.cl'
[opencl_build_program] successfully built program
[opencl_init] compiling program `nlmeans.cl' ..
[opencl_load_program] successfully loaded program from `/local/maz/temp/darktable_install/share/darktable/kernels/nlmeans.cl'
[opencl_build_program] successfully built program
[opencl_init] compiling program `gaussian.cl' ..
[opencl_load_program] successfully loaded program from `/local/maz/temp/darktable_install/share/darktable/kernels/gaussian.cl'
[opencl_build_program] successfully built program
[opencl_init] compiling program `sharpen.cl' ..
[opencl_load_program] successfully loaded program from `/local/maz/temp/darktable_install/share/darktable/kernels/sharpen.cl'
[opencl_build_program] successfully built program
[opencl_init] compiling program `extended.cl' ..
[opencl_load_program] successfully loaded program from `/local/maz/temp/darktable_install/share/darktable/kernels/extended.cl'
[opencl_build_program] successfully built program
[opencl_init] compiling program `soften.cl' ..
[opencl_load_program] successfully loaded program from `/local/maz/temp/darktable_install/share/darktable/kernels/soften.cl'
[opencl_build_program] successfully built program
[opencl_init] successfully initialized.
[opencl_init] FINALLY: opencl is AVAILABLE on this system.
[opencl_init] initial status of opencl enabled flag is ON.
[opencl_create_kernel] successfully loaded kernel `blendop_Lab' (0) for device 0
[opencl_create_kernel] successfully loaded kernel `blendop_RAW' (1) for device 0
[opencl_create_kernel] successfully loaded kernel `blendop_rgb' (2) for device 0
[opencl_create_kernel] successfully loaded kernel `blendop_copy_alpha' (3) for device 0
[mipmap_cache] cache version too old, dropping `/home/maz/.cache/darktable/mipmaps-1cada29e5270a6cedd0520c51d0c8657ce17526b' cache
[opencl_create_kernel] successfully loaded kernel `vibrance' (4) for device 0
[opencl_create_kernel] successfully loaded kernel `zonesystem' (5) for device 0
[opencl_create_kernel] successfully loaded kernel `channelmixer' (6) for device 0
[opencl_create_kernel] successfully loaded kernel `graduatedndp' (7) for device 0
[opencl_create_kernel] successfully loaded kernel `graduatedndm' (8) for device 0
[opencl_create_kernel] successfully loaded kernel `colorcorrection' (9) for device 0
[opencl_create_kernel] successfully loaded kernel `highpass_invert' (10) for device 0
[opencl_create_kernel] successfully loaded kernel `highpass_hblur' (11) for device 0
[opencl_create_kernel] successfully loaded kernel `highpass_vblur' (12) for device 0
[opencl_create_kernel] successfully loaded kernel `highpass_mix' (13) for device 0
[opencl_create_kernel] successfully loaded kernel `monochrome' (14) for device 0
[opencl_create_kernel] successfully loaded kernel `splittoning' (15) for device 0
[opencl_create_kernel] successfully loaded kernel `lens_distort_bilinear' (16) for device 0
[opencl_create_kernel] successfully loaded kernel `lens_distort_bicubic' (17) for device 0
[opencl_create_kernel] successfully loaded kernel `lens_distort_lanczos2' (18) for device 0
[opencl_create_kernel] successfully loaded kernel `lens_distort_lanczos3' (19) for device 0
[opencl_create_kernel] successfully loaded kernel `lens_vignette' (20) for device 0
[opencl_create_kernel] successfully loaded kernel `basecurve' (21) for device 0
[opencl_create_kernel] successfully loaded kernel `velvia' (22) for device 0
[opencl_create_kernel] successfully loaded kernel `soften_overexposed' (23) for device 0
[opencl_create_kernel] successfully loaded kernel `soften_hblur' (24) for device 0
[opencl_create_kernel] successfully loaded kernel `soften_vblur' (25) for device 0
[opencl_create_kernel] successfully loaded kernel `soften_mix' (26) for device 0
[opencl_create_kernel] successfully loaded kernel `overexposed' (27) for device 0
[opencl_create_kernel] successfully loaded kernel `colorzones' (28) for device 0
[opencl_create_kernel] successfully loaded kernel `highlights' (29) for device 0
[opencl_create_kernel] successfully loaded kernel `colorout' (30) for device 0
[opencl_create_kernel] successfully loaded kernel `clip_and_zoom_demosaic_half_size' (31) for device 0
[opencl_create_kernel] successfully loaded kernel `ppg_demosaic_green' (32) for device 0
[opencl_create_kernel] successfully loaded kernel `green_equilibration' (33) for device 0
[opencl_create_kernel] successfully loaded kernel `pre_median' (34) for device 0
[opencl_create_kernel] successfully loaded kernel `ppg_demosaic_green_median' (35) for device 0
[opencl_create_kernel] successfully loaded kernel `ppg_demosaic_redblue' (36) for device 0
[opencl_create_kernel] successfully loaded kernel `clip_and_zoom' (37) for device 0
[opencl_create_kernel] successfully loaded kernel `border_interpolate' (38) for device 0
[opencl_create_kernel] successfully loaded kernel `color_smoothing' (39) for device 0
[opencl_create_kernel] successfully loaded kernel `borders_fill' (40) for device 0
[opencl_create_kernel] successfully loaded kernel `exposure' (41) for device 0
[opencl_create_kernel] successfully loaded kernel `nlmeans_init' (42) for device 0
[opencl_create_kernel] successfully loaded kernel `nlmeans_dist' (43) for device 0
[opencl_create_kernel] successfully loaded kernel `nlmeans_horiz' (44) for device 0
[opencl_create_kernel] successfully loaded kernel `nlmeans_vert' (45) for device 0
[opencl_create_kernel] successfully loaded kernel `nlmeans_accu' (46) for device 0
[opencl_create_kernel] successfully loaded kernel `nlmeans_finish' (47) for device 0
[opencl_create_kernel] successfully loaded kernel `gaussian_column' (48) for device 0
[opencl_create_kernel] successfully loaded kernel `gaussian_transpose' (49) for device 0
[opencl_create_kernel] successfully loaded kernel `shadows_highlights_mix' (50) for device 0
[opencl_create_kernel] successfully loaded kernel `gaussian_copy_alpha' (51) for device 0
[opencl_create_kernel] successfully loaded kernel `vignette' (52) for device 0
[opencl_create_kernel] successfully loaded kernel `colorcontrast' (53) for device 0
[opencl_create_kernel] successfully loaded kernel `pixelmax_first' (54) for device 0
[opencl_create_kernel] successfully loaded kernel `pixelmax_second' (55) for device 0
[opencl_create_kernel] successfully loaded kernel `global_tonemap_reinhard' (56) for device 0
[opencl_create_kernel] successfully loaded kernel `global_tonemap_drago' (57) for device 0
[opencl_create_kernel] successfully loaded kernel `global_tonemap_filmic' (58) for device 0
[opencl_create_kernel] successfully loaded kernel `sharpen_hblur' (59) for device 0
[opencl_create_kernel] successfully loaded kernel `sharpen_vblur' (60) for device 0
[opencl_create_kernel] successfully loaded kernel `sharpen_mix' (61) for device 0
[opencl_create_kernel] successfully loaded kernel `lowlight' (62) for device 0
[opencl_create_kernel] successfully loaded kernel `flip' (63) for device 0
[opencl_create_kernel] successfully loaded kernel `whitebalance_1ui' (64) for device 0
[opencl_create_kernel] successfully loaded kernel `whitebalance_4f' (65) for device 0
[opencl_create_kernel] successfully loaded kernel `whitebalance_1f' (66) for device 0
[opencl_create_kernel] successfully loaded kernel `colorin' (67) for device 0
[opencl_create_kernel] successfully loaded kernel `gaussian_column' (68) for device 0
[opencl_create_kernel] successfully loaded kernel `gaussian_transpose' (69) for device 0
[opencl_create_kernel] successfully loaded kernel `lowpass_mix' (70) for device 0
[opencl_create_kernel] successfully loaded kernel `gaussian_copy_alpha' (71) for device 0
[opencl_create_kernel] successfully loaded kernel `tonecurve' (72) for device 0
[opencl_create_kernel] successfully loaded kernel `clip_rotate_bilinear' (73) for device 0
[opencl_create_kernel] successfully loaded kernel `clip_rotate_bicubic' (74) for device 0
[opencl_create_kernel] successfully loaded kernel `clip_rotate_lanczos2' (75) for device 0
[opencl_create_kernel] successfully loaded kernel `clip_rotate_lanczos3' (76) for device 0
[opencl_create_kernel] successfully loaded kernel `colorize' (77) for device 0
[opencl_create_kernel] successfully loaded kernel `levels' (78) for device 0
[opencl_create_kernel] successfully loaded kernel `eaw_decompose' (79) for device 0
[opencl_create_kernel] successfully loaded kernel `eaw_synthesize' (80) for device 0
[opencl_create_kernel] successfully loaded kernel `relight' (81) for device 0
[pixelpipe_process] [export] using device 0
[default_process_tiling_cl_roi] use tiling on module 'demosaic' for image with full input size 3462 x 5198
[default_process_tiling_cl_roi] (1 x 2) tiles with max input dimensions 3462 x 4842
[default_process_tiling_cl_roi] tile (0, 0) with 3462 x 2668 at origin [0, 0]
[default_process_tiling_cl_roi] tile (0, 1) with 3462 x 2633 at origin [0, 2564]
[pixelpipe_process] [export] using device 0
[default_process_tiling_cl_roi] use tiling on module 'demosaic' for image with full input size 3462 x 5198
[default_process_tiling_cl_roi] (1 x 2) tiles with max input dimensions 3462 x 4842
[default_process_tiling_cl_roi] tile (0, 0) with 3462 x 2668 at origin [0, 0]
[default_process_tiling_cl_roi] tile (0, 1) with 3462 x 2633 at origin [0, 2564]
[pixelpipe_process] [export] using device 0
[default_process_tiling_cl_roi] use tiling on module 'demosaic' for image with full input size 5198 x 3462
[default_process_tiling_cl_roi] (2 x 1) tiles with max input dimensions 4842 x 3462
[default_process_tiling_cl_roi] tile (0, 0) with 2700 x 3462 at origin [0, 0]
[default_process_tiling_cl_roi] tile (1, 0) with 2561 x 3462 at origin [2630, 0]
[pixelpipe_process] [export] using device 0
[pixelpipe_process] [export] using device -1
[pixelpipe_process] [export] using device 0
[pixelpipe_process] [export] using device 0
[default_process_tiling_cl_roi] use tiling on module 'demosaic' for image with full input size 5198 x 3462
[default_process_tiling_cl_roi] (2 x 1) tiles with max input dimensions 4842 x 3462
[default_process_tiling_cl_roi] tile (0, 0) with 2642 x 3462 at origin [0, 0]
[default_process_tiling_cl_roi] tile (1, 0) with 2584 x 3462 at origin [2608, 0]
[pixelpipe_process] [export] using device 0
[pixelpipe_process] [full] using device 0
[pixelpipe_process] [preview] using device -1
[pixelpipe_process] [full] using device 0
[pixelpipe_process] [preview] using device -1
[default_process_tiling_cl_roi] use tiling on module 'demosaic' for image with full input size 5198 x 3462
[default_process_tiling_cl_roi] (2 x 1) tiles with max input dimensions 4842 x 3462
[default_process_tiling_cl_roi] tile (0, 0) with 2611 x 3462 at origin [0, 0]
[default_process_tiling_cl_roi] tile (1, 0) with 2615 x 3462 at origin [2582, 0]
[pixelpipe_process] [export] using device 0
[pixelpipe_process] [preview] using device -1
[pixelpipe_process] [full] using device 0
[pixelpipe_process] [export] using device -1
[pixelpipe_process] [export] using device -1
[pixelpipe_process] [export] using device 0

I still see a considerable difference between OpenCL and not. And it only occurs when crop is enabled.

#9 Updated by Matthias Jansen almost 8 years ago

I could be that you have to zoom in and out again to see the noise in fullframe view (completely zoomed out), not in 100% view. I checked todays git master but still there.

#10 Updated by Johannes Hanika almost 8 years ago

do you have any auto-applying presets? like special demosaicing settings (amaze/color smoothing.. )?

#11 Updated by Matthias Jansen almost 8 years ago

I did a rm ~/.config/darktable/* and started the current git master but still the same. I only enabled the crop module as you can see on the screenshot (after the default settings).

#12 Updated by Matthias Jansen almost 8 years ago

Here is another example with ISO 320. It also gives me this effect without crop but with zooming in one step. So it is really related to resizing.

#13 Updated by Matthias Jansen almost 8 years ago

I think I found the culprit: If I switch from PPG to AMaZe the noise is gone, so its PPG together with resizing.

#14 Updated by Ulrich Pegelow almost 8 years ago

Amaze is not handled by gpu at all and falls back to cpu processing.

Interestingly you have the same gpu hardware than me. Still I do not see the noise even when zoomed in.
Could you please send us your darktablerc file, so we can see you overall settings.

#15 Updated by Matthias Jansen almost 8 years ago

I could send you the file but it also happens with no darktablerc at all.

Do you need any software-version installed?

Its a gentoo linux system.

#16 Updated by Ulrich Pegelow almost 8 years ago

Please anyhow send us the darktablerc file. The only important external part we depend on in this case is the OpenCL driver, although I would not expect the driver to be responsible for this noise.

Another information would be helpful. Please run DT with '-d opencl -d perf'. This will give us a bit more detail on which OpenCL kernels exactly are used together with profiling data.

#17 Updated by Matthias Jansen almost 8 years ago

Please see the debug-log: http://pastebin.com/n85xbJyu

and attached the darktablerc

#18 Updated by Ulrich Pegelow almost 8 years ago

  • % Done changed from 20 to 10
  • Status changed from Triaged to Confirmed

OK, now I am able to reproduce the problem. It occurs when demosaic is done by OpenCL kernel clip_and_zoom_demosaic_half_size, which is the case at certain medium zoom levels. This also explains why file export is not affected.

I need to dig deeper into the problem to find a solution.

#19 Updated by Ulrich Pegelow almost 8 years ago

  • Estimated time set to 40.00 h
  • Target version changed from Candidate for next minor release to Future

A short update on the topic.

OpenCL demosaic uses different algorithms than cpu demosaic in some parts. One consequence is the described difference in noise levels. However, this can not be fixed easily. An easy fix of the current OpenCL implementation could produce a better noise level but only at the cost of a reduced sharpness impression. This would be a bad deal, as sharpness is a more important dimension for first inspection of image quality at low resolution than noise level.

A final solution will need to tackle several of our OpenCL demosaic kernels with the goal to have them deliver 1:1 the same results as cpu demosaic.

#20 Updated by Ulrich Pegelow almost 8 years ago

I just pushed a fix to git master. Please check and report back.

#21 Updated by Simon Spannagel almost 8 years ago

  • % Done changed from 10 to 100
  • Status changed from Confirmed to Fixed

Ulrich, is this a cherry-pick candidate for 1.0.x?
If so please set the status to "Fixed: to be cherry-picked".

#22 Updated by Matthias Jansen almost 8 years ago

Yes, I it looks like the bug is fixed.

Also available in: Atom PDF

Go to top