AviSynthShader
(more doc) |
|||
Line 20: | Line 20: | ||
== [[Script variables|Syntax and Parameters]] == | == [[Script variables|Syntax and Parameters]] == | ||
− | ===ConvertToShader=== | + | ===Shader.dll=== |
+ | Plugin containing <code>ConvertToShader()</code>, <code>ConvertFromShader()</code>, <code>Shader()</code>, and <code>ExecuteShader()</code> functions. | ||
+ | <br> | ||
+ | <br> | ||
+ | ====ConvertToShader==== | ||
Converts a clip into a wider frame containing UINT16 or half-float data. Clips must be converted in such a way before running any shader. | Converts a clip into a wider frame containing UINT16 or half-float data. Clips must be converted in such a way before running any shader. | ||
Line 53: | Line 57: | ||
<br> | <br> | ||
------------ | ------------ | ||
− | ===ConvertFromShader=== | + | ====ConvertFromShader==== |
Convert a half-float clip into a standard clip. | Convert a half-float clip into a standard clip. | ||
<br> | <br> | ||
Line 83: | Line 87: | ||
<br> | <br> | ||
------------ | ------------ | ||
− | ===Shader=== | + | ====Shader==== |
Runs a HLSL pixel shader on specified clip. You can either run a compiled .cso file or compile a .hlsl file. | Runs a HLSL pixel shader on specified clip. You can either run a compiled .cso file or compile a .hlsl file. | ||
<br> | <br> | ||
Line 132: | Line 136: | ||
<br> | <br> | ||
------------ | ------------ | ||
− | ===ExecuteShader=== | + | ====ExecuteShader==== |
Executes the chain of commands on specified input clips. | Executes the chain of commands on specified input clips. | ||
<br> | <br> | ||
Line 181: | Line 185: | ||
[[TODO]] | [[TODO]] | ||
<br> | <br> | ||
− | <> | + | <br> |
== Changelog == | == Changelog == | ||
Version Date Changes<br> | Version Date Changes<br> |
Revision as of 18:02, 18 May 2020
Abstract | |
---|---|
Author | mysteryx93 |
Version | v1.6.5 |
Download | AviSynthShader-1.6.5.zip |
Category | Multipurpose |
License | |
Discussion | Doom9 Forum |
Contents |
Description
This plugin allows running HLSL pixel shaders within AviSynth. This gives access to various HLSL filters that haven't been programmed in AviSynth.
Requirements
Syntax and Parameters
Shader.dll
Plugin containing ConvertToShader()
, ConvertFromShader()
, Shader()
, and ExecuteShader()
functions.
ConvertToShader
Converts a clip into a wider frame containing UINT16 or half-float data. Clips must be converted in such a way before running any shader.
16-bit-per-channel half-float data isn't natively supported by AviSynth. It is stored in a RGB32 container with a Width that is twice larger. When using Clip.Width, you must divine by 2 to get the accurate width.
- ConvertToShader (clip, int "Precision", bool "lsb", bool "planar", int "opt")
- clip =
- Input clip.
- clip =
- int Precision = 1
- Precision:
- 0 to convert to Y8
- 1 to convert into BYTE (default)
- 2 to convert into UINT16
- 3 to convert into half-float
- Precision:
- int Precision = 1
- bool lsb = false
- Whether to convert from DitherTools' Stack16 format. Only YV12 and YV24 are supported. Default=false
- bool lsb = false
- bool planar = false
- True to convert into YV24 planar data to reduce memory transfers. If you assign such a clip to Clip1, the shader will receive the 3 planes as Clip1, Clip2 and Clip3. Default=false
- bool planar = false
- int opt = -1
- Optimization path:
- In AviSynth 2.6, 0 for only C++, 1 for SSE2, 2 for AVX(only used with Precision=3), -1 to auto-detect.
- In AviSynth+, -1 to use the AviSynth+ code path, other values to use legacy code paths.
- Default=-1
- Optimization path:
- int opt = -1
ConvertFromShader
Convert a half-float clip into a standard clip.
- ConvertFromShader (clip, int "Precision", string "Format", bool "lsb", int "opt")
- clip =
- Input clip.
- clip =
- int Precision = 1
- Precision:
- 0 to convert to Y8
- 1 to convert into BYTE (default)
- 2 to convert into UINT16
- 3 to convert into half-float
- Precision:
- int Precision = 1
- string Format = "YV12"
- The video format to convert to. Valid formats are YV12, YV24 and RGB32. Default=YV12.
- string Format = "YV12"
- bool lsb = false
- Whether to convert to DitherTools' Stack16 format. Only YV12 and YV24 are supported. Default=false
- bool lsb = false
- int opt = -1
- Optimization path:
- In AviSynth 2.6, 0 for only C++, 1 for SSE2, 2 for AVX(only used with Precision=3), -1 to auto-detect.
- In AviSynth+, -1 to use the AviSynth+ code path, other values to use legacy code paths.
- Default=-1
- Optimization path:
- int opt = -1
Shader
Runs a HLSL pixel shader on specified clip. You can either run a compiled .cso file or compile a .hlsl file.
- "Shader (clip, string "Path", string "EntryPoint", string "ShaderModel", string "Param0", ..., string "Param8", clip "Clip1", ..., clip "Clip9", int "Output", int "Width", int "Height", int "Precision", string "Defines")
- clip =
- The first input clip.
- clip =
- string Path = ""
- The path to the HLSL pixel shader file to run. If not specified, Clip1 will be copied to Output.
- string Path = ""
- string EntryPoint = "main"
- If compiling HLSL source code, specify the code entry point.
- string EntryPoint = "main"
- string ShaderModel = "ps_3_0"
- If compiling HLSL source code, specify the shader model. Usually PS_2_0 or PS_3_0
- string ShaderModel = "ps_3_0"
- string Param0 = ""
- .....
- string Param8 = ""
- Sets each of the shader parameters.
- Ex: "float4 p4 : register(c4);" will be set with
Param4="1,1,1,1f"
- End each value with 'f'(float), 'i'(int) or 'b'(bool) to specify its type.
Param0
corresponds to c0,Param1
corresponds to c1, etc.- If setting float or int, you can set a vector or 2, 3 or 4 elements by separating the values with ','.
- If not specified,
Param0 = Width,Height
andParam1 = 1/Width, 1/Height
by default.
- string Param0 = ""
- clip Clip1 = 1
- .....
- clip Clip9 = 0
- The index of the clips to set into this shader. Input clips are defined when calling ExecuteShader. Clip1 sets 's0' within the shader, while clip2-clip9 set 's1' to 's8'. The order is important.
- Default for clip1 is 1, for clip2-clip9 is 0 which means no source clip.
- clip Clip1 = 1
- int Output = 1
- The clip index where to write the output of this shader, between 1 and 9. Default is 1 which means it will be the output of ExecuteShader. If set to another value, you can use it as the input of another shader. The last shader in the chain must have output=1.
- int Output = 1
- int Width =
- int Height =
- The size of the output texture. Default = same as input texture.
- int Width =
- int Precision = -1
- While processing precision is set with ExecuteShader, this allows processing certain shaders with a different precision.
- int Precision = -1
- string Defines = ""
- List of pre-compilation constants to set for HLSL files, separated by ';'. Ex: "Kb=0.114;Kr=0.299;"
- string Defines = ""
ExecuteShader
Executes the chain of commands on specified input clips.
- "ExecuteShader(clip, clip "Clip1-9", int "Clip1Precision", ..., int "Clip9Precision", int "Precision", int "OutputPrecision", bool "PlanarOut", int "Engines", bool "Resource")
- clip =
- cmd: A clip containing the commands returned by calling
Shader
.
- cmd: A clip containing the commands returned by calling
- clip =
- clip Clip1 =
- .....
- clip Clip9 =
- Clip1-Clip9: The clips on which to run the shaders.
- clip Clip1 =
- int Clip1Precision =
- .....
- int Clip9Precision =
- Clip1Precision-Clip9Precision:
- 1 if input clips is BYTE
- 2 if UINT16
- 3 if half-float.
- Default=1 or the value of the previous clip
- Clip1Precision-Clip9Precision:
- int Clip1Precision =
- int Precision = 3
- Precision:
- 1 to execute with 8-bit precision
- 2 to execute with 16-bit precision
- 3 to execute with half-float precision. Default=3
- Precision:
- int Precision = 3
- int OutputPrecision = 1
- OutputPrecision:
- 1 to convert into BYTE (default)
- 2 to convert into UINT16
- 3 to convert into half-float
- OutputPrecision:
- int OutputPrecision = 1
- bool PlanarOut = true
- True to transfer data from the GPU back to the CPU as planar data to reduce memory transfers.
- Reading back from the GPU is a serious bottleneck and this generally gives a nice performance boost. Default=true
- bool PlanarOut = true
- int Engines = 1
- Engines count.
- int Engines = 1
- bool Resource = false
- Resource (don't search for file)
- bool Resource = false
Examples
Changelog
Version Date Changes
v1.6.5 2018/05/13 - Fixed crash on NVidia cards when PlanarOut=true
External Links
- GitHub - Source code repository.
Back to External Filters ←