fn image_dimensions()

in benches/benches.rs [341:357]


fn image_dimensions(i: u32, format: PixelFormat) -> (u32, u32) {
    let components = match format {
        PixelFormat::Bgr => 3,
        _ /* Bgra */ => 4,
    };

    let payload = 1 << i;
    let pixels = (payload + (components - 1)) / components;

    let width = (16f32 * ((pixels as f32) / 144_f32).sqrt()).floor() as u32;
    let width = (width + 31) & !31;

    let height = (pixels + (width - 1)) / width;
    let height = (height + 1) & !1;

    (width, height)
}