Author Topic: Reverse Engineering Picture Styles  (Read 179106 times)

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Reverse Engineering Picture Styles
« Reply #300 on: April 22, 2017, 08:32:25 PM »
The announcement of Canon Log for the 5D4 is certainly grabbing a lot of attention and the comments from users range from delight to outrage--mostly outrage that the camera needs to be sent in and it cost $99. It won't be available until July so we'll have to wait a few months to hear from users' experiences with it.

One thing does seem to be clear, this is partially a hardware modification. If you check out log settings on professional video cameras you'll notice that it is more than just a picture style. In order to use log, automatic exposure is not possible and the recommended ISO settings center around a sweet spot called the base or native ISO. In the case of the 5D4 it will be ISO 400.

This will be the second Canon DSLR to receive the log option, the first was the EOS-1D C. Several comments are floating around as to why the EOS-1D X Mark II isn't getting this log upgrade. Perhaps the question should be why Canon doesn't combine those two cameras but it would have to be a merge that doesn't compromise the video capabilities of the 1D C or the still photo capabilities of the 1D X.

Back to Canon Log on the 5D4, will we be able to come up with a picture style that can do Canon Log on the other camera models? Though we have had log picture styles since Technicolor released CineStyle in 2011, are log picture styles the same as the hardware log profiles? Probably not. The EOSHD C-LOG picture style was developed by matching the EOS-1D C log setting as closely as possible. It will be interesting comparing this picture style with the real thing when it comes out in July.

The Canon announcement includes reference to a new "View Assist" setting that will show a "normal" looking image on the camera while recording log internally or outputting log video through the HDMI port. That is something that can be approximated with the display settings in Magic Lantern on certain cameras.



Note that on the 5D4 the HDMI output is still at best 1920x1080 8-bit 4:2:2 so 4k will still need to be recorded internally with the 8-bit Motion JPEG 4:2:2 at 500Mbit/s codec. Ideally the HDMI output would be 4k 10-bit (or higher) 4:4:4 so you can use an external recorder to capture broadcast ready 4k video.

If you want log media another option is to shoot MLV and apply a log DNG Camera Profile when creating your movie files. @Andy600 is the expert when it comes to that workflow.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Reverse Engineering Picture Styles
« Reply #301 on: April 28, 2017, 04:13:06 AM »
I just got back from NAB and saw the 5D Mark IV with Canon Log being demonstrated. Right next to it was a 1 DX Mark II without Canon Log. OK, we knew about that but missing from the camera lineup was the 1 DC which of course was the first to have Canon Log. Will it be discontinued? They were tight lipped about that.

Interesting was that they were still offering to send you information about the 5D Mark III when they scanned your badge so either it hasn't been discontinued yet or they must still have a stack of 5D3's in the warehouse.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

DeafEyeJedi

  • Hero Member
  • *****
  • Posts: 3401
  • 5D3 | M1 | 7D | 70D | SL1 | M2 | 50D
Re: Reverse Engineering Picture Styles
« Reply #302 on: April 28, 2017, 07:04:36 AM »
I just got back from NAB and saw the 5D Mark IV with Canon Log being demonstrated. Right next to it was a 1 DX Mark II without Canon Log. OK, we knew about that but missing from the camera lineup was the 1 DC which of course was the first to have Canon Log. Will it be discontinued? They were tight lipped about that.

Uh-oh... smells like a hint to me. Shall we bait on it?  :-X

Interesting was that they were still offering to send you information about the 5D Mark III when they scanned your badge so either it hasn't been discontinued yet or they must still have a stack of 5D3's in the warehouse.

Heck by the end of this year before the Holidays kicks in we might as well just grab another brand new 5D3 or two just to have as back-up's down the road. These beasts are still going to be kicking ass come 2020 and beyond. Just not sure whether I should invest into a 5D4 just yet. Maybe a used one by the time the Mark V comes out.
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Reverse Engineering Picture Styles
« Reply #303 on: April 28, 2017, 06:27:26 PM »
Just thought I'd post my obligatory shot of Canon Log at NAB.



Although Magic Lantern wasn't represented at NAB I did find a booth where an exhibitor had it installed on one of their demo cameras.



We now return to our regularly scheduled topic on reverse engineering picture styles.

5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

hyalinejim

  • Member
  • ***
  • Posts: 131
Re: Reverse Engineering Picture Styles
« Reply #304 on: April 28, 2017, 06:45:40 PM »
Is that an early Canon from the Paleolithic era?

;)

DeafEyeJedi

  • Hero Member
  • *****
  • Posts: 3401
  • 5D3 | M1 | 7D | 70D | SL1 | M2 | 50D
