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 > Capturing and Editing Video > HDTV / DVB / TiVo

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd September 2019, 07:54   #1  |  Link
VictorLS
Registered User
 
Join Date: Mar 2009
Location: Russian Crimea
Posts: 335
HLG processing for good picture on SDR monitor

Due to huhn's "madVR doesn't support HLG" in thread LAV Filters - DirectShow Media Splitter and
Decoders
here I've known madVR still not support HLG if it can be correctly done at all (as MPC-BE developer says there's only few HLG content so they don't want support HLG in their MPC-BE well - present their EVR Custom Presenter (EVR-CP)'s auto switching on as minimum with DXVA2 (native and copy-back) Processing: HDR(HLG) to SDR gives overcontrasted and bad saturated video as minimumn on SDR monitors - even worse than without any processing - washed out colors and i.e. red becomes orange w/o processing:
SDR (well):

HLGw/oProcessing (undersaturated and undercontrasted):

HLGtoSDRprocessing (oversaturated and overcontrasted):

I've found with old version of LAV Video Decoder 0.68.1.35 (modified by Aleksoid1978 to accelerate 4K h265 10bit via NVIDIA CUVID in WinXP) Processing: HDR(HLG) to SDR not switching on even in any DXVA2 mode.
Return to huhn's "madVR doesn't support HLG" - I'm not pity very much because my old computer couldn't use madVR in modes showing not worse than EVR or EVR-CP on 4K but I want watch F1 in HLG h265 10bit 4:2:0 4K with colors not worse than before HLG (see SDR picture) in i.e. 2018 - I've recorded many files to compare - here's three of them:
20180729-160530_RTL UHDsdr.ts (73MB) https://yadi.sk/i/nKbwy-6ohkWQxw
20190511-140255_RTL UHDhlg.ts (19MB) https://yadi.sk/d/sVcYR6QgkfcGOw
20190630-183800_RTL UHDhlg.ts (14MB) https://yadi.sk/d/OjMMtl5d6JibQQ
But my GTX750v2 videocard is strong enough to process 4K video with shaders (i.e. Convert HDR to SDR or HDR but they gives wrong colors too) in EVR-CP so my questions are:
1. Does anybody know some another HLG to SDR shader I can try?
2. Can anybody write such shader which can process HLG metadata (repeat - if it can be correctly done at all)?
VictorLS is offline   Reply With Quote
Old 23rd September 2019, 14:58   #2  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
1. It's not a shader but DGHDRtoSDR 1.13 can now convert HLG to SDR. DGIndexNV can also do it for its display, with parameter sliders compatible with DGHDRtoSDR. The results are very pleasing and expose the issues with just playing HLG directly without conversion. It should be easy to do in a shader but I don't do DirectShow stuff so someone else will have to do it. I'd be happy to provide the algorithm if someone wants it to make a shader. But anyway, it's not rocket science. You just replace the PQ EOTF with the HLG EOTF.

2. AFAIK, HLG does not have any metadata that would guide the presentation. Yes, I know about the preferred transfer function SEI, but it is fixed at 18 for HLG. Lack of metadata is a big plus for HLG.

Last edited by videoh; 23rd September 2019 at 19:09.
videoh is offline   Reply With Quote
Old 23rd September 2019, 17:12   #3  |  Link
VictorLS
Registered User
 
Join Date: Mar 2009
Location: Russian Crimea
Posts: 335
videoh, thanks for reply and your algorithm.
I'm not programmer but I've heard about DGIndexNV (DGDecNV) but never used it so I'm not sure I'll can to convert HLG to SDR correctly.
Tell me, please where can I download DGHDRtoSDR 1.13 to try to convert HLG videos to SDR to see result?
If link is a secret can you convert 20190511-140255_RTL UHDhlg.ts and/or 20190630-183800_RTL UHDhlg.ts and upload it, please?

Last edited by VictorLS; 23rd September 2019 at 17:15.
VictorLS is offline   Reply With Quote
Old 23rd September 2019, 18:25   #4  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
No secrets from you, VictorLS! You'll find it here (scroll down a bit):

http://rationalqm.us/mine.html

