538
- 收藏
- 点赞
- 分享
- 举报
HI_MPI_VO_SendFrame 提示无效的视频帧
在VPSS获取视频数据后,进行dma拷贝,并完成vgs缩放,然后将数据发生vo,会提示无效的视频帧
通过log信息打印为 :undefined
typedef struct crop_frame
{
VPSS_CHN VpssChn;
SAMPLE_VO_CONFIG_S stVoConfig;
VPSS_GRP VpssGrpVenc;
VO_CHN VoChn;
}CropFrame;
IVE_SRC_DATA_S g_stSrcData;
IVE_DST_DATA_S g_stDstData;
单独的函数,启动线程处理裁剪
{
CropFrame* pFrame = (CropFrame*)malloc(sizeof(CropFrame));
pFrame->stVoConfig = stVoConfig;
pFrame->VpssChn = VpssChn;
pFrame->VoChn = VoChn;
pFrame->VpssGrpVenc = VpssGrpVenc;
pFrame->rect_h = stGlobalParam->stCamCfg.rect_height;
pFrame->rect_w = stGlobalParam->stCamCfg.rect_width;
pFrame->rect_x = stGlobalParam->stCamCfg.rect_x;
pFrame->rect_y = stGlobalParam->stCamCfg.rect_y;
SAMPLE_PRT("rect_h : %d , rect_w : %d , rect_x : %d, rect_y : %d\n", pFrame->rect_h, pFrame->rect_w, pFrame->rect_x, pFrame->rect_y);
g_stSrcData.u32Width = 3840;
g_stSrcData.u32Height = 2160;
g_stSrcData.u32Stride = 3840;
s32Ret = HI_MPI_SYS_MmzAlloc_Cached(&g_stSrcData.u64PhyAddr, &g_stSrcData.u64VirAddr, "User", HI_NULL, g_stSrcData.u32Height*g_stSrcData.u32Stride*3/2);
if(HI_SUCCESS!=s32Ret)
{
HI_MPI_SYS_MmzFree(g_stSrcData.u64PhyAddr, g_stSrcData.u64VirAddr);
printf("000 HI_MPI_SYS_MmzAlloc_Cached failed with error code: %#x\n", s32Ret);
return;
}
g_stDstData.u32Width = 1920;
g_stDstData.u32Height = 1080;
g_stDstData.u32Stride = 1920;
s32Ret = HI_MPI_SYS_MmzAlloc_Cached(&g_stDstData.u64PhyAddr, &g_stDstData.u64VirAddr, "User", HI_NULL, g_stDstData.u32Height* g_stDstData.u32Stride*3/2);
if(HI_SUCCESS!=s32Ret)
{
printf("111 HI_MPI_SYS_MmzAlloc_Cached failed with error code: %#x\n", s32Ret);
HI_MPI_SYS_MmzFree(g_stDstData.u64PhyAddr, g_stDstData.u64VirAddr);
return;
}
// HI_MPI_VO_Enable
s32Ret = SAMPLE_COMM_VO_StopVO(&pFrame->stVoConfig);
if (s32Ret != HI_SUCCESS) {
printf("SAMPLE_COMM_VO_StopVO failed. s32Ret: 0x%x ! \n", s32Ret);
}
/*start vo*/
s32Ret = SAMPLE_COMM_VO_StartVO(&pFrame->stVoConfig);
if (HI_SUCCESS != s32Ret) {
SAMPLE_PRT("start vo failed. s32Ret: 0x%x !\n", s32Ret);
}
pthread_t pth_vio;
pthread_create(&pth_vio, NULL, Crop_Video_Frame, pFrame);
}
HI_VOID *Crop_Video_Frame(void* arg){
CropFrame* pFrame = (CropFrame*)arg;
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\n", pstVideoFrame.stVFrame.enPixelFormat, pstVideoFrame.u32PoolId, pstVideoFrame.enModId, pstVideoFrame.stVFrame.enVideoFormat);
SAMPLE_PRT("pstVideoFrame width : %d, height : %d, stride:%d\n", pstVideoFrame.stVFrame.u32Width, pstVideoFrame.stVFrame.u32Height, pstVideoFrame.stVFrame.u32Stride[0]);
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));
//pstVideoFrame to stSrcData
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 = g_stDstData.u64PhyAddr;
stDstData.u64VirAddr = g_stDstData.u64VirAddr;
stDstData.u32Width = g_stDstData.u32Width;
stDstData.u32Height = g_stDstData.u32Height;
stDstData.u32Stride = g_stDstData.u32Stride;
SAMPLE_PRT("stDstData u32Stride : %d , width :%d , height : %d\n", stDstData.u32Stride, stDstData.u32Width, stDstData.u32Height);
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 = g_stDstData.u64PhyAddr+ 1920 * 1080;
stDstData.u64VirAddr = g_stDstData.u64VirAddr+ 1920 * 1080;
stDstData.u32Width = g_stDstData.u32Width;
stDstData.u32Height = g_stDstData.u32Height/2;
stDstData.u32Stride = g_stDstData.u32Stride;
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 = g_stDstData.u32Width;
stTask.stImgIn.stVFrame.u32Height = g_stDstData.u32Height;
stTask.stImgIn.stVFrame.u32Stride[0] = g_stDstData.u32Stride;
stTask.stImgIn.stVFrame.u64PhyAddr[0] = g_stDstData.u64PhyAddr;
stTask.stImgIn.stVFrame.u64VirAddr[0] = g_stDstData.u64VirAddr;
stTask.stImgIn.stVFrame.u64PhyAddr[1] = g_stDstData.u64PhyAddr + 1920 * 1080;
stTask.stImgIn.stVFrame.u64VirAddr[1] = g_stDstData.u64VirAddr + 1920 * 1080;
stTask.stImgIn.stVFrame.u32Stride[1] = g_stDstData.u32Stride;
stTask.stImgIn.stVFrame.enPixelFormat = PIXEL_FORMAT_YVU_SEMIPLANAR_420;
//creat vb
VB_POOL ourpool;
VB_POOL poolId;
VB_BLK ourblock;
VB_POOL_CONFIG_S ourVBconfig;
HI_U64* ourPhyAddr;
HI_U8 *ourVirAddr;
(hi_void)memset_s(&ourVBconfig, sizeof(VB_POOL_CONFIG_S), 0, sizeof(VB_POOL_CONFIG_S));
ourVBconfig.u32BlkCnt = 1;
ourVBconfig.u64BlkSize = 3840 * 2160 * 3 / 2;
ourVBconfig.enRemapMode = VB_REMAP_MODE_NONE;
ourpool = HI_MPI_VB_CreatePool(&ourVBconfig);
if (ourpool == VB_INVALID_POOLID) {
SAMPLE_PRT("HI_MPI_VB_CreatePool failed!\n");
printf("Create pool error\n");
}
ourblock = HI_MPI_VB_GetBlock(ourpool, 3840 * 2160 * 3 / 2, "ourspace");
ourPhyAddr = HI_MPI_VB_Handle2PhysAddr(ourblock);
ourVirAddr = (HI_U8 *)HI_MPI_SYS_Mmap(ourPhyAddr, 3840 * 2160 * 3 / 2);
stTask.stImgOut.stVFrame.u32Width = g_stSrcData.u32Width;
stTask.stImgOut.stVFrame.u32Height = g_stSrcData.u32Height;
stTask.stImgOut.stVFrame.u32Stride[0] = g_stSrcData.u32Stride;
stTask.stImgOut.stVFrame.u64PhyAddr[0] = ourPhyAddr;
stTask.stImgOut.stVFrame.u64VirAddr[0] = (HI_U64)(HI_UINTPTR_T)ourVirAddr;
stTask.stImgOut.stVFrame.u64PhyAddr[1] = ourPhyAddr +3840*2160;
stTask.stImgOut.stVFrame.u64VirAddr[1] =stTask.stImgOut.stVFrame.u64VirAddr[0] +3840*2160;
stTask.stImgOut.stVFrame.u32Stride[1] = g_stSrcData.u32Stride;
stTask.stImgOut.stVFrame.enPixelFormat = PIXEL_FORMAT_YVU_SEMIPLANAR_420;
stTask.stImgOut.stVFrame.enVideoFormat = VIDEO_FORMAT_LINEAR;
stTask.stImgOut.u32PoolId = ourpool;
SAMPLE_PRT("stTask.stImgOut.u32PoolId : %d, ourpool : %d\n", stTask.stImgOut.u32PoolId, ourpool);
VGS_HANDLE hHandle;
s32Ret = HI_MPI_VGS_BeginJob(&hHandle);
if (s32Ret != HI_SUCCESS) {
SAMPLE_PRT("HI_MPI_VGS_BeginJob failed with error code: %#x\n", s32Ret);
}
s32Ret = HI_MPI_VGS_AddScaleTask(hHandle,&stTask,VGS_SCLCOEF_NORMAL);
if (s32Ret != HI_SUCCESS) {
HI_MPI_VGS_CancelJob(hHandle);
SAMPLE_PRT("HI_MPI_VGS_AddScaleTask failed with error code: %#x\n", s32Ret);
}
s32Ret = HI_MPI_VGS_EndJob(hHandle);
if (s32Ret != HI_SUCCESS) {
HI_MPI_VGS_CancelJob(hHandle);
SAMPLE_PRT("HI_MPI_VGS_EndJob failed with error code: %#x\n", s32Ret);
}
SAMPLE_PRT("stTask out width : %d , hight : %d, stride : %d , stride[1] : %d\n", stTask.stImgOut.stVFrame.u32Width, stTask.stImgOut.stVFrame.u32Height, stTask.stImgOut.stVFrame.u32Stride[0], stTask.stImgOut.stVFrame.u32Stride[1]);
VO_LAYER VoLayer = pFrame->stVoConfig.VoDev; // VO层号
s32Ret = HI_MPI_VO_SendFrame(VoLayer, pFrame->VoChn, &stTask.stImgOut, -1);
if (s32Ret != HI_SUCCESS) {
SAMPLE_PRT("HI_MPI_VO_SendFrame failed with error code: %#x\n", s32Ret);
}
s32Ret = HI_MPI_SYS_Munmap(ourVirAddr, 3840 * 2160 * 3 / 2);
if (s32Ret != HI_SUCCESS) {
SAMPLE_PRT("HI_MPI_SYS_Munmap failed with error code: %#x\n", s32Ret);
}
s32Ret = HI_MPI_VB_ReleaseBlock(ourblock);
if (s32Ret != HI_SUCCESS) {
SAMPLE_PRT("HI_MPI_VB_ReleaseBlock failed with error code: %#x\n", s32Ret);
}
}
我来回答
回答9个
时间排序
认可量排序
认可0
认可0
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2017-02-15 17:19:37
-
2018-02-05 13:34:20
-
2019-07-18 21:48:13
-
2019-10-30 08:36:01
-
2019-06-04 15:08:30
-
2015-11-19 09:23:55
-
2016-07-28 14:55:36
-
2022-11-02 20:17:05
-
2017-09-27 17:38:14
-
2019-10-18 17:50:56
-
2019-03-29 20:45:47
-
2020-07-31 15:42:13
-
2020-07-10 17:39:59
-
2020-03-17 10:54:35
-
2020-10-29 11:14:15
-
2016-07-19 21:51:15
-
2019-01-18 17:50:46
-
2016-07-26 15:38:13
-
2018-06-20 16:12:41
无更多相似问答 去提问
点击登录
-- 积分
-- 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币)
取消
确认