Re: Reverse Engineering Picture Styles
« Reply #305 on: April 28, 2017, 07:15:05 PM »
More like from the Flintstone's era!
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Reverse Engineering Picture Styles
« Reply #306 on: April 28, 2017, 08:35:58 PM »
Don't you get the joke? Hint--that's a brick.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

DeafEyeJedi

  • Hero Member
  • *****
  • Posts: 3401
  • 5D3 | M1 | 7D | 70D | SL1 | M2 | 50D
Re: Reverse Engineering Picture Styles
« Reply #307 on: April 28, 2017, 10:23:31 PM »
Don't you get the joke? Hint--that's a brick.

Ah, you got me. Just shat a brick!  :P
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7188
Re: Reverse Engineering Picture Styles
« Reply #308 on: April 28, 2017, 11:11:04 PM »
Just wait for a1ex to set up a fir for that brick guys.

Kharak

  • Hero Member
  • *****
  • Posts: 1008
Re: Reverse Engineering Picture Styles
« Reply #309 on: April 28, 2017, 11:28:49 PM »
Can you elaborate on the brick? :)
once you go raw you never go back

ItsMeLenny

  • Hero Member
  • *****
  • Posts: 928
  • 550D
Re: Reverse Engineering Picture Styles
« Reply #310 on: April 29, 2017, 08:02:32 AM »
So what are the hardware changes that have to be made?
I guess the thing as we still dont know where the canon curve lies as the cinestyle picture style reversed it within the picture style.

noetzelj

  • Just arrived
  • *
  • Posts: 1
Re: Reverse Engineering Picture Styles
« Reply #311 on: September 08, 2017, 09:03:33 PM »
Sure thing, sorry I didn't copy that from the Cinestyle tab into the main tab. It's the same for L*a*b* Gamma too.

For everyone's reference, the way it works is that for each channel, the first set of 4 bytes (ie 00 00 00 02) indicates how many points there are in the curve, and then each pair of 8 bytes following corresponds to an input and output for that point, used to calculate transformations from incoming data. So for instance if there are only 2 curve points, then the first set of I/O corresponds to black level and the next set corresponds to white level, and the remaining values in that channel are left blank. If there are three points, then first is black, second is your custom point, third is white, and the rest are blank. Strangely, the max seems to be twelve even though there's enough space in each data block for 15 points. So, each channel within the data block will always end with at least 24 bytes of zeros.


Resurrection from the dead.  I've been digging into this for two days straight....

I'm unable to have success with this....but I've been trying it with .pf3 files.

Does anybody have a .pf2/3 file with individually adjusted R, G, & B curves?  I'd like to open it up and see what I'm doing wrong.


Thanks!



ItsMeLenny

  • Hero Member
  • *****
  • Posts: 928
  • 550D
Re: Reverse Engineering Picture Styles
« Reply #312 on: September 10, 2017, 12:47:37 PM »
you could make one pretty quickly in the canon picture style editor.
i'd do it and send a copy but I'm on linux so it's a bit of a process.

markanini

  • Freshman
  • **
  • Posts: 54
Re: Reverse Engineering Picture Styles
« Reply #313 on: October 15, 2017, 05:16:32 AM »
Since I started developing my RAW photos with an awesome Canon 450D derived tone curve the prospect of bringing OOC previews closer to my final curve sounds too sweet to pass. My hacking skills are below the pay grade of most contributors in this thread, but I'm ready to do some testing so let me know if this sounds feasible. Perhaps this will be useful for for multi-camera setups too. Roughly what I want to do:
  • Start with a general purpose PS like Standard, Neutral or Faithful.
  • Using dcptool or dcp2json I extract my target curve from "Canon EOS 450D Camera Standard.dcp" stored in decimal form. (A large number of unique tone curves can be sourced from DCP files by Adobe, free to download.)
  • Scale the target curve by 50% to in order to apply it equally between L and RGB blocks. This should provide a good balance between saturation and hue accuracy.
  • The linearizing reverse RGB S-curve(discovered in Cinestyle) is converted to decimal and added to the curve made in the previous step.
  • Curves created in step 3 & 4 are interpolated and converted into hex and finally written into L and RGB blocks respectively.
Gear: Canon 600D & Magic Lantern Nightly.

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Reverse Engineering Picture Styles
« Reply #314 on: October 16, 2017, 01:14:54 AM »
Not following exactly what you are trying to do but hey, we're here to learn.

Did you know that the custom profiles are accessible from a firmware dump? Not exactly sure how to do it but if you search a disassembly on a camera that had Cinestyle installed you'll see something like this:

