This new replacement in C is 13x faster than the previous work in swift using CIImage.
The color results are not the same, but close. In the screenshot above, the top row is the original implementation and the second row is the replacement.