L* gamma

Is there a way to specify libraw to use the L-star gamma function? Or do I need to manually apply the function, and then specify the libraw linear function?
I mean this formula (from lindblum.com): (linear <= (216.0 / 24389.0)) ? (linear * 24389.0 / 2700.0) : (1.16 * Math.pow(linear, 1.0 / 3.0) - 0.16);


Output curve is used only on

Output curve is used only on output phase (dcraw_make_mem_image or dcraw_ppm_tiff_writer)

So, you may modify source and replace calls to gamma_curve(...) by own output curve creation.

No direct way in LibRaw to do that, we'll consider to add some interface for user-defined curve in 0.19 release.

-- Alex Tutubalin @LibRaw LLC

Thanks for the quick response

Thanks for the quick response.
I found the answer to my question. It's very simple. For L *, use gamm [0] = 1/3 and gamm [1] = 9.033.

With best wishes, Konstantin

gamma correction

I also want to pick a single gamma curve and apply those same remap value to hundreds or thousands of images. So having the ability to directly manipulate the libraw_colordata_t.curve[] data in lieu of defining gammas would be VERY nice. I find on 50mp canon cr2 images calculating the gamma curve remap per image is almost 15s per image on an ivy bridge xeon.

Just changed (in copy_mem

Just changed (in copy_mem_image code)

    gamma_curve(O.gamm[0], O.gamm[1], 2, (t_white << 3) / O.bright);


	for(int i = 0; i < 1000; i++)
		gamma_curve (O.gamm[0], O.gamm[1], 2, (t_white << 3)/O.bright);

And run Canon 5Ds image though profiler (Intel VTune amplifier). Gamma curve (1000 repetitions) takes 0.619 seconds, so usual one-time run should be about than 0.6 msec
CPU: i7-7700k at base speed.

Other processing: 411ms for decode, 700ms for scale colors, 900ms for (fastest available) linear interpolation, so about 2sec total.

So, gamma_curve is less than 1/3000 of total processing time for such large files.

Either your profiler is wrong, or your math library (pow(), log(), or exp() functions) is incredibly slow.

-- Alex Tutubalin @LibRaw LLC