Quellcode durchsuchen

Dst pixel coordinate fix

disintegration vor 9 Jahren
Ursprung
Commit
0feec06645
1 geänderte Dateien mit 3 neuen und 3 gelöschten Zeilen
  1. 3
    3
      filters.go

+ 3
- 3
filters.go Datei anzeigen

@@ -87,7 +87,7 @@ func createWeights8(dy, filterLength int, blur, scale float64, kernel func(float
87 87
 	coeffs := make([]int16, dy*filterLength)
88 88
 	start := make([]int, dy)
89 89
 	for y := 0; y < dy; y++ {
90
-		interpX := scale * (float64(y) + 0.5)
90
+		interpX := scale*(float64(y)+0.5) - 0.5
91 91
 		start[y] = int(interpX) - filterLength/2 + 1
92 92
 		interpX -= float64(start[y])
93 93
 		for i := 0; i < filterLength; i++ {
@@ -107,7 +107,7 @@ func createWeights16(dy, filterLength int, blur, scale float64, kernel func(floa
107 107
 	coeffs := make([]int32, dy*filterLength)
108 108
 	start := make([]int, dy)
109 109
 	for y := 0; y < dy; y++ {
110
-		interpX := scale * (float64(y) + 0.5)
110
+		interpX := scale*(float64(y)+0.5) - 0.5
111 111
 		start[y] = int(interpX) - filterLength/2 + 1
112 112
 		interpX -= float64(start[y])
113 113
 		for i := 0; i < filterLength; i++ {
@@ -126,7 +126,7 @@ func createWeightsNearest(dy, filterLength int, blur, scale float64) ([]bool, []
126 126
 	coeffs := make([]bool, dy*filterLength)
127 127
 	start := make([]int, dy)
128 128
 	for y := 0; y < dy; y++ {
129
-		interpX := scale * (float64(y) + 0.5)
129
+		interpX := scale*(float64(y)+0.5) - 0.5
130 130
 		start[y] = int(interpX) - filterLength/2 + 1
131 131
 		interpX -= float64(start[y])
132 132
 		for i := 0; i < filterLength; i++ {