Learning about Dolby Vision and CoreELEC development

It’s alive !!! - DV working for non licenced devices
Since my previous update, I’ve now managed to get metadata to be read from a playing file to use in the fly.

Only L1 metadata at the moment is taken from the playing file. But now the data is passing through getting all the other metadata is straightforward.


Setup: Get the on-the-fly metadata working as detailed in Learning about Dolby Vision and CoreELEC development - #249 by doppingkoala.


Usage: After the setup, play a DV file and enter the following commands (use the copy button).

For P5 content:

echo 0,0,0,0,82,0,0,32,0,3,31,6,145,32,0,252,91,4,67,32,0,1,11,234,87,0,0,0,0,8,0,0,0,8,0,0,0,66,185,254,163,254,163,254,163,66,185,254,163,254,163,254,163,66,185,255,255,0,0,0,0,0,0,0,0,12,2,1,1,0,62,11,134,0,42,1,0,0,0,6,1,0,20,0,50,0,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,189,151,135,54 > /sys/module/amvideo/parameters/metadata_buffer
echo 0,0,0,0,82,0,0,32,0,3,31,6,145,32,0,252,91,4,67,32,0,1,11,234,87,0,0,0,0,8,0,0,0,8,0,0,0,66,185,254,163,254,163,254,163,66,185,254,163,254,163,254,163,66,185,255,255,0,0,0,0,0,0,0,0,12,2,1,1,0,62,11,134,0,42,1,0,0,0,6,1,5,220,13,172,11,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,116,190,2,153 > /sys/module/amvideo/parameters/metadata_buffer2
echo Y > /sys/module/amvideo/parameters/update_crc
echo 5 > /sys/module/amvideo/parameters/steps_to_try
echo 0 > /sys/module/amvideo/parameters/num_frames_to_toggle_metadata
echo Y > /sys/module/amvideo/parameters/get_aux_data_from_provider
echo Y > /sys/module/amvideo/parameters/inject_osd_metadata
echo Y > /sys/module/am_vecm/parameters/DV_vsif_send_in_hdmi_packet
echo Y > /sys/module/am_vecm/parameters/always_send_tvled_DV_vsif
echo DV_enable > /sys/devices/virtual/amhdmitx/amhdmitx0/attr

For profile 8:

echo 0,0,0,0,82,0,0,37,102,0,0,53,234,37,102,249,252,235,28,37,102,68,202,0,0,1,0,0,0,8,0,0,0,8,0,0,0,28,54,34,67,1,134,14,70,48,142,5,20,0,0,1,166,62,90,255,255,0,0,0,0,0,0,0,0,12,0,1,0,0,62,11,134,42,42,1,0,0,0,6,1,0,20,0,50,0,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,120,97,107 > /sys/module/amvideo/parameters/metadata_buffer
echo 0,0,0,0,82,0,0,37,102,0,0,53,234,37,102,249,252,235,28,37,102,68,202,0,0,1,0,0,0,8,0,0,0,8,0,0,0,28,54,34,67,1,134,14,70,48,142,5,20,0,0,1,166,62,90,255,255,0,0,0,0,0,0,0,0,12,0,1,0,0,62,11,134,42,42,1,0,0,0,6,1,5,220,13,172,11,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,194,81,228,196 > /sys/module/amvideo/parameters/metadata_buffer2
echo Y > /sys/module/amvideo/parameters/update_crc
echo 5 > /sys/module/amvideo/parameters/steps_to_try
echo 0 > /sys/module/amvideo/parameters/num_frames_to_toggle_metadata
echo Y > /sys/module/amvideo/parameters/get_aux_data_from_provider
echo Y > /sys/module/amvideo/parameters/inject_osd_metadata
echo Y > /sys/module/am_vecm/parameters/DV_vsif_send_in_hdmi_packet
echo Y > /sys/module/am_vecm/parameters/always_send_tvled_DV_vsif
echo DV_enable > /sys/devices/virtual/amhdmitx/amhdmitx0/attr

Test files: Any DV file should work, but L1 demos from Level 1 – Google Drive are great demos of seeing the dynamic response.

