Reverse Engineering Picture Styles

Started by dfort, December 07, 2015, 05:50:39 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

dfort

Ok--here we go:

2016-09-07 v1.4 - Test version to improve highlights detail. (Don't use if you're using zebras to judge exposure.) Dropped logStandard and logFaithful.
2016-09-02 v1.3 - Overall better match
2016-09-01 v1.2 - Combined highlights from v1.0 with shadows from v1.1 and Saturation now defaults to -2
2016-08-31 v1.1 - Small adjustments to correct color shifts in shadows
2016-08-31 v1.0 - Initial release

This was a joint effort between Danne and myself, dfort. For the first release we did the best we could at matching Technicolor CineStyle. The reason we picked CineStyle is because it is in wide use, hasn't been updated since it was initially released in 2011 and it is a .pf2 that cannot be editing using Canon's Picture Style Editor. Ours is in the newer .pf3 file format and is editable. We didn't even put a copyright notice on it so feel free to do with it as you please.

We did a lot of testing and have a fairly high degree of confidence that this can be a direct replacement for CineStyle. This means that all of the luts available for CineStyle can be used. Is it a perfect copy? No, but it is the best we could do using the tools we had at our disposal. Visually it should be impossible to see any difference between CineStyle and logNeutral. Why call it logNeutral? Because it turns out that CineStyle uses the standard Canon Neutral picture style as its base. Only the luma gamma curve has been modified. How do we know this? Let's just say we're pretty sure.

So if there is a logNeutral could there be variations using other standard Canon picture styles? Yes. We found out that the luma gamma curve works with other picture styles. Sure, you could probably adjust the look of the Neutral style in post to match the other picture styles but one of most often mentioned issues with CineStyle is that it is hard to get pleasing skin tones. So why not experiment with the Portrait style as a base? We included all of standard Canon picture styles with this release.

Now with all the excitement over raw video why is a copy of a 5-year old picture style of any significance? It turns out that many people are using CineStyle not only for H.264 (8-bit 4:2:0) but also for HDMI out to an external recorder. In the future perhaps someone can do the same with Log-C or something that will take better advantage of the 8-bit 4:2:2 HDMI output.

Consider using MLP in your workflow for this picture style. Danne continues to update this program and it can handle luts, denoising and conversion to Prores. MLP can also work with H.264 HDR which is a natural for this picture style.

Most of all, try it out and report back. If you don't like it, hey at least you didn't pay for it.

********************
Original post starts here:
********************

Not sure which category to post this under because it is part general chat, part shooting, part post production, part raw and part not...

I've been thinking about picture styles because of a conversation I had with Danne about CineStyle. I call that conversation the "CineStyle Conspiracy Theory." Basically it goes like this:

Ok, let's start out with who developed Cinestyle. Technicolor--not exactly a little fly by night company but one of the most respected companies in the motion picture industry. Interestingly it is a French multinational company, not just a film lab in Hollywood.

When. 2011, that's a year before the 5D Mark III but more importantly also a year before the C100 which has the so-called "log" profile built in. Why did Technicolor create Cinestyle then stopped supporting it? The luts and tools that Technicolor developed are no longer available directly from the company though the webpage is still live and the profile is still available for download.

Looking at the sample footage shot on "Canon Log" from the C100 compared with Cinestyle they look very similar. Same with the GoPro "Protune" but here's a little known fact--Protune was developed by Technicolor. I'm not saying that GoPro footage is great but Protune does allow more flexibility in post in order to more closely match footage shot on other cameras so there is some merit to this.

I have read a lot of pros and cons (mostly cons) on the boards about Cinestyle and mostly praises for the "log" profiles like S-Log, Log C, Canon Log, etc. Log does have advantages and disadvantages. The old saying that you can't get something from nothing certainly applies here. Technically, it may even be inferior to getting everything "right" in the camera but in practice things are a little different.




I can't look into what they did with CineStyle because that profile is locked out of the Canon PictureStyleEditor but I did read up on how to make a picture style and you have to start with a CR2 file. That got me thinking, all this talk about picture styles not affecting raw images--is that really true? I shot some still and MLV files with monochrome and CineStyle then took a look at them in various programs. Guess what, it does make a difference depending on what program you're using. Try it yourself, set the profile to monochrome and shoot something then open it up in Canon's Digital Photo Professional app--that's a free one that you can download from Canon. The raw image is in black and white. Now open it in Photoinfo--I'm not sure where that came from but I think it comes with OS-X. Also in black and white but it is apparently showing the jpeg preview. How about Adobe Camera Raw or RawTherapee? Color! Run exiftool on it and it will show:

Picture Style                   : Monochrome

