Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 18th March 2024, 12:19   #1  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,330
Subtitle colors (SUP/PGS) with Dolby Vision video

Hello.

Does anyone know what is the color conversion to use to have the expected color of SUP/PGS subtitles displayed with a DV video file ?
It's not a "pure/only" DV, it's an HDR+DV.

Actualy on my subtitles, the green is purple, the yellow is green, etc...
Black and white are fine...

If there is any formula convertion or anything similar, i'm interested.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 24th March 2024, 11:37   #2  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,330
So, i've made the following experience.
Created a subtitle with this picture to display:

And the result on a file with DV video is:


I'll try to figure out the DV conversion matrix.
Anyone is free to try also to figure out, i take any input.
__________________
My github.

Last edited by jpsdr; 24th March 2024 at 11:40.
jpsdr is offline   Reply With Quote
Old 24th March 2024, 16:16   #3  |  Link
von Suppé
Registered User
 
von Suppé's Avatar
 
Join Date: Dec 2013
Posts: 638
Would this only go for Dolby Vision Profile 5? When experiencing green & purple, usually P5 is in play. If so, I reckon it has to do with Dolby proprietary IPTPQc2 colorspace P5 video is encoded in.
Where P8 and P7 aren't.
von Suppé is offline   Reply With Quote
Old 24th March 2024, 19:10   #4  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,330
Video is played properly, it's just the subtitles which are messed up. Video is HDR10 compatible with DV data, so colorspace of video is standard HDR PQ, video is not the green & purple type.
Also, maybe it's a bug in the HW player, and it shouldn't apply DV "things" to color palette subtitles... But it is this way.

Edit:
Something pecular: There is displayed red,green,blue,cyan, magenta, but despite the fact i put all the colors combinations, there is no yellow !

I needed green and yellow colors subtitles, i don't know if it will even be possible...
__________________
My github.

Last edited by jpsdr; 24th March 2024 at 20:39.
jpsdr is offline   Reply With Quote
Old 24th March 2024, 22:08   #5  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 117
The first time I peek at the x265 subforum to find the right set of parameters to produce encodes for UHD BD, there HAS to be a thread about PGS at the top. Absolutely incredible.
How did you generate the PG stream? Some authoring tools do not seem particularly careful about the transfer matrix and so on.

Furthermore: what is the PID of your subtitle file? It seems that 0x1200-121F are meant for SDR PGS, while 0x12A0-12BF are for HDR. As we lack UHD BD details, it is hard to know why they added additional PIDs for PGS, but it is probably related to this statement found in this technical review:
Quote:
Subtitles
Subtitles must be carried in a BD-ROM Presentation Graphics (PG) stream. Subtitles use an 8-bit indexed (palletized) format. For SDR BT.709 and SDR BT.2020 videos, a color lookup table (CLUT) is used to convert each pixel in the subtitle image from an 8-bit index value into 8-bit BT.709 YCbCr alpha values. A BT.709 to BT.2020 color space conversion must be applied by the player to convert the BT.709 subtitle pixel values to BT.2020 before compositing with SDR BT.2020 10-bit video. For HDR BT.2020 video, a CLUT is used to convert each pixel in the subtitle from an 8-bit index value into 8-bit BT.2020 ST 2084 YCbCr alpha 8-bit values. The 8-bit pixel values from the CLUT are multiplied by 4 before compositing with 10-bit video pixels.
Either the author has no understanding of the BD subtitle rendering pipeline, or he hints at some behaviour unbeknownst to us peasants. There is no way to specify the matrix in the PG stream, so it has to be handled by the BD player in one way or the other (CLPI data, or different PID). Quite likely, SDR subtitles (HDMV PGS "SDR" 0x1200-1F) are blended before the Dolby Vision layer is added, while the new PID range (HDMV PGS "HDR" 0x12A0-BF) uses a different pipeline where the matrix is expected to be 1:1 to the video, and the 8-bit value are multiplied by 4 to use the full 10-bit range.

This is furthermore backed by:
Quote:
Mandatory for Players
BT.709 to BT.2020 Conversion for HDMV Subtitles and Graphics
Players must have the capability to convert PG subtitles and IG graphics pixel values from SDR BT.709 YCbCr to SDR BT.2020 YCbCr values before compositing with SDR BT.2020 video
For the technical paper to pinpoint this requirement means this must be in the UHD spec. And that could lead to some bad colour mangling.

Last edited by cubicibo; 25th March 2024 at 09:31.
cubicibo is offline   Reply With Quote
Old 25th March 2024, 09:29   #6  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,330
This is not a Blu-Ray, this is an MKV file i'm making. I made myself the PGS/SUB. And it's not a BT.2020/BT.709 issue, this is DV specific. The same on a video without DV has the colors displayed properly.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 25th March 2024, 09:37   #7  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 117
But how do you play back the file? Seems like your issue is either:
- Your software video player applies DV to subtitles. This is very much incorrect and this should be reported to the issue tracker of the player.
- You use a BD player to read the file from a hard-drive. And as it is MKV, the player is unable to know if it should use the SDR or HDR PGS decoder (no PID information in MKV). And eventually it just defaults to SDR "before DV" blend. The fix is simply to use a transport stream container in that case.
cubicibo is offline   Reply With Quote
Old 25th March 2024, 13:55   #8  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,330
I play the file on my HW player, a Zappiti Neo.
And i also think that it shouldn't apply DV to subtitles... But i don't know the specs, and how it's supposed to do.
__________________
My github.

