gofmt
This commit is contained in:
parent
62777ac833
commit
c37f8f8470
14
filters.go
14
filters.go
|
@ -170,17 +170,17 @@ func Bilinear(img image.Image, factor [2]float32) Filter {
|
||||||
}
|
}
|
||||||
|
|
||||||
func splineKernel(B, C float32) func(float32) float32 {
|
func splineKernel(B, C float32) func(float32) float32 {
|
||||||
factorA := 2.0-1.5*B-C
|
factorA := 2.0 - 1.5*B - C
|
||||||
factorB := -3.0+2.0*B+C
|
factorB := -3.0 + 2.0*B + C
|
||||||
factorC := 1.0-1.0/3.0*B
|
factorC := 1.0 - 1.0/3.0*B
|
||||||
factorD := -B/6.0-C
|
factorD := -B/6.0 - C
|
||||||
factorE := B+5.0*C
|
factorE := B + 5.0*C
|
||||||
factorF := -2.0*B-8.0*C
|
factorF := -2.0*B - 8.0*C
|
||||||
factorG := 4.0/3.0*B + 4.0*C
|
factorG := 4.0/3.0*B + 4.0*C
|
||||||
return func(x float32) (y float32) {
|
return func(x float32) (y float32) {
|
||||||
absX := float32(math.Abs(float64(x)))
|
absX := float32(math.Abs(float64(x)))
|
||||||
if absX <= 1 {
|
if absX <= 1 {
|
||||||
y = absX*absX*(factorA*absX+factorB) +factorC
|
y = absX*absX*(factorA*absX+factorB) + factorC
|
||||||
} else if absX <= 2 {
|
} else if absX <= 2 {
|
||||||
y = absX*(absX*(absX*factorD+factorE)+factorF) + factorG
|
y = absX*(absX*(absX*factorD+factorE)+factorF) + factorG
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user