Author Topic: Contrast and picture styles, the real scoop.  (Read 13971 times)

stevefal

  • Contributor
  • Hero Member
  • *****
  • Posts: 528
Contrast and picture styles, the real scoop.
« on: March 13, 2013, 02:30:26 AM »
I've spent today trying to research the Canon image dataflow, i.e. 14-bit sensor > 8-bit video, and I'm still unclear on a few things. Too bad Canon makes this stuff so opaque.

Like everyone else, I want to get the most out of the measly 8-bits, and I'm looking to third-party picture styles as well as in-camera and potentially ML settings to optimize things.

I've come to the conclusion that a lot of people use and promote picture styles without necessarily understanding what they do, or which problems they can and can't solve. Everything is about tradeoffs, and making them takes solid understanding.

It seems the biggest concept people trip over is what happens when a 12 or 14 bit image is converted to 8-bit. People need to understand that 14-bit data can be clipped, scaled linearly or non-linearly, or a combination of all three in order to produce the 8-bit version that's recorded.

This discussion over on the BlackMagic forum is a good example of confusion/debate about this even among qualified people: http://forum.blackmagicdesign.com/viewtopic.php?f=2&t=2119

When data is clipped, the image loses detail in highlight areas. When data is scaled linearly (dropping least significant bits), detail is lost in shadows. If data is modified non-linearly through high-gamma or s-curves, highlights and/or shadows can be retain at the expense of lower color resolution (flatness) in the mids. The only way not to suffer these losses is to avoid conversion to 8-bit. RAW is great because you sidestep this issue until you're ready to grade in post.

Another breakdown I see is people choosing a low-contrast style because that's how to "get the film look" or to enable grading. While that is valid in some cases, what's invariably absent from the discussion is what scene you are shooting in the first place. If the scene I'm shooting has 5 stops of dynamic range, compressing that down to 3 stops is pointless and even counterproductive.

If we're all trying to capture the most of what we want from a scene, whether it's shadow detail, highlights, great skin-tone or whatever, we need to first know how much dynamic range is in the scene, and, assuming that it's greater than 8 stops/bits, what we want to sacrifice from those bits beyond 8.

This brings me to my questions. A1ex said this in another thread:

1) From ARM you can only see it as 8 bit, with all curves applied. The pipeline seems like this:

- 14bit data
- linear transformation (digital ISO gain, black level)
- HTP (nonlinear) - if enabled
- 14 to 12 bit reduction (suggested by 14_12 strings and by lack of shadow detail in aggressive Flaat styles, compared with digital ISO gain)
- nonlinear curves (like picture style)
- result: 8-bit 422 (codenamed Craw or HD buffer, almost 1080p, see Debug menu for exact size).
- Craw is downsampled for LV display
- Craw is fed directly to H.264 encoder, where it becomes 420 and slightly upsampled to 1080p.

1) When experimenting with "contrast" within a picture style, my impression is that lowering contrast brings a little more information from the 14/12 bit domain, via scaling, into my image (at the inevitable expense of more banding). Is this correct, or does contrast merely alter gamma within the 8-bit space?

2) The Picture Style Editor's curve UI seems only to alter dynamics post 8-bit conversion. That is, you can't use it to recover highlights or shadows from the RAW 14. Is that right?

3) If #1 and #2 are correct, my most important question is whether 3rd party picture style developers have access only to the mostly pointless parameters in the Picture Style Editor, or do they have back-door access to parameters governing the actual 14/12>8 bit conversion algorithm?

4) If it's the latter, what freedom is available for controlling the balance of truncation versus scaling during the conversion? Why don't style developers simply explain what their profiles do in terms of scaling and truncation? This is a math problem, but people seem to treat it as black, uh, magic.

When preparing to shoot a scene, I would like to measure the scene's physical dynamic range using a light meter or camera (or ML feature!) and then based on those measurements and a well documented set of 14>8bit conversion profiles, pick the best one for the shot.

P.S. Does anyone know exactly what HTP does? Does it linearly scale 14>12? Or does it non-linearly scale the top few bits of the 14 into the top few of the 12? Something else?
Steve Falcon

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: Contrast and picture styles, the real scoop.
« Reply #1 on: March 13, 2013, 03:02:15 AM »
The black level piqued my interest. I see a difference at high settings and it seems to be recorded into the video. Opens up the shadow area like marvel's ps.

HTP just seemed to add gain into the iso.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12464
Re: Contrast and picture styles, the real scoop.
« Reply #2 on: March 13, 2013, 09:12:48 AM »
HTP is applied before picture styles, and I think it's nonlinear applied at 14-12 stage. So, picture styles can't really recover much shadow detail, but HTP can bring one extra stop of DR.

In debug.c, define CONFIG_ISO_TESTS and you can plot the response curve (EV vs luma).

