Hi, yes I don't think I've ever used that block on its own, we mostly just program it up automatically when HDR modes get enabled (these two functions are rather entwined) - so it's a good question.
A bit of background on this block. It probably doesn't do exactly what you think. It actually lives in the pipeline as the very last thing *before* demosaic. Note that the gamma block (which probably is more what you imagine) is then happening as well, much later in the pipeline.
Therefore tonemap is operating in the Bayer domain. It constructs a local Y signal, tonemaps that, and then tries to reconstruct the Bayer at that changed brightness level, which involves scaling colour differences. There's also some weird filtering that goes on trying to create a low pass Y signal, but you definitely need to be turning that off.
Anyway, my vague recollection here is that the numbers need to be in the range 0 to 65535, not 0 to 1, so try that and see what happens. If there no weird smeary-blurry filtering going on, then you're probably OK. If there is, maybe try setting all the other parameters (apart from "tone_curve") to zero.
The other strategy would be to use the gamma block, and "compose" your tonemap curve with the one already there.
I think the practical difference between these two blocks is that the tonemap version will scale colour differences when pixels are made brighter and darker, whereas the regular gamma block won't. So with tonemap, colours might start to appear quite strong when a pixel is brightened, whereas with gamma, they may start to wash out in this case. You'll have to experiment. There might even be an interesting compromise where you apply some of the tonemap in the tonemap block, and the rest in the gamma block!
A bit of background on this block. It probably doesn't do exactly what you think. It actually lives in the pipeline as the very last thing *before* demosaic. Note that the gamma block (which probably is more what you imagine) is then happening as well, much later in the pipeline.
Therefore tonemap is operating in the Bayer domain. It constructs a local Y signal, tonemaps that, and then tries to reconstruct the Bayer at that changed brightness level, which involves scaling colour differences. There's also some weird filtering that goes on trying to create a low pass Y signal, but you definitely need to be turning that off.
Anyway, my vague recollection here is that the numbers need to be in the range 0 to 65535, not 0 to 1, so try that and see what happens. If there no weird smeary-blurry filtering going on, then you're probably OK. If there is, maybe try setting all the other parameters (apart from "tone_curve") to zero.
The other strategy would be to use the gamma block, and "compose" your tonemap curve with the one already there.
I think the practical difference between these two blocks is that the tonemap version will scale colour differences when pixels are made brighter and darker, whereas the regular gamma block won't. So with tonemap, colours might start to appear quite strong when a pixel is brightened, whereas with gamma, they may start to wash out in this case. You'll have to experiment. There might even be an interesting compromise where you apply some of the tonemap in the tonemap block, and the rest in the gamma block!
Statistics: Posted by therealdavidp — Fri Jun 13, 2025 7:14 am