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 18th August 2019, 13:38   #561  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
thx, found it later too.

Also found this https://artoriuz.github.io/mpv_upscaling.html
FSRCNNX is an upscaler which seems to be similar to NGU (madvr)

It can be downloaded here in glsl format: https://github.com/igv/FSRCNN-TensorFlow/releases

Maybe Avisynth shader could support glsl in (a not so distant) future


EDIT: Ahh finally found the diffenrence between hlsl and glsl (directx vs opengl) https://anteru.net/blog/2016/mapping...HLSL-and-GLSL/
and the future seems to be SPIR-V (vulkan)
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database

Last edited by ChaosKing; 18th August 2019 at 13:42.
ChaosKing is offline   Reply With Quote
Old 18th August 2019, 20:22   #562  |  Link
Alexkral
Registered User
 
Join Date: Oct 2018
Posts: 319
Quote:
Originally Posted by ChaosKing View Post
This loads now, but the output looks a bit broken.
I managed to make this work with some problems, this is what I have found so far:

- The default precision for ConvertToShader and ConvertFromShader is not 1, so you have to specify it.
- The input has to be RGB because otherwise the shader receives YUV channels.
- The first shader receives the channels as BGRA. The last shader has to return them as BGRA for RGB32 by changing the order again, or as GBRA for YV12 or YV24.
- The Alpha channel can be used to pass data between the shaders, but obviously it is lost at the end.

There is no need to compile the shaders. The naive luminance aproximation in the ComputeLum shader doesn't make any sense, doing it the right way compiles to less instructions.