Running exiftool with the -v option will give even more information:

 
  | | | 20) ProcessingInfo (SubDirectory) -->
  | | | + [BinaryData directory, 28 bytes]
  | | | | ToneCurve = 0
  | | | | Sharpness = 3
  | | | | SharpnessFrequency = 0
  | | | | SensorRedLevel = 0
  | | | | SensorBlueLevel = 0
  | | | | WhiteBalanceRed = 0
  | | | | WhiteBalanceBlue = 0
  | | | | WhiteBalance = -1
  | | | | ColorTemperature = 7300
  | | | | PictureStyle = 134
  | | | | DigitalGain = 0
  | | | | WBShiftAB = 0
  | | | | WBShiftGM = 0


What is interesting is running an MLV shot with the monochrome picture profile through mlv_dump with the -mv option will also show some picture style information:

Block: STYL
  Offset: 0x0000022c
    Size: 52
    Time: 0.006000 ms
     picStyle:   134
     contrast:   0
     sharpness:  3
     saturation: -559038737
     colortone:  -559038737


There's that same "134" picture style which I guess is the monochrome profile. How about an MLV shot on CineStyle?

Block: STYL
  Offset: 0x0000022c
    Size: 52
    Time: 0.006000 ms
     picStyle:   33
     contrast:   -4
     sharpness:  0
     saturation: -2
     colortone:  0


So what is the significance of this? Well it might be possible to make a "real" log picture profile that will create proper log H.264 files. I looked into this and yes it is possible thought it might not be practical. DeafEyeJedi mentioned that the editors where he works prefer wide gamut over log and I'm thinking that CineStyle might just be a hybrid log/flat/wide gamut picture style because there's only so much you can do with 8-bit 4.2.0 files. However, if the picture style can also be used on the raw files then you can actually create a true log like Arri Log C picture style.

Now for the bad news. Picture styles are binary files and the PictureStyleEditor is a rather elementary tool that isn't really suitable for creating a proper log curve. Then of course there's the job of figuring out how to interpret the picture style that is embedded in the raw file. I looked at the CineStyle picture style in a HEX editor and can't make heads or tails of it but there is a lot more information in there than what exiftool is reporting.

reddeercity

The picture profile "Cinestyle" was a great effort  by Technicolor but the Cost of Killing Skin tone was & is  unacceptable.
Been using it with H264 since it came out on my 5D2 & being fighting with Skin tone since that day,(skin was gray-no mid tones) .
ML raw was a godsend for skin tones , and from what I understand about Raw video there is no Picture profile being applied at all.
Will not totally thou because the HDMI & Liveview  still relies on the Picture Profile , because of the processing of the Jpeg chip where the Profiles are applied ,
that where the HDMI feed came from and it is truly uncompressed (1.5Gb/s 4:2:2 60i)(check with my AJA Kona Lhi card) so in respect to that
the profile is important ,as from time to time I capture the HDMI to my Ninja for backup of Raw Video I record internally .
With Raw/MLV Video I use "standard picture profile" for exposure ,  give me a look that is close to a fully graded image.
If a "Log" Picture Profile like "Cinestyle"  could be developed  that respected Skin Tones ,  that would be bonus for H264 & HDMI Capture.
Not raw video as its not being applied , at least not to my knowledge.
My 2 cents  :D

DeafEyeJedi

+1 for starting this thread! [emoji108]
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

mothaibaphoto

Quote from: dfort on December 07, 2015, 05:50:39 AM
However, if the picture style can also be used on the raw files then you can actually create a true log like Arri Log C picture style.
As far as I understand, all flavors of in-camera Log is a lossy compression of debayered image (and even Adobe lossy DNG too). So, it's not applicable to "real" undebayered Raw.

Andy600

I've done a fair bit of work with regards to understanding Cinestyle and Picture Styles in general. I do see the point that many users make regarding black level, skin tones and other negatives but like all intermediate log profiles the end result is really about how you handle correction in post.

I'm not going to comment on Technicolor's sudden discontinuing of Color Assist (their own grading app) as I think it was purely a business decision based on numbers but there are a lot of clues about Cinestyle in interviews with it's creator - Josh Pines (find the videos on Youtube).

My findings regarding Cinestyle are pretty much this:

Cinestyle and Picture Styles are essential .ICC profiles. You can unlock Cinestyle using Matlab by modifying the header structure but that will not get you far or make the PS editable in PSE because the tone curve is affected by something further upstream than occurs with other picture styles.

Cinestyle is the only 'correctly' coded log Picture Style profile for Canon DSLRs. That is to say that each stop has the same amount of code values and are mapped using a formula, not some manually applied, arbitrary control points made in PSE. I, and I guess many others, have written to Josh Pines and Technicolor to ask for the exact formula used but Technicolor will not release the info - i.e. it had to be a reverse engineering job.

H.264 is always encoded with legal levels but Cinestyle is full range data.

