diff --git a/src/codecs/avif/yuv.rs b/src/codecs/avif/yuv.rs index e0c70174e6..29167342a4 100644 --- a/src/codecs/avif/yuv.rs +++ b/src/codecs/avif/yuv.rs @@ -528,7 +528,7 @@ fn process_halved_chroma_row< // preventing accidental use of invalid values from the trailing region. let y_plane = &image.y_plane[0..image.width]; - let chroma_size = (image.width + 1) / 2; + let chroma_size = image.width.div_ceil(2); let u_plane = &image.u_plane[0..chroma_size]; let v_plane = &image.v_plane[0..chroma_size]; let rgba = &mut rgba[0..image.width * CHANNELS];