EndlesslyFlowering / ReShade_HDR_shaders

ReShade shaders focused on HDR analysis, (post) processing and (inverse) tone mapping.
GNU General Public License v3.0
203 stars 6 forks source link

[Feature request] Add option to exclude top/bottom 0.1% of pixels from measurements #32

Open KoKlusz opened 2 months ago

KoKlusz commented 2 months ago

Sometimes a stray pixels can mess up the measurements, this would help avoid that.

EndlesslyFlowering commented 2 weeks ago

I have thought about this for a while and it is very complicated to do efficiently. Since 3840 * 2160 * 0.001 = 8294.4 which makes that 8294 pixels that I would need to keep track off and make that double for the max and min. And that takes a lot of performance.

My old solution for this was to sample a 3x3 area with the max or min in the middle and take the average of that. Problem with that is there could be multiple pixels with the same max or min value.

I guess 0.01% would make it more reasonable? 3840 * 2160 * 0.0001 = 829.44 so 829 values to keep track off. 495 values for 3440x1440, 368 values for 2560x1440, 207 values for 1920x1080 and 92 values for 1280x720. Make it double for all values of course.

I wanted to make this for a long while. Pretty close to the beginning of creating these shaders actually. For a while there was unused code for this in the source. I removed that a while ago...

Hmm I guess sorting could also be done. That sounds like pain to optimise 😬. Maybe when I am really bored.