DaVinci Resolve and ML Raw

Started by baldavenger, September 01, 2015, 11:41:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SpcCb

Quote from: baldavenger on December 28, 2015, 08:00:19 PM(...)
I'd prefer to continue to focus on developing new approaches though, (...)
+1

This thread is massively interesting.

baldavenger

I shot a lot of difficult footage during the summer as a means of testing my camera, ML Raw, and my post production process. One of the most difficult scenarios is when shooting a scene with a high dynamic range and lots of glare, especially if you're pushing the camera by way of higher fps (at the expense of vertical resolution) or Dual-ISO. Sometimes the aliasing and moire (and other weird artifacts) are too pronounced to overcome, therefore rendering the image useless. However, in cases where the outcome is borderline it is definitely worth exploring possible redemptive options.

I was reasonably happy with the composition of some 60fps footage I shot on a beach, even though I was having problems with my polariser, UV, and ND filters (bad skills on my part). I compounded the already bad situation by closing down the aperture to f18, and along with shooting at a resolution of 1728 x 458 (to get 60fps without skipping) I was asking for trouble.

I used MLVFS to convert the MLV file to DNGs. I found that the Bad Pixel and Chroma Smoothing actually made the artifacts worse, so I got better results by not selecting those options.



I found a noticeable difference when I opened one of the DNGs in ACR, compared to Resolve. ACR still has a better debayer system and provides a cleaner starting point, but overall Resolve offers more control with regards to video.





You can already see how washed out and almost colourless the image is, and how all the micro details and highlights can prove difficult to deal with.



Selecting Highlight Recovery in Camera Raw didn't help much



I tried different ways of rescuing the highlights, but pulling keys and blurring channels proved a bit ineffective. I tried splitting the signal, but no joy, and even when there was progress there was detrimental effects elsewhere.
What finally worked came from a chance discovery. I tried out a blur plugin (free from Red Giant Universe) and turned vertical blur down to zero, creating the streaks that covered the artifacts without messing up the smaller waves. It provided the base for the rest of the grade. I fine-tuned and settled on a preferable wash, then added grain in a post-group clip. Although I tried originally in sRGB, I found it was overall easier to deal with both the good and bad while in Cineon.






Here are some downloads. The first is the original MLV file, the second is a ProRes 422HQ final pass, and the third is a compressed H264 version.


https://www.dropbox.com/s/ztf8zh0bjqw9ks3/Test%20MLV%20Folder.zip?dl=0

https://www.dropbox.com/s/dbetn0s74j2f1zu/Brazil_Beach_Test_Pass_2.mov?dl=0

https://www.dropbox.com/s/hp5hq2ulo9jrsgo/Brazil_Beach_Test_Pass_2_H264.mov?dl=0


And a token butchered version on Youtube





So there you go. Solutions can be found to even the most difficult conundrums, albeit with a bit of luck now and again.



EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

baldavenger

There is now an OFX plugin that allows for the input of math expressions in Resolve, and it's open source. It's called ChannelMath, and was primarily compiled for Natron but functions just fine in Resolve. Simply download from Github and place in Library/OFX/Plugins.

https://github.com/nicholascarroll/openfx-misc/releases

I tested with a LogC to Linear expression, an Alexa Wide Gamut to Rec709 3x3 Matrix expression, and a Linear to Rec709 transfer function expression.








It's slow (especially with a modest set-up) but caching is your friend, and even if you prefer to stick with speedier LUTs there will always be the option of 100% verification.

Well done Mr Nicholas Carroll, whoever you are  :D
EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

DeafEyeJedi

Seriously how'd you managed to find that plugin @baldavenger?!?!

Looks useful and definitely worth a try. Will dig into this some more and Thanks for sharing.
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

baldavenger

It was very much a chance occurrence. I installed Natron a while back so I could get a better understanding of the basics of OFX plugins, and in the process I signed up for monthly email updates (or something like that). None of the plugins I managed to install were of any use, so I didn't pay that much attention whenever updates occasionally came along, but I half noticed the word math when I quickly glanced at the email that came today so figured what the harm in checking it out. Even when I installed it and booted up Resolve I either expected it not to resister at all in the OFX library, or to be just another dud.

What a lovely surprise it was to be proven wrong. Really unexpected, and really quite wonderful. A few minor tweaks and it could prove to be a major contribution to workflow in Resolve.
EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

Andy600

Nice find! Apparently all the Natron plugins 'can' work in Resolve. (see: https://github.com/devernay/openfx-misc/issues/36)

They just need a small tweak to the manifest when compiling and some linked DLL's to be included in the distro (plus you might also need FFMpeg installed for some to work). The plugins are in bundles but each can be compiled separately. You'll need a C++ compiler to do it - I've got VS so I'll have a go at a Windows build over the weekend and share if I get anywhere.
Colorist working with Davinci Resolve, Baselight, Nuke, After Effects & Premier Pro. Occasional Sunday afternoon DOP. Developer of Cinelog-C Colorspace Management and LUTs - www.cinelogdcp.com

baldavenger

Thanks Andy  :) I managed to get a few of the Natron plugins working in OSX by some basic compiling, but the more practical stuff never used to work. Something to do with parametric parameters. I know very little by way of coding, so I was more stumbling in the dark and hoping to get lucky.

