|
@@ -105,14 +105,14 @@ func Resize(width, height uint, img image.Image, interp InterpolationFunction) i
|
105
|
105
|
switch input := img.(type) {
|
106
|
106
|
case *image.RGBA:
|
107
|
107
|
// 8-bit precision
|
108
|
|
- temp := image.NewNRGBA(image.Rect(0, 0, input.Bounds().Dy(), int(width)))
|
109
|
|
- result := image.NewNRGBA(image.Rect(0, 0, int(width), int(height)))
|
|
108
|
+ temp := image.NewRGBA(image.Rect(0, 0, input.Bounds().Dy(), int(width)))
|
|
109
|
+ result := image.NewRGBA(image.Rect(0, 0, int(width), int(height)))
|
110
|
110
|
|
111
|
111
|
// horizontal filter, results in transposed temporary image
|
112
|
112
|
coeffs, offset, filterLength := createWeights8(temp.Bounds().Dy(), taps, blur, scaleX, kernel)
|
113
|
113
|
wg.Add(cpus)
|
114
|
114
|
for i := 0; i < cpus; i++ {
|
115
|
|
- slice := makeSlice(temp, i, cpus).(*image.NRGBA)
|
|
115
|
+ slice := makeSlice(temp, i, cpus).(*image.RGBA)
|
116
|
116
|
go func() {
|
117
|
117
|
defer wg.Done()
|
118
|
118
|
resizeRGBA(input, slice, scaleX, coeffs, offset, filterLength)
|
|
@@ -124,24 +124,24 @@ func Resize(width, height uint, img image.Image, interp InterpolationFunction) i
|
124
|
124
|
coeffs, offset, filterLength = createWeights8(result.Bounds().Dy(), taps, blur, scaleY, kernel)
|
125
|
125
|
wg.Add(cpus)
|
126
|
126
|
for i := 0; i < cpus; i++ {
|
127
|
|
- slice := makeSlice(result, i, cpus).(*image.NRGBA)
|
|
127
|
+ slice := makeSlice(result, i, cpus).(*image.RGBA)
|
128
|
128
|
go func() {
|
129
|
129
|
defer wg.Done()
|
130
|
|
- resizeNRGBA(temp, slice, scaleY, coeffs, offset, filterLength)
|
|
130
|
+ resizeRGBA(temp, slice, scaleY, coeffs, offset, filterLength)
|
131
|
131
|
}()
|
132
|
132
|
}
|
133
|
133
|
wg.Wait()
|
134
|
134
|
return result
|
135
|
135
|
case *image.NRGBA:
|
136
|
136
|
// 8-bit precision
|
137
|
|
- temp := image.NewNRGBA(image.Rect(0, 0, input.Bounds().Dy(), int(width)))
|
138
|
|
- result := image.NewNRGBA(image.Rect(0, 0, int(width), int(height)))
|
|
137
|
+ temp := image.NewRGBA(image.Rect(0, 0, input.Bounds().Dy(), int(width)))
|
|
138
|
+ result := image.NewRGBA(image.Rect(0, 0, int(width), int(height)))
|
139
|
139
|
|
140
|
140
|
// horizontal filter, results in transposed temporary image
|
141
|
141
|
coeffs, offset, filterLength := createWeights8(temp.Bounds().Dy(), taps, blur, scaleX, kernel)
|
142
|
142
|
wg.Add(cpus)
|
143
|
143
|
for i := 0; i < cpus; i++ {
|
144
|
|
- slice := makeSlice(temp, i, cpus).(*image.NRGBA)
|
|
144
|
+ slice := makeSlice(temp, i, cpus).(*image.RGBA)
|
145
|
145
|
go func() {
|
146
|
146
|
defer wg.Done()
|
147
|
147
|
resizeNRGBA(input, slice, scaleX, coeffs, offset, filterLength)
|
|
@@ -153,10 +153,10 @@ func Resize(width, height uint, img image.Image, interp InterpolationFunction) i
|
153
|
153
|
coeffs, offset, filterLength = createWeights8(result.Bounds().Dy(), taps, blur, scaleY, kernel)
|
154
|
154
|
wg.Add(cpus)
|
155
|
155
|
for i := 0; i < cpus; i++ {
|
156
|
|
- slice := makeSlice(result, i, cpus).(*image.NRGBA)
|
|
156
|
+ slice := makeSlice(result, i, cpus).(*image.RGBA)
|
157
|
157
|
go func() {
|
158
|
158
|
defer wg.Done()
|
159
|
|
- resizeNRGBA(temp, slice, scaleY, coeffs, offset, filterLength)
|
|
159
|
+ resizeRGBA(temp, slice, scaleY, coeffs, offset, filterLength)
|
160
|
160
|
}()
|
161
|
161
|
}
|
162
|
162
|
wg.Wait()
|
|
@@ -194,14 +194,14 @@ func Resize(width, height uint, img image.Image, interp InterpolationFunction) i
|
194
|
194
|
return result.YCbCr()
|
195
|
195
|
case *image.RGBA64:
|
196
|
196
|
// 16-bit precision
|
197
|
|
- temp := image.NewNRGBA64(image.Rect(0, 0, input.Bounds().Dy(), int(width)))
|
198
|
|
- result := image.NewNRGBA64(image.Rect(0, 0, int(width), int(height)))
|
|
197
|
+ temp := image.NewRGBA64(image.Rect(0, 0, input.Bounds().Dy(), int(width)))
|
|
198
|
+ result := image.NewRGBA64(image.Rect(0, 0, int(width), int(height)))
|
199
|
199
|
|
200
|
200
|
// horizontal filter, results in transposed temporary image
|
201
|
201
|
coeffs, offset, filterLength := createWeights16(temp.Bounds().Dy(), taps, blur, scaleX, kernel)
|
202
|
202
|
wg.Add(cpus)
|
203
|
203
|
for i := 0; i < cpus; i++ {
|
204
|
|
- slice := makeSlice(temp, i, cpus).(*image.NRGBA64)
|
|
204
|
+ slice := makeSlice(temp, i, cpus).(*image.RGBA64)
|
205
|
205
|
go func() {
|
206
|
206
|
defer wg.Done()
|
207
|
207
|
resizeRGBA64(input, slice, scaleX, coeffs, offset, filterLength)
|
|
@@ -213,24 +213,24 @@ func Resize(width, height uint, img image.Image, interp InterpolationFunction) i
|
213
|
213
|
coeffs, offset, filterLength = createWeights16(result.Bounds().Dy(), taps, blur, scaleY, kernel)
|
214
|
214
|
wg.Add(cpus)
|
215
|
215
|
for i := 0; i < cpus; i++ {
|
216
|
|
- slice := makeSlice(result, i, cpus).(*image.NRGBA64)
|
|
216
|
+ slice := makeSlice(result, i, cpus).(*image.RGBA64)
|
217
|
217
|
go func() {
|
218
|
218
|
defer wg.Done()
|
219
|
|
- resizeNRGBA64(temp, slice, scaleY, coeffs, offset, filterLength)
|
|
219
|
+ resizeRGBA64(temp, slice, scaleY, coeffs, offset, filterLength)
|
220
|
220
|
}()
|
221
|
221
|
}
|
222
|
222
|
wg.Wait()
|
223
|
223
|
return result
|
224
|
224
|
case *image.NRGBA64:
|
225
|
225
|
// 16-bit precision
|
226
|
|
- temp := image.NewNRGBA64(image.Rect(0, 0, input.Bounds().Dy(), int(width)))
|
227
|
|
- result := image.NewNRGBA64(image.Rect(0, 0, int(width), int(height)))
|
|
226
|
+ temp := image.NewRGBA64(image.Rect(0, 0, input.Bounds().Dy(), int(width)))
|
|
227
|
+ result := image.NewRGBA64(image.Rect(0, 0, int(width), int(height)))
|
228
|
228
|
|
229
|
229
|
// horizontal filter, results in transposed temporary image
|
230
|
230
|
coeffs, offset, filterLength := createWeights16(temp.Bounds().Dy(), taps, blur, scaleX, kernel)
|
231
|
231
|
wg.Add(cpus)
|
232
|
232
|
for i := 0; i < cpus; i++ {
|
233
|
|
- slice := makeSlice(temp, i, cpus).(*image.NRGBA64)
|
|
233
|
+ slice := makeSlice(temp, i, cpus).(*image.RGBA64)
|
234
|
234
|
go func() {
|
235
|
235
|
defer wg.Done()
|
236
|
236
|
resizeNRGBA64(input, slice, scaleX, coeffs, offset, filterLength)
|
|
@@ -242,10 +242,10 @@ func Resize(width, height uint, img image.Image, interp InterpolationFunction) i
|
242
|
242
|
coeffs, offset, filterLength = createWeights16(result.Bounds().Dy(), taps, blur, scaleY, kernel)
|
243
|
243
|
wg.Add(cpus)
|
244
|
244
|
for i := 0; i < cpus; i++ {
|
245
|
|
- slice := makeSlice(result, i, cpus).(*image.NRGBA64)
|
|
245
|
+ slice := makeSlice(result, i, cpus).(*image.RGBA64)
|
246
|
246
|
go func() {
|
247
|
247
|
defer wg.Done()
|
248
|
|
- resizeNRGBA64(temp, slice, scaleY, coeffs, offset, filterLength)
|
|
248
|
+ resizeRGBA64(temp, slice, scaleY, coeffs, offset, filterLength)
|
249
|
249
|
}()
|
250
|
250
|
}
|
251
|
251
|
wg.Wait()
|
|
@@ -310,14 +310,14 @@ func Resize(width, height uint, img image.Image, interp InterpolationFunction) i
|
310
|
310
|
return result
|
311
|
311
|
default:
|
312
|
312
|
// 16-bit precision
|
313
|
|
- temp := image.NewNRGBA64(image.Rect(0, 0, img.Bounds().Dy(), int(width)))
|
314
|
|
- result := image.NewNRGBA64(image.Rect(0, 0, int(width), int(height)))
|
|
313
|
+ temp := image.NewRGBA64(image.Rect(0, 0, img.Bounds().Dy(), int(width)))
|
|
314
|
+ result := image.NewRGBA64(image.Rect(0, 0, int(width), int(height)))
|
315
|
315
|
|
316
|
316
|
// horizontal filter, results in transposed temporary image
|
317
|
317
|
coeffs, offset, filterLength := createWeights16(temp.Bounds().Dy(), taps, blur, scaleX, kernel)
|
318
|
318
|
wg.Add(cpus)
|
319
|
319
|
for i := 0; i < cpus; i++ {
|
320
|
|
- slice := makeSlice(temp, i, cpus).(*image.NRGBA64)
|
|
320
|
+ slice := makeSlice(temp, i, cpus).(*image.RGBA64)
|
321
|
321
|
go func() {
|
322
|
322
|
defer wg.Done()
|
323
|
323
|
resizeGeneric(img, slice, scaleX, coeffs, offset, filterLength)
|
|
@@ -329,10 +329,10 @@ func Resize(width, height uint, img image.Image, interp InterpolationFunction) i
|
329
|
329
|
coeffs, offset, filterLength = createWeights16(result.Bounds().Dy(), taps, blur, scaleY, kernel)
|
330
|
330
|
wg.Add(cpus)
|
331
|
331
|
for i := 0; i < cpus; i++ {
|
332
|
|
- slice := makeSlice(result, i, cpus).(*image.NRGBA64)
|
|
332
|
+ slice := makeSlice(result, i, cpus).(*image.RGBA64)
|
333
|
333
|
go func() {
|
334
|
334
|
defer wg.Done()
|
335
|
|
- resizeNRGBA64(temp, slice, scaleY, coeffs, offset, filterLength)
|
|
335
|
+ resizeRGBA64(temp, slice, scaleY, coeffs, offset, filterLength)
|
336
|
336
|
}()
|
337
|
337
|
}
|
338
|
338
|
wg.Wait()
|