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
40aac25
commit 1437368
Showing
15 changed files
with
216 additions
and
210 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
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
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 |
---|---|---|
@@ -1,48 +1,50 @@ | ||
function SuperXBR(clip input, float "edgeStrength", float "sharpness", bool "thirdPass", bool "convert") | ||
function SuperXBR(clip Input, float "EdgeStrength", float "Sharpness", bool "ThirdPass", int "PrecisionIn") | ||
{ | ||
edgeStrength = default(edgeStrength, 1) | ||
sharpness = default(sharpness, 1) | ||
thirdPass = default(thirdPass, true) | ||
convert = default(convert, true) | ||
|
||
Assert(edgeStrength >= 0 && edgeStrength <= 5, "EdgeStrength must be between 0 and 5") | ||
Assert(sharpness >= 0 && sharpness <= 1.5, "Sharpness must be between 0 and 1.5") | ||
Assert(convert || thirdPass, "ThirdPass is required when Convert=false") | ||
EdgeStrength = default(EdgeStrength, 1) | ||
Sharpness = default(Sharpness, 1) | ||
ThirdPass = default(ThirdPass, true) | ||
PrecisionIn = default(PrecisionIn, 0) | ||
convert = PrecisionIn==0 | ||
|
||
Assert(EdgeStrength >= 0 && EdgeStrength <= 5, "EdgeStrength must be between 0 and 5") | ||
Assert(Sharpness >= 0 && Sharpness <= 1.5, "Sharpness must be between 0 and 1.5") | ||
Assert(convert || ThirdPass, "ThirdPass is required when PrecisionIn > 0") | ||
Assert(PrecisionIn >= 0 && PrecisionIn <= 3, "PrecisionIn must be between 0 and 3") | ||
|
||
input | ||
Input | ||
|
||
convertYuv = convert && !IsRGB() | ||
#convertYuv = convert && !IsRGB() | ||
sourceFormat = IsYV12() ? "YV12" : IsYV24() ? "YV24" : IsRGB24() ? "RGB24" : "RGB32" | ||
|
||
input = convert ? ConvertToFloat(precision=1) : last | ||
Input = convert ? ConvertToShader(Precision=2) : last | ||
|
||
input | ||
inputWidth = convert ? width : width / 2 | ||
inputHeight = height | ||
args_string = string(edgeStrength,"%.32f") + "," + string(sharpness,"%.32f") + "0,0f" | ||
size0_string = string(inputWidth) + "," + string(inputHeight)+"," + string(1./InputWidth,"%.32f") + "," + string(1./height,"%.32f")+"f" | ||
size1_string = string(2*inputWidth) + "," + string(2*inputHeight) + "," + string(1./(2*inputWidth),"%.32f") + "," + string(1./(2*inputHeight),"%.32f")+"f" | ||
Input | ||
InputWidth = Width / (PrecisionIn==0 || PrecisionIn==1 ? 2 : 2) | ||
InputHeight = Height | ||
args_string = string(EdgeStrength,"%.32f") + "," + string(Sharpness,"%.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" | ||
|
||
# It works just as well in YUV colorspace | ||
#convertYuv ? Shader("YuvToGamma.cso") : nop | ||
|
||
Shader("super-xbr-pass0.cso",\ | ||
param2=args_string,\ | ||
param3=size0_string,\ | ||
width=2*inputWidth,height=2*inputHeight) | ||
Param2 = args_string,\ | ||
Param3 = size0_string,\ | ||
Width = 2*InputWidth, Height = 2*InputHeight) | ||
|
||
Shader("super-xbr-pass1.cso",\ | ||
param2=args_string,\ | ||
param3=size1_string) | ||
Param2=args_string,\ | ||
Param3=size1_string) | ||
|
||
thirdPass ? Shader("super-xbr-pass2.cso",\ | ||
param2=args_string,\ | ||
param3=size1_string) : nop | ||
ThirdPass ? Shader("super-xbr-pass2.cso",\ | ||
Param2=args_string,\ | ||
Param3=size1_string) : nop | ||
|
||
#convertYuv ? Shader("GammaToYuv.cso") : nop | ||
last.ExecuteShader(input, precision=2, precisionIn=convert?1:2, precisionOut=convert?1:2) | ||
last.ExecuteShader(Input, Precision=2, PrecisionIn=convert?1:PrecisionIn, PrecisionOut=convert?1:PrecisionIn) | ||
|
||
convert ? ConvertFromFloat(format=sourceFormat, precision=1) : last | ||
convert ? ConvertFromShader(Format=sourceFormat, Precision=1) : last | ||
|
||
!thirdPass ? spline36resize(width, height, -.5, -.5, width, height) : last | ||
!ThirdPass ? spline36resize(2*InputWidth, 2*InputHeight, -.5, -.5, 2*InputWidth, 2*InputHeight) : last | ||
} |
Oops, something went wrong.