If the plugin could be modified to have more expression inputs (like a similar node in Nuke or Fusion) and incorporate proper GPU acceleration, then it really would be a very useful tool. I'm sure there's a way to make that so.
EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

baldavenger

I ran a few more tests with the ChannelMath plugin. The parametric parameters issue that plagues the other OFX plugins is still present, but it's just a minor inconvenience really. I had hoped to use param2 to turn the plugin into an extended waveform viewer, but that can still be done only without the added ease of a slider.

I had a go at nesting expressions into expressions, and the results were good. That is to say, instead of having separate plugins to perform specific tasks, I wrote everything into one long expression to see if concatenation was viable.

I tried combining a LogC to Linear, Alexa Wide Gamut to Rec709, and Linear to LogC.

LogC to Lin

r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655

g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655

b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655

Alexa Wide Gamut to Rec709

(r * 1.617523) + (g * -0.537287) + (b * -0.080237)

(r * -0.070573) + (g * 1.334613) + (b * -0.26404)

(r * -0.021102) + (g * -0.226954) + (b * 1.248056)

Lin to LogC

r > 0.010591 ? 0.247190 * log10(5.555556 * r + 0.052272) + 0.385537 : 5.367655 * r + 0.092809

g > 0.010591 ? 0.247190 * log10(5.555556 * g + 0.052272) + 0.385537 : 5.367655 * g + 0.092809

b > 0.010591 ? 0.247190 * log10(5.555556 * b + 0.052272) + 0.385537 : 5.367655 * b + 0.092809

Nesting the LogC to Linear expression into the Alexa Wide Gamut to Rec709 expression, and then nesting that into the Linear to LogC expression, results in these expressions (for R, G, and B respectfully):

(((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655) * 1.617523) + ((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655) * -0.537287) + ((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655) * -0.080237)) > 0.010591 ? 0.247190 * log10(5.555556 * (((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655) * 1.617523) + ((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655) * -0.537287) + ((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655) * -0.080237)) + 0.052272) + 0.385537 : 5.367655 * (((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655) * 1.617523) + ((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655) * -0.537287) + ((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655) * -0.080237)) + 0.092809


(((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655) * -0.070573) + ((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655) * 1.334613) + ((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655) * -0.26404)) > 0.010591 ? 0.247190 * log10(5.555556 * (((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655) * -0.070573) + ((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655) * 1.334613) + ((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655) * -0.26404)) + 0.052272) + 0.385537 : 5.367655 * (((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655) * -0.070573) + ((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655) * 1.334613) + ((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655) * -0.26404)) + 0.092809



(((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655) * -0.021102) + ((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655) * -0.226954) + ((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655) * 1.248056)) > 0.010591 ? 0.247190 * log10(5.555556 * (((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655) * -0.021102) + ((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655) * -0.226954) + ((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655) * 1.248056)) + 0.052272) + 0.385537 : 5.367655 * (((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655) * -0.021102) + ((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655) * -0.226954) + ((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655) * 1.248056)) + 0.092809





There's a serious performance hit with such long expressions, but it's good to know that it works and that it is an option.

EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

baldavenger

There was something odd about the Cineon Film Log option in RCM with the 12.2 update in Resolve. Turns out it was only affecting Raw files (well, at least CinemaDNG), and not regular footage. The same was also happening when choosing Linear. I exported some dpx files and brought them into Nuke, and after testing with different varieties of illuminants and primaries it turns out it was ACES colour space (AP0 primaries to be exact). Weird. It would have been cool if Blackmagic Design had actually let people know if was going to adopt this approach, but anyway...

As there isn't an official ACES pipeline established for ML footage I haven't paid a lot of attention to it, but a little extra research has resulted in enough usable information (for now).

You'll find relevant matrix values on this page:

https://github.com/ampas/aces-dev/blob/master/transforms/ctl/README-MATRIX.md

And additional relevant information here:

http://www.reduser.net/forum/showthread.php?134789-ACES-workflow-tested-and-verified&p=1533260&viewfull=1#post1533260

The CIEXYZ option in RCM is basically Linear XYZ, so that's the reference gamma and gamut and effectively the core starting point for all transformations. More useful matrices can be found in the first link.


Ben Turley's LUTCalc is also a handy source. Always select Data In and Data Out when exporting a LUT (Resolve operates in full Data, and handles any legal conversions so stick to Data only with LUTs). I wasn't sure of this before, but I am now.