You should be able to tweak parameters to fairly well match the SDR version. DGIndexNV has a GUI tweaker for it that makes finding good parameters really easy. You'll need a decent nVidia card to run DGIndexNV. You can run DGHDRtoSDR without an nVidia card but it can be slow in SW mode. Do you have a decent nVidia card installed?

The gentleman that asked me to implement this said he is very happy with the results (zys4416 at DG forum): "the result is pretty perfect". Sweetie Pie would say "purrfect".

Probably jpsdr's HDR tools can also do this conversion. Always great to hear from jpsdr so maybe he will chime in.

Bullwinkle said: "PQ sucks. People say I don't suck. HLG is the True Way."

Last edited by videoh; 23rd September 2019 at 19:39.
videoh is offline   Reply With Quote
Old 23rd September 2019, 22:34   #5  |  Link
VictorLS
Registered User
 
Join Date: Mar 2009
Location: Russian Crimea
Posts: 335
Quote:
Originally Posted by videoh View Post
No secrets from you, VictorLS! You'll find it here (scroll down a bit):
http://rationalqm.us/mine.html
Thanks, I've download DGHDRtoSDR_1.13.rar from there but I haven't seen algorithm there like i.e. for kerneldeint141
Quote:
Originally Posted by videoh View Post
Do you have a decent nVidia card installed?
Yes, I have decent enough GTX750v2 on GM206 (as GTX950 and GTX960 but I think ~ two times slower) videocard - it can hardware decoding 4K h265 10bit 4:2:0 even in WinXP.
Quote:
Originally Posted by videoh View Post
Always great to hear from jpsdr so maybe he will chime in.
I hope it'll be so.
Quote:
Originally Posted by videoh View Post
The gentleman that asked me to implement this said he is very happy with the results (zys4416 at DG forum): "the result is pretty perfect".
I've found at http://rationalqm.us/board/viewtopic...=617&start=550
I tried so AviSynth+ script in ffdshow:
=================================
loadplugin("C:\dghdrtosdr.dll")
DGHDRtoSDR(impl="sw",mode="hlg",white=1800)
Prefetch(3)
=================================
(impl="sw" because I haven't dgdecodenv.dll) but got error while playing trim_187.ts and my test h265 SD SDR quasi-interlaced file (I've written AviSynth(+)-script to deinterlace it correctly). How can I get YUV420P16?
Attached Images
 
VictorLS is offline   Reply With Quote
Old 23rd September 2019, 23:05   #6  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Quote:
Originally Posted by VictorLS View Post
Thanks, I've download DGHDRtoSDR_1.13.rar from there but I haven't seen algorithm there like i.e. for kerneldeint141
I'm not sure what you mean by "algorithm" here. What exactly are you looking for, source code?

Quote:
I've found at http://rationalqm.us/board/viewtopic...=617&start=550
I tried so AviSynth+ script in ffdshow:
=================================
loadplugin("C:\dghdrtosdr.dll")
DGHDRtoSDR(impl="sw",mode="hlg",white=1800)
Prefetch(3)
=================================
(impl="sw" because I haven't dgdecodenv.dll) but got error while playing trim_187.ts and my test h265 SD SDR quasi-interlaced file (I've written AviSynth(+)-script to deinterlace it correctly). How can I get YUV420P16?
Your script needs a source filter capable of delivering high-bit depth 10-bit in YUV420P16. That would normally be DGSource(), but I am sure there are others. Send me a PM and I'll gift you a DGDecNV license, as you seem to be a fine chap. You probably want a 10-series card or better for UHD 10-bit HEVC stuff.
videoh is offline   Reply With Quote
Old 24th September 2019, 08:27   #7  |  Link
VictorLS
Registered User
 