Last edited by jpsdr; 25th March 2024 at 13:57.
jpsdr is offline   Reply With Quote
Old 25th March 2024, 14:29   #9  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 117
This is not a Blu-ray Disc player, the manufacturer is not listed on the BDA licensee list: it most likely does not comply with the Blu-ray specifications and overlay the subtitles before the enhancement layer. File a bug report to Zappiti so they can fix their device.
cubicibo is offline   Reply With Quote
Old 25th March 2024, 16:58   #10  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,819
Quote:
Originally Posted by von Suppé View Post
Would this only go for Dolby Vision Profile 5? When experiencing green & purple, usually P5 is in play. If so, I reckon it has to do with Dolby proprietary IPTPQc2 colorspace P5 video is encoded in.
Where P8 and P7 aren't.
Y'CtCp, yes. Also, Profile 5 also changes the code value to nits mapping shot-by-shot to get as much of the 10-bit range used as possible.

It's all very clever, but means decoding a Profile 5 base layer as normal Y'CbCr PQ 2020 looks really weird. I'm kind of thankful that it is weird enough that no one will think it's operating properly. Makes for easier debugging.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 26th March 2024, 10:07   #11  |  Link
von Suppé
Registered User
 
von Suppé's Avatar
 
Join Date: Dec 2013
Posts: 638
Quote:
Originally Posted by jpsdr View Post
I play the file on my HW player, a Zappiti Neo.
Reading the specs of this player, it runs on a Realtek RTD1619DR chipset. Same as my Zidoo Z9X. Which a couple of years ago also suffered from wrong subtitle colorings. This was brought up in the Zidoo forums, which are monitored by one of the Zidoo people. Consequently, firmware updates then ironed out the issue.
I can imagine your Zappiti having a similar firmware problem. Where letting Zappiti's customer-service folks know about it may trigger a fix?

Last edited by von Suppé; 26th March 2024 at 10:18.
von Suppé is offline   Reply With Quote
Old 26th March 2024, 13:42   #12  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,330
Probably.
In the meantime, i'll create two subtitles tracks, one with "normal" colors, one with "DV Mode" colors.

I've tried to figure out if there was a linear matrix transform, like this:
[Rdv,Gdv,Bdv]=[Matrix]*[R,G,B].

For now, i've guessed the following, according the display result:
[R,G,B] -> [Rdv,Gdv,Bdv]
[1,0,0] -> [0.5,0.25,0]
[0.5,0,0] -> [0.25,0.125,0]
[0,0,1] -> [0.5,0,0.25]
[0,0,0.5] -> [0.25,0,0.125]

But, after some others guess, it seems that's clearly it's not so simple/linear...

So, i'll have to try the other method: test/experiment, what color produces the display i expect.
As it's for subtitles, i don't need true accurate, but something which "looks like". If something looks like green, even if not "pure green", it will be enough.
I can produce basic colors, or at least something which looks like : Red, Green, DarkGreen, Blue, Cyan, Magenta...
And i need (except Black/White) Greend, DarkGreen, Yellow... But... Where is yellow ????

I "only" tried 1 & 0.5 combinations with only 1 or 2 values (like [1,0,0] or [0,0.5,0] or [1,0.5,0]).
Didn't tried yet things like [1,0.5,0.5] or [1,1,0.5]... Maybe i'll be able to discover what produces a yellow display.

It's not so a linear combination, because according display, it seems:
[1,1,0] -> [0,1,0] and [1,0,1] -> [1,0,0]
So... [2,1,1] -> [1,1,0]....
But [1,0.5,0.5] could be worth trying, because it wasn't in my first picture, so, who knows...
__________________
My github.

Last edited by jpsdr; 26th March 2024 at 13:48.
jpsdr is offline   Reply With Quote
Old 26th March 2024, 15:16   #13  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 574
Did you try LMS? AFAIK Dolby Vision is transformed and transmitted in that colorspace.
__________________
LG C2 OLED | GitHub Projects
quietvoid is offline   Reply With Quote
Old 26th March 2024, 18:57   #14  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,330
Don't know this, i'll search.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 27th March 2024, 15:05   #15  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,330
I took a look at LMS, from the few i understood, there is 3 (at least) differents: Equal-energy illuminants, Normalized to D65 and physiological CMFs.
Any idea, by any chance, which one it could be ?
__________________
My github.
jpsdr is offline   Reply With Quote
Old 27th March 2024, 17:56   #16  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 574
Quote:
Normalized to D65
Probably?
__________________
LG C2 OLED | GitHub Projects
quietvoid is offline   Reply With Quote
Old 29th March 2024, 00:00   #17  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,819
Quote:
Originally Posted by quietvoid View Post
Probably?
D65 would be my first guess too. D65 is the default color temp for video, and so using it would avoid yet more extra math.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 1st April 2024, 16:21   #18  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,330
I've made a new experiment, but still not able to figure out what produces true yellow with DV...
Original:

Displayed:

I stop here, even if i don't have yellow, i have here something which looks like "ocher/ochre" (my dictionary gave me the two words), it will be enough, and i allready have my green and dark green.
__________________
My github.

Last edited by jpsdr; 1st April 2024 at 16:25.
jpsdr is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:56.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.