XU XUv0.16.0

#bytes/aligned

import: #bytes/aligned

counts: 4 functions, 16 methods, 5 types, 0 constants, 0 method sets

Aligned zero-copy owned byte buffer and disjoint multi-plane descriptors (for SIMD 64-byte alignment, page-aligned DMA/IOSurface/DirectIO buffers, and YUV420/NV12 multi-plane frame layouts).

struct AlignedBuf

XuAPI
pub struct AlignedBuf {

}

Purpose

AlignedBuf context or state structure.

Public fields

This type has no public fields.

struct PlaneLayout

XuAPI
pub struct PlaneLayout {
    pub offset int
    pub len int
    pub stride int
    pub width int
    pub height int
}

Purpose

Disjoint sub-region descriptor inside an AlignedBuf (byte offset/length + stride).

Public fields

offset int
offset
len int
field (int)
stride int
field (int)
width int
field (int)
height int
field (int)

struct Split2

XuAPI
pub struct Split2 {
    pub left PlaneLayout
    pub right PlaneLayout
}

Purpose

Structure encapsulating left, right.

Public fields

left PlaneLayout
field (PlaneLayout)
right PlaneLayout
field (PlaneLayout)

struct Yuv420Layout

XuAPI
pub struct Yuv420Layout {
    pub y PlaneLayout
    pub u PlaneLayout
    pub v PlaneLayout
    pub total_bytes int
}

Purpose

Structure encapsulating y, u, v, total_bytes.

Public fields

y PlaneLayout
value
u PlaneLayout
field (PlaneLayout)
v PlaneLayout
value
total_bytes int
field (int)

struct Nv12Layout

XuAPI
pub struct Nv12Layout {
    pub y PlaneLayout
    pub uv PlaneLayout
    pub total_bytes int
}

Purpose

Structure encapsulating y, uv, total_bytes.

Public fields

y PlaneLayout
value
uv PlaneLayout
field (PlaneLayout)
total_bytes int
field (int)

align_up

XuAPI
pub fn align_up(n int, align int) int

Purpose

Align up.

Parameters

n int
count, length, or limit (int)
align int
align (int)

Returns

int — a value of this type

alloc

XuAPI
pub fn alloc(size int, align int) AlignedBuf

Purpose

Allocate size zeroed bytes aligned to align (power of two >= 8). Throws on failure; handle the error or propagate it to the caller.

Parameters

size int
size (int)
align int
align (int)

Returns

AlignedBuf — a value of this type

yuv420_layout

XuAPI
pub fn yuv420_layout(width int, height int, row_align int) Yuv420Layout

Purpose

Compute disjoint 3-plane YUV420 layout with aligned row strides and plane bases. Throws on failure; handle the error or propagate it to the caller.

Parameters

width int
width (int)
height int
height (int)
row_align int
row_align (int)

Returns

Yuv420Layout — a value of this type

nv12_layout

XuAPI
pub fn nv12_layout(width int, height int, row_align int) Nv12Layout

Purpose

Compute disjoint 2-plane NV12 layout (Y plane + interleaved UV plane). Throws on failure; handle the error or propagate it to the caller.

Parameters

width int
width (int)
height int
height (int)
row_align int
row_align (int)

Returns

Nv12Layout — a value of this type

(&AlignedBuf) len

XuAPI
pub fn (b &AlignedBuf) len() int

Purpose

Operation on &AlignedBuf: return the length.

Parameters

b &AlignedBuf
The AlignedBuf instance used by this call (borrow).

Returns

int — a value of this type

(&AlignedBuf) alignment

XuAPI
pub fn (b &AlignedBuf) alignment() int

Purpose

Execute alignment on &AlignedBuf.

Parameters

b &AlignedBuf
The AlignedBuf instance used by this call (borrow).

Returns

int — a value of this type

(&AlignedBuf) is_aligned

XuAPI
pub fn (b &AlignedBuf) is_aligned(align int) bool

Purpose

Operation on &AlignedBuf: whether it is aligned.

Parameters

b &AlignedBuf
The AlignedBuf instance used by this call (borrow).
align int
align (int)

Returns

bool — true or false

(&AlignedBuf) split_at

XuAPI
pub fn (b &AlignedBuf) split_at(mid int) Split2

Purpose

Operation on &AlignedBuf: split at. Throws on failure; handle the error or propagate it to the caller.

Parameters

b &AlignedBuf
The AlignedBuf instance used by this call (borrow).
mid int
mid (int)

Returns

Split2 — a value of this type

($&AlignedBuf) zero

XuAPI
pub fn (b $&AlignedBuf) zero() int

Purpose

Operation on $&AlignedBuf: zero. Throws on failure; handle the error or propagate it to the caller.

Parameters

b $&AlignedBuf
The AlignedBuf instance used by this call (exclusive borrow).

Returns

int — a value of this type

(&AlignedBuf) byte_at

XuAPI
pub fn (b &AlignedBuf) byte_at(off int) u8

Purpose

