Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d0254b
commit 771f8ed
Showing
29 changed files
with
191 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
function SuperResXBR(clip Input, int "Passes", float "Strength", float "Softness", float "xbrEdgeStrength", float "xbrSharpness", string "MatrixIn", string "MatrixOut", string "FormatOut", bool "Convert", bool "ConvertYuv", bool "lsb_in", bool "lsb_out") | ||
{ | ||
Passes = default(Passes, 1) | ||
Strength = default(Strength, 1) | ||
Softness = default(Softness, 0) | ||
xbrEdgeStrength = default(xbrEdgeStrength, 1) | ||
xbrSharpness = default(xbrSharpness, 1) | ||
MatrixIn = default(MatrixIn, "709") | ||
MatrixOut = default(MatrixOut, "709") | ||
FormatOut = default(FormatOut, "") | ||
Convert = default(Convert, true) | ||
ConvertYuv = default(ConvertYuv, Convert ? !Input.IsRGB() : true) | ||
lsb_in = default(lsb_in, false) | ||
lsb_out = default(lsb_out, false) | ||
|
||
Assert((Passes > 0 && Passes <= 3) ? true : false, "Passes must be between 1 and 3") | ||
Assert((Strength >= 0 && Strength <= 1) ? true : false, "Strength must be between 0 and 1") | ||
Assert((Softness >= 0 && Softness <= 1) ? true : false, "Softness must be between 0 and 1") | ||
Assert(xbrEdgeStrength >= 0 && xbrEdgeStrength <= 5, "xbrEdgeStrength must be between 0 and 5") | ||
Assert(xbrSharpness >= 0 && xbrSharpness <= 1.5, "xbrSharpness must be between 0 and 1.5") | ||
Assert(MatrixIn == "601" || MatrixIn == "709", "MatrixIn must be 601 or 709") | ||
Assert(MatrixOut == "601" || MatrixOut == "709", "MatrixOut must be 601 or 709") | ||
Assert((!lsb_in && !lsb_out) || Convert, "Convert must be True to use lsb_in or lsb_out") | ||
|
||
Input | ||
|
||
PrecisionIn = Convert && !lsb_in ? 1 : 2 | ||
PrecisionOut = Convert && !lsb_out ? 1 : 2 | ||
sourceFormat = FormatOut != "" ? FormatOut : IsYV12 ? "YV12" : IsYV24 ? "YV24" : IsRGB24 ? "RGB24" : IsRGB32 ? "RGB32" : "" | ||
Assert(sourceFormat != "", chr(10) + "Source must be YV12, YV24, RGB24 or RGB32" + chr(10)) | ||
|
||
InputWidth = Width / PrecisionIn | ||
InputHeight = Height | ||
args_string = string(xbrEdgeStrength,"%.32f") + "," + string(xbrSharpness,"%.32f") + ",0,0f" | ||
size0_string = string(InputWidth) + "," + string(InputHeight) + "," + string(1./InputWidth,"%.32f") + "," + string(1./InputHeight,"%.32f") + "f" | ||
size1_string = string(2*InputWidth) + "," + string(2*InputHeight) + "," + string(1./(2*InputWidth),"%.32f") + "," + string(1./(2*InputHeight),"%.32f") + "f" | ||
|
||
Input = convert ? ConvertToShader(PrecisionIn, lsb=lsb_in) : last | ||
Shader(Output=2) | ||
|
||
# Super-xBR | ||
Shader("super-xbr-pass0.cso",\ | ||
Param2 = args_string,\ | ||
Param3 = size0_string,\ | ||
Width = 2*InputWidth, Height = 2*InputHeight) | ||
Shader("super-xbr-pass1.cso",\ | ||
Param2=args_string,\ | ||
Param3=size1_string) | ||
Shader("super-xbr-pass2.cso",\ | ||
Param2=args_string,\ | ||
Param3=size1_string) | ||
|
||
Shader(ConvertYuv && MatrixIn=="601" ? "Yuv601ToLinear.cso" : ConvertYuv ? "YuvToLinear.cso" : "GammaToLinear.cso") | ||
|
||
# SuperRes | ||
SuperResPass(last, Input, Strength, Softness, 1, Passes, ConvertYuv, Convert, PrecisionIn, MatrixIn, MatrixOut) | ||
Passes > 1 ? SuperResPass(Input, Strength, Softness, 2, Passes, ConvertYuv, Convert, PrecisionIn, MatrixIn, MatrixOut) : nop | ||
Passes > 2 ? SuperResPass(Input, Strength, Softness, 3, Passes, ConvertYuv, Convert, PrecisionIn, MatrixIn, MatrixOut) : nop | ||
|
||
ExecuteShader(last, Input, Precision=3, Clip1Precision=PrecisionIn, OutputPrecision=PrecisionOut) | ||
convert ? ConvertFromShader(PrecisionOut, format=sourceFormat, lsb=lsb_out) : last | ||
} | ||
|
||
function SuperResPass(clip cmd, clip Input, float Strength, float Softness, int Pass, int Passes, bool ConvertYuv, bool Convert, int PrecisionIn, string MatrixIn, string MatrixOut) | ||
{ | ||
InputWidth = Input.Width / PrecisionIn | ||
|
||
cmd.Shader("Bicubic.cso", Output=3, \ | ||
Param0=string(InputWidth) + "," + string(Input.Height) + "," + string(1./InputWidth,"%.32f") + "," + string(1./Input.Height,"%.32f") + "f",\ | ||
Param1=string(InputWidth*2) + "," + string(Input.Height*2) + "," + string(1./(InputWidth*2),"%.32f") + "," + string(1./(Input.Height*2),"%.32f") + "f",\ | ||
Param2=string(1/3.,"%.32f") + "," + string(1/3.,"%.32f") + "f",\ | ||
Width=InputWidth, Height=Input.Height) | ||
|
||
Shader(ConvertYuv && MatrixIn=="601" ? "SuperResDiff601.cso" : ConvertYuv ? "SuperResDiff709.cso" : "SuperResDiff.cso", Clip1=3, Clip2=2, Output=4) | ||
|
||
Shader(Pass==Passes ? (MatrixOut=="601" ? "SuperResFinal601.cso" : ConvertYuv ? "SuperResFinal709.cso" : "SuperResFinal.cso") : "SuperRes.cso", Clip1=1, Clip2=4, Output=1, \ | ||
Param0=string(InputWidth*2) + "," + string(Input.Height*2) + "f", \ | ||
Param1=string(1./(InputWidth*2), "%.32f") + "," + string(1./(Input.Height*2), "%.32f") + "f", \ | ||
Param2=string(InputWidth) + "," + string(Input.Height) + "," + string(1./InputWidth,"%.32f") + "," + string(1./Input.Height,"%.32f") + "f", \ | ||
Param3=string(Strength,"%.32f") + "," + string(Softness,"%.32f") + "," + string(Pass) + "," + string(Passes) + "f") | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.