float3 applyLiftGammaGainOffset(float3 color)
{
	float3 liftAdjust = (lift.rgb - 0.5) * 0.5;
	float3 offsetAdjust = (offset.rgb - 0.5) * 0.5;
	float3 gammaAdjust = exp2((gamma.rgb - 0.5) * 2.0);
	float3 gainAdjust = exp2((gain.rgb - 0.5) * 2.0);

	float3 lifted = color + liftAdjust;
	float3 gained = lifted * gainAdjust;
	float3 corrected = pow(saturate(gained), 1.0 / max(gammaAdjust, float3(0.001)));
	return corrected + offsetAdjust;
}

float4 shadeVideo(ShaderContext context)
{
	float4 source = context.sourceColor;
	float3 graded = applyLiftGammaGainOffset(source.rgb);
	source.rgb = lerp(source.rgb, graded, strength);
	return saturate(source);
}
