Unbounded Floating Point Pipelines

Let me provide an example of scene-referred image that was entirely obtained with ICC-based tools.

It is the result of the exposure blending of 5 bracketed images. The RAW files were interpolated in PhotoFlow, and saved in the original camera colorspace before being aligned with align_image_stack. The aligned images have been re-imported into PhotoFlow, converted to linear Rec.2020 and blended with luminosity masks.

The blended image has then be saved in two versions, one in the same linear Rec.2020 colorspace, and a second version saved with a V4 sRGB profile.
Both TIFF files have been saved with a +4ev exposure compensation, which results in a significant amount of pixels exceeding 1.0 (just to demonstrate the unbounded conversions). The files can be downloaded from here.

The two screenshots below show the image without exposure compensation. The first one is a direct display of the original image, while the second one corresponds to the sRGB TIFF, re-opened, converted to linear Rec.2020 and with a -4ev exposure compensation applied.

The perfect agreement between the two images shows that V4 profiles with parametric TRCs are perfectly suited for manipulating images with arbitrarily large values…

Are we really sure about this? I mean, apart for the adoption of the teal-orange look that is so popular on Instagram and the like.
Below I put a random contemporary masterpiece that I can hardly believe was influenced by movie aesthetics…

This statement betrays the data.

I won’t be restating what I stated above. This demonstration does not counter anything I said. It clearly wasn’t understood.

Okay, here’s my experiment. I set out here to do two things 1) demonstrate scene-referenced editing with my existing rawproc program (the concept), and 2) look for the places were I’d insert OCIO (figure out where to insert the mechanism). It might also inform others trying to figure it all out, or, it might confuse mightily. Anyhoo…

To start, a couple of things about rawproc, my hack software. It’s on github, here:

For those who have downloaded a copy at some time or are synced to the github repository, you’ll not be able to replicate this specific experiment unless you sync to a commit (49d3dc) I made today, to allow inserting a colorspace tool when color management is disabled. Seemed like a good idea at the time… I’m on a path to a release, and instead of a major build in a few weeks, I might do a minor build in a day or two.

So, rawproc is a toolbox-oriented image processor. You open an image, then apply tools in arbitrary order. The list of tools applied is shown in a panel; you can add or insert tools to your satisfaction. Each applied tool has a copy of the image, developed by starting with a copy of the previous tool’s image. So, a chain of applied tools is really a stack of images, which saves time selecting images for display as well as in processing. Yes, rawproc is a memory hog. That’s a feature, not a bug…

Each tool has a checkbox that you use to select the displayed image; you can be working a particular tool but displaying another. That’ll be useful for the experiment.

rawproc has a boatload of configurable parameters, editable in the Properties dialog. To start this experiment, I turned off color management:

input.cms=0

This turns off all the automatic display and output ICC transforms; we’re going to to that by hand.

First, I’m going to open a raw image with only demosaic, white balance, and wavelet denoise, no color or gamma transform. Also, I’m going to assign the opened image it’s calibrated camera profile. Here are the properties:

input.raw.libraw.autobright=0
input.raw.libraw.cameraprofile=Nikon_D7000_Sunlight.icc
input.raw.libraw.colorspace=raw
input.raw.libraw.gamma=linear
input.raw.libraw.threshold=500

This is the same as dcraw -o 0 -g 1 1 -W -n 500. Here’s a screenshot of the result:

The internal image is 32-bit floating point, 0.0-1.0. The histogram is of the internal image, but is scaled 0-255 for convenience. This is the raw RGB data, with its original radiometric relationships ‘as-shot’. The display has no display profile applied, it’s just a transform of the 0.0-1.0 internal data to 8-bit 0-255 integer data for the GUI to render on the screen. And, the assigned colorspace is the camera gamut determined by callibration, no TRC or gamma, corresponding to the linear data, but that doesn’t show on the screen.

So now I’m going to construct a view transform using my available tools. I don’t have a LUT tool yet, but I think what I’m about to do is instructive. First, I’m going to scale the data to perceptual using a plain old 2.2 gamma:

Note the histogram, reflects the ‘spreading’ of the data to a perceptual range. Now, I’m going to apply an additional scaling to set the black and white points at the limits of the data range, 0.0-1.0, using a curve:

