mirror of https://github.com/status-im/resize.git
Remove some redundancies.
This commit is contained in:
parent
446eea2f7b
commit
a83cb40860
|
@ -65,7 +65,7 @@ func (f *filterModel) SetKernelWeights(u float32) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *filterModel) convolution1d(x float32) (c colorArray) {
|
func (f *filterModel) convolution1d() (c colorArray) {
|
||||||
for j := range f.tempRow {
|
for j := range f.tempRow {
|
||||||
for i := range c {
|
for i := range c {
|
||||||
c[i] += f.tempRow[j][i] * f.kernelWeight[j]
|
c[i] += f.tempRow[j][i] * f.kernelWeight[j]
|
||||||
|
@ -88,7 +88,7 @@ func (f *filterModel) Interpolate(u float32, y int) color.RGBA64 {
|
||||||
f.at(uf+i, y, &f.tempRow[i])
|
f.at(uf+i, y, &f.tempRow[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
c := f.convolution1d(u)
|
c := f.convolution1d()
|
||||||
return color.RGBA64{
|
return color.RGBA64{
|
||||||
clampToUint16(c[0]),
|
clampToUint16(c[0]),
|
||||||
clampToUint16(c[1]),
|
clampToUint16(c[1]),
|
||||||
|
@ -227,8 +227,6 @@ func lanczosKernel(a uint) func(float32) float32 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const lanczosTableSize = 300
|
|
||||||
|
|
||||||
// Lanczos interpolation (a=2)
|
// Lanczos interpolation (a=2)
|
||||||
func Lanczos2(img image.Image, factor float32) Filter {
|
func Lanczos2(img image.Image, factor float32) Filter {
|
||||||
return createFilter(img, factor, 4, lanczosKernel(2))
|
return createFilter(img, factor, 4, lanczosKernel(2))
|
||||||
|
|
Loading…
Reference in New Issue