Join Date: Mar 2009
Location: Russian Crimea
Posts: 335
Quote:
Originally Posted by videoh View Post
I'm not sure what you mean by "algorithm" here. What exactly are you looking for, source code?
May be source code - I'm not programmer so all can help to write shader after your
Quote:
Originally Posted by videoh View Post
I'd be happy to provide the algorithm if someone wants it to make a shader
will be appreciated.
Quote:
Originally Posted by videoh View Post
Your script needs a source filter capable of delivering high-bit depth 10-bit in YUV420P16. That would normally be DGSource(), but I am sure there are others.
I see.
Quote:
Originally Posted by videoh View Post
Send me a PM and I'll gift you a DGDecNV license, as you seem to be a fine chap.
I'm from Russian Crimea and you can change your opinion http://forum.doom9.org/search.php?se...8484373&pp=200 (read mostly from 27th July 2016, 17:30 to 20th November 2016, 09:56)
In any case many thanks for proposition (in anyway we are in Crimea under sanctions and PayPal not work in Crimea as international cards too) - I've sent you PM.
Quote:
Originally Posted by videoh View Post
You probably want a 10-series card or better for UHD 10-bit HEVC stuff.
I want hypotetic 30-series weak (and therefore cheap and silent as mine GTX750v2 - btw I removed fan from at all so it's passive now - just almost noiseless 120mm not too far from that and it still cool while hardware decoding 4K h265 10bit 4:2:0 video with ~ 50% load of VideoEngine) videocard with 4GB VideoRAM and hardware acceleration HEVC 8K 4:2:2 (for some SAT feeds - nVIDIA has promised to think about) and 4:4:4 (20-series can accelerate 4:4:4 already but I haven't seen from SAT yet) and VP10 and AV1 in Windows7x64

Last edited by VictorLS; 24th September 2019 at 12:27.
VictorLS is offline   Reply With Quote
Old 25th September 2019, 11:27   #8  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
Yeah, no 4:2:2 atm for 20 series, but is there are some channels airing in 4:2:2 chroma subsampling format? That's a news for me.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 25th September 2019, 22:23   #9  |  Link
VictorLS
Registered User
 
Join Date: Mar 2009
Location: Russian Crimea
Posts: 335
DJATOM
Best regards to former and I hope future in Russian World compatriot.
Quote:
Originally Posted by DJATOM View Post
is there are some channels airing in 4:2:2 chroma subsampling format? That's a news for me.
Despite it's offtop here - about 10 years ago was 4:2:2 MPEG2 permanent SD channel MED OFFICE on 39e satellite MED OFFICE.ts (10MB) https://yadi.sk/i/NnRontXRs-xckA - I knew only Elecard could decode it that time.
First race of FormulaE in history was translated from 4:2:2 feed - I've remuxed it with mkvtoolnix 09-13_13-19-15_hy1_-002.mkv (126MB) https://yadi.sk/i/G7KrUACkbUYEU
Eurovision 1920x1080i50 feeds was MPEG2 and now h264 but always 4:2:2
In some years international F1 feed from 10e is transmitted as h264 1920x1080i50 4:2:2 (namely when F1 - other events of weekend are in 4:2:0 chroma subsampling) i.e. 4:2:2 20190414-090034_TATA WIF Main_КвятКитай.ts (19MB) https://yadi.sk/i/XqdkpfKMddC_vA
In some month if I remember correctly from 4e9 was transmitting 3840x2160p25 4KUA channel 20171204-234107_4KUA.ts (55MB) https://yadi.sk/d/bo-0KiV83QKoge - only MainConcept HEVC Video Decoder can decode all 25 frames per second on my old and weak Athlon II x3 460 with ~90% load of each core, LAV Video Decoder stutters with 100% load.
Later I saw just seldom feeds like h264 1920x1080i50 4:2:2 09-16_14-29-23_LEV VS VAL HD50_.ts (62MB) https://yadi.sk/d/2lXjVe2S3MxFXG (my processor is quite enough to decode all 50 fps with ~50% load) or h265 4:2:2 3840x2160p50 20180428-175510_4K ENC 3 RMAD VS LEG.ts (563MB) https://yadi.sk/d/m0s5ztpj3XnUyw - I believe few processors (begining from Intel Core i7 and top AMD Ryzen) can decode all 50 frames per second and keep video and audio synced. I watched it with MainConcept's SkipPB option or with MPC Video Decoder with "Skip non Intra frames" in Properties of MPCVideoDec_skip_non_I-frames.7z (7,2MB) https://yadi.sk/d/ZBA-K2-6UUV4TQ with synced audio and ~1fps

