AviSynthShader
From Avisynth wiki
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
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-8", clip "Clip1-9", int "Output", int "Width", int "Height", int "Precision", string "Defines")
- clip =
- 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 = ""
Examples
TODO
<>
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 ←