Code: [Select]
"CineStyle":
fff01b44: 656e6943 strbvs r6, [lr, #-2371]! ; 0x943
fff01b48: 6c797453 cfldrdvs mvd7, [r9], #-332 ; 0xfffffeb4
fff01b4c: 00000065 andeq r0, r0, r5, rrx
...
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

markanini

  • Freshman
  • **
  • Posts: 54
Re: Reverse Engineering Picture Styles
« Reply #315 on: October 16, 2017, 05:55:48 AM »
Not following exactly what you are trying to do but hey, we're here to learn.
Basically, since we know how to create a linear tone picture style(see RGB_Gamma_curve.pf3 http://www.magiclantern.fm/forum/index.php?topic=16299.msg172770#msg172770) I'm playing with the idea of creating picture styles with my custom tone curve for photographic purposes. You might think this would be negated by shooting raw. While I agree with that, this would improve visual feedback while shooting. Here's the tone curve I want to try:

https://www.dropbox.com/s/3t8sq71bm3ku200/450D%20TC_Adobe.CSV?dl=0

Did you know that the custom profiles are accessible from a firmware dump? Not exactly sure how to do it but if you search a disassembly on a camera that had Cinestyle installed you'll see something like this:

Code: [Select]
"CineStyle":
fff01b44: 656e6943 strbvs r6, [lr, #-2371]! ; 0x943
fff01b48: 6c797453 cfldrdvs mvd7, [r9], #-332 ; 0xfffffeb4
fff01b4c: 00000065 andeq r0, r0, r5, rrx
...
Cool find. Do you think the values correspond to sharpness contrast etc settings or do they provide further insight on the picturestyle format?

EDIT:It's shouldn't be understated that separate RGB and L curve adjustment that we have now is really powerful. To illustrate this I developed a raw photo with the tone curve applied in RGB space, L space and 50% RGB and L.

Tone curve in RGB / Tone curve in L / Tone curve in 50% RGB, 50% L

RGB Reminds me of Neutral and Standard. Gray-ish skintones, overall yellow-leaning. / L Reminds me of Faithful. Pastell-leaning hues. Washed out skintones.  / 50-50 RGB-L  Has skintones with a natural definition, smoother tonal transitions and truer hues.



Gear: Canon 600D & Magic Lantern Nightly.

Lars Steenhoff

  • Senior
  • ****
  • Posts: 473
Re: Reverse Engineering Picture Styles
« Reply #316 on: October 16, 2017, 01:07:18 PM »
Would it be possible to convert a LUT from for example the ektar chrome to a canon picture style?

https://www.magiclantern.fm/forum/index.php?topic=19338.0

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7188
Re: Reverse Engineering Picture Styles
« Reply #317 on: October 16, 2017, 01:20:15 PM »
You can mimic luts but it will take effect very late in the chain. Also, when using picture style editor you only have twelwe gamma/tone curve points to work with.
There are a few initiatives that digged out a whole lot of infomation about how it all works but one reason it all stopped is probably we are too far from sensor level to make good use of it all. Please correct me if I'm wrong here.

Lars Steenhoff

  • Senior
  • ****
  • Posts: 473
Re: Reverse Engineering Picture Styles
« Reply #318 on: October 16, 2017, 04:18:15 PM »
If its only to display on the back of the screen and for the h264 proxy to look a certain way the shot is intended to look, would it really matter if its too late in the chain?

With too late I assume you mean after some conversions already happenend to the signal and therefore losing dynamic range.

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7188
Re: Reverse Engineering Picture Styles
« Reply #319 on: October 16, 2017, 04:27:30 PM »
A lut(3D) has so much information so to manually recreate it with picture style editor will at its best be a "similarly" looking look. If that´s ok then go for it. Converting the lut into a .pf3 with some existing tool. Havn´t heard of it

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Reverse Engineering Picture Styles
« Reply #320 on: October 16, 2017, 08:15:19 PM »
...we are too far from sensor level to make good use of it all...

I don't know exactly why the 5D4 needs to be sent in to a Canon service center to get the Log Feature Upgrade installed but lately I've been fiddling around with some higher end cine cameras and there are some quirks to working in log that makes me think that it needs to be done in hardware. Some cameras lock you into a "Native ISO" others recommend not to go below a certain ISO when using log and the new Panasonic EVA1 has Dual Native ISO which gives you a choice of 800 or 2500 but nothing else.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

reddeercity

  • Contributor
  • Hero Member
  • *****
  • Posts: 2293
Re: Reverse Engineering Picture Styles
« Reply #321 on: October 17, 2017, 06:09:00 AM »
The following only applies to h264 4:2:0 & uncompressed 8bit HDMI 4:2:2 Color Space not Raw Video .
Yes , when recording in Log Space there needs to be a certain parameters for the camera to capture the maximum dynamic range in it's native color space . That kind of what A.C.E.S is about , that's a whole different thread .
Lets take Technicolor CineStyle Profile  for example , as it was originally developed for 5D mark ii but can be used by all canon dslr's , the optimal image quality to record Log is
•Sharpness: 0
•Contrast: -4
•Saturation: -2
•Color Tone: 0
•ISO: a multiple of 160

The only 2 things I would add to this is Always record @ 160 ISO (if possible but not over 320 ISO) and drop Saturation to -4 .

What does cinestyle profile do to the image
Quote
When the Technicolor CineStyle Profile is selected in the camera, video images are recorded in log space.
.... though the image will appear flat and de-saturated, there is actually more detail retained in the shadows and mid-tones
.
So by apply a modified Picture Style (Not Technicolor CineStyle as this is the Low Level chain of image processing) with LOG Type tone curve or thought software after the fact you are really not recording and or saving in LOG and thus are only imitating LOG space which is not maximuming dynamic range to it's fullest extent .

Once you study the parameters required to record true LOG Space with Technicolor CineStyle  it's clear the camera's picture style had been calibrated to the  Sensor at a low level along the lines of the IDT (Input Device Transform)is in A.C.E.S
If anyone is interested in A.C.E.S here a link  http://acescentral.com/ I've been a member since 2014 , it's free to join and even if you don't use A.C.E.S , there is lot's of great info on color grading and color space's etc. .... I get a new letter once a mouth with updates & or discussions .

What is Academy ACES
Quote
WHAT IS ACES?
The Academy Color Encoding System (ACES) is becoming the industry standard for managing color throughout the life cycle of a motion picture or television production. From image capture through editing, VFX, mastering, public presentation, archiving and future remastering, ACES ensures a consistent color experience that preserves the filmmaker’s creative vision. In addition to the creative benefits, ACES addresses and solves a number of significant production, post-production and archiving problems that have arisen with the increasing variety of digital cameras and formats in use, as well as the surge in the number of productions that rely on worldwide collaboration using shared digital image files.

ACES is a free, open, device-independent color management and image interchange system that can be applied to almost any current or future workflow. It was developed by hundreds of the industry’s top scientists, engineers and end users, working together under the auspices of the Academy of Motion Picture Arts and Sciences.

ACES 1.0 is the first production-ready release of the system, the result of over 10 years of research, testing and field trials. It includes support for a wide variety of digital and film-based production workflows, visual effects, animation and archiving.


Edit:
What Technicolor Color up to now ? check out the YouTube link
 

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Reverse Engineering Picture Styles
« Reply #322 on: October 17, 2017, 07:26:23 AM »
I don't know about that recommendation of dropping the saturation to -4.

Quote
WHAT ARE THE RECOMMENDED CANON EOS-5D MARK II CAMERA SETTINGS TO OBTAIN OPTIMAL IMAGE QUALITY?

We recommend the following settings:

Sharpness: 0
Contrast: -4
Saturation: -2
Color Tone: 0
ISO: a multiple of 160

Another popular picture style that has worked well for me is the Prolost Flat which doesn't require loading a custom picture style through the Canon EOS Utility. Simply start with Neutral and:



Now why would professional cinematographers and a company with a reputation like Technicolor recommend taking the saturation down to only -2 and not to -4? There must be a reason for that.

As far as the ISO, on the Canon C100 and C300 when shooting C-Log the recommendation is to shot at ISO 850. Going below this and you will lose some dynamic range. This is clearly illustrated in this Cinema 5D article. This may not apply to picture styles because there is difference between a "real" log profile that is applied so the low level chain of image processing that it requires a hardware modification on the 5D4 and a picture style. Cinestyle is a picture style, you can clearly see if you disassemble the firmware that it lives in the same space as other picture styles so how can it possible be applied lower in the image processing chain than any other picture style?

I'm not trying to start an argument, just struggling understanding these concepts.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

ItsMeLenny

  • Hero Member
  • *****
  • Posts: 928
  • 550D
Re: Reverse Engineering Picture Styles
« Reply #323 on: October 17, 2017, 07:58:40 AM »
As far as the dropping the saturation down you lose colour depth. It's like over underexposing.
Underexposing is easier to fix than clipped highlights, but if you're so far underexposed then try to bring it up to a normal exposure you'll get banding.
Considering our eyes perceive contrast more than colour who knows how much it would affect visually, it's already 8 bit and 4:2:0 chroma sub sampled.
But try it yourself, in an extreme case, take any photo, de-saturate it to -95 (and apply it so its destructive if the program doesn't already), and then re-saturate repeatedly til it's roughly the same saturation. Enjoy colour banding for all.

bpv5P

  • Member
  • ***
  • Posts: 167
Re: Reverse Engineering Picture Styles
« Reply #324 on: October 17, 2017, 06:15:07 PM »
Hi @reddeercity , can you answer this other thread? I'm very curious about ACES, but don't know much. Thanks.