avoid division by 0
This commit is contained in:
parent
618524d8cb
commit
e8ffee3892
|
@ -393,11 +393,13 @@ func resizeYCbCr(in *ycc, out *ycc, scale float64, coeffs []int16, offset []int,
|
||||||
}
|
}
|
||||||
|
|
||||||
xo := (y-newBounds.Min.Y)*out.Stride + (x-newBounds.Min.X)*3
|
xo := (y-newBounds.Min.Y)*out.Stride + (x-newBounds.Min.X)*3
|
||||||
|
if sum != 0 {
|
||||||
out.Pix[xo+0] = clampUint8(p[0] / sum)
|
out.Pix[xo+0] = clampUint8(p[0] / sum)
|
||||||
out.Pix[xo+1] = clampUint8(p[1] / sum)
|
out.Pix[xo+1] = clampUint8(p[1] / sum)
|
||||||
out.Pix[xo+2] = clampUint8(p[2] / sum)
|
out.Pix[xo+2] = clampUint8(p[2] / sum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func nearestYCbCr(in *ycc, out *ycc, scale float64, coeffs []bool, offset []int, filterLength int) {
|
func nearestYCbCr(in *ycc, out *ycc, scale float64, coeffs []bool, offset []int, filterLength int) {
|
||||||
|
|
Loading…
Reference in New Issue