420
- 收藏
- 点赞
- 分享
- 举报
HI_MPI_IVE_DMA 裁剪颜色为绿色
从HI_MPI_VPSS_GetGrpFrame获取数据帧,图像格式为PIXEL_FORMAT_YVU_SEMIPLANAR_420,进行dma拷贝后,图像为绿色
HI_S32 s32Ret;
VIDEO_FRAME_INFO_S pstVideoFrame;
s32Ret = HI_MPI_VPSS_GetGrpFrame(pFrame->VpssChn, 0, &pstVideoFrame);
if (HI_SUCCESS != s32Ret) {
SAMPLE_PRT("HI_MPI_VPSS_GetGrpFrame failed. s32Ret: 0x%x !\n", s32Ret);
}
SAMPLE_PRT("pstVideoFrame enPixelFormat : %d , poolID : %d, enModId :%d, stVFrame.enVideoFormat : %d , enCompressMode: %d\n", pstVideoFrame.stVFrame.enPixelFormat, pstVideoFrame.u32PoolId, pstVideoFrame.enModId, pstVideoFrame.stVFrame.enVideoFormat, pstVideoFrame.stVFrame.enCompressMode);
SAMPLE_PRT("pstVideoFrame width : %d, height : %d, stride:%d, stride1 : %d , stride2 : %d\n", pstVideoFrame.stVFrame.u32Width, pstVideoFrame.stVFrame.u32Height, pstVideoFrame.stVFrame.u32Stride[0], pstVideoFrame.stVFrame.u32Stride[1],pstVideoFrame.stVFrame.u32Stride[2]);
// ExtVirAddr = (HI_U8 *)HI_MPI_SYS_Mmap(pstVideoFrame.stVFrame.u64PhyAddr[0], 1920 * 1080 * 3 / 2);
IVE_HANDLE hIve;
IVE_SRC_DATA_S stSrcData;
IVE_DST_DATA_S stDstData;
IVE_SRC_DATA_S stSrcData1;
IVE_DST_DATA_S stDstData1;
IVE_DMA_CTRL_S stDmaCtrl = { IVE_DMA_MODE_DIRECT_COPY, 0 };
VGS_TASK_ATTR_S stTask;
memset(&stTask, 0, sizeof(stTask));
memcpy(&stTask.stImgIn, &pstVideoFrame.stVFrame, sizeof(VIDEO_FRAME_INFO_S));
memcpy(&stTask.stImgOut, &pstVideoFrame.stVFrame, sizeof(VIDEO_FRAME_INFO_S));
#if 1
VB_POOL ourpool;
VB_POOL poolId;
VB_BLK ourblock;
VB_POOL_CONFIG_S ourVBconfig;
HI_U64* ourPhyAddr;
HI_U8 *ourVirAddr;
HI_U32 u32BlkSize;
u32BlkSize = COMMON_GetPicBufferSize(3840, 2160, SAMPLE_PIXEL_FORMAT, DATA_BITWIDTH_8, COMPRESS_MODE_SEG, DEFAULT_ALIGN);
(hi_void)memset_s(&ourVBconfig, sizeof(VB_POOL_CONFIG_S), 0, sizeof(VB_POOL_CONFIG_S));
ourVBconfig.u32BlkCnt = 1;
ourVBconfig.u64BlkSize = u32BlkSize;
ourVBconfig.enRemapMode = VB_REMAP_MODE_NONE;
ourblock = HI_MPI_VB_GetBlock(ourpool, u32BlkSize, "ourspace");
ourPhyAddr = HI_MPI_VB_Handle2PhysAddr(ourblock);
ourVirAddr = (HI_U8 *)HI_MPI_SYS_MmapCache(ourPhyAddr, u32BlkSize);
stSrcData.u64PhyAddr = pstVideoFrame.stVFrame.u64PhyAddr[0];
stSrcData.u64VirAddr = pstVideoFrame.stVFrame.u64VirAddr[0];
stSrcData.u32Width = pstVideoFrame.stVFrame.u32Width/2;
stSrcData.u32Height = pstVideoFrame.stVFrame.u32Height/2;
stSrcData.u32Stride = pstVideoFrame.stVFrame.u32Stride[0]/2;
stDstData.u64PhyAddr = ourPhyAddr;
stDstData.u64VirAddr = ourVirAddr;
stDstData.u32Width = 1920;
stDstData.u32Height = 1080;
stDstData.u32Stride = 1920;
HI_BOOL bInstant = HI_FALSE;
s32Ret = HI_MPI_IVE_DMA(&hIve, &stSrcData, &stDstData, &stDmaCtrl, bInstant);
if (s32Ret != HI_SUCCESS) {
SAMPLE_PRT("000 HI_MPI_IVE_DMA failed with error code: %#x , bInstant : %d\n", s32Ret, bInstant);
}
stSrcData.u64PhyAddr = pstVideoFrame.stVFrame.u64PhyAddr[1] ;
stSrcData.u64VirAddr = pstVideoFrame.stVFrame.u64VirAddr[1] ;
stSrcData.u32Width = pstVideoFrame.stVFrame.u32Width/2;
stSrcData.u32Height = pstVideoFrame.stVFrame.u32Height/4;
stSrcData.u32Stride = pstVideoFrame.stVFrame.u32Stride[1]/2;
stDstData.u64PhyAddr = ourPhyAddr+ 1920 * 1080;
stDstData.u64VirAddr = ourVirAddr+ 1920 * 1080;
stDstData.u32Width = 1920;
stDstData.u32Height = 1080/2;
stDstData.u32Stride = 1920;
SAMPLE_PRT("stDstData u32Stride : %d , width :%d , height : %d\n", stDstData.u32Stride, stDstData.u32Width, stDstData.u32Height);
s32Ret = HI_MPI_IVE_DMA(&hIve, &stSrcData, &stDstData, &stDmaCtrl, bInstant);
if (s32Ret != HI_SUCCESS) {
SAMPLE_PRT("111 HI_MPI_IVE_DMA failed with error code: %#x , bInstant : %d\n", s32Ret, bInstant);
}
// s32Ret = HI_MPI_VPSS_ReleaseGrpFrame(pFrame->VpssGrpVenc, 0, &pstVideoFrame);
// if (s32Ret != HI_SUCCESS) {
// SAMPLE_PRT("HI_MPI_VPSS_ReleaseGrpFrame failed with error code: %#x\n", s32Ret);
// }
stTask.stImgIn.stVFrame.u32Width = 1920;
stTask.stImgIn.stVFrame.u32Height = 1080;
stTask.stImgIn.stVFrame.u32Stride[0] = 1920;
stTask.stImgIn.stVFrame.u64PhyAddr[0] = ourPhyAddr;
stTask.stImgIn.stVFrame.u64VirAddr[0] = (HI_U64)(HI_UINTPTR_T)ourVirAddr;
stTask.stImgIn.stVFrame.u64PhyAddr[1] = ourPhyAddr + 1920 * 1080;
stTask.stImgIn.stVFrame.u64VirAddr[1] = stTask.stImgIn.stVFrame.u64VirAddr[0] + 1920 * 1080;
stTask.stImgIn.stVFrame.u32Stride[1] = 1920;
stTask.stImgIn.stVFrame.enPixelFormat = PIXEL_FORMAT_YVU_SEMIPLANAR_420;
stTask.stImgIn.stVFrame.enVideoFormat = VIDEO_FORMAT_LINEAR;
stTask.stImgIn.u32PoolId = ourpool;
我来回答
回答3个
时间排序
认可量排序
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2020-05-21 09:50:15
-
2019-10-30 18:55:25
-
2020-05-20 16:37:36
-
2017-09-16 09:41:02
-
2019-12-20 11:56:30
-
2023-10-18 14:11:10
-
2021-01-20 15:53:17
-
2018-12-11 10:12:12
-
2019-11-01 17:45:15
-
2019-07-11 13:52:03
-
2019-03-19 14:41:53
-
2015-04-28 13:59:15
-
2019-08-23 09:51:16
-
2017-10-18 11:32:16
-
2017-10-09 10:12:44
-
2020-05-14 20:10:19
-
2019-02-20 18:19:49
-
2020-11-26 16:56:05
-
2016-07-29 11:54:40
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5Hi3516CV610 如何使用SD卡升级固件
-
5cat /dev/logmpp 报错 <3>[ vi] [func]:vi_send_frame_node [line]:99 [info]:vi pic queue is full!
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认