pub fn packed_rgba16f_layout(
format: PixelFormat,
dtype: DType,
width: usize,
height: usize,
) -> Option<PackedRgba16fLayout>Expand description
Canonical geometry for the RGBA16F-packed surface backing a planar F16 image tensor.
Returns Some(layout) only when all of the following hold:
dtype == DType::F16formatisPixelFormat::PlanarRgb(3 planes) orPixelFormat::PlanarRgba(4 planes)width % 4 == 0
Returns None for any other (format, dtype) combination, misaligned
width, or when the surface geometry would overflow usize — callers
must fall back to a non-packed path or return a context-appropriate
error.
§Examples
use edgefirst_tensor::{packed_rgba16f_layout, PixelFormat, DType};
let layout = packed_rgba16f_layout(PixelFormat::PlanarRgb, DType::F16, 640, 480).unwrap();
assert_eq!(layout.surface_w, 160);
assert_eq!(layout.surface_h, 1440);
assert_eq!(layout.bytes_per_texel, 8);
assert_eq!(layout.pitch, 1280);