Some rough notes: http://magiclantern.wikia.com/wiki/ISO

Rush

  • Member
  • ***
  • Posts: 159
  • 5D3, EOS M
Re: Contrast and picture styles, the real scoop.
« Reply #3 on: March 13, 2013, 09:24:00 AM »
In my experiments in post I noted that popular Cinestyle have DR not more than Marvels Cine. And both have DR that almost identical to DR of Neutral style (with -4 contrast).
Seems that the only advantage of Cinestyle in that comparison - less banding in shadows and highlights in cost of increased banding in mid-tones. Neutral style (contrast -4) is opposite - less banding in mids but increased in lows and highs. Marvels is balanced.
For me, since I usually shoot people (midtones) and anyway prefer contrast look in final output - I prefer Marvels.

(by the way, from my tests, Lightform N adds ~1/3 stop DR in lights, but I don't like the way it lowers white level - ML exposure aids don't work with it correctly)
Greetings from Russia!

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: Contrast and picture styles, the real scoop.
« Reply #4 on: March 13, 2013, 02:45:24 PM »
6D has tons of ISO choices with both canon and ml gain, I think ISO tests will prove interesting. Without marvels the shadow area is just black... I don't think I'm getting *extra* DR with marvel's (or any other P/S), just not recording the shadows as pure black.

ReinisK

  • New to the forum
  • *
  • Posts: 27
Re: Contrast and picture styles, the real scoop.
« Reply #5 on: March 21, 2013, 10:11:01 PM »
I have been thinking of this also for a while now.
To my understanding - in controlled lighting you never want to use flat picture styles. Actually it is the other way - you could gain resolution by adding contrast to picture styles and then adjust the lighting to your desired contrast level.

c2s07

  • New to the forum
  • *
  • Posts: 40
  • 500D/6D/0.07D
Re: Contrast and picture styles, the real scoop.
« Reply #6 on: September 29, 2013, 08:11:11 PM »
Bump! Sorry, but this is an interesting topic. I've been testing settings on 6D, to see what has changed over the years.

So regarding movie shooting and highlight tone priority, on 6D:

For some reason, HTP seems to only go up to 6400 analog ISO and not higher (at which point the ISO reads 12800 D+). Don't ask me why this limitation. So comparing 12800 D+ to true 12800, using static movie clips shot in a relatively dark corridor: 12800 D+ has shadows with a greenish tint, while the true 12800 has shadows with more accurate colors.

If you're shooting a video in darkness and need a way to brighten up the footage in-camera, this limitation makes HTP inferior to actually using true ISO 12800 or the 25600/H. On top of the latter two, you could try using auto lighting optimizer (a subtle effect), or a custom picture style that attempts to replicate the effect of HTP by lifting tones (caveat: this picture style won't be operating on 14 bits).

Another observation is that 6D won't let you use (true) ISO 25600 in movie mode. Considering that 6D specifications, to my understanding, suggest native ISOs from 100 to 25600, I have no idea why this true ISO 25600 is then blocked in movie shooting, as one would think it's always a better option than 12800 digitally pushed. But I guess this has been the case since 500D.

Feel free to post your thoughts, and correct me where I'm wrong. :)

vickersdc

  • Freshman
  • **
  • Posts: 67
Re: Contrast and picture styles, the real scoop.
« Reply #7 on: January 11, 2014, 04:40:31 PM »
I think this is interesting too!

I've been using raw recording on my 600D, and whilst it is amazing to be able to do that, I was plagued by dots across the whole image. Although I could get rid of these, it was another step in the raw workflow that I could do without. So, whilst I like shooting a little bit of raw, I went back to H.264 and picture styles.

I figured that by selecting a flatter style when faced with a contrasty image, or a more contrasty style in flat light, I'd gain back some control and this could be done in camera. I also thought that by using the contrast setting within a picture style would provide a level of control as well.

Finally, I thought I'd create a new picture style with a little bit of an S-Curve built-in. This is the result... no post-processing done to the video at all (this is just a stills frame straight from the MOV file). CBR set to 3.0.



If anyone fancies trying the picture style, it can be downloaded at http://www.dropbox.com/s/hvkwekdoseieen7/S-Curve.pf3

I'm happy with the result, and probably keep to H.264 for now! I'm filming an interview this week, so it'll get tried out properly then.

Finally, in my new Davinci Resolve video tutorial about working with audio and video  - I filmed a piece to camera using H.264 and there seems to be no issues with levels of detail there. I'm beginning to wonder if I've fallen foul of the mad rush to use raw... well, just because I could! The H.264 quality seems plenty good enough for my uses.

Farnham360: my personal video project for 2014... http://www.farnham360.co.uk
Learn the basics of Davinci Resolve 10 Lite by following the tutorials at http://www.davidvickers.co.uk
Twitter: @DVMediaPro