I am of the opinion now that any gamma transform performed by a LUT should be done separately and only in a 1D LUT, and 3D LUTs should only deal with the colour element. 3D LUTs used for calibrating a monitor can incorporate subtle non-linear gamma adjustments, but they are the exception. From now on I prefer to use a 3D LUT in only a Log to Log manner, such as LogC Alexa Wide Gamut to LogC LC709 (which can't be achieved with a matrix so only a 3D LUT will work).

Please feel free to try out some of the suggestions here and post feedback :)
EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

baldavenger

I listened again to an old podcast where the colourist Peter Doyle spoke about some of the grading techniques he used on the final Harry potter movie. When I first listened to it about 2 years ago I understood very little of what he was talking about, but things are a bit clearer now. 2 techniques in particular are worth looking at inside of Resolve.


https://www.fxguide.com/fxpodcasts/the-art-of-grading-harry-potter-peter-doyle/


When he mentions 'matrices' around the 15 minute mark it turns out that he actually means expressions.

He stated the intention of the expression was to prevent cyan being greater than the sum of the other two channels (red and green), so given that green would be a common factor it suggests limiting the blue channel value so that it never exceeds the value of the red channel. He mentions the same technique later in the podcast when discussing the scene in the river.

Using the ChannelMath OFX plugin, leave red and green empty, and enter

b > r ? r : b


I believe ChannelMath processes are done in full 32bit float with no clipping/range restrictions, but it can hog the system.

An alternative would be to export as a 3D LUT straight from Resolve, though it's limited to a 33x33x33 cube (whereas Resolve can actually process a 65x65x65 cube)

A 65x65x65 cube can be instead be built in Nuke (using an Expression Node) or Fusion (using a Custom Tool 'tool'). Fusion only offers ALUT3, ITX, and 3DL as LUT options, but the ITX version is identical to that which Resolve exports, you just need to change the extension from '.itx' to '.cube' and Resolve will recognise it.

When I started trying to figure out the expression I came up with some slightly more complex yet nonetheless interesting versions. One limits the channel so that it is never the highest value (despill), the other so that it is never more than the third highest value.

g > b ? (r > g ? g : r) : (r > b ? b : r)

g > b ? (r > b ? b : r) : (r > g ? g : r)

r > b ? (g > r ? r : g) : (g > b ? b : g)

r > b ? (g > b ? b : g) : (g > r ? r : g)

r > g ? (b > g ? g : b) : (b > r ? r : b)

r > g ? (b > r ? r : b) : (b > g ? g : b)

A specific Luma range can be incorporated into the expressions (and LUTs), but it makes more sense to leave that to a more flexible luma key in the application.

The other technique he mentions is splitting the colour from the luma. This is pretty common place now, though perhaps not in such a specific way as he describes.



The Splitter-Combiner node reveals which channels are cleaner (usually green) or dirtier (usually blue), so some early repair can be done. Then the signal gets split, using RGB Mixer to select Monotone (Preserve Luma unticked) and then rebuilding the luma channel by substituting blue for green (usually). The bottom layer node has YUV selected and using RGB Mixer (Preserve Luma unticked) to put a zero value in the red channel, and the composite mode is Add. This method doesn't work with LAB. Separate sharpening is done on the luma, and blur on the chroma. Pretty much as he describes it in the podcast.

In the immortal words of Harry Potter, "Shazam!"


EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

baldavenger

I looked a bit further into the idea of rebuilding highlights in Resolve, and I've put together a selection of clips that I hope people will have a go at. I'm interested in hearing feedback as to what approaches work better than others.

There are four clips, with two shot regular, and two in Dual-ISO. The regulars are in the form of 100 frame MLV files, and the Dual-ISO are folders with 100 already converted DNG files. All available for download, along with 4 signal splitter 1D LUTs and the ChannelMath plugin (OS X only).

If using the ChannelMath plugin, the following images show the expressions for splitting the signal:






The clips (in Rec709 Gamma and Gamut) are presented in this order: Viewer + Node Graph, Highlight Recovery Off and Waveform, Highlight Recovery On and Waveform.


























The Node Graph set-up allows for viewing the highlights, along with the option to grade, rebuild, and blur if so required. Rebuilding should be done using the RGB Mixer, with Preserve Luminance unticked.



The last operation should be the use of Soft Clip (High Soft) in the Custom Curves section:



The Soft Clip is a handy way to bring your highlights into display values, though it is limited to how much it can grab so try to have your highlights scaled to no higher than the 384 mark on the waveform once you're finished working on them.

There is great work being done right now by the ML community, so it is only right that equal effort should be put into making the most out of the information contained in the files. Onward and upwards.

Here are the downloads:

https://www.dropbox.com/s/bsf6zp4zp1dn3xm/Signal%20Splitters.zip?dl=0

https://www.dropbox.com/s/gj3mvwcrouum94k/indoors.mlv.zip?dl=0

https://www.dropbox.com/s/ub8iuuysrunf6zy/balcony.mlv.zip?dl=0

https://www.dropbox.com/s/f25khctemium4kh/Beach_Dual_ISO.zip?dl=0

https://www.dropbox.com/s/1jm9x7ywxr60mrq/Sunrise_Dual_ISO.zip?dl=0


EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

baldavenger

I converted both the MLVs into folders containing the DNG files (for those who prefer the quicker and easier option).


https://www.dropbox.com/s/7p8e5y8qvc2ddtf/indoors_1_2014-07-25_0001_C0000.zip?dl=0

https://www.dropbox.com/s/8nl3i0yltrmu4n5/balcony_1_2014-10-11_0001_C0000.zip?dl=0



One of the issues with dealing with a split signal is not being able to view the individual streams and make adjustments to earlier nodes (with the Highlight function limiting adjustments to the selected node). This can be somewhat addressed by adding a node to the stream you want to 'switch off' and using the RGB Mixer controls to enter 0 for every channel. This node can then be enabled/disabled as per when required.


EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

baldavenger

I recently reviewed my DIT workflow and decided to add a few changes. I focused more on removing the gamma function from the Print LUT in order to have a 'cleaner' signal path.

As a starting point I decided to go with Linear, Linear, Bypass in RCM, which puts the footage into Linear gamma and ACES (AP0) primaries. In the first node I hacked a 3x3 matrix into the RGB Mixer, converting ACES (AP0) to Alexa Film Matrix. The second node has a 14bit 1D LUT applied, converting Linear to Cineon Log Gamma and therefore completing the conversion to a something resembling a scanned negative.

The Film Print LUT stage is now broken into two parts. The first is a Cineon to Cineon 3D Film LUT that deals with chromaticity, followed by a 14bit 1D LUT that converts Cineon to sRGB (or whichever display gamma is required). The Film LUTs that are supplied come in two varieties, with Inter (interim) and Out (more punch) the options. They still add some s-curve, but I modified how much they push the mid-tones and shadows to avoid baked in compression.



The only adjustments I made to the above image were pulling a small bit of red from the highlights in Colour Wheels, and pushing more green into the foliage with Hue vs Hue.

Also included are Arri to Cineon LUTs, which I wrote some expressions for in order to prevent clipping while still preserving the main part of the signal (0%, 18%, and 90% reflectance).

Print Film LUTs are primarily built for Cineon scanned negative, and given that scanned negative is still the most robust medium for grading it means that the LUTs can be quite brutal on weaker footage (most forms of digital). Also, it expects a high signal midpoint so any footage that is a bit lower than this really gets squashed. Even LogC gets over pushed, which is why I made the Arri to Cineon converters. LogC has a lower midpoint because it actually squeezes in an extra two stops of latitude at both ends of the signal, but it still needs to be conformed in order to get the cleanest possible results.

Anyway, have a go and leave some feedback if you get a chance.


https://www.dropbox.com/s/zckc4t2y8ux43yc/DIT_Workflow_Resolve.zip?dl=0


EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

cmccullum

Loving all the info here. I don't really get it, but it's a fascinating thread. That being said, will there ever be a streamlined or "for dummies" guide to all this?

I did some tests using RCM and then the included Alexa log to rec709 lut, and after a little exposure tweaking got what I think is a damn good looking image. I don't really know how to use DR at all so can you break down the benefits of learning such a (seemingly) complicated workflow as opposed to just doing what I did?
(RCM input and timeline Alexa log. bypass output. First node> Alexa log to rec709. next node> adjust exposure/color)
Also, am I even doing that right?

baldavenger

Here's a list of the formulas that are involved in converting LogC Alexa Wide Gamut to Cineon Log Alexa Film Matrix. The larger ones might seem daunting at first sight, but they are merely concatenations of several smaller components. They can be applied directly via the ChannelMath plugin, or exported as LUTs.


LogC to Cineon functions:


log(13.5216945686, 55.0800869419) = 0.649646535749151

0.6496465358

log(abs(-0.0056508194), abs(-0.0172904190)) = 1.275618891720147

1.2756188918

R = r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655

G = g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655

B = b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655

R > 1 ? pow(R, 0.6496465358) : (R < 0 ? pow(abs(R), 1.2756188918) * -1 : R)

G > 1 ? pow(G, 0.6496465358) : (G < 0 ? pow(abs(G), 1.2756188918) * -1 : G)

B > 1 ? pow(B, 0.6496465358) : (B < 0 ? pow(abs(B), 1.2756188918) * -1 : B)


r < 0 ? pow(abs(r),0.7839332002)*-1 : (r > 1 ? 1 : r)

(r > 1 ? pow(r, 0.6496465358) : 1) - 1

AWG to Film Matrix

(r*1.271103)+(g*-0.284279)+(b*0.013176)
(r*-0.127165)+(g*1.436429)+(b*-0.309264)
(r*-0.129927)+(g*-0.510286)+(b*1.640214)

LogC AWG to Arri Linear Film Matrix

((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*1.271103)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.284279)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*0.013176)


((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.127165)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*1.436429)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*-0.309264)


((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.129927)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.510286)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*1.640214)


LogC AWG to Cineon Linear Film Matrix


