XU XUv0.16.0

#bytes/aligned

导入方式: #bytes/aligned

公开 API: 4 函数, 16 方法, 5 类型, 0 常量, 0 方法集

标准库包 `#bytes/aligned`。

struct AlignedBuf

XuAPI
pub struct AlignedBuf {

}

用途

AlignedBuf 上下文或状态结构体。

公开字段

此类型没有公开字段。

struct PlaneLayout

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

用途

承载 offset、len、stride、width、height 等属性的结构体。

公开字段

offset int
偏移
len int
字段(int)
stride int
字段(int)
width int
字段(int)
height int
字段(int)

struct Split2

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

用途

承载 left、right 等属性的结构体。

公开字段

left PlaneLayout
字段(PlaneLayout)
right PlaneLayout
字段(PlaneLayout)

struct Yuv420Layout

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

用途

承载 y、u、v、total_bytes 等属性的结构体。

公开字段

y PlaneLayout
值
u PlaneLayout
字段(PlaneLayout)
v PlaneLayout
值
total_bytes int
字段(int)

struct Nv12Layout

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

用途

承载 y、uv、total_bytes 等属性的结构体。

公开字段

y PlaneLayout
值
uv PlaneLayout
字段(PlaneLayout)
total_bytes int
字段(int)

align_up

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

用途

执行 align up 操作。

参数

n int
数量、长度或上限(int)
align int
align(int)

返回值

int — 该类型的值

alloc

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

用途

执行 alloc 处理。失败时抛出错误,调用方需处理或继续传播。

参数

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

返回值

AlignedBuf — 该类型的值

yuv420_layout

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

用途

执行 yuv420 layout 操作。失败时抛出错误,调用方需处理或继续传播。

参数

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

返回值

Yuv420Layout — 该类型的值

nv12_layout

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

用途

执行 nv12 layout 操作。失败时抛出错误,调用方需处理或继续传播。

参数

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

返回值

Nv12Layout — 该类型的值

(&AlignedBuf) len

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

用途

&AlignedBuf 上的操作:返回长度。

参数

b &AlignedBuf
本次调用使用的 AlignedBuf 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&AlignedBuf) alignment

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

用途

在 &AlignedBuf 上执行 alignment 操作。

参数

b &AlignedBuf
本次调用使用的 AlignedBuf 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&AlignedBuf) is_aligned

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

用途

&AlignedBuf 上的操作:判断是否 aligned。

参数

b &AlignedBuf
本次调用使用的 AlignedBuf 实例;以只读借用传入,调用方仍持有实例。
align int
align(int)

返回值

bool — 是否成立

(&AlignedBuf) split_at

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

用途

&AlignedBuf 上的操作:执行 split at 操作。失败时抛出错误,调用方需处理或继续传播。

参数

b &AlignedBuf
本次调用使用的 AlignedBuf 实例;以只读借用传入,调用方仍持有实例。
mid int
mid(int)

返回值

Split2 — 该类型的值

($&AlignedBuf) zero

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

用途

$&AlignedBuf 上的操作:全零。失败时抛出错误,调用方需处理或继续传播。

参数

b $&AlignedBuf
本次调用使用的 AlignedBuf 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

(&AlignedBuf) byte_at

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

用途

&AlignedBuf 上的操作:执行 byte at 操作。失败时抛出错误,调用方需处理或继续传播。

参数

b &AlignedBuf
本次调用使用的 AlignedBuf 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)

返回值

u8 — 该类型的值

($&AlignedBuf) set_byte

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

用途

$&AlignedBuf 上的操作:设置 byte。失败时抛出错误,调用方需处理或继续传播。

参数

b $&AlignedBuf
本次调用使用的 AlignedBuf 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
off int
偏移(int)
v u8
值(u8)

返回值

int — 该类型的值

($&AlignedBuf) copy_from_bytes

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

用途

$&AlignedBuf 上的操作:拷贝从字节。失败时抛出错误,调用方需处理或继续传播。

参数

b $&AlignedBuf
本次调用使用的 AlignedBuf 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
off int
偏移(int)
src &[]u8
源数据(只读借用,调用方仍持有原值;类型 &[]u8)
src_off int
src_off(int)
n int
数量、长度或上限(int)

返回值

int — 该类型的值

(&AlignedBuf) copy_to_bytes

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

用途

&AlignedBuf 上的操作:拷贝到字节。失败时抛出错误,调用方需处理或继续传播。

参数

b &AlignedBuf
本次调用使用的 AlignedBuf 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)
dst $&[]u8
目标(独占借用,可修改原值;类型 $&[]u8)
dst_off int
dst_off(int)
n int
数量、长度或上限(int)

返回值

int — 该类型的值

($&AlignedBuf) copy_from_string

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

用途

$&AlignedBuf 上的操作:拷贝从字符串。失败时抛出错误,调用方需处理或继续传播。

参数

b $&AlignedBuf
本次调用使用的 AlignedBuf 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
off int
偏移(int)
src &string
源数据(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

(&AlignedBuf) write_to_file

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

用途

&AlignedBuf 上的操作:写入到文件。失败时抛出错误,调用方需处理或继续传播。

参数

b &AlignedBuf
本次调用使用的 AlignedBuf 实例;以只读借用传入,调用方仍持有实例。
dst &os.File
目标(只读借用,调用方仍持有原值;类型 &os.File)
off int
偏移(int)
n int
数量、长度或上限(int)

返回值

int — 该类型的值

(&AlignedBuf) as_span

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

用途

&AlignedBuf 上的操作:执行 as span 操作。失败时抛出错误,调用方需处理或继续传播。

参数

b &AlignedBuf
本次调用使用的 AlignedBuf 实例;以只读借用传入,调用方仍持有实例。

返回值

span.ByteSpan — 该类型的值

($&AlignedBuf) as_span_mut

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

用途

$&AlignedBuf 上的操作:执行 as span mut 操作。失败时抛出错误,调用方需处理或继续传播。

参数

b $&AlignedBuf
本次调用使用的 AlignedBuf 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

span.MutByteSpan — 该类型的值

(&AlignedBuf) plane_view

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

用途

&AlignedBuf 上的操作:执行 plane view 操作。失败时抛出错误,调用方需处理或继续传播。

参数

b &AlignedBuf
本次调用使用的 AlignedBuf 实例;以只读借用传入,调用方仍持有实例。
pl &PlaneLayout
pl(只读借用,调用方仍持有原值;类型 &PlaneLayout)
bpp int
bpp(int)

返回值

span.PlaneView — 该类型的值

($&AlignedBuf) plane_view_mut

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

用途

$&AlignedBuf 上的操作:执行 plane view mut 操作。失败时抛出错误,调用方需处理或继续传播。

参数

b $&AlignedBuf
本次调用使用的 AlignedBuf 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
pl &PlaneLayout
pl(只读借用,调用方仍持有原值;类型 &PlaneLayout)
bpp int
bpp(int)

返回值

span.MutPlaneView — 该类型的值

($&AlignedBuf) close

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

用途

$&AlignedBuf 上的操作:关闭资源。

参数

b $&AlignedBuf
本次调用使用的 AlignedBuf 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值