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. |
2nd July 2020, 22:51 | #606 | Link |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
I would like to add VapourSynth support. I think AviSynth/VapourSynth cross-platoform compatibility should be the standard in 2020 (although this particular project can't work outside Windows because of DirectX9)
Yet I still haven't looked into learning VapourSynth at all. It would be useful if someone would write documentation with standard guidelines to write plugins for both VapourSynth and Avisynth, and also for making them cross-platform. Otherwise each dev needs to figure it out on their own. |
3rd July 2020, 12:13 | #607 | Link | |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
|
Quote:
Here's the uncomfortable truth: 1. Did you write GPU code? Probably not portable 2. Did you write code with unaligned memory access? Probably not portable 3. Did you access the filesystem? Probably not portable 4. Did you partially access a wider numerical type in memory? Definitely not portable! 5. Are you super great at build systems? No? No portability for you! If you write sane code that only performs some CPU calculations and nothing else it'll probably be portable without much effort but that's about it.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
|
3rd July 2020, 19:04 | #608 | Link |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
These would be good guidelines for those starting to write new plugins. Things to know before writing the first line of code.
What's easier to do is port to VapourSynth and support both. If the actual work is done by a well-encapsulated class, then it should only require 2 separate code files to interop with each *synth? |
3rd July 2020, 20:16 | #609 | Link | |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
|
Quote:
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
|
20th July 2020, 15:26 | #610 | Link | ||
Registered User
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
|
Quote:
Quote:
__________________
See My Avisynth Stuff |
||
21st July 2020, 20:08 | #611 | Link |
Registered User
Join Date: Oct 2018
Posts: 319
|
Hi MysteryX, I've been working with AviSynth Shader for some time trying to use it to run some Super-resolution CNNs implemented as pixel shaders. You can see the result here. First thing I have to say is that it works very good and fast, so I wanted to thank you for your work, it's great to be able to use a tool like this. However I have found some problems and limitations that I wanted to inform you about, so that you can see what would be necessary to solve them if this is possible:
- This works by using each plane as the input/output for a filter, so with a maximum of 9 clips, the maximum number of filters is 36. To implement a network of 64 filters (most), 16 clips would therefore be necessary. For simple models like FSRCNN, this can be solved by spliting the layers between two or more shaders, but for more complex models this would mean a large increase in the number of shaders, and apart from what this would mean for performance, there is already a limit about the maximum number of shaders that can be used in the same pass (see below). - I'm not sure what the problem is with Y16 as this seems to have been changing. Using it as input produces the error "CombinePlanes: source has no such plane U". Using it as output returns a YUVA444P16 clip. Maybe this could help to increase performance. - Trying to return a Y8 clip now with Precision = 0 produces the error "CombinePlanes: source bit depth is different from 16". - Shader Model 3.0 has a limit of 224 Constant registers. This means that, for example, the maximum number of clips that can be used in a shader for a Conv3x3 layer is equal to 6. Unfortunately this can only be solved by using Shader Model 4.0 or spliting the layers as above. - There is a limit on the maximum number of shaders that can be used in a single pass, after which an access violation error occurs. I have noticed that this limit varies slightly depending on Precision and PlanarOut. This is what I've found in case it could help you: With Precision = 1 and PlanarOut = false, the limit is 79. With Precision = 1 and PlanarOut = true, the limit is 76. With Precision = 2 and PlanarOut = false, the limit is 80. With Precision = 2 and PlanarOut = true, the limit is 77. And I think that would be it. For the kind of models I am using, troubleshooting the Y8 and Y16 issues could help to increase performance. I don't think that solving the other issues related to increasing the number of filters or layers could be especially beneficial, because the models would be much slower and the improvement in results would be only marginal. To have the possibility of implementing other more complex networks, a solution would be necessary though. Last edited by Alexkral; 30th October 2020 at 18:01. |
24th July 2020, 17:49 | #612 | Link | |
Quality Checker
Join Date: Aug 2013
Posts: 284
|
Quote:
I find VapourSynth faster/stable then AviSynth when it comes to frame interpolation
__________________
I love Doom9 |
|
16th September 2020, 03:17 | #613 | Link |
Registered User
Join Date: Dec 2019
Posts: 68
|
Don't know if anyone here still uses this, but do I have to use a combination of SuperRes and another upscaler to upscale say a 720p source to 4k? If not, how do I make it so that it doesn't scale 2x.
The results are pretty good tbh :P |
10th November 2020, 18:43 | #615 | Link |
Registered User
Join Date: Oct 2001
Posts: 416
|
Please check syntax
Trying to get this to work in AVS but having problems. I've tried to fix the syntax as best I can but after loading the avs file into Vdub I get this error -
I see the suggested script - ConvertToShader(1) Input Shader("Diff1.cso", Output=2) Shader("Diff2.cso", Output=3) Shader("Merge.cso", Clip1=2, Clip2=3, Output=1) ShaderExecute(last, Input, Clip1Precision=1, Precision=3, OutputPrecision=1) ConvertFromShader(1) I'm not sure what "Input" means and whether "1" means precision=1? Here is my script - I tried to copy another script in this thread. mov = FFVideoSource("J:\video.mp4") ConvertToShader(mov) Shader("G:\Adaptive-sharpen - Pass one.hlsl", Output=2) Shader("G:\Adaptive-sharpen - Pass two.hlsl", Output=1) ExecuteShader(last, mov, Clip1Precision=1, Precision=3, OutputPrecision=1) ConvertFromShader() Can you see what's wrong? Last edited by tyee; 10th November 2020 at 18:47. |
10th November 2020, 20:52 | #616 | Link |
Registered User
Join Date: Oct 2018
Posts: 319
|
Try this:
Code:
mov = FFVideoSource("J:\video.mp4") Input = ConvertToShader(mov, 1) Shader(Input, "G:\Adaptive-sharpen - Pass one.hlsl", Output = 2) Shader("G:\Adaptive-sharpen - Pass two.hlsl", Clip1 = 2) ExecuteShader(last, Input, Clip1Precision = 1, Precision = 3, OutputPrecision = 1) ConvertFromShader()
__________________
AviSynth AiUpscale |
11th November 2020, 06:17 | #617 | Link |
Registered User
Join Date: Oct 2001
Posts: 416
|
OK, thanks. Tried it and got an error about opening the shader. I removed the "G:\" and copied the .hlsl files to the plugin folder and now it loads fine but the image in Vdub is not the correct aspect ratio (width is 1/2 what it should be) and it's all covered in blue. I think there was something in the instructions about floating point?
Last edited by tyee; 11th November 2020 at 06:45. |
11th November 2020, 08:49 | #618 | Link |
Registered User
Join Date: Oct 2018
Posts: 319
|
Yeah, I guess the shaders are these. You have to set also precision in ConvertFromShader(1)
__________________
AviSynth AiUpscale Last edited by Alexkral; 11th November 2020 at 08:59. |
2nd January 2021, 13:59 | #620 | Link | |
Registered User
Join Date: Jun 2020
Posts: 303
|
I've tried out Avisynth shader on a simple mp-hc video player shader. Any further advice welcome.
Mpc-hc shaders only run in rgb so it is necessary to convert to RGB32 at the input and the output. It also seems necessary to modify the shader so that it takes bgra as input and output to get correct colors. sampler s0: register(s0); float4 main(float2 tex: TEXCOORD0): COLOR { float4 c0 = tex2D(s0, tex).bgra; ... c0+= float4(1, 0, 0, 0); //saturate red channel ... return c0.bgra; } Perf overhead: tested on old intel integrated graphics i3-4150, realtime preview at 720p60 and 1080p25 seem near achievable. adding Prefetch(2) at the end of the script improves perf slightly but does increase cpu usage. # AviSynth Shader v1.6.6 with Avisynth+ v3.6.1 x64 on Win10 https://github.com/mysteryx93/AviSynthShader/releases Quote:
EDIT: My understanding of how avisynth shader works is as follows: - The input video file (ex: yuv420) is loaded into avisynth (cpu). - avisynth shader can transfer this to a pixel shader chain (dx9 .hlsl, gpu). - mpc-hc video player shaders run in rgba. Thus the input has to be converted to RGB first (!!! avisynth shader input/output is in .bgra format meaning the shader code will have to be modified if it performs specific operations on color component). - it would be possible to write hlsl shaders that run in yuv and you can pass parameters to the shaders via registers. - the output gets transfered back to avisynth (cpu). The transfers between cpu/gpu have significant overhead, especially at higher resolution. Further processing can be done in avisynth at input or output.
__________________
bShaders: realtime Effects/filters for video players Last edited by butterw2; 3rd January 2021 at 15:25. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|