asc_load_image_to_cbuf
产 品 支 持 情 况
| 产 品 | 是 否 支 持 |
|---|---|
| √ | |
| √ |
功 能 说 明
将 图 像 数 据 从Global Memory搬 运 到L1 Buffer。
函 数 原 型
常 规 搬 运
C++__aicore__ inline void asc_load_image_to_cbuf(__cbuf__ int8_t* dst, uint16_t hor_size, uint16_t ver_size, uint16_t hor_start_pos, uint16_t ver_start_pos, uint16_t src_hor_size, uint8_t top_pad_size, uint8_t bot_pad_size, uint16_t left_pad_size, uint16_t right_pad_size) __aicore__ inline void asc_load_image_to_cbuf(__cbuf__ half* dst, uint16_t hor_size, uint16_t ver_size, uint16_t hor_start_pos, uint16_t ver_start_pos, uint16_t src_hor_size, uint8_t top_pad_size, uint8_t bot_pad_size, uint16_t left_pad_size, uint16_t right_pad_size)同 步 搬 运
C++__aicore__ inline void asc_load_image_to_cbuf_sync(__cbuf__ int8_t* dst, uint16_t hor_size, uint16_t ver_size, uint16_t hor_start_pos, uint16_t ver_start_pos, uint16_t src_hor_size, uint8_t top_pad_size, uint8_t bot_pad_size, uint16_t left_pad_size, uint16_t right_pad_size) __aicore__ inline void asc_load_image_to_cbuf_sync(__cbuf__ half* dst, uint16_t hor_size, uint16_t ver_size, uint16_t hor_start_pos, uint16_t ver_start_pos, uint16_t src_hor_size, uint8_t top_pad_size, uint8_t bot_pad_size, uint16_t left_pad_size, uint16_t right_pad_size)
参 数 说 明
| 参 数 名 | 输 入/输 出 | 描 述 |
|---|---|---|
| dst | 输 出 | 目 的 操 作 数(矢 量)的 起 始 地 址。 |
| hor_size | 输 入 | 从 源 图 中 加 载 图 片 的 水 平 宽 度,单 位 为 像 素。取 值 范 围:[1, 4094]。 |
| ver_size | 输 入 | 从 源 图 中 加 载 图 片 的 垂 直 高 度,单 位 为 像 素。取 值 范 围:[1, 4094]。 |
| hor_start_pos | 输 入 | 加 载 图 片 在 源 图 片 上 的 水 平 起 始 地 址,单 位 为 像 素。取 值 范 围:[0, 4095]。 |
| ver_start_pos | 输 入 | 加 载 图 片 在 源 图 片 上 的 垂 直 起 始 地 址,单 位 为 像 素。取 值 范 围:[0, 4095]。 |
| src_hor_size | 输 入 | 源 图 片 水 平 宽 度,单 位 为 像 素。取 值 范 围:[1, 4094]。 |
| top_pad_size | 输 入 | 目 的 图 片 顶 部 填 充 的 像 素 数。取 值 范 围:[0, 32]。 |
| bot_pad_size | 输 入 | 目 的 图 片 底 部 填 充 的 像 素 数。取 值 范 围:[0, 32]。 |
| left_pad_size | 输 入 | 目 的 图 片 左 边 填 充 的 像 素 数。取 值 范 围:[0, 32]。 |
| right_pad_size | 输 入 | 目 的 图 片 右 边 填 充 的 像 素 数。取 值 范 围:[0, 32]。 |
返 回 值 说 明
无
流 水 类 型
PIPE_MTE2
约 束 说 明
- dst的 起 始 地 址 需 要32字 节 对 齐。
- 操 作 数 地 址 重 叠 约 束 请 参 考通 用 地 址 重 叠 约 束。
调 用 示 例
C++
constexpr uint64_t total_length = 128; // total_length指 参 与 搬 运 的 数 据 总 长 度
__cbuf__ half dst[total_length];
// 加 载 图 片 时 的 高 度 与 宽 度 均 为1,起 始 地 址 为(0,0),源 图 片 水 平 宽 度 为1,不 做padding
asc_load_image_to_cbuf(dst, 1, 1, 0, 0, 1, 0, 0, 0, 0);