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 > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th June 2018, 20:12   #41  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
Ok, i see (at least, i hope...).
... Hum... If i understand properly, it seems i have to add again another parameter for HLG, which specifies what transfer color matrix use within the OOTF function, because it's not necessary BT.2020... Argh....
__________________
My github.
jpsdr is offline   Reply With Quote
Old 30th July 2018, 16:30   #42  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
After a long fight (HLG is realy a pain in the ass if you want to optimize things), i'm near the end. But i have two choices, for a specific point. For speed-up i've implemented lookup. 8 bit is 3D lookup, so it's fine, but for 10 and 12 bit i've tried 2D lookup. It's faster than 16 bits, but... there is a noticeable resolution loss on low values (visible on some colors of ColorBars when testing YUVtoRGB followed by RGBtoYUV).
Choice 1 : Keep actual status, with 2D lookup for 10/12 bits.
As most of source filters produce 16bits ouput, if you don't want speed, you keep 16 bits, it you want speed-up, you add ConvertBits to reduce the bitdepth to the actual true bitdepth of the source. With this option, you keep the possibility to choose.
Choice 2 : No 2D lookup, 10 to 16 bit, same speed.
For now, i'm more on "Choice 1", allowing users to keep the possibility to choose, but i want to know what others users thinks what would be better.

BTW :I personnaly have nothing to display HDR video, no reader, no screen, nothing. The only tests i can do is checking ouput is not obvious garbage, no crash or things like this, that an operation followed by its reverse produce output indentical to input, but i have no way to check if output is realy proper.
__________________
My github.

Last edited by jpsdr; 30th July 2018 at 16:35.
jpsdr is offline   Reply With Quote
Old 31st July 2018, 17:52   #43  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
Finaly, the Hell Log Gamma is done. New version, add HLG support, see first post.
I've also updated the PDF document, there was some still some mistake (things i've not totaly properly understood) on the last one.
I've made a lot of tests, but there's still the possibilty that i've missed something, but i hope not...
__________________
My github.
jpsdr is offline   Reply With Quote
Old 1st August 2018, 03:58   #44  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Thank you very much indeed.

By the way there's a typo in the Readme "Outpout RGB64." instead of "Output" in "ConvertXYZtoRGB".

Anyway, I tried this:

Code:
FFMpegSource2("test.mov", atrack=-1)

ConvertYUVtoXYZ(Color=2, OutputMode=2, fullrange=false)

ConvertXYZtoRGB(OutputMode=0)

ConvertXYZ_SDRtoHDR()
But ConvertXYZ_SDRtoHDR keeps complaining that input format must be RGB64 or RGBPS.

So I tried with:

Code:
ConvertYUVtoLinearRGB(Color=2, OutputMode=2, fullrange=false)

ConvertXYZ_SDRtoHDR()
But again ConvertXYZ_SDRtoHDR keeps complaining that input format must be RGB64 or RGBPS.

I'm trying to convert a normal 8bit yv12() footage to XYZ Planar float RGB 8bit and then use ConvertXYZ_SDRtoHDR() to get an HDR BT2020 PQ 8bit output.


Windows XP x86 Build, Avisynth 2.6.1.

Am I doing something wrong?

Thank you in advance.

Oh, by the way, are you considering to integrate this into your jpsdr_plugin.dll?
FranceBB is online now   Reply With Quote
Old 1st August 2018, 08:34   #45  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
Yes, there is "something wrong" : standard avisynth doesn't support RGB64 neither RGBPS, so, you need avs+.