The log curve of Cinestyle is close to Cineon log but is more a derivative of JPLog in that it is based on pivoted middle grey. JPLog is also from Josh Pines. A full-to-legal pre-adjustment of IRE (as used in the formula for Canon Log) is also 'likely' to be used in the Cinestyle formula.

The delogging lut that Technicolor provide is often confused as being 'Cinestyle to Rec709' and there have been several apps that base Cinestyle support on this. This assumption is wrong because it does not account for the s-curve. It is Rec709 in as much as it fits Cinestyle into a rec709 display space but it's not the actual BT.709 transfer function.

The inverse of the Cinestyle lut is not Cinestyle.

Cinestyle was apparently developed using 'Canon Standard' color but the size of the PS file is very small and leads me to believe that it omits any color profile and is simply a straight forward log transform of white balanced raw data with sRGB primaries.

With H.264 being 8bit, correct exposure for Cinestyle is critical but there is very little in the way of instruction available. Going by the cryptic clues in interview videos with JP, it seems as though ISO320 is a sweet spot but, as DSLRs do not have a high base ISO, it's likely that ISO160 will capture the best DR vs noise ratio.

The recorded 'raised' black level of Cinestyle is one of the main points of user/reviewer criticism but it is there for a reason. H.264 encoder pays less attention to low code values which typically contain signal with the most noise so Cinestyle raises the noise floor just above the point where H.264 encoding will be detrimental to shadows.

Cinestyle was developed by Technicolor for the 5D Mark II BUT (importantly) internal H.264 encoding was never used in development. If you watch any of the show videos where JP is being interviewed about Cinestyle, he points out that the signal is taken from the HDMI port - but afaik the HDMI out on the 5D2 is interlaced?

The captured dynamic range of Cinestyle is actually very impressive (I would say slightly better than 8bit Canon log) but 8bit H.264 encoding destroys a lot of information in the process.


Some tips for shooting Cinestyle:

Most ML users will select Cinestyle as the record PS and set exposure with Neutral but the exposure tools in ML (except the raw histogram and zebras) will be affected by the settings of the exposure PS. In the absence of a better raw waveform monitor it's probably best to expose with raw zebras to ensure highlights are not clipped while using the exposure PS (i.e. Neutral, Standard etc) for checking the exposure isn't being lowered too much BUT you can't currently do this in ML as you would need to enable raw shooting, expose then change back to H.264 - hence my request a while back for this ability.

Nail your white balance before shooting using a white balance card and be sure to set the custom white balance to use the setting or you'll regret it later!

Use the recommended settings for Cinestyle i.e. Contrast -4, sat -2 and NO SHARPENING! Sharpening at this stage will only add artifacts. It's much better to add it in post. High pass or unsharpen masking are a good choice over normal sharpen plugins as they will only enhance the luminance edge contrast leading to less color artifacts and more natural images but don't over do it!

I'm personally a little skeptical of the recommended saturation setting as desaturating before encoding could actually be losing much color information. If the -2 setting is to emulate the appearance of a wider gamut it's not really a good idea because pixels with RGB Values that already have close to no color will become grey and this cannot be recovered.

Editing H.264 can be a pain, especially in DaVinci Resolve so it's a good idea to transcode to ProRes. There is little point using the high-end 444 or XQ options as there is no extra color information to take advantage of so ProRes HQ is fine. http://rarevision.com/5dtorgb/ is still a great option for this.

Contouring or banding artifacts go hand-in-hand with 8bit H.264 so you will see them in gradients. If you have Neat video or another noise reduction plugin that offers Temporal Filtering you can remove or at least reduce banding by setting this option to use more than 1 frame. With Temporal Filtering set to 4 or 5 in Neat Video it usually removes all but the most stubborn banding.


If there is anything else I can think of I'll add it later.


Incidentally, GoPro Protune wasn't a Technicolor invention. It was developed (co-developed) by David Newman of GoPro and was derived from SI-2K log (also David Newman). He's written several articles on it over the years.

The Picture Style number in .cr2 files is just a flag to tell DPE which PS was active (and used for Jpegs). Custom Picture Styles are embedded in the .cr2 and read by DPE.

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

DeafEyeJedi

Great read, Andy, as always and I am actually glad that I still use Rarevision's 5DtoRGB for my H264 recordings (which is a great option) especially with CineStyle as the PS since the results are quite decent even with the Blacks especially coming from only 8-bit in H264.

So is it best not to use this particular PS when it comes to shooting Raw? I usually get better exposure results by eye because of using it. But you have a valid point that Standard or even Neutral will give closer to what it'll look like at the end in Post, right?

Thanks again, Daniel, for starting this wonderful thread and great to hear from you again, Andy!
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

Andy600

Your choice of Picture Style doesn't matter when shooting raw. It's only used for Jpeg and H.264. You shouldn't be eyeballing exposure but you should use the raw histo and zebras.