In OCIO, I believe these two transforms would be baked into a LUT, along with maybe other “look-oriented” manipulations. Note the flat colors; the large camera gamut is being truncated by the display. So finally, I’ll add a colorspace tool to take care of that, converting the working data to linear sRGB, which is close enough to my display gamut for this experiment:

Oh, thanks for the really nice set of profiles, @Elle; I use them all the time.

So, at this point what I’ve done is to load the camera raw as scene-linear as I can get it, then I applied three tools to construct my present notion of a view transform. Note in the last screenshot I drew a red line above the first tool; tools below the line are the view transform, and I’ll maintain the line in the next screenshots.

Now, I’m going to do some work on the image: take care of a wonky color balance, resize and sharpen for output. To do this work, I’m going to insert tools in the chain above the view transform segment of the chain, which I think would pay homage to scene-referred editing. However, I’m going to keep the last tool in the chain checked for display, WYSIWYG. Here’s the result of the color balance, applied as a blue curve followed by a red curve, manipulated to bring those channels in line with the green:

Make note of where those curves went in the tool chain, after the initial open but before the first view transform tool. Note the histogram, right now it’s always of the working data associated with the displayed image; I’m likely going to make it configurable to show the histogram of the tool in work, to support this workflow. Now, resize and sharpen:

Again, I stuck them in the chain above the view transform tools.

So, in a fashion I’d assert I’ve demonstrated scene-referenced image editing, as all of the editing tools were done on the linear data. You’ll note I didn’t adjust exposure; the scene doesn’t have a reliable gray patch, and I’m not shipping the image around so I didn’t worry that part. But I think I covered everything else. Note there was only one ICC-based transform, and that transform only did the gamut mapping from camera to display gamut.

Now, this exercise leads me to think that I could incorporate a passable first-cut at OCIO by putting its transforms from a pre-loaded configuration as an alternate selection in the colorspace tool. A decent view transform LUT would take the place of the three tools I used for this experiment.

The thing I can’t yet figure is how the camera colorspace gets transformed to the OCIO reference colorspace. Until I do, I’ll be putting in a colorspace tool first, to ICC-transform the data from the camera profile to a working profile corresponding to the OCIO configuration’s reference colorspace. Rec709 doesn’t seem right for this application, the gamut isn’t all that different from sRGB. So, I’d be looking to make a OCIO config with a Rec2020 reference colorspace. Still, until I learn otherwise it’ll take a ICC transform to go from the camera to the reference colorspace.

Comments are most welcome; I’m trying hard to figure this out.

No, it simply shows that V4 ICC profiles with parametric TRCs can correctly handle floating-point data outside the [0,1] range. The non-linear sRGB TRC that is encoded in the pixel values of the second image can be properly “undone” by a sRGB → linear Rec.2020 ICC conversion, thus restoring the correct “ratios of energies” of the original scene-referred pixel values. That’s the only deminstration I had in mind with this example.

You asked for “a V4 ICC profile that works[1] for scene referred data”, and I tried to give an example of such a thing. I didn’t mean to counter-argument anything you said, just provide an example you have asked for.

In fact, I think the main problem we are having in this thread is the lexical barrier. I am a scientist, I have a very good understanding of math as well as the details of how photons are detected and measured by photo-sensors, and I dare to say that I have a fair understanding of color management (although I am not a color scientist). However, I am not familiar at all with the jargon you are using, not because it is wrong, but because it is too accurate and technical for an outsider like me.

You might than say that I should not invest time in developing image editing software if I do not understand the technical discussions, but I would object to this as well. The math behind image editing is in most of the cases rather simple, and you do not need any VFX background to understand it correctly.

I see you removed all your posts, and that’s really a pity. I’m completely sure there is a lot we could learn from this discussion, once we get the correct key to decipher the technical terms that we find obscure…

I agree! This is such a shame. @anon11264400 could you please undo this? You might be fed up with this arguing and discussion, or frankly think you’re talking to a brick wall, but to remove your contributions to the discussion is definitely not helping us to maybe getting to some understanding of your vision.

2 Likes

And though most of this whole topic is too technical and bleeding edge for me to wrestle with, I think you’re doing a great job, I hope it goes well, keep posting!

1 Like

Could we clarify the scope of the term “garbage” that has been extensively used in this thread?

What you are saying is that doing a simple ICC transform from the linear scene-referred working space to the monitor profile, which implies some clipping if the linear values are outside of the [0,1] range, results in garbage.