8 bits creates too much precision loss on linear data on HDR video. You can easely see it just by doing, on 8 bit video (even if it's not an HDR video) the following (it will use for this test the PQ HDR path) :
ConvertYUVtoLinearRGB(Color=0)
ConvertLinearRGBtoYUV(Color=0)
Theoricaly, the ouput should be identical to the input, but you'll see effect of precision loss. So, doing HDRtoSDR functions on 8 bits data is a total nonsense (when your data are the linear sensor data).
This could be possible if you're doing a function which will do the 3 functions in one (YUV -> RGB -> HDRtoSDR -> RGB -> YUV) and working internaly with 16 bits data, but it's not the path i've choosen. I choose modular functions option.
So if you stay with standard avisynth, you'll not be able to use the specific HDR/SDR functions.

I've re-read again, and there is nothing wrong in the description of "ConvertXYZtoRGB" in the readme.

Yes, i'll integrate it later, after the 0.4.0, where i'll add Hable, Mobius and Reinhard (but again, they'll be usable only with avs+).
Expect 6 new functions like ConvertXYZ_Mobius_HDRtoSDR, ConvertRGB_Mobius_HDRtoSDR, etc...
__________________
My github.

Last edited by jpsdr; 1st August 2018 at 08:59.
jpsdr is offline   Reply With Quote
Old 1st August 2018, 10:07   #46  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Quote:
avisynth doesn't support RGB64 neither RGBPS
I see...

Quote:
8 bits creates too much precision loss on linear data on HDR video.
Well... yes...
But 16bit stacked conversion to RGB48y would probably provide enough precision, I think and Avisynth supports that thanks to Dither Tool, but I don't think I'll ever see it supported as you said that you didn't like the stacked 16bit format 'cause you considered it an "hack" back when I asked you about NNEDI... :'(

Last edited by FranceBB; 1st August 2018 at 10:09.
FranceBB is online now   Reply With Quote
Old 1st August 2018, 10:14   #47  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
Yes, as it exists avs+ which supports 16 bits, i don't intend to spend/waste time to add stacked version on my plugins.

Is it XP which prevents you from using avs+ ? avs+ can't be installed or don't work on XP ?
__________________
My github.
jpsdr is offline   Reply With Quote
Old 1st August 2018, 10:52   #48  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Quote:
Originally Posted by jpsdr View Post
Is it XP which prevents you from using avs+ ? avs+ can't be installed or don't work on XP ?
I don't know whether it's officially supported or not, but it installs on XP. It automatically detected my Avisynth installation and offered to "migrate my plugins to AVS+". I clicked "yes" and it only copied some of the plugins I had in my plugin folder. Then, when I tried to run it with a simple command, it loaded them all together automatically ('cause they are .avsi) and it crashed.
I've been using Avisynth since 2006 and I have many plugins in my plugins directory. I gotta find out which one/ones are causing the problem, why they are causing the problem and a workaround to solve it. I'm gonna open up a new thread about this in "Avisynth usage" though.
FranceBB is online now   Reply With Quote
Old 1st August 2018, 13:09   #49  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
FranceBB,
Just get Groucho2004 AvsMeter
Code:
AvsMeter Avsinfo
Avs+ officially supports XP and is much better than avs standard.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 3rd August 2018, 21:06   #50  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
New version, see first post.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 9th August 2018, 18:51   #51  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
New version with tonemap, see first post.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 10th August 2018, 17:09   #52  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
New version, minor change.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 11th August 2018, 14:29   #53  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
As i've explained in post #42, i don't know if finaly it's working properly. So, users who have HDR display and stuff, can you provide feedback ? Are the formula i use/implement good ? Are things working properly ?
__________________
My github.
jpsdr is offline   Reply With Quote
Old 14th August 2018, 03:58   #54  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Quote:
Originally Posted by jpsdr View Post
As i've explained in post #42, i don't know if finaly it's working properly. So, users who have HDR display and stuff, can you provide feedback ? Are the formula i use/implement good ? Are things working properly ?
I tested them with their default values, so I didn't change parameters out of curiosity.

From the test results, it seems that HDR to SDR is working as expected, with Reinhard getting closest to the original compared to the others.

Source: 4K HDR 10bit BT2100 PQ
Scene: Sunset, a very dark scene, with a bit of contrast between the objects (dark) and the sky (not so bright, yet brighter than the objects).

- ConvertXYZ_Scale_HDRtoSDR

Grade: F

Insufficient, totally unreliable, colors completely messed up, out of range, unwatchable. On top of that, it turned a sunset into a sunrise.
It's a simple scalar function, so it's not expected to be reliable, but still, the output was completely wrong.

- ConvertXYZ_Hable_HDRtoSDR

Grade: C+

Way better than the scalar function, however, it was brighter than the original HDR version. I had the feeling that it tried to "exasperate" the colors, trying to reproduce a very strong fake HDR effect in SDR. Although some people might love very strong colors, it doesn't quite resemble the original HDR version which is way darker. As result, the colors that were already kinda "bright" in the HDR version, became too bright in the Hable SDR version, compromising details (like the edges of the clouds) with the white point set too high.
Still, I think that it's tweakable, you can play around with the settings to make it look better and some people might like it, even though this "colorful" tone-mapping approach is not my favorite.

- ConvertXYZ_Mobius_HDRtoSDR

Grade: B

This is more like it.
With the default settings it got close to the original and the content is actually watchable and many people wouldn't complain with the result, to be fair.
However... I'm not one of these people.
The result is actually slightly darker than the original HDR in some areas and slightly brighter in some other, which is interesting... Odd, but interesting.
The grass became slightly darker than the original as well as few other objects, while the sky became slightly brighter.
Almost no details were lost in the sky and in the clouds, but they were still slightly brighter. As to the grass and other objects, they indeed lost details because they were slightly too dark, but I'm pretty confident that playing around with the settings a good balance can be found.
Mobius has slightly too contrast because it tries to reproduce the HDR one in the best possible way; sometimes it gets it wrong, but it can be tweaked and the result is gonna look acceptable.

- ConvertXYZ_Reinhard_HDRtoSDR

Grade: A

With the default settings, Reinhard seems to be the best one.
I'm very impressed, it almost looks like the original HDR and it gives a really good, conservative feeling when you watch it on an SDR screen. I mean, if you are not an encoder and you don't deal with these stuff (like the normal user watching TV) you probably wouldn't even notice that the content was graded in PQ and then tone-mapped to SDR via Reinhard.
Compared to Mobius, the sky is slightly darker (closer to the original) and the grass and other objects are brighter (again, closer to the original). The sky looks pretty legit and natural and there are more details in the grass and other objects compared to Mobius, however, it's still not like the original, even though it's pretty close. It can be tweaked as well and I think it can be improved even more by fine-tuning parameters and I believe it has the potential to look really close to the original. I really like it and it's definitely gonna be my choice if I gotta make HDR to SDR conversion.



Screenshot:

I compared the SDR footages with the HDR one using my TV, because my computer is obviously SDR (a normal LCD 1920x1080 60Hz, nothing special).
Besides, trying to screenshot an HDR material doesn't really make much sense, but in order to give you something to compare the tone-mapped SDR versions, I'm gonna give you... well... "something".

- "Original" HDR (well, sort of):
Link

- Simple Scalar Function:
Link

- Hable:
Link

- Mobius:
Link

- Reinhard:
Link


I don't see anything wrong in the implementation of Jean-Philippe: it works and I find it very useful.
I didn't try SDR to HDR, PQ to HLG and HLG to PQ, though.

It would be interesting to test PQ to HLG and vice-versa using HDRTools and Davinci Resolve, then compare the results and check whether there are differences or not, but I don't have time for this right now.

Anyway, a big fat thank you to Jean-Philippe for this amazing plugin, once again.

On a very side note: I got this error the very first time I tried to run Hable, when I was seeking the video, but after seeking frame-by-frame without jumping "frenetically", it disappeared.


Last edited by FranceBB; 14th August 2018 at 04:13.
FranceBB is online now   Reply With Quote
Old 14th August 2018, 09:17   #55  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
Scale seems to provide "appropriate" results with a coeff between 35 - 40. On the other side, as i've said, it was just "out of curiosity" to see what a simple scalar can do on XYZ colorspace, i never expect great result from it. If it was so simple, it would have been done a long time ago

About detail loss, out of curiosity : Does it change if you use OutputMode=2 on the first ConvertYUVtoXYZ (or similar) ?

I'll take a look on Hable just in case, can you provide the exact script ? But, the 3 tonemap are all "indetical". I mean, the code is just a copy/paste on all 3, just the formula on the lookup table creation on the constructor changes.

I'll integrate it on the "all" plugins package version.

After, i don't know what you're seeking with, but i've noticed that according the tool used, there is 2 working ways :
- Constructor is run only once, and when seeking, only getframe is called (this is what you have in Virtualdub).
- Constructor/destructor is called each time a new frame is required. As filter has a "long" setup time (creating lookups), if you freneticaly seek, it's not impossible that you hit a "time out" issue, requesting 5 frames when the 1rst is still not out. This is how tools like avspmod seems to work. My guess is that you are in this case.

Otherwise, thanks for your post.

Now, i'll slowly work on my original idea, and the real "why" i've created these tools : Try a neural network approch on HDR to SDR. No idea if it will even work, but without trying, who knows...
To bad tritical is not here anymore, i would have asked some question about neural network. I've made my neural network class, i think i have the learning retropropagation algorithm correct, but i need convergence tweaking and feedback from neural networl expert. Well, i'll see later.
__________________
My github.

Last edited by jpsdr; 14th August 2018 at 09:41.
jpsdr is offline   Reply With Quote
Old 14th August 2018, 10:42   #56  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
To bad tritical is not here anymore, i would have asked some question about neural network.
V.C.Mohan still visits quite regularly, and wrote NeuralNet plugin, no idea if he can assist.
http://www.avisynth.nl/users/vcmohan...NeuralNet.html
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 14th August 2018, 17:50   #57  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
New version, minor change, see first post.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 14th August 2018, 18:56   #58  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
For Scale tonemap, the following is not too bad, at least on my small video part of Dark Crystal :
Coeff_X=37,Coeff_Y=36,Coeff_Z=36
__________________
My github.
jpsdr is offline   Reply With Quote
Old 15th August 2018, 14:21   #59  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Quote:
Originally Posted by jpsdr View Post
I don't know what you're seeking with, but i've noticed that according the tool used, there is 2 working ways :
- Constructor is run only once, and when seeking, only getframe is called (this is what you have in Virtualdub).
- Constructor/destructor is called each time a new frame is required. As filter has a "long" setup time (creating lookups), if you freneticaly seek, it's not impossible that you hit a "time out" issue, requesting 5 frames when the 1rst is still not out. This is how tools like avspmod seems to work. My guess is that you are in this case.
Yes, you are right, it was AVSPmod.
I'm downloading the new version of plugin_JPSDR, so thank you for including this new filter there.
As to the other tests, I'll eventually make a few more when I'll have time, but right now I'm really focused on something else due to work-related problems.
FranceBB is online now   Reply With Quote
Old 16th August 2018, 09:36   #60  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
HLG mode can have a very long (like in seconds) setup time according the input/ouput and configuration. Warning, it will be a nightmare with tools working calling constructor/destructor each time you seek a frame.
__________________
My github.
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 00:13.


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