Color space and L1 should be correct. No other DV metadata would be so don’t expect the output to look exactly as it should at this stage.


The build:

Appreciate anyone that can to test it out and let me know how it goes for others.

8 Likes

Amazing! Getting DV in P5/P8 files on my Beelink GS king-X, Take my hats off to you mate, truly Genius indeed.

However still finding it difficult on non DV files with the injected_value write, but will persist till i get it working.

Thanks again.


1 Like

If P5/P8 files are working and putting your tv into DV mode, the value for injected_value is correct.


After you have a DV file working, try on a non DV file:

echo 0,0,0,0,82,0,0,37,102,0,0,53,234,37,102,249,252,235,28,37,102,68,202,0,0,1,0,0,0,8,0,0,0,8,0,0,0,28,54,34,67,1,134,14,70,48,142,5,20,0,0,1,166,62,90,255,255,0,0,0,0,0,0,0,0,12,0,1,0,0,62,11,134,42,42,1,0,0,0,6,1,0,20,0,50,0,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,120,97,107 > /sys/module/amvideo/parameters/metadata_buffer
echo 0,0,0,0,82,0,0,37,102,0,0,53,234,37,102,249,252,235,28,37,102,68,202,0,0,1,0,0,0,8,0,0,0,8,0,0,0,28,54,34,67,1,134,14,70,48,142,5,20,0,0,1,166,62,90,255,255,0,0,0,0,0,0,0,0,12,0,1,0,0,62,11,134,42,42,1,0,0,0,6,1,5,220,13,172,11,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,194,81,228,196 > /sys/module/amvideo/parameters/metadata_buffer2
echo N > /sys/module/amvideo/parameters/update_crc
echo 0 > /sys/module/amvideo/parameters/steps_to_try
echo 125 > /sys/module/amvideo/parameters/num_frames_to_toggle_metadata
echo N > /sys/module/amvideo/parameters/get_aux_data_from_provider
echo Y > /sys/module/amvideo/parameters/inject_osd_metadata
echo Y > /sys/module/am_vecm/parameters/DV_vsif_send_in_hdmi_packet
echo Y > /sys/module/am_vecm/parameters/always_send_tvled_DV_vsif
echo DV_enable > /sys/devices/virtual/amhdmitx/amhdmitx0/attr
1 Like

Yep, That works also :muscle:.
Issues to Note: gui wrong colour fix not working with below Cmd. And sometimes when stop play you get blank screen with DV still activated & must reboot to fix it all.

echo N > /sys/module/am_vecm/parameters/DV_vsif_send_in_hdmi_packet
echo DV_disable_vsif > /sys/devices/virtual/amhdmitx/amhdmitx0/attr

So my value is 1 like yours on a beelink gs king-x, right?


If you didn’t change it since the last boot, yes.

Ahh yes, you will need a different disable command to match the updated enable command for you

echo N > /sys/module/am_vecm/parameters/DV_vsif_send_in_hdmi_packet
echo N > /sys/module/am_vecm/parameters/always_send_tvled_DV_vsif
echo DV_disable_vsif > /sys/devices/virtual/amhdmitx/amhdmitx0/attr

So with these results, it appears that your tv needs the vsif to be sent constantly to enable DV. This is something that wasn’t needed on my tv. Looking at the original amlogic dv code, the vsif is sent all the time. I’ll just change my code to always send the packet.

2 Likes

Thanks, why is my tv (lg c6) need vsif sent all time & how do i check myself? Thanks.
Is your next step to work on L2 L8… etc.
I’m still in awe how you did this or even came up with the idea of this, incredible indeed.

I have been away from the thread too long. Exciting progress! On my x96 max with Philips 808, p5 and P8 are working.

Not sure what injected value and playing non hdr videos are about. I’ll try to read back.

Tv froze once when I entered P8 commands for p5 file.

Could be because the tv supports an older version of tv-led DV. Could something specific to that model. No real idea.

You can check by playing with /sys/module/am_vecm/parameters/always_send_tvled_DV_vsif. TV-led mode has only worked for you when enabled and you have needed it to be disabled to exit dv mode.