My opinion is that this all depends on what is the use of the produced image. If one is editing an intermediate image that is part of a static scene or a movie, and that needs to be composited/blended with other real or synthetic images, then I understand why you consider such a final product garbage.

However, in a photographic workflow where the image seen on the screen is the final product, I do not agree. The goal is to produce an artistic result that matches the ideas and personal taste of the photographer, and not a technically correct image that preserves the linear relationship between light intensities and pixel values in the scene.

In such case, clipping might even be part of the artistic decisions of the photographer (for example to obtain an “high-key” effect).

I am convinced that for most of the users in this forum, what matters is to have at hand tools that “do the right thing”, and that help them to achieve pleasing and realistic results. It is then their choice to deviate from realism if the wish to do so. In all cases, what they see on the screen matches what they will post on the web. Sometimes a filmic-like tone mapping is a good artistic choice to get closer to the common perception of the scene being depicted, but in other cases it might go completely against the result one wants to achieve.

There are however some basic principles that I believe should be respected. To give the most simple example, an exposure correction applied to linear, scene-referred values gives a pleasing result, while the same linear scaling applied to sRGB-encoded values most likely turns out quite ugly…

I strongly support whoever tries to educate the photo retouchers to work on linear RGB data, but I have the feeling that at some point in the pipeline, the needs of pure photography as opposed to VFX/graphic design deviate quite significantly.

That said, I am really interested in trying to extend the capabilities of our FOSS tools to match the needs of fields other than “pure photography[1]”, but that does not mean that what we have been doing so far is just garbage.

[1] when I say “pure photography”, I mean the artistic process of creating a pleasing image out of a single, real-world scene. For example, replacing the sky in a picture is for me already outside the scope of “pure photography”…

1 Like

Well, me too, actually. Three technical degrees, but only four real math courses. Long story…

Beginning of last year, I thought color management was about organizing my Crayons in the box. Hurt my head mightily, but I figured out LittleCMS and how to insert it in my software. Now, the current discourse is a bit of that all over again, but also about putting things I experienced last year with ICC in perspective. In this conversation, I think intermingling the concepts with the tools has confused the conversation. Once I teased them apart, the concepts are clear. The tools, well I’m getting there…

For me, the take-home message of this topic is the obvious one: in the real world, there is no upper limit to luminance. Hence the concept of “white”, meaning the brightest possible colour, has no meaning in the real world. There are only shades of gray.

From that, much follows.

I am gobsmacked by this statement. I am reasonably sure this statement isn’t quite your intention.

A scene referred model ensures a physically plausible set of manipulations. That means things that blurs work correctly as they would, overs work, etc. Everyone here already understands the benefits of a linearized model.

What follows from that, is a scene referred model / view architecture. It cannot be a hybrid.

A scene referred model isn’t handcuffing a creative look or style. It is attempting solely to keep the various manipulations physically plausible and not corrupted by over darkening / fringing etc. and result in natural light blending, exposure adjustments via painting, etc.

As pointed out a few times, when attempting to shoehornin a scene referred model into display referred software, the following insurmountable problems result:

  • Only display a small artificial “slice” of the data will be displayed.
  • The slice of the data will not be displayed at the proper encoded output levels.
  • The slice of the data will potentially not display the correct colours.

Placing a tone map operator at the very tail end of a display referred system is the beginning of attempting to think like a scene referred system. There are other creative sweeteners that may be part of the view transform, as well as utility in optional / alternate views combined with looks.

This.

Once one has wrapped their head around this facet, the rest is a simple mental step; it applies to all operations done on scene referred data. The view forms the “render”.

2 Likes

The real question is: is aces or scene referred without IDT from raw supported/possible by all cameras?

It looks like it’s possibile to use an aces workflow only if the camera’s manifacturer gives support to aces.
https://www.usa.canon.com/internet/portal/us/home/explore/product-showcases/cameras-and-lenses/aces-compatibility-software

https://groups.google.com/forum/m/#!topic/academyaces/CijK3EGJPpE
“I’m interested in converting Nikon RAW NEF files into ACES”

"
Understandably, there’s a desire to use footage from cameras that aren’t
classified as “motion picture” cameras, or we haven’t had detailed
conversations with the manufacturers about. In those cases we’d encourage
you to contact those manufacturers and tell them about your desire to use
ACES with their products. We’re very happy to work with any manufacturer to
integrate ACES.

In some cases we may have the ability to create reasonable IDTs without the
direct support of the manufacturer"