The point I was making is that these raw exposure helpers are not available when shooting Cinestyle H.264. Metering is affected by settings in the picture style. Ideally you would exposure for Cinestyle in the same way as for raw, taking care to not clip highlights but you have to enable raw recording to do that.
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

dfort

Wow, what fantastic insight! Where shall I start? Feel like I dove into the deep end of the pool before knowing how to swim so I'll start at the shallow end with a waterproof camera.

Quote from: Andy600 on December 07, 2015, 12:15:05 PM
Incidentally, GoPro Protune wasn't a Technicolor invention. It was developed (co-developed) by David Newman of GoPro and was derived from SI-2K log (also David Newman). He's written several articles on it over the years.

Interesting, that just adds to my CineStyle conspiracy theory. Here's a link to a Technicolor news release: GOPRO PARTNERS WITH TECHNICOLOR TO INCORPORATE CINESTYLE INTO GOPRO'S NEW PROTUNE FIRMWARE FOR HD HERO2 AT NAB 2012--April 20, 2012 Guess you can't believe everything that's posted on the Internet.

Interesting that Josh Pines developed CineStyle, he is also one of the developers of CDL, Color Decision List, which was awarded a Technical Achievement Award by the Academy of Motion Picture Arts and Sciences in 2012. I haven't worked on a show that used CDL but from what I've heard it is more than just a standardized method for defining Slope, Offset and Power. The CDL is embedded into the metadata of the original file and the CDL travels all the way through post production so when it gets to color grading the DP's original settings when the scene was shot can be recalled. Well, at least that's what I was told at an Editors Guild workshop. The editors were grumbling because they are doing more and more color adjustments before the cut goes to color grading and the first thing the DP does is ask that the colors be set to what he created on set with the DIT, Digital Image Technician. (I'm trying to write this for those who want to follow this discussion without having to look up every acronym I throw out there.)

Of course there's theory and there's practice. From what I heard new technology like CDL and ACES, Academy Color Encoding System, isn't widely used and when it is only certain parts are implemented. In addition, the transition to these technologies don't happen all at once. For example, I'm doing a job at a studio that has recently switched over from using DPX to EXR in their production pipeline as they adapt to the ACES workflow but they have not yet adapted all of the ACES components. (EXR, extended range, files are part of the ACES specification which uses a color gamut greater the visible spectrum and can handle HDR images in a file format that can be losslessly compressed for archival purposes.)

Gee, hope I'm not sounding pretentious--there is a whole lot that I don't know, like deciding a look ahead of time and create a picture style for it.

Quote from: Andy600 on December 07, 2015, 12:15:05 PM
The Picture Style number in .cr2 files is just a flag to tell DPE which PS was active (and used for Jpegs). Custom Picture Styles are embedded in the .cr2 and read by DPE.

Yay! So the proxies for editorial will have the right look and when we get to final grading we can start with the DP's original grade and get creative from there.

But wait, I'm not sure about this:
Quote from: Andy600 on December 07, 2015, 05:47:19 PM
Your choice of Picture Style doesn't matter when shooting raw. It's only used for Jpeg and H.264.

Of course you are right, at least at this point in time because only Canon's software can seem to work with picture styles. Since the metadata is being embedded in not only the CR2 files but also the MLV and the extracted DNG's maybe we can make some good use of this information, if we can get to it and decipher what it means--one of the reasons I posted in the Reverse Engineering section of the forum.

Picture styles can also be useful for recording off the HDMI port:

Quote from: reddeercity on December 07, 2015, 07:12:27 AM
... HDMI & Liveview  still relies on the Picture Profile , because of the processing of the Jpeg chip where the Profiles are applied ,
that where the HDMI feed came from and it is truly uncompressed (1.5Gb/s 4:2:2 60i)(check with my AJA Kona Lhi card) so in respect to that
the profile is important ,as from time to time I capture the HDMI to my Ninja for backup of Raw Video I record internally . ...

I have no experience whatsoever with HDMI recorders but I do know all about the confusion between raw as in capturing the unadulterated data straight from the sensor and raw as in the uncompressed video streaming through the HDMI, High-Definition Multimedia Interface. The video coming through the HDMI has a baked in look so if it looks good on the monitor chances are you'll have a hard time if you decide to change the look in post. It would probably be best to put one of the standard camera log gamma curves on the HDMI stream before recording it to ProRes or DNxHD. If you have a log gamma video going into a professional monitor you can apply an output lut so people on the set won't think that the camera is broken.

Ok, so there's yet another reason to figure out how to create picture styles that work.

As a first step I think it would be great to deconstruct the CineStyle profile for those of us who still shoot mostly H.264--what can I say, I'm working on some documentaries. It looks like Andy600 has a good idea of how it works but it would be great to figure out how to reconstruct it from scratch as an open source project.

Quote from: reddeercity on December 07, 2015, 07:12:27 AM
Been using it with H264 since it came out on my 5D2 & being fighting with Skin tone since that day,(skin was gray-no mid tones) .

From what I read about log gamma curves it is all about evening out the distribution of bits to luminescence and not HSL (hue, saturation, and lightness) and HSV ( hue, saturation, and value). I'm going to take Andy600's advice next time I go out to shoot with CineStyle:

Quote from: Andy600 on December 07, 2015, 12:15:05 PM
I'm personally a little skeptical of the recommended saturation setting as desaturating before encoding could actually be losing much color information. If the -2 setting is to emulate the appearance of a wider gamut it's not really a good idea because pixels with RGB Values that already have close to no color will become grey and this cannot be recovered.

This should improve the grey skin tone issue.

Thanks Andy600, not for just this but for all the great tips that you are sharing with the ML community.

So it looks like my todo list just got a lot more ambitious.

reddeercity

So I download the "Cinestyle" Picture Profile from Technicolor Web site again to Check it out and
I never new there was s-curve lut that's going with that profile to de-log it in the download package.
If anyone interested I'll put the whole LUT package (including the Pf2 file & PDF user guide) it in my Dropbox  Link below
https://www.dropbox.com/sh/pboi1nziu9rus9f/AABv1_-iJ49ox5W9TfKwEJdka?dl=0
There a .txt file plus a .mga lut file not to sure about that format maybe a 'cube file"

Kharak

@dfort, Thank you for taking the time to explain the acronyms, sometimes posts on here get so full of acronyms which are impossible to google, that I feel like I am reading hieroglyphs at times.

I only record RAW since ML Raw was unleashed on the world, but I use custom Picture Profiles all the time. Cinestyle has a very good emulation of how the "final" RAW Log image will look like, In my case Cinelog-C to Log-C.

I was very excited when I first learned about Cinestyle those many years ago, so I was doing a lot of reading. I can understand that they don't want to share the ins and outs of it. They spent over a year developing the Profile, so there is some magic in there.

I've tried Marvels flat and Flaaat and VisionTech and whatever flat profile that I could find out there, but none of them come even close to delivering the "dynamic range" of Cinestyle.

So my setup now is always having Cinestyle and two Picture Profiles with a look to it. Because we can not use in-camera LUT's, instead we have the picture profiles and for giving a scene a better cinematic look or feel, its nice to have Custom Profiles. And I can highly recommend the 'Cinema' Picture Profile from Cineplus. It has a very nice and Natural Film look to it, but what I really like about it, is that you can easily "Grade" the shot, in camera by adjusting the WB respectively, the Picture Profile doesn't fall apart like the standard profiles and many other custom profiles I've used, it retains the filmic look but just grades nicely towards the temperature you set. And then changing the G/M towards either Green or Magenta, you can get more or less the exact look you want in camera.

I just wish we could have more than 3 Custom Profiles or atleast be able to change the standard ones.

Just beware of skintones with Cinestyle.

and sorry for straying so much off topic
once you go raw you never go back

dfort

Googling around I found this interesting blog post by Jorgen Escher who worked on one of the other Canon picture profiles out there, Marvels cinestyle. Yeah, I know--confusing because it has the same name as Technicolor's CineStyle but it is obviously something else. What is interesting is that Marvels has updated their picture style as recently as April 2015.

Another interesting piece of this puzzle is that Jorgen apparently asked for help reverse engineering the Canon .pf2 file format.

QuoteI have real trouble finding reliable information about the color tone curves and HLS mapping. The luminance curve is relatively obvious and "easy", for the rest i need someone to help me with the file format, like Tramel Hudson or someone of that stature.

Jorgen

Tramel Hudson started Magic Lantern. I'm not a Magic Lantern historian and I don't know if he is still involved but the source code is still hosted on his bitbucket account. I wonder if he knows what's in the Canon picture style files.

ansius

My two cents - I juggle between Technicolor and Marvels. Marvels mostly when the production is DSLR only, but I use Technicolor when I have to mix with other pro video cameras, Somehow it is easier for me to get them look the same. Tough yes - skin tones is problem, I get them first with vectroscope, and technicolor is rather unforgiving g if the white balance is not exactly right.
Canon EOS 7D & 40D, EF-S 17-85mm IS USM, EF 28-300mm IS USM, Mir-20, Mir-1, Helios 44-5, Zenitar ME1, Industar 50-2, Industar 61L/Z-MC, Jupiter 37A, TAIR-3
http://www.ansius.lv http://ansius.500px.com

Andy600

With all due respect to Jorgen Escher who does know a thing or two, I have to say I'm of the exact same opinion as Mike Seymour of FXPHD in that Jorgen is wrong when it comes to Cinestyle and he wrote a good article to explain why:

https://www.fxphd.com/blog/squeezing-the-most-out-of-a-5d-mk-ii-or-alexa-signal

The argument that is always made is that it is best to make use of 256 code values (8bits) for the tone curve as any less will cause banding (true - but that will happen anyway with this much linear data being compressed into 8bit log). Keeping shadow information in the lowest code values means important shadow detail is in the range where the H.264 encoder will do the most damage and, coupled with sensor noise, it becomes a mess. It is better in terms of noise and blocking artifacts (caused by the encoder) to raise the shadows to just above the noise floor, capture then drop them back down in post. 

It's true that a lot of users of Marvel's Cine find it easier to grade than Cinestyle simply because Marvels pegs black at 0 while Cinestyle needs a little more work in post BUT ultimately you will get cleaner images and maximum DR with Cinestyle.

Another important aspect is the gamut. If you record a DSC CamAlign chart and analyze the color patches on a vectorscope (2x), Cinestyle puts primaries and secondaries right where they should be. Picture styles that have been developed in PSE will show hue rotations caused by the base color profile (Neutral, Standard etc etc) - This is where Cinestyle has the edge. It's very accurate to Rec709 primaries BUT we are so used to seeing the prettier colors and warmer skin tones of Picture Styles that we tend to prefer the 'Canon' look.

The base profiles that most Picture Styles are based on are basically 16bit linear 3D luts in XYZ colorspace inside an ICC profile. The XYZ lut is processed in a Canon colorspace they named '6000'. This 6000 colorspace has Adobe 1998 primaries but with a D50 white point instead of D65 (simply because the processing all happens in XYZ which also uses D50 white). After the 'look' is added the inverse of 6000 is applied before the output colorspace is assigned (either sRGB or Adobe 1998). The lut part is crafted to produce a nice 'look', control any out-of-gamut colors and help keep saturation under control in the highlights and shadows - many of the most important decisions about color processing are taken out of your hands and, because the 'look' is not a simple matrix, it is pretty much impossible to undo.

You can see now that with Picture Styles, what comes out is far removed from what goes in - Cinestyle is much much closer to what the sensor captures and is corrected/calibrated for accurate rec709 primaries - this is how most video cameras work.
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

Audionut

Quote from: Andy600 on December 09, 2015, 02:30:13 PMKeeping shadow information in the lowest code values means important shadow detail is in the range where the H.264 encoder will do the most damage and, coupled with sensor noise, it becomes a mess. It is better in terms of noise and blocking artifacts (caused by the encoder) to raise the shadows to just above the noise floor, capture then drop them back down in post.

Agreed (somewhat).  If you search the doom9 forums from around 04' you will see all the complaining regarding shadow detail.  Back then it was mostly people with shitty display devices that were not calibrated, and tended to have the brightness to high.  So they could only just spot some issues, then went and raised the brightness on encoded content to exacerbate the issue.

To be fair, it's not really a problem per se.  To compress content, you must throw some away, and the shadows are an excellent source of content that can be discarded without perception.

The problems arise where people raise the brightness of these shadow areas after encoding.  The encoder isn't a mind reader, it doesn't know that the user wants to raise brightness after it's compressed the content.

The important part to understand in determining whether raising the brightness before encoding (with cinestyle or whatever) is useful, is to understand your final rendered image.  If you want to raise the shadows in post, then raise the shadows before encoding to maintain maximum detail.  If you're just going to crush the shadows in post, then raising the shadows before encoding is pointless, and means that the overall quality of your encode will be less, since the compression efficiency in the shadows will be lost.

dfort

Mind expanding stuff. Now I'm sorting out LUTs and ICCs and Picture Styles and how they are related.

The Canon PictureStyleEditor was updated to version 1.15.30 on October 28 and it looks like the same Picture Styles file format (.pf2 and .pf3) are being used in their latest cameras. I took a peak into the contents of the Mac version and found several ICC files, probably defining their default picture styles.



Quote from: reddeercity on December 08, 2015, 01:00:28 AM
I never new there was s-curve lut that's going with that profile to de-log it in the download package.

A while back I searched for those LUT's and someone converted the ones provided by Technicolor in .mga and .txt format to other formats including, .3dl, .a3d, .cms, .csp, .cube, .icc and .vf. I looked at the .icc file with Apple's ColorSync Utility and found that the file was created with LUT Buddy. It also had a "Copyright 2007 The Orphanage" in the file so who knows where that file has been!

Anyway the point of this isn't to steal copyrighted material but to figure out the intricacies of .pf2 and .pf3 files. Looks like they could be useful for more than just shooting JPEG stills and H.264 video. I must admit that my original intent was to see if it would be possible to come up with an open source log gamma Picture Style even though it looks like Technicolor CineStyle has that pretty well covered.

@Andy600 -- I thought that a Log Gamma curve needs to be tailored to each individual camera, how is it that Technicolor CineStyle apparently works for all models of Canon cameras?

Andy600

The Picture Style ICC profiles are the looks and are available for both sRGB and Adobe 1998 colorspaces i.e. FA = Faithful (Adobe 1998), FS = Faithful (sRGB), SA = Standard (Adobe 1998), SS = Standard (sRGB) etc etc

The camera too has an ICC (several actually) which come as binary files denoted by a number, look and colorspace i.e. 6211_ntla.BIN = camera_model/Neutral/Adobe1998. The number denoting the camera model can be found by using a live monitoring app which shows which files are called by an app while it is running. The binary files are included with Canon's SDK but you can't use them without DPP.

re: the S-Curve_for_Cinestyle.mga lut included with Cinestyle. It's actually quite poor in terms of resolution even for 8bit.

The other formats that can be found online (.3dl, .cube etc) are all converted from this low res lut too and won't improve things. The copyright notice indicates that the lut was likely converted with LUTBuddy which was developed by the Orphanage.

re: Cameras and log profiles - yes, ideally each camera model would have a tailored log profile but the difference in sensitivity between Canon DSLRs isn't that great (less than 1/2 a stop). The lin2log transfer function in Cinestyle was developed for the 5D Mark II so we can assume it is for the 5D2's DR and, because it gets applied after white balancing in XYZ space it works with all the cameras. There would be some gain if Cinestyle were developed for each camera independently but it would be very small and not amount to much - it's 8bit anyway so we're splitting hairs here.

@Audionut - I get what you are saying and while that method might achieve better detail and less noise (visually at one end of the signal), it is not really the intention of a log conversion which is merely to compress the linear signal into a smaller space so that it can later be expanded back to something resembling what the camera sensor captured without the influence of curves, contrast etc and with minimal loss. The camera will only capture what is within it's dynamic range capability so it's more about maximizing this linear range so that the log conversion can compress the most information without wasting bits but 14 into 8bits is going to mean high granulation and big gaps in the delogged signal.

I had the idea to add noise to the recorded signal which fills the gaps resulting in a solid histogram and no banding when linearized - it seems to work well and can be done with a lut.
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

DeafEyeJedi

Quote from: Andy600 on December 10, 2015, 02:28:17 PM
The Picture Style ICC profiles are the looks and are available for both sRGB and Adobe 1998 colorspaces i.e. FA = Faithful (Adobe 1998), FS = Faithful (sRGB), SA = Standard (Adobe 1998), SS = Standard (sRGB) etc etc

The camera too has an ICC (several actually) which come as binary files denoted by a number, look and colorspace i.e. 6211_ntla.BIN = camera_model/Neutral/Adobe1998. The number denoting the camera model can be found by using a live monitoring app which shows which files are called by an app while it is running. The binary files are included with Canon's SDK but you can't use them without DPP.

This is good to know...

Quote from: Andy600 on December 10, 2015, 02:28:17 PM
re: the S-Curve_for_Cinestyle.mga lut included with Cinestyle. It's actually quite poor in terms of resolution even for 8bit.

The other formats that can be found online (.3dl, .cube etc) are all converted from this low res lut too and won't improve things. The copyright notice indicates that the lut was likely converted with LUTBuddy which was developed by the Orphanage.

That actually makes sense and hence the reason why I didn't really like it or at least wasn't too fond of the results when combining the S-Curve Lut that came with Cinestyle from their site. Haven't used it again since. I like your products better, Andy!

Quote from: Andy600 on December 10, 2015, 02:28:17 PM
@Audionut - I get what you are saying and while that method might achieve better detail and less noise (visually at one end of the signal), it is not really the intention of a log conversion which is merely to compress the linear signal into a smaller space so that it can later be expanded back to something resembling what the camera sensor captured without the influence of curves, contrast etc and with minimal loss. The camera will only capture what is within it's dynamic range capability so it's more about maximizing this linear range so that the log conversion can compress the most information without wasting bits but 14 into 8bits is going to mean high granulation and big gaps in the delogged signal.

I had the idea to add noise to the recorded signal which fills the gaps resulting in a solid histogram and no banding when linearized - it seems to work well and can be done with a lut.

Point taken. Hopefully this idea of yours will be implemented into the next update for Cinelog-C and hopefully soon by the Holidays!  8)
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

