sobel: Simplify buffer usage by clamping