Why a raw file needs an IDT?

I think that this can be taken as the first stone of our new building. So let’s take for granted that we agree on the advantages of manipulating pixels in linear, scene-referred representation.

However, we are still hitting a wall when we come to the point of sending the linear pixel values to the output device. Here again, I think we agree on the general concept that a view is needed to map the scene-referred values into the dynamic range of the output device.

That said, let’s see if we can find a concrete starting point. Would you agree with the following statement?
In a non-destructive workflow, an ICC conversion from the linear scene-referred working colorspace to the output display profile is a very specific, and possibly over-simplified, kind of view transform.
Here, non-destructive workflow means that the user always manipulates the linear pixel values, which are then converted to the display profile on-the-fly.

Yes.

Even data forwarded to output without an ICC is a form of a view transform with similar problematic limitations, as both end up being a display referred dump[1].

[1] There has been much talk about the potential for a parametric V4 ICC leprechaun for scene referred data. No such official sighting has been corroborated by authorities, and said leprechaun is still considered at large.

An example of this is the default view in Blender. (and the reason why Filmic Blender was created).
Thanks to OCIO it was possible to replace that poor default view for something better, and it’s a mechanism that allows to implement easily other views and other devices as needed.
Back to Blender’s crappy default: It just dumps the 0,1 portion of the scene data to the display and applies the non-linear gamma function.
The result is what I showed earlier with the swatches example, and can be confirmed with GIMP, Photoshop, Darktable and all the programs that dump that data to the screen.
Now, compare that to what a camera usually does (even a point and shoot camera that produces jpegs): There is ALWAYS a transform that compresses the camera’s DR in the display range and re-arrange the tone distribution in a pleasing/natural way.
Even Darktable starts with an autmatic base-curve similar to what camera models apply (unless you override it and turn off the base curve).
Nothing wrong with that, because one expects to get a picture as close as the real scene that was shot. Some artists will prefer to turn off the base curve and go for a personalized tonemap, but the issue remains: You don’t want the data just dumped to the display. You want some degree of wysiwyg.
OCIO view transforms allow that, and in a way that doesn’t mean that you have to actually modify the scene-referred data. That information remains available, making the image operations produce a physically plausible result (which is otherwise adversely affected when the display transform is baked in the pixels).

Garbage is information that will produce undesired results when processed, or that it won’t be displayed properly. Conversely, a view that doesn’t display valid information properly can be treated as garbage too :smile:
I guess the concept has different meanings depending on what you expect from your processing pipeline, but what I do know is that scene-referred images are a proper digital representation of your scene. That means in practical terms having a “virtual scene” you can shot with one or many “virtual cameras” (the view/display) and in every case the output will be correct.
Imagine a scene-referred image as a virtual scene you can take with you. Want a sRGB jpeg from it? Want a rec.2020 tif? done. Want an HDR image for your 1000 nits TV? Also possible. All from the same master.
Sure, you may argue that the same is attainable from a RAW image, but think about convenience: Can you edit a RAW straight away, or you have to go through the development process again and again for different outputs? The first advantage of a scene-referred workflow is that convenience.

Next: different cameras (forget about cinema for a moment, let’s talk about photography): You and your buddy are going to take pictures at a party. You like Canon, he prefers Nikon.
Your model has a DR of 12.5 stops, his only 11 and some. Different primaries, different looks. But you want the party photos to be consistent.
With the usual display-referred workflow using a raw development software this is usually a headache, specially because most softwares aim to mimic the vendors secret sauce as starting point, so you have to manually compare shots side by side trying to produce a unified look, which is tedious, error prone, and never turns out really well unless you put an insane amount of work on it.
Scene-referred in a common reference space through the same view transform greatly mitigates that. Not to mention how much easier is obtaining a unified grading from that (basically you’ll use the same look on the different shots and everything will be consistent, making the fine-tuning the only remaining step).

I’m not saying that you CAN’T do that with a display-referred workflow, but it doesn’t take much to realize how a proper scene-referred model with a detached view is beneficial.

p.s.: I would like to study the examples posted above by @Carmelo_DrRaw and @ggbutcher but I think it would be better to do it in separate threads. This one got too long and broad.
Could you please move them to specific threads so we discuss them there in depth?

1 Like