dfort

Quote from: Andy600 on December 10, 2015, 02:28:17 PM
The Picture Style ICC profiles are the looks and are available for both sRGB and Adobe 1998 colorspaces i.e. FA = Faithful (Adobe 1998), FS = Faithful (sRGB), SA = Standard (Adobe 1998), SS = Standard (sRGB) etc etc

Interesting, now we're getting somewhere in this reverse engineering thing-a-ma-jig. So it seems that a custom picture style is based on one of the standard picture styles? Maybe with the exception of Auto and Monochrome? The Canon apps use the icc to get into the ballpark then apply the custom parts of the picture style? That's probably why other apps don't display custom picture styles properly on raw files.

Quote from: Andy600 on December 10, 2015, 02:28:17 PM
re: the S-Curve_for_Cinestyle.mga lut included with Cinestyle. It's actually quite poor in terms of resolution even for 8bit.

You know this better than I but rumor has it that colorists are removing the S-Curve_for_Cinestyle lut before applying their own adjustments. Maybe if the lut were higher quality that wouldn't be happening?

Quote from: Andy600 on December 10, 2015, 02:28:17 PM
I had the idea to add noise to the recorded signal which fills the gaps resulting in a solid histogram and no banding when linearized - it seems to work well and can be done with a lut.

Some people are transcoding their H.254 footage before editing. On one of my shoots I removed the objectionable noise with Neat Video then added in a little film grain before exporting to ProRes 444 HQ and wow, what a difference. Of course it took a long time to process but it was worth it.

