BradLarson/GPUImage — pull request #1071 by karlvr (2013-07-06 21:48:04+00:00)
Title: Tone curve filter: fixes missing last point and incorrect application of RGB curve in conduction with individual channels

It looks like I didn't submit a pull request for this back in December when I discovered this issue! Sorry about that.

Firstly, the last point in a curve is missed if the last point has an x value < 1.0. Because the curve gets close but not exactly right this can be a little difficult to see, but I have verified this by examining the array of points produced.

Secondly, the tone curve doesn't correctly apply an RGB curve in conjunction with individual R, G or B curves. The RGB adjustment needs to be made after the individual channels. You can prove this fix with a simple experiment in Photoshop: add a curves adjustment layer with an R curve and an RGB curve. I choose [0,0] [0.5, 0.5] [1.0, 0.1] for both. After this patch the output from GPUImageToneCurveFilter matches the result in Photoshop.