Dont fail if sum is 0

This commit is contained in:
Andrea Maria Piana 2020-12-15 17:42:50 +01:00
parent 83c6a99326
commit 7c6d9f0d30
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
1 changed files with 5 additions and 3 deletions

View File

@ -393,9 +393,11 @@ func resizeYCbCr(in *ycc, out *ycc, scale float64, coeffs []int16, offset []int,
}
xo := (y-newBounds.Min.Y)*out.Stride + (x-newBounds.Min.X)*3
out.Pix[xo+0] = clampUint8(p[0] / sum)
out.Pix[xo+1] = clampUint8(p[1] / sum)
out.Pix[xo+2] = clampUint8(p[2] / sum)
if sum != 0 {
out.Pix[xo+0] = clampUint8(p[0] / sum)
out.Pix[xo+1] = clampUint8(p[1] / sum)
out.Pix[xo+2] = clampUint8(p[2] / sum)
}
}
}
}