ItsMeLenny

  • Hero Member
  • *****
  • Posts: 927
  • 550D
Re: Contrast and picture styles, the real scoop.
« Reply #8 on: January 12, 2014, 04:06:05 AM »
My quest is to remove that picture style step. Or counteract the picture style step with a picture style.

This is Canon's Neutral picture style (photo taken with a 550D)
https://lh4.googleusercontent.com/-Lz_UH1Vlmo0/UtH94w6PvaI/AAAAAAAABN8/Ud8XNoN94RE/s2560/uSocks_neutral.JPG
bigger image ^^^
Canon's Neutral picture style with -4 contrast.
https://lh3.googleusercontent.com/-qJDh9_GJH9w/UtH9-x5CC2I/AAAAAAAABOU/0j9VGzP1g7g/s2560/uSocks_neutral_-4cont.JPG
Darktable rendering the raw image (ppg demosaic)
https://lh3.googleusercontent.com/-_BNNs4yJ8wc/UtH95Tx8a6I/AAAAAAAABOI/y_bfdYEx6ZI/s2560/uSocks_darktable.jpg
Darktable rendering the raw image but applying a base curve which mimics canon EOS cameras.
https://lh4.googleusercontent.com/-yF0JeyEp9FU/UtH96HpGaII/AAAAAAAABOM/C8TJex8pr8c/s2560/uSocks_darktable_basecurve.jpg

My favourite is the darktable render, which I believe is essentially a direct passthrough. And I've tested every flat picture style out there and none of them result in anything close to it. It looks and feels to me like a correct representation of the image.
Also, if you compare the darktable with basecurve to canons neutral, they are somewhat similar, however the colours in the darktable are more true. The blue and the yellow, and in particular that maroony red.
So I'm still on a quest to find how I can get that darktable render look in camera for 8 bit. It gives a more television appearance than it does blown out appearance like canons styles.
One other thing; I think it was a1ex that make a soft film curve, which preserved/displayed a lot more in the highlights, I quite like it as a curve, but nothing else has ever sufficed.

superkraft

  • New to the forum
  • *
  • Posts: 6
Re: Contrast and picture styles, the real scoop.
« Reply #9 on: November 01, 2014, 12:51:18 PM »
Dear Stevefal,

I was very happy to discover your questions about the implementation of the picture style and the consequences to the image quality.
Could you or anyone in the forum solve/answer your original questions? - THX !

1) When experimenting with "contrast" within a picture style, my impression is that lowering contrast brings a little more information from the 14/12 bit domain, via scaling, into my image (at the inevitable expense of more banding). Is this correct, or does contrast merely alter gamma within the 8-bit space?

2) The Picture Style Editor's curve UI seems only to alter dynamics post 8-bit conversion. That is, you can't use it to recover highlights or shadows from the RAW 14. Is that right?

3) If #1 and #2 are correct, my most important question is whether 3rd party picture style developers have access only to the mostly pointless parameters in the Picture Style Editor, or do they have back-door access to parameters governing the actual 14/12>8 bit conversion algorithm?

4) If it's the latter, what freedom is available for controlling the balance of truncation versus scaling during the conversion? Why don't style developers simply explain what their profiles do in terms of scaling and truncation? This is a math problem, but people seem to treat it as black, uh, magic.

When preparing to shoot a scene, I would like to measure the scene's physical dynamic range using a light meter or camera (or ML feature!) and then based on those measurements and a well documented set of 14>8bit conversion profiles, pick the best one for the shot.

P.S. Does anyone know exactly what HTP does? Does it linearly scale 14>12? Or does it non-linearly scale the top few bits of the 14 into the top few of the 12? Something else?

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1671
  • 6d - Nightly build user
Re: Contrast and picture styles, the real scoop.
« Reply #10 on: November 01, 2014, 04:20:48 PM »
@c2s07
"For some reason, HTP seems to only go up to 6400 analog ISO and not higher (at which point the ISO reads 12800 D+). Don't ask me why this limitation. So comparing 12800 D+ to true 12800, using static movie clips shot in a relatively dark corridor: 12800 D+ has shadows with a greenish tint, while the true 12800 has shadows with more accurate colors."

While watching changes in values in the CMOS and ADTG registers, we do know that the 6d has a native sensor ISO that goes up to 6400.
Shooting in ISO 12800 and 25600 on a 6d, uses same CMOS values as shooting in ISO 6400, so the data coming from the sensor is the same.
BUT, 12800 and 25600 are not digitally/software pulled as is the case with ISO 51200 and 104200.
12800 and 25600 are amplified(I believe analogue, before the data get's converted to digital, but I'm not sure about that  :-\ )

The Canon 5d Mark III has a native ISO 12800. The weird part is that it looks just as bad (or good?) as the non native, amplified, iso 12800 from the 6d.