including brute-force solving for the matrix based on a known input and output!
Oh, wow. That is a bad idea, but you got the second matrix (PL_COLOR_SYSTEM_DOLBY_IPT) almost correct. Compare this and [0050] from patent. Actually it should be this one. Again without the reshaping, it should not be this one.
Now second matrix dvipt_lms2rgb is this one (calculations to get it attached in pic) (then round to 4th decimal, invert and then transpose):
BT.2111 test pattern that was generated by testing-av project is wrong IMHO. But you can use it to check what it should be because it does decode in Films & TV and that Dolby vision app.
Edited
Designs
Child items
0
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related.
Learn more.
Related merge requests
1
When this merge request is accepted, this issue will be closed automatically.
I'm not sure I follow. You mention a lot of matrices. Can you summarize which matrix you believe is the correct YCbCr->LMS matrix that we should hardcode?
Edit: Nvm, your first two links were just demonstrating why the existing matrix doesn't match up.
So, I implemented your suggestions, which upon inspection I realized were pretty much the first thing I tried as well. The problem is, suffice to say, that it does not work, and the output is not useful. I've pushed the commit at 3c19e385. Attached are screenshots demonstrating the issue.
Using the following dolby vision sample as a source:
λ mediainfo iOS_P5_GlassBlowing2_3840x2160@59.94fps_15200kbps.mp4GeneralComplete name : iOS_P5_GlassBlowing2_3840x2160@59.94fps_15200kbps.mp4Format : MPEG-4Format profile : Base Media / Version 2Codec ID : mp42 (mp42/isom/iso5)File size : 330 MiBDuration : 2 min 58 sOverall bit rate : 15.6 Mb/sVideoID : 1Format : HEVCFormat/Info : High Efficiency Video CodingFormat profile : Main 10@L5.1@MainHDR format : Dolby Vision, Version 1.0, dvhe.05.09, BL+RPUCodec ID : dvh1Duration : 2 min 55 sBit rate : 15.2 Mb/sWidth : 3 840 pixelsHeight : 2 160 pixelsDisplay aspect ratio : 16:9Frame rate mode : ConstantFrame rate : 59.940 (60000/1001) FPSColor space : YUVChroma subsampling : 4:2:0Bit depth : 10 bitsCompression mode : LossyBits/(Pixel*Frame) : 0.031Stream size : 317 MiB (96%)Default : YesAlternate group : 1Color range : FullCodec configuration box : hvcC+dvcC
I get the following screenshot:
Compare this against what the file is supposed to look like (BT.2020 source):
λ mediainfo P81_GlassBlowing2_3840x2160@59.94fps_15200kbps_fmp4.mp4GeneralComplete name : P81_GlassBlowing2_3840x2160@59.94fps_15200kbps_fmp4.mp4Format : MPEG-4Format profile : Base Media / Version 2Codec ID : mp42 (mp42/isom/iso5)File size : 329 MiBDuration : 2 min 58 sOverall bit rate : 15.5 Mb/sVideoID : 1Format : HEVCFormat/Info : High Efficiency Video CodingFormat profile : Main 10@L5.1@MainHDR format : Dolby Vision, Version 1.0, dvhe.08.09, BL+RPU, HDR10 compatible / SMPTE ST 2086, HDR10 compatibleCodec ID : hev1Codec ID/Info : High Efficiency Video CodingDuration : 2 min 55 sBit rate : 15.1 Mb/sWidth : 3 840 pixelsHeight : 2 160 pixelsDisplay aspect ratio : 16:9Frame rate mode : ConstantFrame rate : 59.940 (60000/1001) FPSColor space : YUVChroma subsampling : 4:2:0 (Type 2)Bit depth : 10 bitsBits/(Pixel*Frame) : 0.030Stream size : 316 MiB (96%)Default : YesAlternate group : 1Color range : LimitedColor primaries : BT.2020Transfer characteristics : PQMatrix coefficients : BT.2020 non-constantMastering display color primaries : BT.2020Mastering display luminance : min: 0.0050 cd/m2, max: 4000 cd/m2Codec configuration box : hvcC+dvvC
This produces the much more reasonable-looking output:
Do you see now why I believe Profile 5 output is completely useless/meaningless without reshaping support?
BTW, I totally forgot, profile 5 is (always) Full range. Do we remember that? I am asking because there are some almost black dots (0, 6, 4; e.g.) in first picture that are (47, 45, 32) in second picture.
BTW, I totally forgot, profile 5 is (always) Full range. Do we remember that? I am asking because there are some almost black dots (0, 6, 4; e.g.) in first picture that are (47, 45, 32) in second picture.
No, I forgot this when testing. It doesn't hugely affect the output:
Since this seems to be a continuation of the mpv issue, thought I'd chime in here.
I've dumped the whole RPU DM metadata for the sample (and scene) in question, if it's of any use.
Every entry corresponds to the metadata of a frame.
The coefficients in there are the raw values, not the correctly interpreted/calculated ones.
So they most likely need to be calculated according to Dolby's patent.
@ValZapod so in the dolby PRU it seems they signal the coefficients for the DoviIPT->DoviLMS and DoviLMS->ICtCpLMS matrices. However, I was not able to find any sample where the matrices differ from the ones hard-coded in 3c19e385.
Do you think it's important for us to make these matrices dynamic, or are we fine to just hard-code them? I suspect that no samples actually exist anywhere where these matrices would be different.
mpv is BTW broken when presenting full range :(((((( it shows 0, 0, 0 as elevated in the green
I think I was wrong. Since discovering -vf extractplanes genious written by Paul IMHO it is just what it is. It is correct, while VLC and Movies & TV do not support full range. Alas.
BTW, ffmpeg now parses RPU. Which is nice, @quitvoid added it all.
The default is YCbCr as used in Blu-ray. You first read signal_color_space and only then...
So did you get the reshaping part? After talking to igorzep he said the matrix does not change but it changes by some polinomial. I did not get further.
Implemented MMR reshaping as well (needed for profiles 8.X), not yet tested. Also implemented loading/applying custom matrices from the RPU, rather than hard-coding them.