Also, these shaders run on screen space so you have to resize before (but if you don't, the effect is quite fun with low-res videos ).
Alexkral is offline   Reply With Quote
Old 18th August 2019, 20:48   #563  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Quote:
Originally Posted by Alexkral View Post
I managed to make this work with some problems, this is what I have found so far:

- The default precision for ConvertToShader and ConvertFromShader is not 1, so you have to specify it.
- The input has to be RGB because otherwise the shader receives YUV channels.
- The first shader receives the channels as BGRA. The last shader has to return them as BGRA for RGB32 by changing the order again, or as GBRA for YV12 or YV24.
- The Alpha channel can be used to pass data between the shaders, but obviously it is lost at the end.

There is no need to compile the shaders. The naive luminance aproximation in the ComputeLum shader doesn't make any sense, doing it the right way compiles to less instructions.

Also, these shaders run on screen space so you have to resize before (but if you don't, the effect is quite fun with low-res videos ).
Ahh ok thx.
But the only thing I had to change was to add Precision=1 in ConvertToShader / ConvertFromShader. Basically it is exactly like the example on github now

Input is yv12 and it seems to work.

EDIT:
But the sharpening effect is a bit too extreme and produces sometimes aliasing. NGU looks much better in the comparison.
The good thing is, it's "fast".
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database

Last edited by ChaosKing; 18th August 2019 at 21:06.
ChaosKing is offline   Reply With Quote
Old 18th August 2019, 21:25   #564  |  Link
Alexkral
Registered User
 
Join Date: Oct 2018
Posts: 319
It works, and the result may even be identical, but it is not correct at all. Use RGB for input and output and change the "float lum ..." line in Anime4K_ComputeLum.hlsl by this:

Code:
float lum = (c0[2] + c0[2] + c0[1] + c0[1] + c0[1] + c0[0]) / 6;
Again, it probably won't make any difference.
Alexkral is offline   Reply With Quote
Old 27th August 2019, 00:53   #565  |  Link
Alexkral
Registered User
 
Join Date: Oct 2018
Posts: 319
Would it be possible to increase the number of clips to 16?
Alexkral is offline   Reply With Quote
Old 27th August 2019, 02:29   #566  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
I can't get the Anime4k hlsl to work . "Invalid arguments to function 'Shader'" . I tried different combinations of CK's post 559, and added Precision=1 for ConvertToShader, ConvertFromShader

Can you post a full script? or whatever the "proper" way to use this ?

Thanks
poisondeathray is offline   Reply With Quote
Old 27th August 2019, 04:07   #567  |  Link
Alexkral
Registered User
 
Join Date: Oct 2018
Posts: 319
Code:
input = FFMS2("video.mkv", colorspace = "RGB32")

c = ConvertToShader(input, Precision = 1)
Shader(c, "Anime4K_ComputeLum.hlsl", output=2)
Shader(last, "Anime4K_Push.hlsl", Clip1 = 2, output = 3)
Shader(last, "Anime4K_ComputeGradient.hlsl", Clip1 = 3, output = 4)
Shader(last, "Anime4K_PushGrad.hlsl", Clip1 = 4, output = 1)
ExecuteShader(last, c, Precision = 3, OutputPrecision = 1)
ConvertFromShader(last, Precision = 1, Format = "RGB32")
Alexkral is offline   Reply With Quote
Old 27th August 2019, 04:21   #568  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Thanks Alexkral, it's working now
poisondeathray is offline   Reply With Quote
Old 6th September 2019, 09:20   #569  |  Link
Alexkral
Registered User
 
Join Date: Oct 2018
Posts: 319
@MysteryX

Since I have read that you have said that the bottleneck is memory transfers, I would like to know if the intermediate results are also being transferred. I ask it because using a chain of shaders the GPU load is below 15%, so I wonder if maybe grouping some shaders into a heavier one could be useful to increase performance.
Alexkral is offline   Reply With Quote
Old 12th October 2019, 10:32   #570  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
I'm unable to resize single planes:

Code:
ConvertToY()
ResizeShader(3840,2160,"bicubic",0,0.4)
Code:
CombinePlanes: source bit depth is different from 16
(C:/Program Files (x86)/AviSynth+/plugins64+/Shader.avsi, line 357)
(New File (1), line 23)
Dogway is offline   Reply With Quote
Old 12th October 2019, 19:06   #571  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
MysteryX, (Not on-line since 27 Sept 2019),

Can you update the dead PostImage.org images in first post please.
[ Easy to do, just edit the post, and change all PostImage.org to PostImage.cc ]

EDIT: Actually, quite a lot of dead images in later posts too.
EDIT: Same in FramerateConverter thread and its predecessor thread SVP-like frame interpolation?.
__________________
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 ???

Last edited by StainlessS; 14th October 2019 at 04:58.
StainlessS is offline   Reply With Quote
Old 14th October 2019, 11:07   #572  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
Quote:
Originally Posted by StainlessS View Post
Can you update the dead PostImage.org images in first post please.
[ Easy to do, just edit the post, and change all PostImage.org to PostImage.cc ]
Work in first post, but not in the second.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 14th October 2019, 16:10   #573  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Thanks for trying Teb.
I dont remember ever seeing the "Image Not Found or Removed" thing (unless it was deleted deliberately by user).
When it first happened (maybe 12 to 18 months ago), I spend several days (3 or 4 maybe) altering several hundred url's,
and I also altered some only a few days ago to restore some broken images (must have been broken for more than 12 months, they had not been deleted).

Thanx again
__________________
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 8th December 2019, 20:50   #574  |  Link
fozter
Registered User
 
Join Date: Aug 2016
Posts: 5
I'm kind of a noob when it comes to video post processing, so please bear with me.

I've got this 1080p/HDR10/HEVC-track that I'm trying to upscale(SuperResXBR) to 2160p while still maintaining the HDR10-part.
Running this line: SuperResXBR(passes=5, factor=2)
But when reading the github I interpret it as colormatrix bt.2020 isn't supported and that by default it will convert it to bt.709.
Is this correct? And if, can someone please point me to another plugin that can achieve this? NNEDI3 maybe?
fozter is offline   Reply With Quote
Old 10th December 2019, 10:22   #575  |  Link
Alexkral
Registered User
 
Join Date: Oct 2018
Posts: 319
You can use the HDRTools plugin to convert to BT.709 and then use SuperResXBR with FormatOut = "YUV420P10". For NNEDI3 you can do the same and use NNedi3 resize 16:

https://forum.doom9.org/showthread.php?t=175488
http://avisynth.nl/index.php/Nnedi3_resize16

Edit: It seems that Nnedi3 resize 16 is no longer available but I think if you use ConvertYuv=false AviSynth Shader will cast YUV as RGB so there's no colorspace conversion and MatrixIn/MatrixOut are not used.

Last edited by Alexkral; 10th December 2019 at 20:37.
Alexkral is offline   Reply With Quote
Old 10th December 2019, 23:16   #576  |  Link
fozter
Registered User
 
Join Date: Aug 2016
Posts: 5
Okay, will try that. Thanks!
fozter is offline   Reply With Quote
Old 11th January 2020, 23:10   #577  |  Link
markiemarcus
Registered User
 
Join Date: May 2018
Posts: 49
I'm observing a very slight colour shift towards green (and I'd swear a slight drop in brightness or contrast) when using high bit depth processing in Avisynth+. This is with a Rec601 source and an AMD RX 480. Doesn't occur with standard bit depths. Any suggestions? It isn't as severe as a 601/709 shift, but it is there.

SuperResXBR(MatrixIn="Rec601")
^This works fine

ConvertBits(16)
SuperResXBR(MatrixIn="Rec601")
ConvertBits(8, dither=-1)
^This experiences the colour shift.

Dither_convert_8_to_16()
SuperResXBR(MatrixIn="Rec601",lsb_in=true,lsb_out=true)
DitherPost (mode=-1)
^No colour shift. Otherwise visually different results from the above.

Perhaps it's something I'm doing wrong? It is very minor and could just be the nature of the beast.

Last edited by markiemarcus; 12th January 2020 at 00:58.
markiemarcus is offline   Reply With Quote
Old 13th January 2020, 20:19   #578  |  Link
Alexkral
Registered User
 
Join Date: Oct 2018
Posts: 319
As you say maybe it's just because of the upscaling, I'm also experiencing color shifts with other algos so it seems quite possible to me. Anyway you could try with ColorYuv = false.
Alexkral is offline   Reply With Quote
Old 13th January 2020, 21:59   #579  |  Link
amayra
Quality Checker
 
amayra's Avatar
 
Join Date: Aug 2013
Posts: 284
i wish if this work in vapoursynth natively
__________________
I love Doom9
amayra is offline   Reply With Quote
Old 14th January 2020, 04:52   #580  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by markiemarcus View Post
I'm observing a very slight colour shift towards green (and I'd swear a slight drop in brightness or contrast) when using high bit depth processing in Avisynth+. This is with a Rec601 source and an AMD RX 480. Doesn't occur with standard bit depths. Any suggestions? It isn't as severe as a 601/709 shift, but it is there.

SuperResXBR(MatrixIn="Rec601")
^This works fine

ConvertBits(16)
SuperResXBR(MatrixIn="Rec601")
ConvertBits(8, dither=-1)
^This experiences the colour shift.

Dither_convert_8_to_16()
SuperResXBR(MatrixIn="Rec601",lsb_in=true,lsb_out=true)
DitherPost (mode=-1)
^No colour shift. Otherwise visually different results from the above.

Perhaps it's something I'm doing wrong? It is very minor and could just be the nature of the beast.

I can reproduce this; easier to see with colorbars or similar patterns

fulls=true seems to "fix" it (or match the others)

Code:
ConvertBits(16, fulls=true)
SuperResXBR(MatrixIn="Rec601")
ConvertBits(8, fulls=true, dither=-1)
poisondeathray 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 19:35.


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