Resolve YCbCr to RGB Conversion

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

RikshaDriver

  • Posts: 653
  • Joined: Sun Aug 12, 2018 10:08 am
  • Location: Melbourne
  • Real Name: Asim Siddiqui

Resolve YCbCr to RGB Conversion

PostTue Oct 29, 2019 12:59 pm

Just need some clarification on the internals of Resolve here...

Does Resolve convert YCbCr footage to RGB under the hood based on video metadata (i.e. color matrix etc)?

If so, how does it manage the conversion in different color modes (i.e. YRGB) where no input Color Space is selected?
GitHub Projects: https://github.com/xtremestuff/
Commercial Plugins: https://xtremestuff.net/store/
Offline
User avatar

Cary Knoop

  • Posts: 1654
  • Joined: Sun Mar 12, 2017 6:35 pm
  • Location: Newark, CA USA

Re: Resolve YCbCr to RGB Conversion

PostTue Oct 29, 2019 2:36 pm

RikshaDriver wrote:Just need some clarification on the internals of Resolve here...

Does Resolve convert YCbCr footage to RGB under the hood based on video metadata (i.e. color matrix etc)?

If so, how does it manage the conversion in different color modes (i.e. YRGB) where no input Color Space is selected?

Very good question! Hopefully, someone from development can provide a small table showing the conversions.

I would assume if nothing was given the default is going to be Rec709. But note that Rec709 would give mismatches, for instance (certain) mjpeg encodings and most SD video should use Rec601.
Offline

Jim Simon

  • Posts: 36070
  • Joined: Fri Dec 23, 2016 1:47 am

Re: Resolve YCbCr to RGB Conversion

PostTue Oct 29, 2019 2:56 pm

Is a color space necessary to the YUV>RGB conversion? I'm no expert, but the formulas I've seen are pretty straightforward. I've never seen mention of needing to know about color space.
My Biases:

You NEED training.
You NEED a desktop.
You NEED a calibrated (non-computer) display.
Offline

RikshaDriver

  • Posts: 653
  • Joined: Sun Aug 12, 2018 10:08 am
  • Location: Melbourne
  • Real Name: Asim Siddiqui

Re: Resolve YCbCr to RGB Conversion

PostTue Oct 29, 2019 7:08 pm

Jim Simon wrote:Is a color space necessary to the YUV>RGB conversion? I'm no expert, but the formulas I've seen are pretty straightforward. I've never seen mention of needing to know about color space.


Short Answer, yes. Examples Below.


Rec 709 RGB to YCbCr Matrix:
Code: Select all
0.212639005871510   0.715168678767756   0.072192315360734
-0.114592177555732   -0.385407822444268   0.500000000000000
0.500000000000000   -0.454155517037873   -0.045844482962127



BT.2100 RGB to YCbCr Matrix:
Code: Select all
0.262700212011267   0.677998071518871   0.059301716469862
-0.139630430187157   -0.360369569812843   0.500000000000000
0.500000000000000   -0.459784529009814   -0.040215470990186



The ITU 2390 documentation also has interesting notes on the Error margin of these conversions. Worth a read.
GitHub Projects: https://github.com/xtremestuff/
Commercial Plugins: https://xtremestuff.net/store/
Offline

Peter Chamberlain

Blackmagic Design

  • Posts: 14916
  • Joined: Wed Aug 22, 2012 7:08 am

Re: Resolve YCbCr to RGB Conversion

PostThu Oct 31, 2019 1:18 am

There are multiple places were conversions take place depending on operator selection but the default processing is RGB in the timeline color space as the user selects in the color management tab of project settings. The appropriate conversions take place based on rules and an example is as shown with 709 and 2020
DaVinci Resolve Product Manager
Offline

RikshaDriver

  • Posts: 653
  • Joined: Sun Aug 12, 2018 10:08 am
  • Location: Melbourne
  • Real Name: Asim Siddiqui

Re: Resolve YCbCr to RGB Conversion

PostThu Oct 31, 2019 4:00 am

Thanks Peter for clarifying.

I have some follow up questions.

