我想将视频解码后的帧数据传回到A8,然后保存为jpg图像(为了实现一个截图功能);
但是在创建穿回到Host的LinkId: SYSTEM_HOST_LINK_ID_IPC_FRAMES_IN_0 时触发了SIGFPE异常。
有人知道应该怎么修改LinkChain,或者其他的截图方法吗?
以下是我创建LingChain的代码:
void mcfw_mp4_dec_dis_chain_crate() {/* link used */gVdecModuleContext.ipcBitsOutHLOSId = SYSTEM_HOST_LINK_ID_IPC_BITS_OUT_0;gVdecModuleContext.ipcBitsInRTOSId = SYSTEM_VIDEO_LINK_ID_IPC_BITS_IN_0;gVdecModuleContext.decId= SYSTEM_LINK_ID_VDEC_0;gMultiCh_VdecVdisObj.videoDupId= SYSTEM_VIDEO_LINK_ID_DUP_0;gMultiCh_VdecVdisObj.ipcOutVideo2VpssId = SYSTEM_VIDEO_LINK_ID_IPC_OUT_M3_0;gMultiCh_VdecVdisObj.ipcOutVideo2HostId = SYSTEM_VIDEO_LINK_ID_IPC_FRAMES_OUT_0;gMultiCh_VdecVdisObj.ipcInVpssId= SYSTEM_VPSS_LINK_ID_IPC_IN_M3_0;gMultiCh_VdecVdisObj.ipcInHostId= SYSTEM_HOST_LINK_ID_IPC_FRAMES_IN_0;gVdisModuleContext.swMsId[0]= SYSTEM_LINK_ID_SW_MS_MULTI_INST_0;gVdisModuleContext.displayId[0]= SYSTEM_LINK_ID_DISPLAY_0; // ON AND OFF CHIP HDMI/* init link params */IpcBitsOutLinkHLOS_CreateParamsipcBitsOutHostPrm;IpcBitsInLinkRTOS_CreateParamsipcBitsInVideoPrm;DecLink_CreateParamsdecPrm;DupLink_CreateParamsvideoDupPrm;IpcFramesOutLinkRTOS_CreateParamsipcOutVideo2VpssPrm;IpcFramesOutLinkRTOS_CreateParamsipcOutVideo2HostPrm;IpcFramesInLinkRTOS_CreateParamsipcInVpssPrm;IpcFramesInLinkHLOS_CreateParamsipcFramesInHostPrm;SwMsLink_CreateParamsswMsPrm[VDIS_DEV_MAX];DisplayLink_CreateParamsdisplayPrm[VDIS_DEV_MAX];UInt32 i;MULTICH_INIT_STRUCT(IpcBitsOutLinkHLOS_CreateParams,ipcBitsOutHostPrm);MULTICH_INIT_STRUCT(IpcBitsInLinkRTOS_CreateParams,ipcBitsInVideoPrm);MULTICH_INIT_STRUCT(DecLink_CreateParams, decPrm);MULTICH_INIT_STRUCT(IpcFramesOutLinkRTOS_CreateParams,ipcOutVideo2VpssPrm);MULTICH_INIT_STRUCT(IpcFramesOutLinkRTOS_CreateParams,ipcOutVideo2HostPrm);MULTICH_INIT_STRUCT(IpcFramesInLinkRTOS_CreateParams,ipcInVpssPrm);MULTICH_INIT_STRUCT(IpcFramesInLinkHLOS_CreateParams,ipcFramesInHostPrm);for (i = 0; i < VDIS_DEV_MAX; ++i){MULTICH_INIT_STRUCT(DisplayLink_CreateParams,displayPrm[i]);MULTICH_INIT_STRUCT(SwMsLink_CreateParams ,swMsPrm[i]);}/* ipc bits out host link */ipcBitsOutHostPrm.baseCreateParams.outQueParams[0].nextLink= gVdecModuleContext.ipcBitsInRTOSId;ipcBitsOutHostPrm.baseCreateParams.notifyNextLink= FALSE;ipcBitsOutHostPrm.baseCreateParams.notifyPrevLink= FALSE;ipcBitsOutHostPrm.baseCreateParams.noNotifyMode= TRUE;ipcBitsOutHostPrm.baseCreateParams.numOutQue= 1;ipcBitsOutHostPrm.inQueInfo.numCh= gVdecModuleContext.vdecConfig.numChn;for (i=0; i<ipcBitsOutHostPrm.inQueInfo.numCh; i++){ipcBitsOutHostPrm.inQueInfo.chInfo[i].width = gVdecModuleContext.vdecConfig.decChannelParams[i].maxVideoWidth;ipcBitsOutHostPrm.inQueInfo.chInfo[i].height = gVdecModuleContext.vdecConfig.decChannelParams[i].maxVideoHeight;ipcBitsOutHostPrm.inQueInfo.chInfo[i].scanFormat = SYSTEM_SF_PROGRESSIVE;ipcBitsOutHostPrm.inQueInfo.chInfo[i].bufType= 0; // NOT USEDipcBitsOutHostPrm.inQueInfo.chInfo[i].codingformat= 0; // NOT USEDipcBitsOutHostPrm.inQueInfo.chInfo[i].dataFormat= 0; // NOT USEDipcBitsOutHostPrm.inQueInfo.chInfo[i].memType= 0; // NOT USEDipcBitsOutHostPrm.inQueInfo.chInfo[i].startX= 0; // NOT USEDipcBitsOutHostPrm.inQueInfo.chInfo[i].startY= 0; // NOT USEDipcBitsOutHostPrm.inQueInfo.chInfo[i].pitch[0]= 0; // NOT USEDipcBitsOutHostPrm.inQueInfo.chInfo[i].pitch[1]= 0; // NOT USEDipcBitsOutHostPrm.inQueInfo.chInfo[i].pitch[2]= 0; // NOT USED //ipcBitsOutHostPrm.maxQueueDepth[i] = MAX_BUFFERING_QUEUE_LEN_PER_CH; //ipcBitsOutHostPrm.chMaxReqBufSize[i] = (ipcBitsOutHostPrm.inQueInfo.chInfo[i].width * ipcBitsOutHostPrm.inQueInfo.chInfo[i].height); //ipcBitsOutHostPrm.totalBitStreamBufferSize [i] = (ipcBitsOutHostPrm.chMaxReqBufSize[i] * BIT_BUF_LENGTH_LIMIT_FACTOR_HD);}/* ipc bits in video link */ipcBitsInVideoPrm.baseCreateParams.inQueParams.prevLinkId= gVdecModuleContext.ipcBitsOutHLOSId;ipcBitsInVideoPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;ipcBitsInVideoPrm.baseCreateParams.outQueParams[0].nextLink = gVdecModuleContext.decId;ipcBitsInVideoPrm.baseCreateParams.noNotifyMode= TRUE;ipcBitsInVideoPrm.baseCreateParams.notifyNextLink= TRUE;ipcBitsInVideoPrm.baseCreateParams.notifyPrevLink= FALSE;ipcBitsInVideoPrm.baseCreateParams.numOutQue= 1;/* decode link */for (i=0; i<ipcBitsOutHostPrm.inQueInfo.numCh; i++){if(gVdecModuleContext.vdecConfig.decChannelParams[i].isCodec == VDEC_CHN_H264)decPrm.chCreateParams[i].format = IVIDEO_H264HP;else if(gVdecModuleContext.vdecConfig.decChannelParams[i].isCodec == VDEC_CHN_MPEG4)decPrm.chCreateParams[i].format = IVIDEO_MPEG4ASP;else if(gVdecModuleContext.vdecConfig.decChannelParams[i].isCodec == VDEC_CHN_MJPEG)decPrm.chCreateParams[i].format = IVIDEO_MJPEG; //else if(gVdecModuleContext.vdecConfig.decChannelParams[i].isCodec == VDEC_CHN_MPEG2) //decPrm.chCreateParams[i].format = IVIDEO_MPEG2HP;decPrm.chCreateParams[i].numBufPerCh = gVdecModuleContext.vdecConfig.decChannelParams[i].numBufPerCh;decPrm.chCreateParams[i].profile = IH264VDEC_PROFILE_ANY;decPrm.chCreateParams[i].displayDelay = gVdecModuleContext.vdecConfig.decChannelParams[i].displayDelay;decPrm.chCreateParams[i].dpbBufSizeInFrames = IH264VDEC_DPB_NUMFRAMES_AUTO; //if (gVdecModuleContext.vdecConfig.decChannelParams[i].fieldPicture) { //OSA_printf("MULTICH_VDEC_VDIS:INFO ChId[%d] configured for field picture\n",i); //decPrm.chCreateParams[i].processCallLevel= VDEC_FIELDLEVELPROCESSCALL; //} //else { //decPrm.chCreateParams[i].processCallLevel= VDEC_FRAMELEVELPROCESSCALL; //}decPrm.chCreateParams[i].targetMaxWidth = ipcBitsOutHostPrm.inQueInfo.chInfo[i].width;decPrm.chCreateParams[i].targetMaxHeight = ipcBitsOutHostPrm.inQueInfo.chInfo[i].height;decPrm.chCreateParams[i].defaultDynamicParams.targetFrameRate = gVdecModuleContext.vdecConfig.decChannelParams[i].dynamicParam.frameRate;decPrm.chCreateParams[i].defaultDynamicParams.targetBitRate = gVdecModuleContext.vdecConfig.decChannelParams[i].dynamicParam.targetBitRate; //decPrm.chCreateParams[i].tilerEnable = FALSE; //decPrm.chCreateParams[i].enableWaterMarking = gVdecModuleContext.vdecConfig.decChannelParams[i].enableWaterMarking;}decPrm.inQueParams.prevLinkId= gVdecModuleContext.ipcBitsInRTOSId;decPrm.inQueParams.prevLinkQueId= 0;decPrm.outQueParams.nextLink= gMultiCh_VdecVdisObj.videoDupId;videoDupPrm.inQueParams.prevLinkId = gVdecModuleContext.decId;videoDupPrm.inQueParams.prevLinkQueId = 0;videoDupPrm.notifyNextLink = TRUE;videoDupPrm.numOutQue = 2;videoDupPrm.outQueParams[0].nextLink = gMultiCh_VdecVdisObj.ipcOutVideo2VpssId;videoDupPrm.outQueParams[1].nextLink = gMultiCh_VdecVdisObj.ipcOutVideo2HostId;/* ipc out video link */ipcOutVideo2VpssPrm.baseCreateParams.inQueParams.prevLinkId= gMultiCh_VdecVdisObj.videoDupId;ipcOutVideo2VpssPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;ipcOutVideo2VpssPrm.baseCreateParams.outQueParams[0].nextLink = gMultiCh_VdecVdisObj.ipcInVpssId;ipcOutVideo2VpssPrm.baseCreateParams.notifyNextLink= TRUE;ipcOutVideo2VpssPrm.baseCreateParams.notifyPrevLink= TRUE;ipcOutVideo2VpssPrm.baseCreateParams.numOutQue= 1;/* ipc out video link */ipcOutVideo2HostPrm.baseCreateParams.inQueParams.prevLinkId= gMultiCh_VdecVdisObj.videoDupId;ipcOutVideo2HostPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;ipcOutVideo2HostPrm.baseCreateParams.outQueParams[0].nextLink = gMultiCh_VdecVdisObj.ipcInHostId;ipcOutVideo2HostPrm.baseCreateParams.notifyNextLink= TRUE;ipcOutVideo2HostPrm.baseCreateParams.notifyPrevLink= TRUE;ipcOutVideo2HostPrm.baseCreateParams.numOutQue= 1;/* ipc in vpss link */ipcInVpssPrm.baseCreateParams.inQueParams.prevLinkId= gMultiCh_VdecVdisObj.ipcOutVideo2VpssId;ipcInVpssPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;ipcInVpssPrm.baseCreateParams.notifyNextLink= TRUE;ipcInVpssPrm.baseCreateParams.notifyPrevLink= TRUE;ipcInVpssPrm.baseCreateParams.numOutQue= 1;ipcInVpssPrm.baseCreateParams.outQueParams[0].nextLink= gVdisModuleContext.swMsId[0];/* ipc in host link */ipcFramesInHostPrm.cbFxn = NULL;ipcFramesInHostPrm.cbCtx = NULL;ipcFramesInHostPrm.baseCreateParams.inQueParams.prevLinkId = gMultiCh_VdecVdisObj.ipcOutVideo2HostId;ipcFramesInHostPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;ipcFramesInHostPrm.baseCreateParams.notifyNextLink = FALSE;ipcFramesInHostPrm.baseCreateParams.notifyPrevLink = FALSE;ipcFramesInHostPrm.baseCreateParams.numOutQue = 0;/* sw mosaic link */swMsPrm[0].numSwMsInst = 1;swMsPrm[0].swMsInstId[0]= SYSTEM_SW_MS_SC_INST_DEIHQ_SC_NO_DEI;swMsPrm[0].swMsInstStartWin[0] = 0;swMsPrm[0].swMsInstStartWin[1] = 10;swMsPrm[0].enableProcessTieWithDisplay = TRUE;// swMsPrm[0].includeVipScInDrvPath = FALSE;VDIS_DEV vdDevId = VDIS_DEV_HDMI;swMsPrm[0].inQueParams.prevLinkId= gMultiCh_VdecVdisObj.ipcInVpssId;swMsPrm[0].inQueParams.prevLinkQueId = 0;swMsPrm[0].outQueParams.nextLink= gVdisModuleContext.displayId[0];swMsPrm[0].numOutBuf= MULTICH_NUM_SWMS_MAX_BUFFERS;swMsPrm[0].maxInputQueLen= SYSTEM_SW_MS_INVALID_INPUT_QUE_LEN;swMsPrm[0].maxOutRes= VSYS_STD_1080P_60;//swMsPrm[0].initOutRes= gVdisModuleContext.vdisConfig.deviceParams[VDIS_DEV_HDMI].resolution;swMsPrm[0].lineSkipMode= FALSE;swMsPrm[0].enableLayoutGridDraw= gVdisModuleContext.vdisConfig.enableLayoutGridDraw;MultiCh_swMsGetDefaultLayoutPrm(vdDevId, &swMsPrm[0], FALSE);/* both from 0-16 chnl *//* display link */displayPrm[0].inQueParams[0].prevLinkId= gVdisModuleContext.swMsId[0];displayPrm[0].inQueParams[0].prevLinkQueId = 0;displayPrm[0].displayRes= VSYS_STD_1080P_60;displayPrm[0].numInputQueues= 1;/* create links */System_linkCreate(gVdecModuleContext.ipcBitsOutHLOSId,&ipcBitsOutHostPrm,sizeof(ipcBitsOutHostPrm));System_linkCreate(gVdecModuleContext.ipcBitsInRTOSId,&ipcBitsInVideoPrm,sizeof(ipcBitsInVideoPrm));System_linkCreate(gVdecModuleContext.decId, &decPrm, sizeof(decPrm));System_linkCreate(gMultiCh_VdecVdisObj.videoDupId , &videoDupPrm, sizeof(videoDupPrm));System_linkCreate(gMultiCh_VdecVdisObj.ipcOutVideo2VpssId, &ipcOutVideo2VpssPrm, sizeof(ipcOutVideo2VpssPrm));System_linkCreate(gMultiCh_VdecVdisObj.ipcOutVideo2HostId, &ipcOutVideo2HostPrm, sizeof(ipcOutVideo2HostPrm));System_linkCreate(gMultiCh_VdecVdisObj.ipcInVpssId , &ipcInVpssPrm, sizeof(ipcInVpssPrm));/* 运行这行代码时发生SIGFPE !!!!!!!! */System_linkCreate(gMultiCh_VdecVdisObj.ipcInHostId , &ipcFramesInHostPrm, sizeof(ipcFramesInHostPrm));System_linkCreate(gVdisModuleContext.swMsId[0] , &swMsPrm[0], sizeof(swMsPrm[0]));System_linkCreate(gVdisModuleContext.displayId[0], &displayPrm[0], sizeof(displayPrm[0])); }
Chris Meng:
你好,
264编码同时就可以做jpeg编码,不需要让A8来做。
user5305451:
回复 Chris Meng:
谢谢,我将尝试一下这个方法。
另外,有没有方法可以从M3VPSS得到正在显示的帧数据呢,感觉这样截出来的图才是实时的。
Da mi:
回复 user5305451:
你好 请问实现功能了吗我也遇到了该问题 方便交流下吗