videoh
Thank you very much - I've got well enough (some cool) colors while playing HLG in DGIndexNV:

Last edited by VictorLS; 25th September 2019 at 22:49.
VictorLS is offline   Reply With Quote
Old 8th October 2019, 20:18   #10  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,869
Quote:
Originally Posted by DJATOM View Post
is there are some channels airing in 4:2:2 chroma subsampling format? That's a news for me.
Professional feeds are always in 4:2:2 planar 10bit, however they are not for end users, they are for broadcasters everywhere in the world to receive the signal, decode it, do any kind of adjustment / comment then event and the re-encode it and air the event with their specifications.

For instance, the ATP Masters 1000 world feed which is shot and distributed across the whole world via Sat to all the licensors is in H.264 4:2:2 planar 10bit 25i, however once we get the signal, we make sure that luma and chroma is in limited tv range and we insert the comment, it gets dithered down to 8bit 4:2:0 planar (yv12) and re-encoded to H.264 25i with a way lower bitrate.



Quote:
Actually it might be useful for animes, since usually it's done into Apple ProRes 4:2:2 @ 10 bit.
Animations of anime characters and so on are generally produced in RGB but they get exported as AppleProRes HQ 4:2:2 10bit progressive as masterfile which is the one that is generally sent to studios. I've been encoding those files from 2013 to 2015 with my previous job (still as encoder but at a different company) however I can tell you that while some studios work really well and give you a nice clean masterfile without any issues, some others don't and the file provided has any kind of issues I'm looking at you, Sentai!.
As a side note, sometimes old japanese broadcasters living in the stone-age prefer to get an XDCAM-50 file instead which is just a crappy MPEG-2 8bit yv16 telecined which is a shame 'cause if you are a sub-licensor you don't get the original masterfile from the Studio, but the mezzanine file sent to the japanese broadcaster instead.
Anyway, I did like that job, but I prefer to work as encoder in the new company as I've been encoding documentaries, tv series and other more important and exciting things than anime.