Anyway, I'm typing this at work and need to wrap up. I'll dive into this deeper later but it seems that maybe creating an open source log camera picture style and associated luts might not be such a bad idea after all?

agentirons

QuoteThe Picture Style ICC profiles are the looks and are available for both sRGB and Adobe 1998 colorspaces i.e. FA = Faithful (Adobe 1998), FS = Faithful (sRGB), SA = Standard (Adobe 1998), SS = Standard (sRGB) etc etc

On a related note, could these ICC profiles be used to create a Digital Camera Profile for use in Adobe Camera Raw that would let me match a .cr2 to the color look of the in-camera JPG?

dfort

Interesting question. If compiled with "gcc -o dcraw -O4 dcraw.c -lm -ljasper -ljpeg -llcms2" dcraw has these options:

-p camera.icm [ -o output.icm ]
Use ICC profiles to define the camera's raw colorspace and the desired output colorspace (sRGB by default).
-p embed
Use the ICC profile embedded in the raw photo.


Don't know how it works. My understanding is that there is an ICC profile embedded inside of CR2 files but only Canon's software seems to be able to make any use of it.

axelcine

Somewhere in one of the ML threads I think I found this link - or was it somewhere else? http://lclevy.free.fr/cr2/

At any rate it confirms that ICC data are embedded in CR2 files.
EOS RP, 5dIII.113/Batt.grip, 5dIII.123, 700d/Batt.Grip/VF4 viewfinder + a truckload of new and older Canon L, Sigma and Tamron glass