(R) > 1 ? pow((R), 0.6496465358) : ((R) < 0 ? pow(abs(R), 1.2756188918) * -1 : (R))

(G) > 1 ? pow((G), 0.6496465358) : ((G) < 0 ? pow(abs(G), 1.2756188918) * -1 : (G))

(B) > 1 ? pow((B), 0.6496465358) : ((B) < 0 ? pow(abs(B), 1.2756188918) * -1 : (B))



(((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*1.271103)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.284279)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*0.013176)) > 1 ? pow((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*1.271103)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.284279)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*0.013176)), 0.6496465358) : ((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*1.271103)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.284279)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*0.013176)) < 0 ? pow(abs(((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*1.271103)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.284279)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*0.013176)), 1.2756188918) * -1 : (((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*1.271103)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.284279)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*0.013176)))



(((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.127165)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*1.436429)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*-0.309264)) > 1 ? pow((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.127165)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*1.436429)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*-0.309264)), 0.6496465358) : ((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.127165)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*1.436429)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*-0.309264)) < 0 ? pow(abs(((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.127165)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*1.436429)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*-0.309264)), 1.2756188918) * -1 : (((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.127165)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*1.436429)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*-0.309264)))



(((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.129927)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.510286)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*1.640214)) > 1 ? pow((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.129927)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.510286)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*1.640214)), 0.6496465358) : ((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.129927)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.510286)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*1.640214)) < 0 ? pow(abs(((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.129927)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.510286)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*1.640214)), 1.2756188918) * -1 : (((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.129927)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.510286)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*1.640214)))



LogC AWG to Cineon Film Matrix


(((log10((R)*(1-.0108)+.0108))*300)+685)/1023


(((log10((G)*(1-.0108)+.0108))*300)+685)/1023


(((log10((B)*(1-.0108)+.0108))*300)+685)/1023




(((log10(((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*1.271103)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.284279)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*0.013176)) > 1 ? pow((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*1.271103)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.284279)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*0.013176)), 0.6496465358) : ((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*1.271103)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.284279)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*0.013176)) < 0 ? pow(abs(((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*1.271103)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.284279)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*0.013176)), 1.2756188918) * -1 : (((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*1.271103)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.284279)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*0.013176))))*(1-.0108)+.0108))*300)+685)/1023


(((log10(((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.127165)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*1.436429)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*-0.309264)) > 1 ? pow((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.127165)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*1.436429)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*-0.309264)), 0.6496465358) : ((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.127165)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*1.436429)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*-0.309264)) < 0 ? pow(abs(((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.127165)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*1.436429)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*-0.309264)), 1.2756188918) * -1 : (((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.127165)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*1.436429)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*-0.309264))))*(1-.0108)+.0108))*300)+685)/1023


