I am stuck with some basic math.
Anybody help me?
I need to reverse the Color Grading filter calcs and solve for input Lift, Gain and Gamma
For some odd reason the results indicate that the Shotcut is not using the code that Austin posted above.
Perhaps an older version.
This code gives same LUT as Shotcut. (just showing code for one color:
// Convert to gamma 2.2
double r = pow( (double)i / 255.0, 1.0 / 2.2 );
// Apply lift
r += rlift * ( 1.0 - r );
// Apply gamma
r = pow( r, 2.2 / rgamma );
// Apply gain
r *= pow( rgain, 2.2 / rgamma ); <<<< not as expected
// Update LUT
self->rlut[ i ] = (int)(r * 255.0);
I need 3 procedures:
ComputeLift(X, Y, Gain, Gamma)
ComputeGain(X, Y, Lift, Gamma)
ComputeGamma(X, Y, Lift, Gain)
I check that the results do not cause overflow / underflow so the values can always be assumed to be within range.