Quote:
(I have few friends who worked on such files, but they didn't share those with me due to NDA).
Of course they didn't, if we ever even dare to upload such a thing and it gets leaked, not only the company we work for loses the licence but it also has to pay a big fee. What happens to the person who shared the file? Well, it gets sacked and he can say goodbye to this job as no one would ever dare to hire him in any other studio.
I can't share their name for privacy reasons, but I know a few people who have been sacked only because someone hacked their account and stole a proxy file (not even the masterfile!!) and shared it publicly on the internet via torrent before it was aired.

Last edited by FranceBB; 8th October 2019 at 20:21.
FranceBB is offline   Reply With Quote
Old 16th November 2019, 21:03   #11  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by FranceBB View Post
For instance, the ATP Masters 1000 world feed which is shot and distributed across the whole world via Sat to all the licensors is in H.264 4:2:2 planar 10bit 25i
Do they still use cameras that record interlaced signals?
No wonder to me broadcast is a dying breed!

ATP matches can be viewed over the internet and there are 0.0 reasons to support this idiotic interlaced signal, it's 2019 for crying out loud!
And if "granny's TV" needs it then interlace the original 50p signal over the air to 50i (or 25i if you prefer this semantic)!

Last edited by Cary Knoop; 16th November 2019 at 21:07.
Cary Knoop is offline   Reply With Quote
Old 16th November 2019, 21:18   #12  |  Link
VictorLS
Registered User
 
Join Date: Mar 2009
Location: Russian Crimea
Posts: 335
Quote:
Originally Posted by Cary Knoop View Post
50i (or 25i if you prefer this semantic)!
I'm not professional but I'm sure not 50i but i50=25i on my own.
May be someone know place where shader-writers are to ask them about writing HLG->BT.709 shader there?
VictorLS is offline   Reply With Quote
Old 16th November 2019, 21:59   #13  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by VictorLS View Post
I'm not professional but I'm sure not 50i but i50=25i on my own.
It's semantics it refers to the same thing. 50 fields per second or 25 frames per second. Personally I prefer the 50i terminology because 2 fields do not actually make a visual frame!
Cary Knoop is offline   Reply With Quote
Old 26th September 2019, 21:56   #14  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
VictorLS
И тебе привет (:
(Hope mods will not restrict me for few Russian words)

So there are not so much channels with 4:2:2 color mode, I see. Actually it might be useful for animes, since usually it's done into Apple ProRes 4:2:2 @ 10 bit (I have few friends who worked on such files, but they didn't shared those with me due to NDA). I personally think it's better to use 4:4:4 (with upscaling of old content) for broadcasting, we're not in analogue TV era where interlace and halved chroma saved a lot of channel bandwidth, allowing more channels per allocated analogue TV frequencies and improving overall quality of transmission.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 26th September 2019, 22:11   #15  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
@VictorLS

You are most welcome and I am happy you find DG tools useful. Maybe I would pop the whites a little by backing off on the tm parameter and/or bumping up the white parameter.

@DJATOM

Hello to you too.

Last edited by videoh; 26th September 2019 at 22:14.
videoh is offline   Reply With Quote
Old 27th September 2019, 10:03   #16  |  Link
VictorLS
Registered User
 
Join Date: Mar 2009
Location: Russian Crimea
Posts: 335
Quote:
Originally Posted by DJATOM View Post
So there are not so much channels with 4:2:2 color mode, I see.
You're right.
Quote:
Originally Posted by DJATOM View Post
Actually it might be useful for animes ... I personally think it's better to use 4:4:4 (with upscaling of old content) for broadcasting
I same think about 4:4:4 for anime and seem nVIDIA too - Turing-core based videocards must support hardware acceleration of 4:4:4 chroma subsampling quite well.
Quote:
Originally Posted by DJATOM View Post
we're not in analogue TV era where interlace and halved chroma saved a lot of channel bandwidth, allowing more channels per allocated analogue TV frequencies and improving overall quality of transmission.
Broadcasters (even German) saves bandwidth as they can so even HD may show worse than high-quality SD channel https://sat-dx.club/viewtopic.php?f=...art=190#p29114
In any way I haven't seen 4:4:4 from SATs yet and sure it wouldn't.
Btw my old 1-core Athlon II 3,2GHz couldn't decode 4:2:2 h264 1920x1080i50 ~20Mbit/s international F1 feed so I've bought 3-core CPU (not found 4-core that time in sale) and insert in old 690G mobo and now CPU load about 50% of each core so I need hardware acceleration of 4K, 8K and so on.
Quote:
Originally Posted by videoh View Post
Maybe I would pop the whites a little by backing off on the tm parameter and/or bumping up the white parameter.
I'll try to watching on new binaries but it'll be appreciated if you'll once let me somehow know about new version out
VictorLS is offline   Reply With Quote
Old 27th September 2019, 11:52   #17  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
@videoh
Hi, Don.

@VictorLS
You can subscribe onto "Binaries update thread" and receive notifications onto e-mail. But I'm just personally checking Don's forum for new posts and updates (good reason to do so).
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 29th September 2019, 20:37   #18  |  Link
VictorLS
Registered User
 
Join Date: Mar 2009
Location: Russian Crimea
Posts: 335
Quote:
Originally Posted by videoh View Post
Maybe I would pop the whites a little by backing off on the tm parameter and/or bumping up the white parameter.
Btw here's two files to help achieve red (and other) colors while playing 4K HLG such ordinary FullHD SDR
20190511-130113_ARENA HD_flag.ts (38MB) https://yadi.sk/i/HiuZ5Rb2RKkc0g
20190511-152944_RTL UHD_flag.ts (67MB) https://yadi.sk/i/985DVw34OHQrrA
VictorLS is offline   Reply With Quote
Old 30th September 2019, 22:23   #19  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Quote:
Originally Posted by VictorLS View Post
Btw here's two files...
Thank you for the samples, VictorLS.
videoh is offline   Reply With Quote
Old 30th September 2019, 23:13   #20  |  Link
VictorLS
Registered User
 
Join Date: Mar 2009
Location: Russian Crimea
Posts: 335
Quote:
Originally Posted by videoh View Post
Thank you for the samples, VictorLS.
You're welcome.
VictorLS 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 09:19.


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