Page MenuHome

Standalone: apply sRGB conversion in OpenImageIO output driver
Needs ReviewPublic

Authored by howetuft (howetuft) on Nov 15 2022, 10:44 PM.

Details

Summary

This revision follows D16482. In the latter, final sRGB conversion was only approximated by a gamma correction.
The present revision is more accurate:

  • when OCIO is available, the sRGB conversion relies on OCIO system
  • when OCIO is not available, an exact sRGB conversion, based on accurate color_linear_to_srgb, is still applied.

Diff Detail

Repository
rC Cycles

Event Timeline

howetuft (howetuft) requested review of this revision.Nov 15 2022, 10:44 PM
howetuft (howetuft) created this revision.

An additional consideration:
OIIO also provides an accurate color space conversion solution: https://openimageio.readthedocs.io/en/latest/imagebufalgo.html#color-space-conversion (I hadn't seen it before, I apologize).
This can be another alternative to the above code. Pros: OIIO code is optimized, especially parallelized - although this conversion treatment is probably not critical. Cons: we have less control over the conversion function than with the internal color_linear_to_srgb function.
-> Can you let me know your preference, OIIO vs. internal, and I'll adapt accordingly?

howetuft (howetuft) edited the summary of this revision. (Show Details)

Update: use OCIO when available

Brecht Van Lommel (brecht) requested changes to this revision.Nov 28 2022, 6:14 PM

For OpenColorIO, we can't assume a colorspace named sRGB is available. We can assume the existence of the scene_linear role.

What it should do it is use the default display and default view transform in the OpenColorIO config, and save using them. And then if we want more control, there can be options to specify the display, view transform and look on the command line. Something like:

const char *display = config->getDefaultDisplay();
const char *view = config->getDefautlView(display);
DisplayViewTransformRcPtr dvt = DisplayViewTransform::Create();
dvt->setSrc("scene_linear");
dvt->setView(view);
dvt->setDisplay(display);

If the purpose is to always write out sRGB, there is no need to involve OpenColorIO for that.

This revision now requires changes to proceed.Nov 28 2022, 6:14 PM

OK, I made a proposal: just tell me if this fits with your target (I'm not sure I have caught all your vision).
If so, I'll add the expected command line arguments in a second time.

I think we should also find a way to register the colorspace in the saved file, otherwise an external viewer will considerer it as sRGB by default, don't you agree?