各位大神,我使用
ti DM8148 在编码时出现了问题,我的数据链路是cap---dup----sws---dis
|---encode
采集的数据经过dup后分两路,一路进行显示dis.另一路经过encode编码,dis可以正常显示,但encode出现了问题,实在找不到问题所在,希望大神们给予指点。
说明:1)输入源为HDMI 1080p60 逐行模式。
以下为部分代码贴图与LOG信息
int main(int argc, char **argv) [
signal(SIGINT, sig_handle);
/* System init */
VSYS_PARAMS_S vsysParams;
Vsys_params_init(&vsysParams);
Vsys_init(&vsysParams);
/* Capture init */
VCAP_PARAMS_S vcapParams;
Vcap_params_init(&vcapParams);
Vcap_init(&vcapParams);
/* Encode init */
VENC_PARAMS_S vencParams;
Venc_params_init(&vencParams);
/* Enable B frame for primary channels - set parameters before venc_init */
int ch;
for (ch=0; ch < CH_NUM; ch++)
vencParams.encChannelParams[ch].dynamicParam.interFrameInterval =I_TO_P_FRAME_INTERVAL_FOR_PRIMARY_STREAMS;
Venc_init(&vencParams);
/* Display init */
VDIS_PARAMS_S vdisParams;
Vdis_params_init(&vdisParams);
vdisParams.deviceParams[VDIS_DEV_HDMI].resolution = VSYS_STD_1080P_60;
vdisParams.mosaicLayoutResolution[VDIS_DEV_HDMI] = vdisParams.deviceParams[VDIS_DEV_HDMI].resolution;
vdisParams.mosaicParams[VDIS_DEV_HDMI].userSetDefaultSWMLayout = TRUE;
Vdis_init(&vdisParams);
/* Configure display */
Vsys_configureDisplay();
/* Init the application specific module which will handle bitstream exchange */
bits_saver_create(CH_NUM, "h264");
void chain_cap_enc_dis_create()
[.......
MultiCh_detectBoard();
System_linkControl(
SYSTEM_LINK_ID_M3VPSS,
SYSTEM_M3VPSS_CMD_RESET_VIDEO_DEVICES,
NULL,
0,
TRUE
);
System_linkControl(
SYSTEM_LINK_ID_M3VIDEO,
SYSTEM_COMMON_CMD_SET_CH2IVAHD_MAP_TBL,
&systemVid_encDecIvaChMapTbl,
sizeof(SystemVideo_Ivahd2ChMap_Tbl),
TRUE
);
gVcapModuleContext.captureId = SYSTEM_LINK_ID_CAPTURE;
gVcapModuleContext.nsfId[0] = SYSTEM_LINK_ID_NSF_0;
gVencModuleContext.encId = SYSTEM_LINK_ID_VENC_0;
gVdisModuleContext.swMsId[0] = SYSTEM_LINK_ID_SW_MS_MULTI_INST_0;
gVdisModuleContext.displayId[0] = SYSTEM_LINK_ID_DISPLAY_0;
gVcapModuleContext.deiId[0] = SYSTEM_LINK_ID_DEI_0;
dupId[0] = SYSTEM_VPSS_LINK_ID_DUP_0;
dupId[1] = SYSTEM_VPSS_LINK_ID_DUP_1;
UInt32 ipcOutVpssId = SYSTEM_VPSS_LINK_ID_IPC_OUT_M3_0;
UInt32 ipcInVideoId = SYSTEM_VIDEO_LINK_ID_IPC_IN_M3_0;
gVencModuleContext.i
PCBitsOutRTOSId = SYSTEM_VIDEO_LINK_ID_IPC_BITS_OUT_0;
gVencModuleContext.ipcBitsInHLOSId = SYSTEM_HOST_LINK_ID_IPC_BITS_IN_0;
gVdecModuleContext.ipcBitsOutHLOSId = SYSTEM_HOST_LINK_ID_IPC_BITS_OUT_0;
gVdecModuleContext.ipcBitsInRTOSId = SYSTEM_VIDEO_LINK_ID_IPC_BITS_IN_0;
/* capture link init */
CaptureLink_CreateParams_Init(&capturePrm);
capturePrm.numVipInst = 1;
capturePrm.outQueParams[0].nextLink = dupId[0];
capturePrm.tilerEnable = FALSE;
capturePrm.enableSdCrop = FALSE;
capturePrm.numBufsPerCh = 8;
capturePrm.maxBlindAreasPerCh = 4;
/* capture instance init */
CaptureLink_VipInstParams *prm_cap_inst = &capturePrm.vipInst[0];
prm_cap_inst->vipInstId = (SYSTEM_CAPTURE_INST_VIP0_PORTA + 0 ) % SYSTEM_CAPTURE_INST_MAX;
prm_cap_inst->videoDecoderId = DEVICE_VID_DEC_ADV7610_DRV;
prm_cap_inst->inDataFormat = SYSTEM_DF_YUV422P;
prm_cap_inst->standard = SYSTEM_STD_1080P_60;
prm_cap_inst->numOutput = 1;
prm_cap_inst->videoIfMode = DEVICE_CAPT_VIDEO_IF_MODE_16BIT;
prm_cap_inst->videoCaptureMode = DEVICE_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC;
/* capture out init */
CaptureLink_OutParams *prm_cap_out = &prm_cap_inst->outParams[0];
prm_cap_out->dataFormat = SYSTEM_DF_YUV420SP_UV;//SYSTEM_DF_YUV422I_YUYV;
prm_cap_out->scEnable = FALSE;
prm_cap_out->scOutWidth = 0;
prm_cap_out->scOutHeight = 0;
prm_cap_out->outQueId = 0;
EncLink_CreateParams_Init(&encPrm);
encPrm.numBufPerCh[0] = 4;
for (i = 0; i < NUM_CH; i++) [
#if 1
EncLink_ChCreateParams *pLinkChPrm = &encPrm.chCreateParams
;
VENC_CHN_PARAMS_S *pChPrm = &gVencModuleContext.vencConfig.encChannelParams;
pLinkChPrm->format = IVIDEO_H264HP;
pLinkChPrm->profile = gVencModuleContext.vencConfig.h264Profile;
pLinkChPrm->dataLayout = VCODEC_FIELD_SEPARATED;
pLinkChPrm->fieldMergeEncodeEnable = FALSE;
pLinkChPrm->enableAnalyticinfo = pChPrm->enableAnalyticinfo;
pLinkChPrm->enableWaterMarking = pChPrm->enableWaterMarking;
pLinkChPrm->maxBitRate = pChPrm->maxBitRate;
pLinkChPrm->encodingPreset = pChPrm->encodingPreset;
pLinkChPrm->rateControlPreset = pChPrm->rcType;
pLinkChPrm->enableSVCExtensionFlag = pChPrm->enableSVCExtensionFlag;
pLinkChPrm->numTemporalLayer = pChPrm->numTemporalLayer;
EncLink_ChDynamicParams *pLinkDynPrm = &pLinkChPrm->defaultDynamicParams;
VENC_CHN_DYNAMIC_PARAM_S *pDynPrm = &pChPrm->dynamicParam;
pLinkDynPrm->intraFrameInterval = pDynPrm->intraFrameInterval;
pLinkDynPrm->targetBitRate = pDynPrm->targetBitRate;
pLinkDynPrm->interFrameInterval = 1;
pLinkDynPrm->mvAccuracy = IVIDENC2_MOTIONVECTOR_QUARTERPEL;
printf("pDynPrm->targetBitRate:%d ....n", pDynPrm->targetBitRate);
printf("pDynPrm->inputFrameRate:%d ....n", pDynPrm->inputFrameRate);
pLinkDynPrm->inputFrameRate = pDynPrm->inputFrameRate;
pLinkDynPrm->rcAlg = pDynPrm->rcAlg;
pLinkDynPrm->qpMin = pDynPrm->qpMin;
pLinkDynPrm->qpMax = pDynPrm->qpMax;
pLinkDynPrm->qpInit = pDynPrm->qpInit;
pLinkDynPrm->vbrDuration = pDynPrm->vbrDuration;
pLinkDynPrm->vbrSensitivity = pDynPrm->vbrSensitivity;
]
#endif
encPrm.inQueParams.prevLinkId = ipcInVideoId;
encPrm.inQueParams.prevLinkQueId = 0;
encPrm.outQueParams.nextLink = gVencModuleContext.ipcBitsOutRTOSId;
/* IPC Bits Out Video M3 link */
ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkId = gVencModuleContext.encId;
ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
ipcBitsOutVideoPrm.baseCreateParams.outQueParams[0].nextLink = gVencModuleContext.ipcBitsInHLOSId;
MultiCh_ipcBitsInitCreateParams_BitsOutRTOS(&ipcBitsOutVideoPrm, TRUE);
/* IPC Bits In Host link */
ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkId = gVencModuleContext.ipcBitsOutRTOSId;
ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
MultiCh_ipcBitsInitCreateParams_BitsInHLOS(&ipcBitsInHostPrm);
以下为LOG信息
pDynPrm->targetBitRate:2000000 ....
pDynPrm->inputFrameRate:30 ....
[m3vpss ] 10079: CAPTURE: Create in progress !!!
[m3vpss ] 10117: CAPTURE: VIP0 PortA capture mode is [16-bit, Non-mux Embedded Sync] !!!
[m3vpss ] UTILS: DMA: Allocated CH (TCC) = 58 (58)
[m3vpss ] UTILS: DMA: 0 of 4: Allocated PaRAM = 58 (0x49004740)
[m3vpss ] UTILS: DMA: 1 of 4: Allocated PaRAM = 64 (0x49004800)
[m3vpss ] UTILS: DMA: 2 of 4: Allocated PaRAM = 65 (0x49004820)
[m3vpss ] UTILS: DMA: 3 of 4: Allocated PaRAM = 66 (0x49004840)
[m3video] 10289: IPC_IN_M3 : Create in progress !!!
[m3video] 10289: SYSTEM: Opening ListMP [VPSS-M3_IPC_OUT_0] ...
[m3vpss ] CAPTURE::HEAPID:0 USED:328
[m3video] 10290: SYSTEM: Opening ListMP [VPSS-M3_IPC_IN_0] ...
[m3vpss ] CAPTURE::HEAPID:4 USED:29030400
[m3video] 10293: IPC_IN_M3 : Create Done !!!
[m3vpss ] 10280: CAPTURE: Create Done !!!
[m3video] 10293: ENCODE: Create in progress ... !!!
[m3vpss ] 10285: DUP: 0: Format: INTERLACED , 1920 x 1080
[m3vpss ] 10287: DUP : Create Done !!!
[m3vpss ] 10287: IPC_OUT_M3 : Create in progress !!!
[m3vpss ] 10289: IPC_OUT_M3 : Create Done !!!
[m3video] 10324: ENCODE: Creating CH0 of 1920 x 1080, pitch = (1920, 1920) [INTERLACED ] [NON-TILED ], bitrate = 2000 Kbps, I-P Interval 1...
[m3video] 10417:!ERROR!:ENCLINK::links_m3video/iva_enc/encLink_h264.c:[576]::INTERNAL ERROR:-1
[m3video] ALGCONTROL FAILED:CMD:1
[m3video] ERROR: IH264ENC_LEVEL_INCOMPLAINT_PARAMETER , 0,
[m3video] 10417:!ERROR!:ENCLINK::links_m3video/iva_enc/encLink_h264.c:[587]::INTERNAL ERROR:0
[m3video] Ext Error :0
[m3video] EXT_ERROR: IH264ENC_EXTERROR_FRMRATE_NUMUNITSINTICKS = 37
[m3video] EXT_ERROR: IH264ENC_EXTERROR_LEVELLIMIT_RESOLUTION = 71