IIRC one of the reshade shader packs (MasterEffect Reborn) had this shader, but thought it was a "stupid thing, author created unnecessarily messy code so rewriting it is difficult when nobody understands HOW it is actually working,"
Given its copypasted presence in a 'effect pack', what were they expecting, a superHDcalifrasticifier? 😐
Also it's not really a "nightmare", it just requires some more passes because the filter must work four times consecutively after the dither (faking a 16-bit pixel buffer). Then lines and gratuitous gamma correction are done after. I haven't looked into Reshade itself yet, but i'm betting it'll be quite easy to have leifx working properly in there. Given that it's a shader to mock the effects of a DAC, it should be done last, but before any signal/monitorscreen shaders.
now if you want MESSY filter code, look at my C version submitted as patches to PCem... 😵 I have to make lookup tables to keep the performance somewhat sane, and it only really works well with Intel Core processors. But when it works, it looks somewhat good
I feel a form of SIMD could be used here, but I know jack about intrinsics and simd assembly.

long live PCem
FUCK "AI". It is a tool of fascism. We do not need it. We do not use it.