Learning about Dolby Vision and CoreELEC development

Yes it works 10bit, doing the fly test now…

Has anyone else tested? Be keen to find out if this is a common problem or not

Hi, tried 10 & 12 bit, cycle all 0-255 write ( ~24mins each ) reading every other 1 min but no picture. Maybe I can try other subsampling and Colour depth?
TIA.

No, it needs to be 4:2:2 subsampling. For me, 8-bit also works, but you don’t want to use that mode given it will drop quality from the 10-bit source files.

Thanks for all the effort. I’ll let you know when I have something else to try.

1 Like

Updated build - Increased compatibility
Minor update to work with older displays as well and a better approach to injecting metadata to make finding the ‘magic’ values easier (@xmlcom thanks for the previous testing showing this was needed)


Test 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.

If you have changed the whitelist function make sure it always causes a 2160p display mode.

Ensure you only use frame rate that your tv supports DV mode in, i.e., older TV’s can’t do more than 30Hz (@xmlcom this is you).

Initial test
Start with testing the rise_of_gru_sample_10bit_embedded.mkv test. When playing and no gui, run

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

TV-led DV should now be working. If so, disable with

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

and move onto setup of the on-the-fly injection.

On-the-fly metadata injection
Need some trial and error to find values that work for different devices. Method of injecting metadata has been improved compared to process done by @xmlcom in the discussions above. Now has ~25% success rate so shouldn’t take very long to find a working value.

The parameter is injected_value. Read with

cat /sys/module/amvideo/parameters/injected_value

Write with, for example the value of 1 with

 echo 1 > /sys/module/amvideo/parameters/injected_value

Valid values are 0 to 764. Use a trial and error approach with this value with the usage commands below to find a value that work for your device.

My tv worked with changing this value on the fly. If you have issues try using the disable commands below, changing the value, and then re-enabling.


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 DV_enable > /sys/devices/virtual/amhdmitx/amhdmitx0/attr

Will need to do this for every video started.

Note: When the videos stop the gui will by in all the wrong colors. If you want to correct that enter the ssh commands

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

and then do something that triggers a resolution/refresh rate change.


There are two buffers for DV metadata setup - these are not yet being set by metadata from video files. The two are initially loaded with metadata for a source in the IPT (i.e., profile 5) colorspace with very different L1 data.

Change to suit profile 8.1 with

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

Change back to IPT with

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

By default these two sets of metadata will be switched between every 125 frames. Can set this timing to whatever, for every 250 frames use

 echo 250 > /sys/module/amvideo/parameters/num_frames_to_toggle_metadata

To disable the auto toggling use

 echo 0 > /sys/module/amvideo/parameters/num_frames_to_toggle_metadata

Can also manually toggle with

echo Y > /sys/module/amvideo/parameters/metadata_toggle

Let me know if it works or not

2 Likes

Thanks! We getting somewhere…


Don’t know if it should be green so let me know.
Thanks again.

:smiley:

I’m guessing that is not profile 5 content. If so, yes that is expected, you are essentially seeing the reverse problem than what usually happens when p5 content is played on a unsupported device.

Try playing some profile 5 content. The colors should be right


Then play some hdr10 content. As in my previous post above, change metadata to suit profile 8.1 with

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

Colors should then be correct.


Few questions:

  • With settings as they were from the photo, do you get correct colors when playing profile 5 content?
  • After changing the metadata with the above commands, do you get correct colors with hdr10 content?
  • Are you seeing the dynamic response with changing brightness levels?
  • Any issues finding the injected_value to work for you? How many numbers did you need to try?

Will do later when I’m back home.
I use your echo 1 inject value, is there an easier way for others like b4 when you can cycle automatically from 0-255? Thanks

Odd, that is actually the same data that it defaulted to before…

It still can be set to cycle,

 echo 125 > /sys/module/amvideo/parameters/num_frames_to_increment_injected_values

I didn’t mention it before as if the default value doesn’t work it really should now be a 25% success rate. Thought it would be easier to just do manually… also avoids needing to work backwards anyway.

Hi @doppingkoala. Is this thread about enabling DV on non-DV media players?

Yes, is amazing what he’s trying to achieve. Can you help in testing with above instructions please, thanks.
@doppingkoala I’m now getting permission denied on write injected_values with p5 & all dv files. It goes automatically in dv but black screen. Strange because i could swear this permission denied wasn’t the case earlier. Any ideas, thanks.

I noticed your test image is using the 4.9 CoreELEC kernel
Same as cpm test build.

Iam thinking if testing on Hk1x4 S905X4.

However i have doubts

This is why
I took a chance with Kinhank G1 on cpm build because i had 2 if the 3 ingredients for Dolby Vision Playback

1 dovi.ko in vender kernel
2 SoC Dolby Vision compatible

What was missing was 3 Dolby blob in Device tree

This is why failed.

Your build is missing all 3

1 No dovi.ko in vender kernel
2No SoC Dolby Vision compatible
3No Device tree

How can these echo commands do anything?

Or you are manipulating the GUI ?

Not taking away from anything you have worked on
Just trying to understand if it is even possible

Yes. Looking like everything aside from dual layer should work properly.

Not quite there yet, but the latest build I posted is a very important step and should let any device put a tv into tv-led DV mode. Essentially, all that remains to do for proper usage is to get access to DV metadata in the right place in the code.

Have a go, shouldn’t matter what your device is. There is not dependence only any existing amlogic DV code, dovi.ko, soc compatibility, or dolby blobs in a device tree.

Because I added them in… :rofl:

More seriously, I am technically manipulating the gui, but only to embed some metadata in pixels in the top few rows - aside from this the actual video stream is untouched.

Essentially, in tv-led mode all that a source device does is take the DV metadata and use this to modify some bits in the top pixels, signal to the TV to look for this metadata, and then let the TV do all the real work. The exception is dual layer support where the source device also needs to compose the two layers - my current work doesn’t address that at all.

Only needing to embed the metadata is why only tv-led mode will work on unsupported devices and not player-led mode, not because it is better (which it is), but because all that really needs to be done is embed the metadata. Using the patents and confirmed with the captures of the DV “tunnel”, what metadata to embed has been worked out. The breakthrough in the recent builds I’ve posted is how to embed that metadata in CoreELEC.


edit: if you boot it up, play a video and just run

echo Y > /sys/module/amvideo/parameters/inject_osd_metadata

you can actually see the metadata in the top pixels yourself.

Thank you for reply
Explanation

I really like your response about echo commands!!!

It is a busy night in my area.
House of Dragons New Season episode.

Also busy week at work coming up.
I noticed from OP you are using S905X3 B revision.

I have Tanix-tx5 Plus Deluxe S905X3 iam going to use instead of HK1X4 S905X4

1 Like

Check for typo’s (it is injected_value not injected_values) / just use to copy button in the top right corner of the snippet windows with the commands. I just ran through them all and the commands are correct in my post. There is no link to the type of file that is playing.


Your tv might be more sensitive then mine to bad signals. Try doing the disable and enable commands between trying different values.

Also try adding

echo Y > /sys/module/am_vecm/parameters/always_send_tvled_DV_vsif

to the enable commands and

echo N > /sys/module/am_vecm/parameters/always_send_tvled_DV_vsif

to the disable commands.


@xmlcom Was your photo in Learning about Dolby Vision and CoreELEC development - #250 by xmlcom actually in DV mode of your TV?

1 Like

I’m starting to look at some code in the kodi/xbmc repo.

Does anyone know if there any easy way to modify variables in that part of the code over ssh at runtime? I was after something similar to the module params that I have been using in the linux code.

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