Re: Documentation issues


Jeremy Selan <jeremy...@...>
 

Hello!

Sorry you're having trouble with the documentation. Which specific
file or url are you at? I'd like to update it to make sure it's
current.

I'd recommend looking into src/apps/ociodisplay/main.cpp

Even though that's a GPU example, 95% of the code would be unchanged
even if we were to use the CPU pathway. (Actually, maybe I should
have ifdef's for CPU vs GPU? It's a nice example.

See UpdateOCIOGLState(), up to the processor = config->getProcessor(transform);
At that point, you can directly apply the processor to perform and
in-place color conversion on your image.

// Wrap the image in a light-weight ImageDescription
OCIO::PackedImageDesc img(imageData, w, h, 4);

// Apply the color transformation (in place)
processor->apply(img);

Unfortunately we dont offer native support for half-float buffers on
the CPU side, so in the meantime you will need to copy to float32.


The reason some applications expose file selectors is for people who
dont want to use OCIO configurations, but still want to be able to use
raw existing luts. (This is essentially for backwards compatibility).
I would say to not worry about this for now, for an initial
implementation.


By the way, I would *highly* recommend looking into using the GPU
pathway for creating a display. (You should be able to steal much of
the code from src/apps/ociodisplay/main.cpp). For places where
you're baking color transforms into images (loading/saving images,
etc) the CPU pathway is preferred. But for situations where you will
be playing back image sequences to the display, or handling pan/zoom
with frequent updates (real-time preview), the GPU pathway is much
higher performance. Also, when using the GPU codepath you can store
the underlying image in any data type you like. (such as half float,
or even integer should your color-space be amenable to it).

-- Jeremy

On Mon, Jun 11, 2012 at 1:50 AM, Boudewijn Rempt <bo...@...> wrote:
Hi!

I'm trying to integrate OpenColorIO into Krita, a 2D painting application
written in C++, and I'm having a bit of trouble with the documentation.

I'm first implementing the CPU path in Krita, GPU will follow. In the CPU
display example, it says

const char * transformName = config->getDefaultDisplayTransformName(device);

I suspect that this should be

const char *  view = config->getDefaultView(displayDevice);

and

transform->setDisplayColorSpaceName( displayColorSpace );

doesn't exist anymore either, so I'm setting view and display on the
transform.

Then I was looking at the mari toobar code, since that probably is closest
to what Krita needs. I don't get why there is a separate file selector for
lut files -- aren't those referenced in the config.ocio file to define the
colorspaces I can get from the config object?

Finally (for now) does OpenColorIO support half as well as float? If not,
I'll need to convert my half data to float before going through ocio -- not
that big a problem, of course, but I would prefer to keep copying and
conversion to a minimum.

--
Boudewijn Rempt, http://krita.org

Join ocio-dev@lists.aswf.io to automatically receive all group messages.