Magic Lantern Forum

Using Magic Lantern => Shoot Preparation => Topic started by: markanini on September 24, 2016, 05:13:11 PM

Title: LV colorimetry
Post by: markanini on September 24, 2016, 05:13:11 PM
On my 600D H264 uses BT.601 color matrix. Jpegs use sRGB (BT.709 equivalent). Does anyone know if LV in shoot mode uses a consistent sRGB/BT.709 colorimetry?
Title: Re: LV colorimetry
Post by: a1ex on September 24, 2016, 05:27:37 PM
Hm, so far only 5D3 and 6D are configured to use BT.709 in ML, and all others assume BT.601. I bet more recent cameras may use BT.709, although nobody checked it, to my knowledge.

This affects RGB overlays and some previews (e.g. screenshots), and it's probably not obvious to the average user.

You can find out by dumping the YUV image buffers from the Debug menu (422 format) and trying to interpret them as either 709 or 601 - the right matrix should probably match Canon's JPEG or H.264. There are converters for the 422 format around.
Title: Re: LV colorimetry
Post by: markanini on September 29, 2016, 10:12:21 PM
I placed red objects on a table and dumped the image buffers and converted with 422ToImage v1.9.2. Then loaded the jpeg into avisynth:
Y = JpegSource(source, rec=0, channel=0)
U = JpegSource(source, rec=0, channel=1).Spline36Resize(Y.width(), Y.height())
V = JpegSource(source, rec=0, channel=2).Spline36Resize(Y.width(), Y.height())
YToUV(U,V,Y)
ConvertToRGB32(matrix = "PC.601")


and compared to the last line replaced with

ConvertToRGB32(matrix = "PC.709")

The first one looked more correct. The second had red shift to yellow, which would be expected from a BT.601 image interpreted as BT.709.

The conslusion I can draw from this: 600D assumes a BT.601 output device. This may also explain why I was adding too much magenta when monitoring on my phone display which is calibrated to sRGB (which shares primaries with BT.709). In case color remapping cant be done effectively in camera I have raised the issue with Chainfire, developer of DSLR Controller: http://forum.xda-developers.com/showpost.php?p=68892617&postcount=3787
Title: Re: LV colorimetry
Post by: a1ex on September 29, 2016, 10:33:13 PM
Nice find.

Would be nice to run the same test on all other cameras (so ML should know what color matrix to use). Volunteers?
Title: Re: LV colorimetry
Post by: markanini on September 30, 2016, 12:06:36 AM
Quote from: a1ex on September 29, 2016, 10:33:13 PM
Nice find.

Would be nice to run the same test on all other cameras (so ML should know what color matrix to use). Volunteers?

What can ML do with matrix data at this point?
Title: Re: LV colorimetry
Post by: a1ex on September 30, 2016, 12:10:08 AM
Exactly what I've mentioned in first post (nothing realtime).
Title: Re: LV colorimetry
Post by: markanini on September 30, 2016, 02:13:40 AM
A custom picture style could be used for realtime. With REC PicStyle enabled you can simulate  BT.709 while setting up a shoot. Or if you skip REC PicStyle it actually becomes BT.709 conversion, just edit the file headers afterwords, you lose some color range though. Lately I'm checking the picture style hacking thread  (http://www.magiclantern.fm/forum/index.php?topic=16299.125) daily :)
Title: Re: LV colorimetry
Post by: markanini on December 08, 2016, 10:36:19 PM
It seems DSLR Controller dev is working on implementing color conversions for LV mirroring: http://forum.xda-developers.com/showpost.php?p=69952745&postcount=3854