Add new comment

I think I sort of got it to work

Well, after some tests and thinking, it downed to me that I should just adjust the gamma curve, there is no point in multiplying everything with a constant multiplyer.

So my function is now like this, and it works (but not exactly how it does in RawTherapee)

void do_color_curve()
{
    int i;
    double resulting_gamma;
    double max_color=original_exposure_max_channels*(1.0f/exposure);
 
    for(i=0;i<65535;i++)
    {
        double i_double=i;
 
        resulting_gamma=pow(i_double/(double)max_color,1.0f/gamma);
        if(resulting_gamma>1)resulting_gamma=1;
        color_curve[i]=resulting_gamma*255;
    }
}