Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.9k stars 323 forks source link

Black boxes in exported image (combining Local contrast and Tone mapping) #5874

Open wilchak opened 4 years ago

wilchak commented 4 years ago

Hello again,

I am seeing black boxes in my exported images, seemingly at random. The number and location of these black boxes seem to be affected by the overall exposure/brightness of the image. (I saw a couple of old bug reports indicating there was a past black boxes bug affecting RL Deconvolution sharpening, but I tested it and changing just RL Deconvolution vs Unsharp Mask has no effect on these particular boxes.)

I've been performing tests with regular JPG export, no resizing. Presently using the dev AppImage 5.8-2377-gb553121_20200727.

Filebin link includes Sony ARW raw, PP3 with settings to reproduce, and two exported JPGs demonstrating the issue. https://filebin.net/2rtrnqesvqniom8n

Please let me know if there's any additional help I can give, as this is kind of a major bummer for me. Thank you!

Two updates: 1) a very similar, but non-black&white version of this PP3 just crashes during export. (If it is possible to get a gdb stack trace from an AppImage, let me know how to do it and I will send one over. 2) when Tone Mapping is disabled, everything looks and works 100% perfectly fine. But the Tone Mapping tool is so great! Please help.

Thanatomanic commented 4 years ago

Tone mapping is notorious for its high CPU and RAM consumption. It takes my fairly hefty machine ~almost~ more than three minutes to process this image in queue! My exported JPEG does not show black boxes, Yes it does, I need my eyes checked so my first guess is that this is an artifact due to memory limitations on your end. How much RAM do you have? but Floessie says no :wink:

Here is my export: _DSC0144

Floessie commented 4 years ago

@Thanatomanic Um, no.

First of all, it there isn't enough physical memory, the OS will provide virtual one by swapping out pages. When even that is exhausted, the allocations will return nullptr and RT isn't prepared for that, so it will segfault.

The fact that you aren't seeing the blocks is more likely because you're running on Windows, if I'm not mistaken. Windows zeros allocations, whereas Linux doesn't. So uninitialized memory is harder to detect on Windows than on Linux.

HTH, Flössie

heckflosse commented 4 years ago

when Tone Mapping is disabled, everything looks and works 100% perfectly fine. But the Tone Mapping tool is so great!

How about disabling Local contrast while keeping Tone Mapping enabled? Does this work?

Thanatomanic commented 4 years ago

When even that is exhausted, the allocations will return nullptr and RT isn't prepared for that, so it will segfault.

@Floessie I just tried exporting on my VM Linux Mint and it did crash during export. Maybe not the best benchmark, but still...

wilchak commented 4 years ago

@Thanatomanic Actually, your export DOES have one black box, in the lower middle of the frame. Yeah, Tone Mapping is crazy heavy on the CPU, especially with Reweighting Iterates set to 4 (even more expensive than the default of 1). But..... a value of 4 results in slightly better image quality than 1. (I used to use 10. I am a little insane.)

@heckflosse Yes, that works. No black boxes with Local Contrast disabled and Tone Mapping enabled. Something about the combination of two seems to create the problem.

I think for now I'm just going to disable TM in my work.... at least my exports will be a lot faster...

Thanatomanic commented 4 years ago

@wilchak You're absolutely right. So, marking this as a legitimate bug.

heckflosse commented 4 years ago

This is a duplicate of another issue (have to dig it out...)