DeafEyeJedi

Ah I knew it ... This is definitely good news and should point us into the right direction. Thanks for sharing @axelcine!
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

agentirons

Quote from: andy600
The Picture Style number in .cr2 files is just a flag to tell DPE which PS was active (and used for Jpegs). Custom Picture Styles are embedded in the .cr2 and read by DPE.

Andy also confirmed this, and I saw it myself by looking at a cr2 shot with Cinestyle and loading it into DPP - it correctly extracts the profile for further processing, and that software also allows you to select a new custom picture style for after-the-fact applying to cr2s.

I would love to know why Adobe wasn't able to use Canon's ICC profiles for creating their Digital Camera Profiles in ACR. I remember reading that they had to reverse engineer the look of each one in the standard set (ie Portrait, Landscape, Neutral, etc.), and the results never match Canon's in-camera or DPP processing of the same image in terms of color. Since ACR's raw processing is so much better in all other aspects, I wish there was a way for it to match Canon's color for cases where their picture style is the exact look desired.

eyeland

Quote from: Andy600 on December 10, 2015, 02:28:17 PM
re: the S-Curve_for_Cinestyle.mga lut included with Cinestyle. It's actually quite poor in terms of resolution even for 8bit.
Any suggestions on what to use instead?
Edit: I forgot about your cinelog-c, I assume that's what you refer to?
Daybreak broke me loose and brought me back...

dfort

Quote from: eyeland on January 27, 2016, 02:52:11 AM
Any suggestions on what to use instead?
Edit: I forgot about your cinelog-c, I assume that's what you refer to?

Picture Styles are loaded into the camera to give custom looks. Cinestyle is a log Picture Style. Think of it like the log profiles available for Black Magic, Panasonic and Sony cameras. Canon also has log Picture Styles built into their professional cine cameras.

LUTs can be applied to footage that was shot in a log Picture Style to change it to a standard color space like say Rec709 or it can apply various "looks" to the footage.

The S-Curve_for_Cinestyle.mga changes Cinestyle shot footage to Rec709. What Andy600 was talking about (I believe) is that the LUT could be of higher resolution. Note that Cinestyle was released in 2011 and there was no further development since. Meanwhile technology in this area has progressed by leaps and bounds. Well, you know what I mean--we should be able to create a better log profile for our cameras. Thing is, Cinestyle is closed source, locked up and somebody seems to have swallowed the key.