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.

Nsf rejects frames

Hello,

I add a nsfLink before encode 'sub-chain' in order to convert YUV422 to 420. However, sometimes, nsfLink rejects frames as below statistics. It seems the actual input frame rate is not fully matched to nfsLink's setting (I'm not sure). Could you give me the suggestion about how to avoid this problem? Thank you in advance.

p.s. I'm using RDK 3.0

[m3vpss ] *** [NSF1] NSF Statistics ***
[m3vpss ]
[m3vpss ] Elasped Time : 39 secs
[m3vpss ] Total Fields Processed : 112
[m3vpss ] Total Fields FPS : 108 FPS
[m3vpss ]
[m3vpss ]
[m3vpss ] CH    | In Recv In Reject In Process Out   User Out Out
[m3vpss ] Num | FPS       FPS        FPS            FPS Skip FPS Skip FPS
[m3vpss ] ------------------------------------------------
[m3vpss ] 0       | 26           23           2                 2              0         23

// nfs param setting
NsfLink_CreateParams_Init( &nsfPrm );

nsfPrm.bypassNsf = TRUE;
nsfPrm.inputFrameRate = 30 ;
nsfPrm.outputFrameRate = 30 ;
nsfPrm.tilerEnable = FALSE;

nsfPrm.numOutQue = 1;
nsfPrm.outQueParams[0].nextLink = ipcOutVpssId;

nsfPrm.numBufsPerCh = 6;

// chain

   |
NSF
   |
IPC OUT (M3)
   |
IPC IN (M3)
   |
Encode
   |
IPC BITS OUT (M3)
   |
IPC BITS IN (A8)

  • Reject FPS indicates NSF did not have output buffers because the nextLink is freeing frames at only 2 fps or it could be FID received in NSF is not in E 0 E 0 pattern if input to NSF is interlaced.It is more likely the first case where output buffers were not available.

  • hi badri,

        Sorry for my double confirm.

        did you mean "NSF did not have output buffers"  or "NSF did not have "enough" output buffers" ?

  • Hello, Bardri

    Does it mean encoder cannot encode data on time? Does enlarging encoder's buffer help?
    Below is my encoder settings. Could you help check if anything could be improved?
    Thank you very much.

    ipcOutVpssPrm.inQueParams.prevLinkId = gVcapModuleContext.nsfId ;

    ipcOutVpssPrm.inQueParams.prevLinkQueId = 0;
    ipcOutVpssPrm.numOutQue = 1;
    ipcOutVpssPrm.outQueParams[0].nextLink = ipcInVideoId;
    ipcOutVpssPrm.notifyNextLink = TRUE; // no sure TRUE or FALSE
    ipcOutVpssPrm.notifyPrevLink = TRUE;
    ipcOutVpssPrm.noNotifyMode = FALSE; // no sure TRUE or FALSE

    ipcInVideoPrm.inQueParams.prevLinkId = ipcOutVpssId ;
    ipcInVideoPrm.inQueParams.prevLinkQueId = 0;
    ipcInVideoPrm.numOutQue = 1;
    ipcInVideoPrm.outQueParams[0].nextLink = gVencModuleContext.encId;
    ipcInVideoPrm.notifyNextLink = TRUE;
    ipcInVideoPrm.notifyPrevLink = FALSE;
    ipcInVideoPrm.noNotifyMode = TRUE;

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

    ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkId = gVencModuleContext.ipcBitsOutRTOSId;
    ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
    //ipcBitsInHostPrm.baseCreateParams.numOutQue = 1;
    ipcBitsInHostPrm.baseCreateParams.outQueParams[0].nextLink = SYSTEM_LINK_ID_INVALID;

    MultiCh_ipcBitsInitCreateParams_BitsInHLOS( &ipcBitsInHostPrm );

    // set encoder
    encPrm.numBufPerCh[0] = 6; // D1
    encPrm.numBufPerCh[1] = 4; // CIF

    EncLink_ChCreateParams *pLinkChPrm;
    EncLink_ChDynamicParams *pLinkDynPrm;
    VENC_CHN_DYNAMIC_PARAM_S *pDynPrm;
    VENC_CHN_PARAMS_S *pChPrm;

    for( i = 0; i < gVencModuleContext.vencConfig.numPrimaryChn; i++ )
    {
    pLinkChPrm = &encPrm.chCreateParams[i];
    pLinkDynPrm = &pLinkChPrm->defaultDynamicParams;

    pChPrm = &gVencModuleContext.vencConfig.encChannelParams[i];
    pDynPrm = &pChPrm->dynamicParam;

    pLinkChPrm->format = IVIDEO_H264HP;
    pLinkChPrm->profile = gVencModuleContext.vencConfig.h264Profile[i];
    pLinkChPrm->dataLayout = IVIDEO_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;

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

    encPrm.inQueParams.prevLinkId = ipcInVideoId;
    encPrm.inQueParams.prevLinkQueId= 0;
    encPrm.outQueParams.nextLink = gVencModuleContext.ipcBitsOutRTOSId;

    // In addition, we add frame rate control to encoder in upper layer (demo code).

    VENC_CHN_DYNAMIC_PARAM_S params = { 0 };
    memset(&params, 0, sizeof(params));

    Venc_setInputFrameRate(0, 30 );

    params.frameRate = 30 ;
    Venc_setDynamicParam(0, 0, &params, VENC_FRAMERATE);

  • Pls attach your usecase file ,logs of usecase create and the full logs of Vsys_printDetailedStatistics .Make sure you have logs with Vsys_printDetailedStatistics invoked two times at atleast 1 min interval

  • Hi,

     

    Could you check if the enough number of output buffers are allocated for the Nsf link?

     

    Regards,

    Brijesh

  • Hello, Brijesh

    Sorry, could you give me clear instructions about checking output buffer of Nsf? Do I need to check source code or debug message?

    Thank you very much. 

  • Hello CJ,

     

    Nsf Link has create time parameters, one of them is used for specifying the number of output buffers to be allocated, If this number is verly less, in that case also, nsf will drop the frames or skip the frames, could you please this variable is set correctly?

     

    Regards,

    Brijesh 

  • Hello, Brijesh

    The nsf's buffer number is 6 by printing the parameter in vpss (nsfLink_drv.c). In addition, encLink's buffer number is 6. 

    nsfPrm.numBufsPerCh = 6;

    encPrm.numBufPerCh[0] = 6;

    I notice that the maximum number of buffer is 7 and I have tried 7, but still got failed result (nsf rejects frames), sometimes. 

    Is there anything I need to check? Thank you very much.

  • As I mentioned:

    Pls attach your usecase file ,logs of usecase create and the full logs of Vsys_printDetailedStatistics .Make sure you have logs with Vsys_printDetailedStatistics invoked two times at atleast 1 min interval