This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320DM8168: h264 enclink report error

Part Number: TMS320DM8168
Other Parts Discussed in Thread: TVP5158

i am using an chain as : capture -> ipcvpssout ->ipcvideoin -> enclink (h264hp)

and get enclink report error . i didn't find how to make the usecases work , can you help to analyse the log , and also help to establish env to make usecase code work(this will be great help ).

such as :tl-mcfw-rdk-1.3/dvr_rdk/mcfw/src_linux/mcfw_api/usecases/ti816x/ multich_interlaced_vcap_venc_vdec_vdis.c

ThreadName:IpcBitsInLink_periodicTaskFxn_3000001a,ThreadID:1146
Display frames... POSITION:4
[m3video] 69178:!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
[m3video] 69179:!ERROR!:ENCLINK::links_m3video/iva_enc/encLink_h264.c:[587]::INTERNAL ERROR:0
[m3video] Ext Error :20
[m3video] EXT_ERROR: IH264ENC_EXTERROR_CONTROLCALL_CMD = 5
[m3video] EXT_ERROR: IH264ENC_EXTERROR_HANDLE_BUFDESCRIPTORS_PTRNULL = 39
[m3video] EXT_ERROR: IH264ENC_EXTERROR_STEREO_PRESET = 130
[m3video] EXT_ERROR: IH264ENC_EXTERROR_VERSION_BUFFER_NULL_OR_SIZE = 131
[m3video] EXT_ERROR: IH264ENC_EXTERROR_VUI_NUMUNITSINTICKS = 132
[m3video] EXT_ERROR: IH264ENC_EXTERROR_VUI_PRESET = 133
[m3video] EXT_ERROR: .x.
[m3video] 69180:!ERROR!:ENCLINK::links_m3video/iva_enc/encLink_h264.c:[587]::INTERNAL ERROR:0
[m3video] Ext Error :80
[m3video] EXT_ERROR: IH264ENC_EXTERROR_CREATE_GOPSTRUCT_LOG2MAX_INTRAINTERVAL = 7
[m3video] EXT_ERROR: IH264ENC_EXTERROR_RATECTRL_BFRAMEPICSIZE = 98
[m3video] EXT_ERROR: IH264ENC_EXTERROR_RATECTRL_CBCRQPINDEX_INITBUFLVL = 99
[m3video] EXT_ERROR: IH264ENC_EXTERROR_RATECTRL_HRDBUFFER_LVLEXCEED = 100
[m3video] EXT_ERROR: IH264ENC_EXTERROR_RATECTRL_IFRAME_QP = 101
[m3video] EXT_ERROR: IH264ENC_EXTERROR_SCLMATRIX_METADATA = 104
[m3video] EXT_ERROR: IH264ENC_EXTERROR_STATUS_SIZE = 128
[m3video] EXT_ERROR: IH264ENC_EXTERROR_STEREO_INPCONTENT = 129
[m3video] 69182:!ERROR!:ENCLINK::links_m3video/iva_enc/encLink_h264.c:[587]::INTERNAL ERROR:0
[m3video] Ext Error :0
[m3video] EXT_ERROR: IH264ENC_EXTERROR_INTRA_REFRESHRATE = 66
[m3video] EXT_ERROR: IH264ENC_EXTERROR_IVAHD_BADRESET = 67
[m3video] EXT_ERROR: IH264ENC_EXTERROR_IVAHD_BADSTATE = 68
[m3video] EXT_ERROR: IH264ENC_EXTERROR_IVAHD_RELEASE = 69
[m3video] EXT_ERROR: IH264ENC_EXTERROR_LOOPFILTER_OFFST_LFIDC = 72
[m3video] EXT_ERROR: IH264ENC_EXTERROR_PROFILE_DATASYNC_INPCONTENT_RES = 96
[m3video] EXT_ERROR: IH264ENC_EXTERROR_PROFILE_INPCONTENT = 97
[m3video] EXT_ERROR: IH264ENC_EXTERROR_STATUS_SIZE = 128
[m3video] EXT_ERROR: IH264ENC_EXTERROR_STEREO_PRESET = 130
[m3video] 69184:!ERROR!:ENCLINK::links_m3video/iva_enc/encLink_h264.c:[587]::INTERNAL ERROR:0
[m3video] Ext Error :0
[m3video] EXT_ERROR: IH264ENC_EXTERROR_FMO_PRESET = 34
[m3video] EXT_ERROR: IH264ENC_EXTERROR_FRMPACKING_PRESET = 35
[m3video] EXT_ERROR: IH264ENC_EXTERROR_FRMPACKING_TYPE_INPCONTENT = 36
[m3video] EXT_ERROR: IH264ENC_EXTERROR_FRMRATE_NUMUNITSINTICKS = 37
[m3video] EXT_ERROR: IH264ENC_EXTERROR_HIGHSPEED_BFARME = 40
[m3video] EXT_ERROR: IH264ENC_EXTERROR_INTRA_REFRESHMETHOD = 64
[m3video] EXT_ERROR: IH264ENC_EXTERROR_INTRA_REFRESHMETHOD_RATE = 65
[m3video] EXT_ERROR: IH264ENC_EXTERROR_PROFILE_DATASYNC_INPCONTENT_RES = 96
[m3video] EXT_ERROR: IH264ENC_EXTERROR_RATECTRL_BFRAMEPICSIZE = 98
[m3video] EXT_ERROR: IH264ENC_EXTERROR_VERSION_BUFFER_NULL_OR_SIZE = 131
[m3video] EXT_ERROR: IH264ENC_EXTERROR_VUI_NUMUNITSINTICKS = 132
[m3video] EXT_ERROR: IH264ENC_EXTERROR_VUI_PRESET = 133
[m3video] EXT_ERROR:

  • Hi,

    Can you share the below:

    1. Encoder & Decoder versions.

    2. All the Encoder parameters used.

    3. Can you give more details on your use-case, depending upon that I can suggest few parameter settings which suits you.

  • this is the code i am using . where can i find the version for encoder & decoder ?

    #include <stdbool.h>
    #include <signal.h>

    #include "osa.h"
    #include "ti_vsys.h"
    #include "ti_vcap.h"
    #include "ti_vdis.h"

    #include "mcfw/src_linux/mcfw_api/usecases/multich_common.h"
    #include "mcfw/src_linux/mcfw_api/usecases/multich_ipcbits.h"
    #include "mcfw/interfaces/link_api/system_tiler.h"

    //#define CAP_DEV_TVP5158
    #define CH_NUM 1
    #define NUM_CAPTURE_DEVICES 1

    static void mcfw_chain_init(UInt32 scaleWidth, UInt32 scaleHeight);
    static void mcfw_chain_deinit();
    Void BitsSaver_create(Int channels, Char *f_ext);
    Void BitsSaver_delete();

    static SystemVideo_Ivahd2ChMap_Tbl systemVid_encDecIvaChMapTbl = {
    .isPopulated = 1,
    .ivaMap[0] =
    {
    .EncNumCh = CH_NUM,
    .EncChList = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 , 14, 15},
    .DecNumCh = 0,
    .DecChList = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 , 14, 15},
    },
    };
    /* signal handle for ctrl + c */
    volatile bool g_quit = false;
    static void sig_handle(int signo) {
    printf("recived quit signal\n");
    g_quit = true;
    }

    int main(int argc, char **argv) {
    //if (argc != 3) {
    // printf("Usage: %s <scale width> <scale height>\n", argv[0]);
    // exit(1);
    //}
    //UInt32 scaleWidth = atoi(argv[1]);
    //UInt32 scaleHeight = atoi(argv[2]);

    signal(SIGINT, sig_handle);

    /* init System, Capture and Display Module */
    VSYS_PARAMS_S prms_sys;
    VCAP_PARAMS_S prms_vcap;
    VENC_PARAMS_S prms_venc;
    VDIS_PARAMS_S prms_vdis;
    Vsys_params_init(&prms_sys);
    Vcap_params_init(&prms_vcap);
    Venc_params_init(&prms_venc);
    Vdis_params_init(&prms_vdis);

    prms_vdis.enableConfigExtVideoEncoder = FALSE;

    Vsys_init(&prms_sys);
    Vcap_init(&prms_vcap);
    Venc_init(&prms_venc);
    Vdis_init(&prms_vdis);

    BitsSaver_create(1, "h264");

    Vsys_configureDisplay(); // configure display

    /* construct capture and display chain */
    //MultiCh_createHDSDIDVR();
    mcfw_chain_init(800,600);//scaleWidth, scaleHeight);

    /* make chain start working */
    printf("Display frames... POSITION:4\n");
    Vdis_start();
    printf("Display frames... POSITION:5\n");
    Venc_start();
    printf("Display frames... POSITION:6\n");
    Vdec_start();
    printf("Display frames... POSITION:7\n");
    Vcap_start();
    printf("Display frames... POSITION:8\n");

    /* wait ctrl + c */
    while (! g_quit) {
    printf("Display frames... CTRL+C\n");
    sleep(10);
    }

    /* stop working and deinit */
    Vcap_stop();
    Venc_stop();
    Vdis_stop();

    BitsSaver_delete();
    mcfw_chain_deinit();

    Vsys_deConfigureDisplay();

    Vcap_exit();
    Venc_exit();
    Vdis_exit();
    Vsys_exit();

    return 0;
    }

    static void mcfw_chain_init(UInt32 scaleWidth, UInt32 scaleHeight) {
    UInt32 i;

    UInt32 captureId,deiId0,deiId1,vpssOutId,videoInId,encId;

    IpcLink_CreateParams ipcInVideoPrm;
    IpcLink_CreateParams ipcOutVpssPrm;


    MULTICH_INIT_STRUCT(IpcLink_CreateParams,ipcOutVpssPrm);
    MULTICH_INIT_STRUCT(IpcLink_CreateParams,ipcInVideoPrm);

    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);

    // initialize enc
    EncLink_CreateParams encPrm;
    IpcBitsOutLinkRTOS_CreateParams ipcBitsOutVideoPrm;
    IpcBitsInLinkHLOS_CreateParams ipcBitsInHostPrm;

    SystemTiler_disableAllocator();

    gVencModuleContext.encId = SYSTEM_LINK_ID_VENC_0;
    encId = gVencModuleContext.encId;
    gVencModuleContext.ipcBitsOutRTOSId = SYSTEM_VIDEO_LINK_ID_IPC_BITS_OUT_0;
    gVencModuleContext.ipcBitsInHLOSId = SYSTEM_HOST_LINK_ID_IPC_BITS_IN_0;

    /* chain: CAPTURE -> DEI -> DISPLAY */
    gVcapModuleContext.captureId = SYSTEM_LINK_ID_CAPTURE;
    captureId = gVcapModuleContext.captureId;
    gVcapModuleContext.deiId[0] = SYSTEM_LINK_ID_DEI_0;
    deiId0 = gVcapModuleContext.deiId[0];
    // gVcapModuleContext.deiId[1] = SYSTEM_LINK_ID_DEI_HQ_0;
    // deiId1 = gVcapModuleContext.deiId[1];
    //gVdisModuleContext.displayId[0] = SYSTEM_LINK_ID_DISPLAY_0;

    vpssOutId = SYSTEM_VPSS_LINK_ID_IPC_OUT_M3_0;
    videoInId = SYSTEM_VIDEO_LINK_ID_IPC_IN_M3_0;

    /* capture link init */
    CaptureLink_CreateParams prm_capture;
    CaptureLink_CreateParams_Init(&prm_capture);
    //prm_capture.outQueParams[0].nextLink = gVcapModuleContext.deiId[0];
    prm_capture.outQueParams[0].nextLink = vpssOutId;
    prm_capture.numVipInst = 1;
    prm_capture.tilerEnable = FALSE;
    prm_capture.numBufsPerCh = 8;
    prm_capture.maxBlindAreasPerCh = 4;
    prm_capture.isPalMode = Vcap_isPalMode();

    #if ! defined CAP_DEV_TVP5158
    prm_capture.doCropInCapture = FALSE;
    prm_capture.enableSdCrop = FALSE;
    #endif

    /* capture instance init */
    CaptureLink_VipInstParams *prm_cap_inst = &prm_capture.vipInst[0];
    prm_cap_inst->vipInstId = (SYSTEM_CAPTURE_INST_VIP0_PORTA + 0 ) % SYSTEM_CAPTURE_INST_MAX;
    prm_cap_inst->inDataFormat = SYSTEM_DF_YUV422P;
    prm_cap_inst->numOutput = 1;

    #if ! defined CAP_DEV_TVP5158
    prm_cap_inst->standard = SYSTEM_STD_1080P_60;
    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;
    #else
    prm_cap_inst->videoDecoderId = SYSTEM_DEVICE_VID_DEC_TVP5158_DRV;
    prm_cap_inst->standard = SYSTEM_STD_MUX_4CH_D1; // set input mode as 4 input with D1 resolution
    #endif

    /* capture out init */
    CaptureLink_OutParams *prm_cap_out = &prm_cap_inst->outParams[0];
    prm_cap_out->dataFormat = SYSTEM_DF_YUV420SP_UV;;
    // prm_cap_out->dataFormat = SYSTEM_DF_YUV422I_YUYV;
    prm_cap_out->scEnable = FALSE;
    prm_cap_out->scOutWidth = 0;
    prm_cap_out->scOutHeight = 0;
    prm_cap_out->outQueId = 0;

    NsfLink_CreateParams prm_nsf;
    MULTICH_INIT_STRUCT(NsfLink_CreateParams, prm_nsf);
    prm_nsf.bypassNsf = FALSE;
    prm_nsf.tilerEnable = FALSE;
    prm_nsf.inQueParams.prevLinkId = gVcapModuleContext.captureId;
    prm_nsf.inQueParams.prevLinkQueId= 0;
    prm_nsf.numOutQue = 1;
    prm_nsf.outQueParams[0].nextLink = gVcapModuleContext.deiId[0];


    /* De-Interleave link init
    DeiLink_CreateParams prm_dei;
    MULTICH_INIT_STRUCT(DeiLink_CreateParams, prm_dei);

    prm_dei.inQueParams.prevLinkId = gVcapModuleContext.captureId;
    prm_dei.inQueParams.prevLinkQueId = 0;
    // Set the scale parameters.
    prm_dei.outScaleFactor[DEI_LINK_OUT_QUE_DEI_SC][0].scaleMode = DEI_SCALE_MODE_ABSOLUTE;
    prm_dei.outScaleFactor[DEI_LINK_OUT_QUE_DEI_SC][0].absoluteResolution.outWidth = 800;
    prm_dei.outScaleFactor[DEI_LINK_OUT_QUE_DEI_SC][0].absoluteResolution.outHeight = 600;
    for (i=1; i < DEI_LINK_MAX_CH; i++)
    prm_dei.outScaleFactor[DEI_LINK_OUT_QUE_DEI_SC][i] = prm_dei.outScaleFactor[DEI_LINK_OUT_QUE_DEI_SC][0];

    prm_dei.enableOut[DEI_LINK_OUT_QUE_DEI_SC] = TRUE;
    // prm_dei.outQueParams[DEI_LINK_OUT_QUE_DEI_SC].nextLink = gVencModuleContext.encId;
    prm_dei.outQueParams[DEI_LINK_OUT_QUE_DEI_SC].nextLink = vpssOutId;
    prm_dei.comprEnable = FALSE;
    prm_dei.setVipScYuv422Format = FALSE;
    printf("Display frames... POSITION:0\n");
    #if ! defined CAP_DEV_TVP5158
    prm_dei.enableDeiForceBypass = TRUE;
    #endif
    */
    /* ipc out vpss link */
    ipcOutVpssPrm.inQueParams.prevLinkId = captureId;
    //ipcOutVpssPrm.inQueParams.prevLinkId = deiId;
    ipcOutVpssPrm.inQueParams.prevLinkQueId = 0;
    ipcOutVpssPrm.notifyNextLink = TRUE;
    ipcOutVpssPrm.notifyPrevLink = TRUE;
    ipcOutVpssPrm.numOutQue = 1;
    ipcOutVpssPrm.outQueParams[0].nextLink = videoInId;

    /* ipc out video link */
    ipcInVideoPrm.inQueParams.prevLinkId = vpssOutId;
    ipcInVideoPrm.inQueParams.prevLinkQueId = 0;
    ipcInVideoPrm.outQueParams[0].nextLink = encId;
    ipcInVideoPrm.notifyNextLink = TRUE;
    ipcInVideoPrm.notifyPrevLink = TRUE;
    ipcInVideoPrm.numOutQue = 1;

    /* Encode link */
    EncLink_CreateParams_Init(&encPrm);
    encPrm.numBufPerCh[0] = 4;
    for (i = 0; i < CH_NUM; i++) {
    EncLink_ChCreateParams *pLinkChPrm = &encPrm.chCreateParams[i];

    VENC_CHN_PARAMS_S *pChPrm = &gVencModuleContext.vencConfig.encChannelParams[i];
    pLinkChPrm->format = IVIDEO_H264HP;
    pLinkChPrm->profile = gVencModuleContext.vencConfig.h264Profile[i];
    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;
    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;
    }
    //prm_capture.outQueParams[0].nextLink = gVcapModuleContext.deiId[0];
    encPrm.inQueParams.prevLinkId = videoInId;//SYSTEM_VIDEO_LINK_ID_IPC_FRAMES_IN_0;
    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.numOutQue = 1;
    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);

    /* Display link init
    DisplayLink_CreateParams prm_dis;
    MULTICH_INIT_STRUCT(DisplayLink_CreateParams, prm_dis);
    prm_dis.inQueParams[0].prevLinkId = gVcapModuleContext.deiId[0];
    prm_dis.inQueParams[0].prevLinkQueId = DEI_LINK_OUT_QUE_DEI_SC;
    prm_dis.displayRes = VSYS_STD_1080P_60;
    */

    /* create link */
    System_linkCreate(gVcapModuleContext.captureId, &prm_capture, sizeof(prm_capture));
    //System_linkCreate(gVcapModuleContext.deiId[0], &prm_dei, sizeof(prm_dei));
    System_linkCreate(vpssOutId, &ipcOutVpssPrm, sizeof(ipcOutVpssPrm));
    System_linkCreate(videoInId, &ipcInVideoPrm, sizeof(ipcInVideoPrm));
    System_linkCreate(gVencModuleContext.encId, &encPrm, sizeof(encPrm));
    System_linkCreate(gVencModuleContext.ipcBitsOutRTOSId, &ipcBitsOutVideoPrm, sizeof(ipcBitsOutVideoPrm));
    System_linkCreate(gVencModuleContext.ipcBitsInHLOSId, &ipcBitsInHostPrm, sizeof(ipcBitsInHostPrm));
    //System_linkCreate(gVdisModuleContext.displayId[0], &prm_dis, sizeof(prm_dis));

    /* setting frames from which channel should be display */
    //DisplayLink_SwitchChannelParams prm_switch_ch;
    //prm_switch_ch.activeChId = 0;
    //System_linkControl(gVdisModuleContext.displayId[0], DISPLAY_LINK_CMD_SWITCH_CH, &prm_switch_ch, sizeof(prm_switch_ch), TRUE);
    }

    static void mcfw_chain_deinit() {
    System_linkDelete(gVcapModuleContext.captureId);
    //System_linkDelete(gVcapModuleContext.deiId[0]);
    System_linkDelete(gVencModuleContext.encId);
    System_linkDelete(gVencModuleContext.ipcBitsOutRTOSId);
    System_linkDelete(gVencModuleContext.ipcBitsInHLOSId);
    //System_linkDelete(gVdisModuleContext.displayId[0]);

    /* Print the HWI, SWI and all tasks load */
    /* Reset the accumulated timer ticks */
    MultiCh_prfLoadCalcEnable(FALSE, TRUE, FALSE);

    SystemTiler_enableAllocator();
    }
  • Hi,

    Can you set these params and try at ur side?3821.Sample_Encoder_cofig_parameters.cfg

    dakai zhou said:
    where can i find the version for encoder & decoder ?

    Version numbers will be there in the Release notes.

  • Hi,
    If the issue is resolved please close this thread.