1. Where RCM is selected and the input is bypassed, if we explicitly set the color space under the first node within the node tree, would the ycbcr to RGB conversion take place at this point, or would it already have already happened prior to this based on the timeline color space?


2. When using ACES 1.03/1.1, is the YCbCr to RGB conversion handled based on the IDT? If so, what is the default behavior when we select no IDT - does it default to ACES AP1 for the conversion?
GitHub Projects: https://github.com/xtremestuff/
Commercial Plugins: https://xtremestuff.net/store/
Offline

Peter Chamberlain

Blackmagic Design

  • Posts: 14916
  • Joined: Wed Aug 22, 2012 7:08 am

Re: Resolve YCbCr to RGB Conversion

PostThu Oct 31, 2019 6:04 am

1) the conversion is prior to the node graph.

2) The conversion is done based on the file’s metadata, a default IDT should be chosen to match but the user can change that.

So a YCbCr file in Rec.2020 with (Rec.709 gamma) will be decoded using the Rec.2020 matrix then processed using the correct Rec.2020 IDT. If there is no IDT selected then that is an issue, since that would imply an ACES file (which should be a linear floating point EXR, not YCbCr).

Having said that if the file was encoded as Rec.2020 but was ACES AP1 when the conversion was undone by the import into Resolve it would end up producing the same results.
DaVinci Resolve Product Manager
Offline

RikshaDriver

  • Posts: 653
  • Joined: Sun Aug 12, 2018 10:08 am
  • Location: Melbourne
  • Real Name: Asim Siddiqui

Re: Resolve YCbCr to RGB Conversion

PostThu Oct 31, 2019 12:38 pm

Thanks again Peter for the insight.

So the YCbCr conversion logic would be as follows...

Order of precedence in RCM:

1. Clip Metadata
2. Input Color Space
3. Timeline Color Space

To conceptualize this:

10-bit 4:2:2 S-log/S-Gamut footage recorded off an external recorder contains Rec.709 color metadata.

In Resolve, user selects S-Log/S-Gamut as Input and ACES as Timeline.

Clip Metadata contains Rec.709, so YCbCr to RGB conversion uses the 709 matrix.

If the clip didn't contain 709 color metadata and the S-Log/S-Gamut input is selected, the S-Gamut color matrix will be used for conversion.

If the clip didn't contain 709 color metadata, and no Input is selected, the timeline color space (ACES AP0) would be used for conversion.




In the context of ACES, the order of precedence would be:

1. Clip Metadata
2. IDT
3. ACES AP0 Timeline?


To conceptualize this:

10-bit 4:2:2 S-log/S-Gamut footage recorded off an external recorder contains Rec.709 color metadata.

ACES will use the Rec.709 matrix for conversion
If no metadata, IDT color matrix will be used.
If no metadata or IDT, ACES AP0 (or AP1?) will be assumed for conversion.


Does that sound about right?
GitHub Projects: https://github.com/xtremestuff/
Commercial Plugins: https://xtremestuff.net/store/
Offline

Peter Chamberlain

Blackmagic Design

  • Posts: 14916
  • Joined: Wed Aug 22, 2012 7:08 am

Re: Resolve YCbCr to RGB Conversion

PostMon Nov 04, 2019 3:12 am

Clip metadata will be ignored if the user selects another IDT, otherwise your oder is correct. If the timeline is in ACEScc its AP1.
DaVinci Resolve Product Manager
Offline

RikshaDriver

  • Posts: 653
  • Joined: Sun Aug 12, 2018 10:08 am
  • Location: Melbourne
  • Real Name: Asim Siddiqui

Re: Resolve YCbCr to RGB Conversion

PostMon Nov 04, 2019 11:50 am

Thanks Peter,

Just confirming that the last bit is specifically for ACES implementation and that RCM YCbCr -> RGB behaves as per my earlier post?
GitHub Projects: https://github.com/xtremestuff/
Commercial Plugins: https://xtremestuff.net/store/

Return to DaVinci Resolve

Who is online

Users browsing this forum: Bing [Bot], jordancamera, Supercar Streetracing and 277 guests