(((log10(((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.129927)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.510286)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*1.640214)) > 1 ? pow((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.129927)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.510286)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*1.640214)), 0.6496465358) : ((((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.129927)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.510286)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*1.640214)) < 0 ? pow(abs(((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.129927)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.510286)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*1.640214)), 1.2756188918) * -1 : (((r > 0.1496582 ? (pow(10.0, (r - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (r - 0.092809) / 5.367655)*-0.129927)+((g > 0.1496582 ? (pow(10.0, (g - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (g - 0.092809) / 5.367655)*-0.510286)+((b > 0.1496582 ? (pow(10.0, (b - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (b - 0.092809) / 5.367655)*1.640214))))*(1-.0108)+.0108))*300)+685)/1023

EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

baldavenger

The actual order of application with regards to the 3x3 Film Matrix is not exactly clear in the Arri white papers. You would assume that it is meant for a signal in linear light space (especially given that it is referenced in connection with a VFX pipeline), but I'm not so sure. It seems odd to countenance the idea of applying a 3x3 matrix to a log signal, but that might actually be Arri's intention. Anyway, here's a list of formulas that incorporate the log option.


LogC AWG to Arri Linear Film Matrix


((r*1.271103)+(g*-0.284279)+(b*0.013176)) > 0.1496582 ? (pow(10.0, (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.092809) / 5.367655


((r*-0.127165)+(g*1.436429)+(b*-0.309264)) > 0.1496582 ? (pow(10.0, (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.092809) / 5.367655


((r*-0.129927)+(g*-0.510286)+(b*1.640214)) > 0.1496582 ? (pow(10.0, (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.092809) / 5.367655


LogC AWG to Cineon(clipped) Film Matrix


(((log10((((r*1.271103)+(g*-0.284279)+(b*0.013176)) > 0.1496582 ? (pow(10.0, (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.092809) / 5.367655)*(1-.0108)+.0108))*300)+685)/1023


(((log10((((r*-0.127165)+(g*1.436429)+(b*-0.309264)) > 0.1496582 ? (pow(10.0, (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.092809) / 5.367655)*(1-.0108)+.0108))*300)+685)/1023


(((log10((((r*-0.129927)+(g*-0.510286)+(b*1.640214)) > 0.1496582 ? (pow(10.0, (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.092809) / 5.367655)*(1-.0108)+.0108))*300)+685)/1023


LogC AWG to Linear(Cineon scaled) Film Matrix


(((r*1.271103)+(g*-0.284279)+(b*0.013176)) > 0.1496582 ? (pow(10.0, (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.092809) / 5.367655) > 1 ? pow((((r*1.271103)+(g*-0.284279)+(b*0.013176)) > 0.1496582 ? (pow(10.0, (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.092809) / 5.367655), 0.6496465358) : ((((r*1.271103)+(g*-0.284279)+(b*0.013176)) > 0.1496582 ? (pow(10.0, (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.092809) / 5.367655) < 0 ? pow(abs(((r*1.271103)+(g*-0.284279)+(b*0.013176)) > 0.1496582 ? (pow(10.0, (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.092809) / 5.367655), 1.2756188918) * -1 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) > 0.1496582 ? (pow(10.0, (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.092809) / 5.367655))


(((r*-0.127165)+(g*1.436429)+(b*-0.309264)) > 0.1496582 ? (pow(10.0, (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.092809) / 5.367655) > 1 ? pow((((r*-0.127165)+(g*1.436429)+(b*-0.309264)) > 0.1496582 ? (pow(10.0, (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.092809) / 5.367655), 0.6496465358) : ((((r*-0.127165)+(g*1.436429)+(b*-0.309264)) > 0.1496582 ? (pow(10.0, (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.092809) / 5.367655) < 0 ? pow(abs(((r*-0.127165)+(g*1.436429)+(b*-0.309264)) > 0.1496582 ? (pow(10.0, (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.092809) / 5.367655), 1.2756188918) * -1 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) > 0.1496582 ? (pow(10.0, (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.092809) / 5.367655))


(((r*-0.129927)+(g*-0.510286)+(b*1.640214)) > 0.1496582 ? (pow(10.0, (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.092809) / 5.367655) > 1 ? pow((((r*-0.129927)+(g*-0.510286)+(b*1.640214)) > 0.1496582 ? (pow(10.0, (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.092809) / 5.367655), 0.6496465358) : ((((r*-0.129927)+(g*-0.510286)+(b*1.640214)) > 0.1496582 ? (pow(10.0, (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.092809) / 5.367655) < 0 ? pow(abs(((r*-0.129927)+(g*-0.510286)+(b*1.640214)) > 0.1496582 ? (pow(10.0, (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.092809) / 5.367655), 1.2756188918) * -1 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) > 0.1496582 ? (pow(10.0, (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.092809) / 5.367655))


LogC AWG to Cineon(scaled) Film Matrix


(((log10(((((r*1.271103)+(g*-0.284279)+(b*0.013176)) > 0.1496582 ? (pow(10.0, (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.092809) / 5.367655) > 1 ? pow((((r*1.271103)+(g*-0.284279)+(b*0.013176)) > 0.1496582 ? (pow(10.0, (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.092809) / 5.367655), 0.6496465358) : ((((r*1.271103)+(g*-0.284279)+(b*0.013176)) > 0.1496582 ? (pow(10.0, (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.092809) / 5.367655) < 0 ? pow(abs(((r*1.271103)+(g*-0.284279)+(b*0.013176)) > 0.1496582 ? (pow(10.0, (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.092809) / 5.367655), 1.2756188918) * -1 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) > 0.1496582 ? (pow(10.0, (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*1.271103)+(g*-0.284279)+(b*0.013176)) - 0.092809) / 5.367655)))*(1-.0108)+.0108))*300)+685)/1023


(((log10(((((r*-0.127165)+(g*1.436429)+(b*-0.309264)) > 0.1496582 ? (pow(10.0, (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.092809) / 5.367655) > 1 ? pow((((r*-0.127165)+(g*1.436429)+(b*-0.309264)) > 0.1496582 ? (pow(10.0, (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.092809) / 5.367655), 0.6496465358) : ((((r*-0.127165)+(g*1.436429)+(b*-0.309264)) > 0.1496582 ? (pow(10.0, (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.092809) / 5.367655) < 0 ? pow(abs(((r*-0.127165)+(g*1.436429)+(b*-0.309264)) > 0.1496582 ? (pow(10.0, (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.092809) / 5.367655), 1.2756188918) * -1 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) > 0.1496582 ? (pow(10.0, (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.127165)+(g*1.436429)+(b*-0.309264)) - 0.092809) / 5.367655)))*(1-.0108)+.0108))*300)+685)/1023


(((log10(((((r*-0.129927)+(g*-0.510286)+(b*1.640214)) > 0.1496582 ? (pow(10.0, (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.092809) / 5.367655) > 1 ? pow((((r*-0.129927)+(g*-0.510286)+(b*1.640214)) > 0.1496582 ? (pow(10.0, (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.092809) / 5.367655), 0.6496465358) : ((((r*-0.129927)+(g*-0.510286)+(b*1.640214)) > 0.1496582 ? (pow(10.0, (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.092809) / 5.367655) < 0 ? pow(abs(((r*-0.129927)+(g*-0.510286)+(b*1.640214)) > 0.1496582 ? (pow(10.0, (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.092809) / 5.367655), 1.2756188918) * -1 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) > 0.1496582 ? (pow(10.0, (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.385537) / 0.2471896) - 0.052272) / 5.555556 : (((r*-0.129927)+(g*-0.510286)+(b*1.640214)) - 0.092809) / 5.367655)))*(1-.0108)+.0108))*300)+685)/1023


It's pretty much a return to the original LogC approach from earlier in the thread, albeit with more informed precision. So much for the short-lived dalliance with ACES primaries.

It's probably not a bad time to start putting the various different techniques and processes together into one main pipeline.

EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

Andy600

re: the Film Matrix - It's the only matrix I know of that is/was intended to be applied in logspace. Log-C with Alexa wide gamut primaries to be precise. It's function is merely to emulate the saturation and hue shift you get when scanning negative stock (most likely 5219) on the ARRIScan. If you apply it as you would most matrices i.e. linear, it will cause over-saturation, particularly in the shadows and highlights. With actual film there is color crosstalk so you will never get an exact match from just using a trivial matrix. ACES and Filmlight are, so far, the only procedural mathematical efforts to try to emulate films' color crosstalk and saturation characteristics but it's a constantly moving target. Print luts are still a very viable alternative for specific stocks and the FM is mainly intended for pipelines using them.

Try to visualize in 3 dimensions what happens and you can see that applying the matrix in logspace has some advantages and disadvantages. The advantage being that you have a more even distribution of saturation (because fundamentally, logspace has/should have an approximate equal number of code values for each stop) and less relative saturation the highlights (a more film like response). The disadvantage is that once you introduce non-linearity (i.e. log, gamma or an s-curve) you can get all kinds of weirdness, hue shifts, hue rotations or over/under-saturated primaries depending on the RGB weighting factor of the saturation values being used - basically the FM is a glorified saturation matrix that is roughly the same in terms of saturation as Rec709 but with some twists. The FM looks pleasing because it shifts skin tones to warmer hues but at the same time it can turn deep reds to orange and deep blues to cyan but, importantly, it keeps grey values neutral and does not affect gamma. 
Colorist working with Davinci Resolve, Baselight, Nuke, After Effects & Premier Pro. Occasional Sunday afternoon DOP. Developer of Cinelog-C Colorspace Management and LUTs - www.cinelogdcp.com

baldavenger

Thank you Andy, that helps clear up a lot of things :) I'll have to revise some of the earlier posted processes.

With regards to the distribution of saturation, won't this be an issue when applying it to ML Raw footage encoded in LogC ? When encoding, it would appear that peak white (1.0) is mapped to the same point as 90% reflectance is with Arri footage, therefore the saturation fall-off that occurs with Arri footage does not apply (to the same extent) to LogC encoded ML Raw footage as the signal was originally scaled to fit into a display referred space.

Apologies for dragging on with this particular line of enquiry (and over multiple threads too), but there's still something I'm not quite getting. Hopefully the penny will drop sooner or later :)
EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

Andy600

Yes and no. With Cineon, the sat rolloff is different to the Alexa but not by a great deal once you add contrast. I opted for Cineon instead of Log-C but with Cinelog the film matrix is still applied to Log-C because it was developed for Log-C and looks different when applied to other gammas i.e. it's an extended transform from cineon AWG to Log-C (1D) > add fm > Log-C to Cineon (1D). It would be relatively easy to scale the matrix if it were for linear application but not trivial to do so in logspace and besides, the extended transform is not very CPU intensive so there is little point.

The important thing here is that using matrices to transform a gamut is far easier to invert/undo than non-linear adjustments or complex luts. There are potentially as many 'film matrices' as there are film stocks, as there are scanners etc but you need to shoot charts on film to define a set of target values then find the closest matrix match. Applying a saturation matrix in logspace helps maintain a psuedo-film aesthetic (illusion) but you need to go to good print luts for the crosstalk characteristic and to get closer to film.

Try playing with saturation matrices in logspace. It's quite interesting :)

Colorist working with Davinci Resolve, Baselight, Nuke, After Effects & Premier Pro. Occasional Sunday afternoon DOP. Developer of Cinelog-C Colorspace Management and LUTs - www.cinelogdcp.com

baldavenger

I see the transform from Cineon to LogC, but doesn't that still preserve the mapping of peak white whereas that should represent reference white instead? That is to say, the saturation roll-off isn't the same as original Arri LogC because the signal is scaled/compressed down. Contrast will increase the signal (and therefore better resemble the preferred distribution in the higher end) but also deepen the lower end, which is probably not desirable. It seems a bit 'loose' to me, at least on a technical level (though I may well be missing something).

EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

baldavenger

Back in Reply #61 there was a brief mention of Dark Frames, along with a link for footage shot on a 5DMkIII. Before proceeding to build a workflow consisting of the 'greatest hits' of the thread, I'll go through an optional process of removing some noise from your footage, especially if shot at a higher ISO.

The Dark Frame has to match the footage it is intended for. That is to say, if you shot a particular resolution (e.g. 1920 by 1080) at a particular frame rate (e.g 24FPS), with a particular ISO setting (e.g. 1600) on a particular camera sensor (e.g. 5D MkIII) then your Dark Frame would have to have been originally compiled using the same camera type and with those settings. Otherwise you will not achieve optimum results.

So for the example above, put the lens cap on the camera (with the correct settings) and record a few seconds. If you were to view the frames of the MLV you would see almost black frames (except for a magenta looking noise). A Dark Frame is a single frame that is to be subtracted from every frame of the destined (actual footage) MLV, so an average frame is made from the few seconds that were shot with the lens cap on.

In Terminal (in OSX) type 'cd' (without exclamation marks) and drag the folder with mlv_dump.osx onto it and press enter. In the same folder have your pre averaged MLV file.

Type

mlv_dump -o Output.mlv -a Input.mlv

With Input.mlv being your pre averaged MLV file.

The result leaves a new Output.mlv in the folder, that is the size of one DNG. Change to the name to something more appropriate, e.g. Darkframe1600.mlv

Bring the MLV you want to perform the subtraction into the folder.

Type

mlv_dump -o footageDframed.mlv -s Darkframe1600.mlv footage.mlv

The result leaves a new footageDframed.mlv in the folder, that is the same size as the original footage.mlv. Use MLVFS to extract a DNG from both MLVs (before and after Dark Frame removal) and compare.

Here are some examples:














Hopefully this process can be included in one or more of the current post-production options. In the link below you'll find some examples to work on.

Ideally what might happen is that Dark Frames are compiled for every ML ready camera for a variety of resolution, frame rate, and ISO combinations, so that a more automated process can be developed.



https://drive.google.com/file/d/0B0WuqGJ11_Egcm9wVjMwbWJPNDA/view?usp=sharing


EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

Danne

Thanks for this info Baldavenger. I see how I can insert this in MLP and I will eventually. Many of the steps could be automated. For instance. One can leave a darkframe MLV in A_lut_hold folder which would activate a whole range of processing ending up with complete set of new mlv files. Cool stuff.

DeafEyeJedi

This is actually incredible and gnarly work done by @baldavenger as per usual! [emoji108]
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

baldavenger

Although really only suitable for viewing purposes, it's possible to use 1D LUTs to turn nodes into constants and therefore perform specific offset operations. Basically, you can view parts of the signal greater than 1.0 in both the viewer and waveform. I built a set of 8bit 1D LUTs for this purpose.





In the above example the Layer Node is set to Add, and in Node 02 is placed the ResolveConstant_-1.cube, revealing in the viewer and waveform the original part of the signal with values ranging from 1.0 to 2.0. Disabling Node 02 only disables the effects of the Node, so the result would actually be the original signal added to itself. Instead, replace the LUT with ResolveConstant_Zero.cube, which turns the node into a constant with 0 for every value, therefore effectively disabling the operation.

The LUTs can be combined for more specific offsets. The next example features a standard chart featuring values ranging from 0.0 to 1.0. Applying a 1D LogC to Linear LUT to it expands the signal values as far as 55.08007431



An offset of -55 can be performed by placing ResolveConstant_10.cube and ResolveConstant_-5.cube in Nodes 02 and 04, multiplying them, then place ResolveConstant_-5.cube in Node 08 and set the final Layer node to Add. In the viewer and waveform the values originally ranging from 55 to 55.08007431 can be seen. An exercise in theory of course, but it also shows that the signal doesn't always have to be compressed into a limited space in order to be viewed.


There are other uses for constants, such as a 0.5 constant as part of high-pass sharpening. Here's a fairly simple example:



The first Layer Node is set to Subtract, with Blur performed in Node 04, and ResolveConstant_-0.5.cube placed in Node 05. The final Layer Node can be set to Overlay, Softlight, or Hardlight (depending on taste).



https://www.dropbox.com/s/os7bms2p8legctb/Resolve%20Constants.zip?dl=0


EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5

baldavenger

For those interested in viewing the whole signal (including sub zero values) there's an easy method using a simple constant.



In the above example when ResolveConstant_-1.cube has been placed in Node 02, by selecting Multiply in the Layer Node the signal gets inverted/rotated 180 degrees around the x axis. In the case of a full logC signal linearised, values can go as low as -0.017290419, and this can now be viewed without pulling and pushing the rest of the image. Perhaps not of any great use, but a nice option nonetheless. I've included a Null LUT in the previous post download that clips above 1.0 and below 0 for signal isolation purposes.
EOS 5D Mark III | EOS 600D | Canon 24-105mm f4L | Canon 70-200mm f2.8L IS II | Canon 50mm f1.4 | Samyang 14mm T3.1 | Opteka 8mm f3.5