What is the source file for noise reduction?

I’m planning on “stealing” the chroma noise reduction for Filmulator, but I haven’t been able to tell what source file has the routines I’m looking for.

Can anyone offer guidance?

Thanks.

1 Like

@CarVac As you only want chroma noise reduction, you can simply ignore the fftw parts in the code as they are for luma noise reduction only.

1 Like

Yeah, I’m not the biggest fan of the way the luma noise reduction turns out.

1 Like

Actually, my friend who helped start the program with me actually made his own non-local means implementation for Filmulator…

Depending on the parameters it takes about 2 to 4 seconds for 21mp on my Ryzen 2700X.

It does have blotchy chroma noise though, so I’ll most likely still be using the RawTherapee chroma NR.

My comment on non local means was for your comment

I’m not the biggest fan of the way the luma noise reduction turns out.

For chroma noise reduction, have a look at the code I mentioned in first answer

This exchange is prime example of why open source software is so great. You can really mix and match and start again from scratch if you have the coding knowledge, and one person creating an algorithm inevitably helps others.

3 Likes

I’m still working on this, and I have a few questions.

  • How does denoiseNestedLevels work? Looks like there’s a namespace global or something…
  • Qt Creator has a clang-powered error checker now, and it’s saying that LUTf doesn’t have a subscript operator so you can do lutname[value]. As far as I can tell, it is properly defined in LUT.h. Is this just something that will work in gcc?

It can be a nice tool (Luma NR) if you can mask it and if you have the self control to apply only a bit. I am actually surprised in DT with Auto-wavelets what a nice result you can get often without any real loss in detail.

1 Like

I’ve tested combining nonlocal means luma NR with RawTherapee’s chroma noise reduction and it works really well, so that’s what I’m planning to do.

However, I do need to get the chroma NR working in the first place. There are some color space conversions to figure out too.

I can only image its a big project…

I don’t think so. RT code is fairly easy to understand because the devs are mindful of that. However, time and effort is part and parcel of any dev work. I look forward to seeing noise reduction in Filmulator.

I can’t tell you how the denoiseNestedLevels work unfortunately, except that it’s been in the codebase for a long time (6+ years). Not sure who introduced it or why. At least git blame doesn’t help me. What I can say is that it seems to only be necessary for luma noise reduction, so you might not need it when figuring out the chroma noise reduction.
The approach lutname[value] should definitely work, even for interpolated values. I also think people like @Floessie would have caught errors in building with clang, so you should be good.

@CarVac Is there something else in particular you can’t seem to get figured out?

Well… :roll_eyes: I’d give it a B-

1 Like

@CarVac Also be aware that a proper calculation bug was fixed recently: Fix NR luminance detail recovery calculation · Beep6581/RawTherapee@62996e1 · GitHub

I’ve stripped out the luminance NR from it anyway.

I need to take a fresh look at the LUT issue tomorrow, and hopefully someone else can chime in in the meantime.

It is a work in progress. :slight_smile:

2 Likes

@CarVac Hi Carlo! We met at LGM2019. :smile: Roel is right: I regularly check RT compilation with GCC and Clang on different architectures with Debian VMs and there are currently only a few warnings using Clang 13. And you’re right that rtengine/LUT.h has a bunch of subscript and call operators for all kinds of purposes. Some of them are guarded with std::enable_if<>, some use vfloat, which could contribute to the fact that QtCreator’s indexer has a hard time to figure it out. But that’s definitely QtCreator’s problem, not Clang’s.

HTH,
Flössie

1 Like

Denoise has a main loop which can be tiled. If it is tiled, e.g. 3x3 tiles, it can use 9 parallel threads. If your machine has e.g. 24 cores, the denoiseNestedLevels will be 24/9 = 2, means for each of the 9 threads 2 threads will be used for the inner loops in wavelet processing.

Usually the main loop is not tiled, means it uses only one thread. In this case the denoiseNestedLevels will be the number of cores of your machine.

1 Like

This is mildly infuriating.

1 Like