Operation on &AlignedBuf: byte at. Throws on failure; handle the error or propagate it to the caller.

Parameters

b &AlignedBuf
The AlignedBuf instance used by this call (borrow).
off int
offset (int)

Returns

u8 — a value of this type

($&AlignedBuf) set_byte

XuAPI
pub fn (b $&AlignedBuf) set_byte(off int, v u8) int

Purpose

Operation on $&AlignedBuf: set byte. Throws on failure; handle the error or propagate it to the caller.

Parameters

b $&AlignedBuf
The AlignedBuf instance used by this call (exclusive borrow).
off int
offset (int)
v u8
value (u8)

Returns

int — a value of this type

($&AlignedBuf) copy_from_bytes

XuAPI
pub fn (b $&AlignedBuf) copy_from_bytes(off int, src &[]u8, src_off int, n int) int

Purpose

Operation on $&AlignedBuf: copy from bytes. Throws on failure; handle the error or propagate it to the caller.

Parameters

b $&AlignedBuf
The AlignedBuf instance used by this call (exclusive borrow).
off int
offset (int)
src &[]u8
source (read-only borrow; caller keeps the original; type &[]u8)
src_off int
src_off (int)
n int
count, length, or limit (int)

Returns

int — a value of this type

(&AlignedBuf) copy_to_bytes

XuAPI
pub fn (b &AlignedBuf) copy_to_bytes(off int, dst $&[]u8, dst_off int, n int) int

Purpose

Operation on &AlignedBuf: copy to bytes. Throws on failure; handle the error or propagate it to the caller.

Parameters

b &AlignedBuf
The AlignedBuf instance used by this call (borrow).
off int
offset (int)
dst $&[]u8
destination (exclusive borrow; may modify the original; type $&[]u8)
dst_off int
dst_off (int)
n int
count, length, or limit (int)

Returns

int — a value of this type

($&AlignedBuf) copy_from_string

XuAPI
pub fn (b $&AlignedBuf) copy_from_string(off int, src &string) int

Purpose

Operation on $&AlignedBuf: copy from string. Throws on failure; handle the error or propagate it to the caller.

Parameters

b $&AlignedBuf
The AlignedBuf instance used by this call (exclusive borrow).
off int
offset (int)
src &string
source (read-only borrow; caller keeps the original; type &string)

Returns

int — a value of this type

(&AlignedBuf) write_to_file

XuAPI
pub fn (b &AlignedBuf) write_to_file(dst &os.File, off int, n int) int

Purpose

Operation on &AlignedBuf: write to file. Throws on failure; handle the error or propagate it to the caller.

Parameters

b &AlignedBuf
The AlignedBuf instance used by this call (borrow).
dst &os.File
destination (read-only borrow; caller keeps the original; type &os.File)
off int
offset (int)
n int
count, length, or limit (int)

Returns

int — a value of this type

(&AlignedBuf) as_span

XuAPI
pub fn (b &AlignedBuf) as_span() span.ByteSpan

Purpose

Operation on &AlignedBuf: as span. Throws on failure; handle the error or propagate it to the caller.

Parameters

b &AlignedBuf
The AlignedBuf instance used by this call (borrow).

Returns

span.ByteSpan — a value of this type

($&AlignedBuf) as_span_mut

XuAPI
pub fn (b $&AlignedBuf) as_span_mut() span.MutByteSpan

Purpose

Operation on $&AlignedBuf: as span mut. Throws on failure; handle the error or propagate it to the caller.

Parameters

b $&AlignedBuf
The AlignedBuf instance used by this call (exclusive borrow).

Returns

span.MutByteSpan — a value of this type

(&AlignedBuf) plane_view

XuAPI
pub fn (b &AlignedBuf) plane_view(pl &PlaneLayout, bpp int) span.PlaneView

Purpose

Operation on &AlignedBuf: plane view. Throws on failure; handle the error or propagate it to the caller.

Parameters

b &AlignedBuf
The AlignedBuf instance used by this call (borrow).
pl &PlaneLayout
pl (read-only borrow; caller keeps the original; type &PlaneLayout)
bpp int
bpp (int)

Returns

span.PlaneView — a value of this type

($&AlignedBuf) plane_view_mut

XuAPI
pub fn (b $&AlignedBuf) plane_view_mut(pl &PlaneLayout, bpp int) span.MutPlaneView

Purpose

Operation on $&AlignedBuf: plane view mut. Throws on failure; handle the error or propagate it to the caller.

Parameters

b $&AlignedBuf
The AlignedBuf instance used by this call (exclusive borrow).
pl &PlaneLayout
pl (read-only borrow; caller keeps the original; type &PlaneLayout)
bpp int
bpp (int)

Returns

span.MutPlaneView — a value of this type

($&AlignedBuf) close

XuAPI
pub fn (b $&AlignedBuf) close() int

Purpose

Operation on $&AlignedBuf: close the resource.

Parameters

b $&AlignedBuf
The AlignedBuf instance used by this call (exclusive borrow).

Returns

int — a value of this type