1 Like

If DV s working don’t bother with the injected_value stuff. Most of it was more a troubleshooting with xmlcom, but that issue appears to have been vsif related.

Not sure what to make of that, I have no problems with that (aside from the obviously wrong colors). The tv doesn’t / can’t even actually know what the profile of the actual file was anyway - all it gets is what is sent in the metadata.

probably tv issue. I was entering commands a bit too quickly I guess.

The part of the metadata relating to the colorspace (i.e., p5 vs p8) is actually meant to be static metadata. My tv seems to be fine having this changed on the fly without disabling and reenabling DV, maybe not all are as tolerant.

@DMDreview Could you please upload a capture of the DV tunnel when playing a CMv4.0 file please? All the others are CMv2.9 and I need it to tell me how to write the metadata


edit: no need, I didn’t check all your captures. One of them is CMv4.0.

Update:

All metadata levels working for cmv2.9 and cmv4.0.

This also includes the level 5 metadata that doesn’t appear to be used by other players in tv-led mode. Sending the level 5 data avoids the problems with L2 positive lift. It will also chop off any gui elements that happen to be showing though - may later try to make the L5 data automatically adaptive based on if the gui has been recently updated / subtitles are showing.


Problems:

  • Content that has reshaping. Won’t play correctly as this work is only adding the metadata. The reshaping would require actually altering the video stream and isn’t something that could be fixed by sending different metadata. From my a few samples I have looked at, it seems this won’t impact P7 (no FEL) or P8 content. But I does mean that some P5 content won’t work correctly.

  • Higher bitrate files. I’m getting flickers on my video with higher bitrate files with a 4K gui and a 12-bit 4:2:2 output. Seems entirely unrelated to DV. I have seen mentions of problems relating to a 4K giu being blamed on device hardware limitations. That said a 4K gui with a 12-bit 4:4:4 output works fine for me for higher bitrate files, so I can’t wrap my head around it being a hardware limitation.


The build:


Usage:
Initial once-off setup: Set kodi to use 12-bit 422 with a 3840 x 2160 gui resolution. Enable the option “Disable GUI scaling”. Reboot.

Use:
To use trigger DV with a video (any video, doesn’t need to be DV) playing by

echo Y > /sys/module/amvideo/parameters/inject_osd_metadata
echo Y > /sys/module/am_vecm/parameters/DV_vsif_send_in_hdmi_packet
echo Y > /sys/module/am_vecm/parameters/always_send_tvled_DV_vsif
echo DV_enable > /sys/devices/virtual/amhdmitx/amhdmitx0/attr

If the file playing is a DV file that metadata will be used. If not, metadata from a P5 file will be used and the brightness will alternate.

To disable

echo N > /sys/module/amvideo/parameters/inject_osd_metadata
echo N > /sys/module/am_vecm/parameters/DV_vsif_send_in_hdmi_packet
echo N > /sys/module/am_vecm/parameters/always_send_tvled_DV_vsif
echo DV_disable_vsif > /sys/devices/virtual/amhdmitx/amhdmitx0/attr
3 Likes

When I tried the last build, ui was sluggish and I noticed 100% cpu utilization for kodi.bin in top output.

I’ll have a look at that. I have added a lot of extra logging that isn’t controlled and spews out way too much data

Man, it really is working. Looked at some movies.

But stopping a video leaves me with a black screen, I have to disable dv every time.

It seems subtitles can cause stutters.

Also I get some white pixels at the top of my screen.

That would be the metadata that is embedded. By default that should be hidden (by a L5 crop) for files that actually have DV.

Is that photo while playing a file that has DV?

Yeah. It’s P7 fel. I’ll try it again tomorrow.

I activate DV by pasting the whole set commands at once from my phone.

I hadn’t yet tested with that. Must not be seeing the metadata. Don’t think it would be hard to make that work in the MEL/P8.1 conversion fashion.

I also tried some other samples and other movies and the white pixels only showed in this I think.

It’s hard to make comparisons but the one above, Beverly Hills Cop, looked the same to my eyes with my ugoos right after this.