[Cin] "color hell"

Andrew Randrianasulu randrianasulu at gmail.com
Tue Jul 13 21:36:55 CEST 2021


On Tuesday, July 13, 2021, Phyllis Smith <phylsmith2017 at gmail.com> wrote:

> Andrew, I really like the "color hell" moniker.
> Andrea, you are right, ffprobe shows it correctly.  I had always heard
> that mediainfo sometimes got it wrong, but this is the first time I saw
> that.
>
> What about old projects? will they handle this change correctly?
>


I tried to add my new colorspace as numbered define  _after_ all pre-used
defines, while renaming old bt601 to bt601 ntsc (given usual ntsc-centered
preference in other parts of cin)

and of course _order_ in preferences mattered,  my patches made things
shift down by one (so displayed colorspace and encoded colorspace drifted
by one! bt2020 displayed was real bt601 pal... bt601 ntsc was bt709... as
you sharply noted!)

I think we save it per-session (in Cinelerra_rc) not per-project? will look
more into it...

try add two more patches I attached? one is fix another is comment.

Also, while we are here may be rename and enlarge  bt2020  label for bt2020
*nc* as code (in ffmpeg.C) seems to map it really?



> On Tue, Jul 13, 2021 at 12:17 PM Andrew Randrianasulu <
> randrianasulu at gmail.com> wrote:
>
>>
>>
>> On Tuesday, July 13, 2021, Phyllis Smith via Cin <
>> cin at lists.cinelerra-gg.org> wrote:
>>
>>> Not so sure about that after running more tests.
>>> Using 601Pal, mediainfo reports BT.601.
>>> Using 601Ntsc, medinao reports BT.709 !!
>>> As always, have to make sure old projects still work.
>>>
>>
>>
>> its called color hell for this exact reason)
>>
>> may be mediainfo a bit wrong (at least ver. you used - shoukd be recent
>> on Fedora, but small fixes like this can go in anytime...)
>>
>> see confusing code at (should be recent enough from 2020)
>>
>> https://sourceforge.net/p/mediainfo/discussion/297610/
>> thread/0b6d2fd38f/?limit=25
>>
>> =====
>>
>> ha.
>>
>> //----------------------------------------------------------
>> -----------------
>> extern const char* Mpegv_colour_primaries(int8u colour_primaries)
>> {
>>     switch (colour_primaries)
>>     {
>>         case 1 : return "BT.709";
>>         case 4 : return "BT.470 System M";
>>         case 5 : return "BT.601 PAL";
>>         case 6 : return "BT.601 NTSC";
>>         case 7 : return "SMPTE 240M"; //Same as BT.601 NTSC
>>         case 8 : return "Generic film";
>>         case 9 : return "BT.2020"; //Added in HEVC
>>         case 10 : return "XYZ"; //Added in HEVC 2014
>>         case 11 : return "DCI P3"; //Added in HEVC 2016
>>         case 12 : return "Display P3"; //Added in HEVC 2016
>>         case 22 : return "EBU Tech 3213"; //Added in HEVC 2016
>>         default : return "";
>>     }
>> }
>>
>> //----------------------------------------------------------
>> -----------------
>> extern const char* Mpegv_transfer_characteristics(int8u
>> transfer_characteristics)
>> {
>>     switch (transfer_characteristics)
>>     {
>>         case 1 : return "BT.709"; //Same as BT.601
>>         case 4 : return "BT.470 System M";
>>         case 5 : return "BT.470 System B/G";
>>         case 6 : return "BT.601";
>>         case 7 : return "SMPTE 240M";
>>         case 8 : return "Linear";
>>         case 9 : return "Logarithmic (100:1)"; //Added in MPEG-4 Visual
>>         case 10 : return "Logarithmic (316.22777:1)"; //Added in MPEG-4
>> Visual
>>         case 11 : return "xvYCC"; //Added in AVC
>>         case 12 : return "BT.1361"; //Added in AVC
>>         case 13 : return "sRGB/sYCC"; //Added in HEVC
>>         case 14 : return "BT.2020 (10-bit)"; //Same a BT.601 //Added in
>> HEVC, 10/12-bit difference is in ISO 23001-8
>>         case 15 : return "BT.2020 (12-bit)"; //Same a BT.601 //Added in
>> HEVC, 10/12-bit difference is in ISO 23001-8
>>         case 16 : return "PQ"; //Added in HEVC 2015
>>         case 17 : return "SMPTE 428M"; //Added in HEVC 2015
>>         case 18 : return "HLG"; //Added in HEVC 2016
>>         default : return "";
>>     }
>> }
>>
>> //----------------------------------------------------------
>> -----------------
>> extern const char* Mpegv_matrix_coefficients(int8u matrix_coefficients)
>> {
>>     switch (matrix_coefficients)
>>     {
>>         case 0 : return "Identity"; //Added in AVC
>>         case 1 : return "BT.709";
>>         case 4 : return "FCC 73.682";
>>         case 5 : return "BT.470 System B/G";
>>         case 6 : return "BT.601"; //Same as BT.470 System B/G
>>         case 7 : return "SMPTE 240M";
>>         case 8 : return "YCgCo"; //Added in AVC
>>         case 9 : return "BT.2020 non-constant"; //Added in HEVC
>>         case 10 : return "BT.2020 constant"; //Added in HEVC
>>         case 11 : return "Y'D'zD'x"; //Added in HEVC 2016
>>         case 12 : return "Chromaticity-derived non-constant"; //Added in
>> HEVC 2016
>>         case 13 : return "Chromaticity-derived constant"; //Added in HEVC
>> 2016
>>         case 14 : return "ICtCp"; //Added in HEVC 2016
>>         default : return "";
>>     }
>> }
>>
>> =====
>>
>> note _transfer characteristics_ #1 said to be the same for bt. 709 and
>> #6  bt. 601! (in comment)
>>
>> can you post full mediainfo output for input video, and three other
>> videos: unmodded Cin, modded and  set to BT601 NTSC, set to BT601 pal?
>>
>>
>>>
>>> On Mon, Jul 12, 2021 at 2:26 PM Andrew Randrianasulu via Cin <
>>> cin at lists.cinelerra-gg.org> wrote:
>>>
>>>> According to
>>>>
>>>> https://kdenlive.org/en/project/color-hell-ffmpeg-
>>>> transcoding-and-preserving-bt-601/
>>>>
>>>> bt 601 pal and bt 601 ntsc are  slightly different, I tried to update
>>>> CinGG's definitions so now she have two distinct 601 colorspaces, but I
>>>> still can be wrong (esp on kr, kb coeffecients)
>>>>
>>>> can anyone test patch 3 and see if it makes any positive difference?
>>>>
>>>>
>>>> --
>>>> Cin mailing list
>>>> Cin at lists.cinelerra-gg.org
>>>> https://lists.cinelerra-gg.org/mailman/listinfo/cin
>>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20210713/dcbb7d59/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Fix-yuv_color_space-menu-after-adding-bt601-variants.patch
Type: text/x-diff
Size: 978 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20210713/dcbb7d59/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Add-comment-about-order-of-array-entries-for-yuv_col.patch
Type: text/x-diff
Size: 827 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20210713/dcbb7d59/attachment-0003.bin>


More information about the Cin mailing list