That’s another point that needs some further clarifications. The FLOSS RAW processors that we are usually discussing in this forum (at least RawTherapee, Darktable, PhotoFlow, and I guess also RawProc) all offer the possibility to generate neutral renderings of RAW files. This can be based either on custom-made camera profiles obtained from color-checker shots (or something equivalent), or on the standard matrix camera profiles provided by Adobe. In both cases, although with different accuracies, the processed RAW file provides colorimetrically correct colors (hope this is the right term).

The neutral rendering is the default one in PhF, and it can be selected with a couple of mouse clicks in RT and DT. In this case, the three editors give practically the same rendering for the same RAW file, at lest at the level of display output. PhF is more geared toward linear RGB editing (by default, the interpolated RAW image is converted to linear Rec.2020), while RT and DT go through an internal RGB-> Lab conversion.

I have copied the relevant part of the post in the PhotoFlow specific thread: Scene-referred editing with PhotoFlow - #28 by Carmelo_DrRaw

Yes, rawproc essentially offers the equivalent of dcraw’s -o 0 -g 1 1, which delivers a RGB image array bereft of both the conversion of the camera colorspace and transforming the data from linear to perceptual. It also allows one to assign a camera-calibrated profile to this data.

Oh, of note is that I re-organized the dcraw semantics for -W, “don’t autobright, default do” to “autobright, default don’t”. So, rawproc doesn’t autobright unless you specifically tell it to do so.

All of the above contributes to delivering linear data to the rawproc workspace. So, my understanding is that this data would then require application of an exposure tool with adjustment to put a known middle gray patch in the image at 0.18. Then, the data could be called scene-referred.

Yes, I’m aware of that. What I wanted to highlight with that comment is what users get: It’s either a vendor-like base curve as a starting point, or it’s a non-wysiwyg view.
In the case of the former, you get the data altered already, in the case of the latter you get a visual feedback that is not what you expect, and unless you’re really aware of how the program processes the data, it’s not immediately obvious what’s the next right step to make.
With a view transform you solve both problems automatically and simultaneously.

If it’s already confusing to adjust a single photo when your view isn’t wysiwyg, think about matching shots from different sources.

In a proper scene-referred workflow you only need your linear data scaled so middle gray is pegged at EV0, and what you get from the view is what you expect (something close to what you saw though your viewfinder when you captured the scene).

That being said, it is clear that non-destructive raw development tools are closer to a proper scene-referred workflow than other tools (like GIMP or Photoshop) that were designed to deal with display-referred imagery.
The basics are covered, processing linear RGB in 32f precision without clipping intensity is of course the way to go, but you still need to deal with the transforms from-reference and to-reference and you still need a proper view transform and make sure that the operations are geared towards scene-referred linear RGB (without flipping the actual pixels to non-linear or switching to different color models).
The from-reference and to-reference transforms can be certainly done through OCIO. It has been suggested here that ICC transforms could be used for that too, although are little to none real-world examples of floating point transforms using ICCs (and this is only a part of the discussion).
Then we have the view tranform. Also covered by OCIO.

“Neutral” would be in the colour space primaries that are of your camera.

When experimenting here, it is going to be far easier to start with REC.709 based primaries as a majority of views are designed for REC.709 based primaries. For example, the Filmic set was intended as an introduction to the scene referred domain, and as such, many folks aren’t aware of primaries and the target of REC.709 was chosen for ease.

Exactly.

That is, if you had a spot meter and plopped it into the scene where your +/- EV0 point would be according to your exposure, the grey card would ideally meter 0.18 when loaded from a linearized TIFF via dcraw -T -4.

Of course, actual white balance will matter here if one is seeking R=G=B channels, and that would require shooting with a D65 white point, or using a manual Bradford adaptation matrix for the input, which could be integrated into the OCIO transform for the particular camera and reference space needs.

1 Like

So, I’ve noticed quite a few deleted posts in this topic. While I understand that a user should have control over their own posts and information, it can be disruptive to understanding the flow of the discussion and breaks the context that much of the conversation may depend on. This makes it particular hard for others, or future others, to follow the topic (which is especially hard in a topic that is already above my head, and quite long).

This also breaks the normal transparency that is a nice way to see how a conversation may develop or flow.

Pretty please consider this carefully before deleting things - maybe edit them or add more context to them if needed instead? I feel like there’s really good information here, even if there’s some mis-understandings, and it would really suck to lose that information for others (even future Pat when he finally is able to wrap his head around color stuff).