360
- 收藏
- 点赞
- 分享
- 举报
HI3516dv500 ss_mpi_ive_csc接口错误码:0xa01d8007
这是我的代码:
static int ive_yuv420sp_to_rgb_package(uint64_t phys_y, uint64_t phys_c,
int stride_y, int stride_c,
int width, int height,
uint8_t *out_rgb, uint64_t *out_cost_us)
{
if (!out_rgb) return -1;
if (width <= 0 || height <= 0) return -1;
uint64_t t0 = prof_now_us(); /* 记录开始时间 */
/* 目标RGB行跨度:按16字节对齐(IVE硬件要求) */
td_u32 dst_stride = (td_u32)((width * 3 + 15) & ~15);
td_u32 dst_size = dst_stride * (td_u32)height; /* 目标缓冲区总大小 */
/* 分配MMZ内存作为IVE的输出缓冲区(硬件可访问) */
td_phys_addr_t dst_phys = 0;
td_u8 *dst_vir = NULL;
if (ss_mpi_sys_mmz_alloc(&dst_phys, (void**)&dst_vir, TD_NULL, TD_NULL, dst_size) != TD_SUCCESS) {
printf("[IVE][ERR] mmz_alloc dst failed\n");
return -2;
}
/* 初始化IVE输入/输出图像结构和控制参数 */
ot_svp_src_img src_img; /* 源图像(YUV420SP) */
ot_svp_dst_img dst_img; /* 目标图像(RGB打包格式) */
ot_ive_csc_ctrl csc_ctrl; /* 颜色空间转换控制参数 */
memset(&src_img, 0, sizeof(src_img));
memset(&dst_img, 0, sizeof(dst_img));
memset(&csc_ctrl, 0, sizeof(csc_ctrl));
/* 设置源图像类型(YUV420SP) */
#if defined(OT_SVP_IMG_TYPE_YVU_SEMIPLANAR_420)
src_img.type = OT_SVP_IMG_TYPE_YVU_SEMIPLANAR_420; /* SDK定义的YUV420SP类型 */
#elif defined(OT_SVP_IMG_TYPE_SP420_YVU)
src_img.type = OT_SVP_IMG_TYPE_SP420_YVU;
#else
src_img.type = 0; /* 占位,需根据实际SDK修改 */
#pragma message("IVE: src_img.type macro not found; using 0 as placeholder - please replace with SDK macro if needed.")
#endif
src_img.width = (td_u32)width; /* 源图像宽度 */
src_img.height = (td_u32)height; /* 源图像高度 */
src_img.stride[0] = (td_u32)stride_y; /* Y分量行跨度 */
src_img.stride[1] = (td_u32)stride_c; /* CbCr分量行跨度 */
/* 设置源图像物理地址(Y和CbCr平面) */
#if defined(OT_SVP_IMG_HAS_PHYS_ADDR)
src_img.phys_addr[0] = (td_u64)phys_y;
src_img.phys_addr[1] = (td_u64)phys_c;
#else
src_img.phys_addr[0] = (td_u64)phys_y; /* 按常见字段设置,需根据SDK调整 */
src_img.phys_addr[1] = (td_u64)phys_c;
#endif
/* 设置目标图像类型(RGB打包格式) */
#if defined(OT_SVP_IMG_TYPE_U8C3_PACKAGE)
dst_img.type = OT_SVP_IMG_TYPE_U8C3_PACKAGE; /* 8位3通道打包格式(RGB) */
#elif defined(OT_SVP_IMG_TYPE_U8C3_PACK)
dst_img.type = OT_SVP_IMG_TYPE_U8C3_PACK;
#else
dst_img.type = 0; /* 占位,需根据实际SDK修改 */
#pragma message("IVE: dst_img.type macro not found; using 0 as placeholder - please replace with SDK macro if needed.")
#endif
dst_img.width = (td_u32)width; /* 目标图像宽度 */
dst_img.height = (td_u32)height; /* 目标图像高度 */
dst_img.stride[0] = dst_stride; /* 目标行跨度 */
dst_img.phys_addr[0] = (td_u64)dst_phys; /* 目标缓冲区物理地址 */
/* 设置颜色空间转换模式(YUV420SP到RGB) */
#if defined(OT_IVE_CSC_MODE_NV21_TO_RGB)
csc_ctrl.mode = OT_IVE_CSC_MODE_NV21_TO_RGB; /* NV21(YUV420SP的一种)转RGB */
#elif defined(OT_IVE_CSC_MODE_SP420_TO_RGB)
csc_ctrl.mode = OT_IVE_CSC_MODE_SP420_TO_RGB;
#elif defined(OT_IVE_CSC_MODE_YUV420SP_TO_RGB)
csc_ctrl.mode = OT_IVE_CSC_MODE_YUV420SP_TO_RGB;
#elif defined(OT_IVE_CSC_MODE_PIC_BT601_YUV_TO_RGB)
csc_ctrl.mode = OT_IVE_CSC_MODE_PIC_BT601_YUV_TO_RGB; /* BT.601标准转换 */
#else
csc_ctrl.mode = 0; /* 占位,需根据实际SDK修改 */
#pragma message("IVE: csc mode macro not found; csc_ctrl.mode set to 0 placeholder - please replace with SDK macro if needed.")
#endif
/* 调用IVE颜色空间转换(阻塞模式) */
ot_ive_handle handle = -1;
td_s32 rc = ss_mpi_ive_csc(&handle, &src_img, &dst_img, &csc_ctrl, TD_TRUE);
if (rc != TD_SUCCESS) {
printf("[IVE][ERR] ss_mpi_ive_csc failed rc=0x%x\n", rc);
ss_mpi_sys_mmz_free(dst_phys, dst_vir); /* 释放MMZ内存 */
return -3;
}
/* 查询IVE任务是否完成 */
td_bool finish = TD_FALSE;
rc = ss_mpi_ive_query(handle, &finish, TD_TRUE);
if (rc != TD_SUCCESS || !finish) {
printf("[IVE][ERR] ss_mpi_ive_query failed rc=0x%x finish=%d\n", rc, (int)finish);
ss_mpi_sys_mmz_free(dst_phys, dst_vir);
return -4;
}
/* 将MMZ中的RGB数据拷贝到用户空间缓冲区 */
memcpy(out_rgb, dst_vir, (size_t)dst_size);
/* 释放MMZ内存 */
if (ss_mpi_sys_mmz_free(dst_phys, dst_vir) != TD_SUCCESS) {
printf("[IVE][WARN] mmz_free failed\n");
}
/* 计算耗时并输出 */
uint64_t t1 = prof_now_us();
if (out_cost_us) *out_cost_us = (t1 >= t0) ? (t1 - t0) : 0;
return 0;
}
这个错误码怎么确定具体原因是什么,解决方法是什么‘
我来回答
回答3个
时间排序
认可量排序
认可0
认可2
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片
相关问答
-
2024-12-30 11:24:22
-
2018-10-22 10:31:09
-
2016-08-01 20:31:43
-
2025-01-06 18:27:15
-
2016-01-13 15:20:50
-
2019-03-08 10:57:11
-
2019-12-20 12:02:51
-
2018-08-28 17:32:18
-
2015-04-27 09:42:02
-
2019-08-23 09:51:16
-
12017-11-02 20:16:06
-
2018-01-17 10:01:48
-
2020-11-26 16:56:05
-
2025-04-01 21:08:06
-
2019-02-17 14:39:02
-
2019-07-12 08:51:24
-
2020-07-22 17:24:15
-
2024-10-28 10:13:45
-
2023-12-26 20:20:14
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5hisi3516cv610 + gc4336p 夜晚很模糊
-
5AIISP(功能演示,SC4336P为BGGR,强制转RGGB,会导致颜色异常)
-
5rv1106使用luckfox的SDK,设备树和驱动都写好了,结果设备文件没有生成
-
5海思3516cv610中如何进行SD卡升级,根据官方文档操作,烧录进板子时,走的默认uboot,没有执行uboot升级。
-
5G610Q-IPC-38E 夜晚很暗 有什么办法解决吗 已经补光了
-
10转换模型时,SoC版本里没显示hi3516cv610芯片
-
5hisi3516cv610 使用 yolov8n 模型训练 要如何提高 这里识别的是人
-
10有人在海思平台接过SC035HGS吗
-
5关于hi3519dv500,以SD卡虚拟 U 盘操作
-
5ss928 sample_venc代码移植到openEuler24.03上执行报错 [sample_comm_vi_start_dev]-1068: vi set dev attr failed wi
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认

微信扫码分享
QQ好友