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.

a strange problem

Hi, we use DM8168, RDK 4.0.

When create the DEI link, if I set absoluteResolution. outWidth and absoluteResolution. outHeight to 1920x1080,  and the call System_linkControl(DEI_LINK_CMD_SET_OUTPUTRESOLUTION) to reset the resolution to 352x288, the image is OK.

If I set absoluteResolution. outWidth and absoluteResolution. outHeight to 352x288, and then call System_linkControl to reset the resolution to 352x288, the image is cut to 352x288.

Buf  if I set the absoluteResolution. outWidth and absoluteResolution. outHeight to 1280x720, and then call System_linkControl to reset the resolution to 1280x720, the image is OK.

What's the problem?

  • In the case

     

    ketty Lu said:
    If I set absoluteResolution. outWidth and absoluteResolution. outHeight to 352x288, and then call System_linkControl to reset the resolution to 352x288, the image is cut to 352x288

    do you mean instead of image being scaled to 352x288 image is cropped to 352x288 ?

     

    The create time absoluteResolution also  determines the output buffer allocation so you should set the create time absoluteResolution to the max output resolution you require in your usecase

     

  • Hi, Badri.

    Yes, the image is  cropped to 352x288. If I init to 1280x720, the image is scaled to 352x288.

    I set the dei Resolution with 1920x1080 at the create time.

    And then call System_linkControl to reset the resolution to 352x288,  it will be scaled.

    But if I dynamicly change the capture input resolution, the image after dei Link is cut?

    Can you help me?

  • It is not clear what the issue is. Pls explain the exact sequence of link API cmds and link create params under which you see the issue. When you change capture resolution are you invoking the CAPTURE_LINK_CMD_SET_RESOLUTION to set the correct resolution ?

    What is the initial capture resolution and what is the dynamically changed resolution

  • I create 2 channel. The dataflow is

     

    I set the dei resolution with rate 1:1, and call DEI_LINK_CMD_SET_OUTPUTRESOLUTION to set the smaller resolution, this is OK.

    But if I another change the capture input resolution with CAPTURE_LINK_CMD_SET_RESOLUTION, the resolution after dei is cut.

  • Hi, Badri.

    Can you give some advice ?

    I need your help.

    Thanks.

  • Are you actually changing camera source to output smaller resolution or are you just invoking  CAPTURE_LINK_CMD_SET_RESOLUTION ? It looks like you are invoking CAPTURE_LINK_CMD_SET_RESOLUTION without changing the camera source resolution.CAPTURE_LINK_CMD_SET_RESOLUTION doesn't do anything to changes the frame resolution. It only informs the next link about the resolution.

  • Hi, Badri.

    I'm sure I change the video source, because I write the channel 0(capture->dup->encode) to file, the file resolution has changed.

    After I change the source resolution, I call the CAPTURE_LINK_CMD_SET_RESOLUTION .

    The channel 0 is normal.

    But the channel 1(capture->dup->dei->encode) is not normal.

  • Which is the DEI LINK ID you are using.Attach your usecase file

  • Void multich_VcapVencCreate()
    {
        CaptureLink_CreateParams    capturePrm;			
        DeiLink_CreateParams        deiPrm[MAX_DEI_LINK];
        MergeLink_CreateParams      mergePrm[NUM_MERGE_LINK];
        DupLink_CreateParams        dupPrm[NUM_DUP_LINK];
    
        IpcLink_CreateParams        ipcOutVpssPrm;
        IpcLink_CreateParams        ipcInVpssPrm;
        IpcLink_CreateParams        ipcOutVideoPrm;
        IpcLink_CreateParams        ipcInVideoPrm;
        EncLink_CreateParams        encPrm;
        IpcBitsOutLinkHLOS_CreateParams   ipcBitsOutHostPrm;
        IpcBitsOutLinkRTOS_CreateParams   ipcBitsOutVideoPrm;
        IpcBitsInLinkHLOS_CreateParams    ipcBitsInHostPrm[2];
        IpcBitsInLinkRTOS_CreateParams    ipcBitsInVideoPrm;
        CaptureLink_VipInstParams         *pCaptureInstPrm;
        CaptureLink_OutParams             *pCaptureOutPrm;
    
        System_LinkInfo                   bitsProducerLinkInfo;
        UInt32 mergeId[NUM_MERGE_LINK];
        UInt32 dupId[NUM_DUP_LINK];
        UInt32 ipcOutVpssId, ipcInVpssId;
        UInt32 ipcOutVideoId, ipcInVideoId;
        UInt32 vipInstId;
        UInt32 i;
    
        MULTICH_INIT_STRUCT(IpcLink_CreateParams,ipcOutVpssPrm);
        MULTICH_INIT_STRUCT(IpcLink_CreateParams,ipcInVpssPrm);
        MULTICH_INIT_STRUCT(IpcLink_CreateParams,ipcOutVideoPrm);
        MULTICH_INIT_STRUCT(IpcLink_CreateParams,ipcInVideoPrm);
        MULTICH_INIT_STRUCT(IpcBitsOutLinkHLOS_CreateParams,ipcBitsOutHostPrm);
        MULTICH_INIT_STRUCT(IpcBitsOutLinkRTOS_CreateParams,ipcBitsOutVideoPrm);
        MULTICH_INIT_STRUCT(IpcBitsInLinkHLOS_CreateParams,ipcBitsInHostPrm[0]);
        MULTICH_INIT_STRUCT(IpcBitsInLinkHLOS_CreateParams,ipcBitsInHostPrm[1]);
        MULTICH_INIT_STRUCT(IpcBitsInLinkRTOS_CreateParams,ipcBitsInVideoPrm);
        MULTICH_INIT_STRUCT(EncLink_CreateParams, encPrm);
    
        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
                    );
    
    
        //DSP OSD				
        gVcapModuleContext.ipcFramesOutVpssId[0] = SYSTEM_VPSS_LINK_ID_IPC_FRAMES_OUT_0;	
        gVcapModuleContext.ipcFramesInDspId[0] = SYSTEM_DSP_LINK_ID_IPC_FRAMES_IN_0;		
        gVcapModuleContext.dspAlgId[0] = SYSTEM_LINK_ID_ALG_0;
    
        gVcapModuleContext.captureId    = SYSTEM_LINK_ID_CAPTURE;
        gVcapModuleContext.nsfId[0]     = SYSTEM_LINK_ID_NSF_0;
        gVcapModuleContext.nsfId[1]     = SYSTEM_LINK_ID_NSF_1;
        gVcapModuleContext.sclrId[0]       = SYSTEM_LINK_ID_SCLR_INST_0;
        gVcapModuleContext.ipcBitsInHLOSId       = SYSTEM_HOST_LINK_ID_IPC_BITS_IN_0;
        gVcapModuleContext.deiId[0]     = SYSTEM_LINK_ID_DEI_HQ_0;
        gVcapModuleContext.deiId[1]     = SYSTEM_LINK_ID_DEI_HQ_1;
        //add for encode at 2013.07.25
        gVcapModuleContext.deiId[2]     = SYSTEM_LINK_ID_DEI_0;
        /*end add */
        gVencModuleContext.encId        = SYSTEM_LINK_ID_VENC_0;
        gVdecModuleContext.decId        = SYSTEM_LINK_ID_VDEC_0;
    
        mergeId[SC_DEI_MERGE_LINK_IDX] = SYSTEM_VPSS_LINK_ID_MERGE_0;
        dupId[CAPTURE_MERGE_DUP_LINK_IDX]     = SYSTEM_VPSS_LINK_ID_DUP_0;  // modify  at 2013.07.22
        ipcOutVpssId = SYSTEM_VPSS_LINK_ID_IPC_OUT_M3_0;
        ipcInVideoId = SYSTEM_VIDEO_LINK_ID_IPC_IN_M3_0;
        ipcOutVideoId= SYSTEM_VIDEO_LINK_ID_IPC_OUT_M3_0;
        ipcInVpssId  = SYSTEM_VPSS_LINK_ID_IPC_IN_M3_0;
        gVencModuleContext.ipcBitsOutRTOSId  = SYSTEM_VIDEO_LINK_ID_IPC_BITS_OUT_0;
        gVencModuleContext.ipcBitsInHLOSId   = SYSTEM_HOST_LINK_ID_IPC_BITS_IN_1;
    
        CaptureLink_CreateParams_Init(&capturePrm);
        capturePrm.outQueParams[0].nextLink   = dupId[CAPTURE_MERGE_DUP_LINK_IDX];
        capturePrm.numVipInst                 = 1; //4;
        capturePrm.tilerEnable                = FALSE;
        capturePrm.numBufsPerCh               = 9;
        capturePrm.numExtraBufs               = 6;
        capturePrm.maxBlindAreasPerCh         = 4;
        capturePrm.enableSdCrop               = FALSE;
        if (IsVgaMode()) capturePrm.doVtronVgaCapture=true;
        gVcapModuleContext.vcapConfig.enableConfigExtVideoDecoder = FALSE;
    
        for(vipInstId=0; vipInstId<capturePrm.numVipInst; vipInstId++)
        {
            pCaptureInstPrm                     = &capturePrm.vipInst[vipInstId];
            pCaptureInstPrm->vipInstId          = (SYSTEM_CAPTURE_INST_VIP0_PORTA+
    			                                        vipInstId)%SYSTEM_CAPTURE_INST_MAX;
            pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422P;                      
            pCaptureInstPrm->standard           = SYSTEM_STD_1080P_60;
            pCaptureInstPrm->numOutput          = 1;
            pCaptureOutPrm                      = &pCaptureInstPrm->outParams[0];
            pCaptureOutPrm->dataFormat          = SYSTEM_DF_YUV420SP_UV;
            pCaptureOutPrm->scEnable            = FALSE;
            pCaptureOutPrm->scOutWidth          = 0;
            pCaptureOutPrm->scOutHeight         = 0;
            pCaptureOutPrm->outQueId          = 0;
        }
        
        dupPrm[CAPTURE_MERGE_DUP_LINK_IDX].notifyNextLink = TRUE;
        dupPrm[CAPTURE_MERGE_DUP_LINK_IDX].inQueParams.prevLinkId = gVcapModuleContext.captureId;
        dupPrm[CAPTURE_MERGE_DUP_LINK_IDX].inQueParams.prevLinkQueId = 0;
    
        /* modify by gao han at 2013.07.22 */
        dupPrm[CAPTURE_MERGE_DUP_LINK_IDX].numOutQue = 2;
        dupPrm[CAPTURE_MERGE_DUP_LINK_IDX].outQueParams[0].nextLink = gVcapModuleContext.deiId[0];
        dupPrm[CAPTURE_MERGE_DUP_LINK_IDX].outQueParams[1].nextLink = mergeId[SC_DEI_MERGE_LINK_IDX];
    
        for(i=0; i< 1; i++)
        {
            DeiLink_CreateParams_Init(&deiPrm[i]);
            deiPrm[i].inQueParams.prevLinkId                   = dupId[CAPTURE_MERGE_DUP_LINK_IDX];
            deiPrm[i].inQueParams.prevLinkQueId                = i;
            deiPrm[i].outScaleFactor[DEI_LINK_OUT_QUE_VIP_SC][0].scaleMode = DEI_SCALE_MODE_ABSOLUTE;
            deiPrm[i].outScaleFactor[DEI_LINK_OUT_QUE_VIP_SC][0].absoluteResolution. outWidth  = 1920;
            deiPrm[i].outScaleFactor[DEI_LINK_OUT_QUE_VIP_SC][0].absoluteResolution. outHeight = 1080;
    
            deiPrm[i].enableOut[DEI_LINK_OUT_QUE_VIP_SC]             = TRUE;
            deiPrm[i].outQueParams[DEI_LINK_OUT_QUE_VIP_SC].nextLink = mergeId[SC_DEI_MERGE_LINK_IDX];
            deiPrm[i].inputFrameRate[DEI_LINK_OUT_QUE_VIP_SC]        = 60;
            deiPrm[i].outputFrameRate[DEI_LINK_OUT_QUE_VIP_SC]       = 60;
            deiPrm[i].comprEnable                                   = FALSE;
            deiPrm[i].setVipScYuv422Format                          = FALSE;
            deiPrm[i].enableDeiForceBypass                          = TRUE;
        }                         
     
        mergePrm[SC_DEI_MERGE_LINK_IDX].numInQue = 2;
        mergePrm[SC_DEI_MERGE_LINK_IDX].inQueParams[0].prevLinkId = gVcapModuleContext.deiId[0];
        mergePrm[SC_DEI_MERGE_LINK_IDX].inQueParams[0].prevLinkQueId = DEI_LINK_OUT_QUE_VIP_SC;
        mergePrm[SC_DEI_MERGE_LINK_IDX].inQueParams[1].prevLinkId = dupId[CAPTURE_MERGE_DUP_LINK_IDX];
        mergePrm[SC_DEI_MERGE_LINK_IDX].inQueParams[1].prevLinkQueId = 1;
        mergePrm[SC_DEI_MERGE_LINK_IDX].outQueParams.nextLink        = ipcOutVpssId;
        mergePrm[SC_DEI_MERGE_LINK_IDX].notifyNextLink               = TRUE;
    
        ipcOutVpssPrm.inQueParams.prevLinkId    = mergeId[SC_DEI_MERGE_LINK_IDX];
        ipcOutVpssPrm.inQueParams.prevLinkQueId = 0;
        ipcOutVpssPrm.outQueParams[0].nextLink  = ipcInVideoId;
        ipcOutVpssPrm.notifyNextLink            = FALSE;
        ipcOutVpssPrm.notifyPrevLink            = TRUE;
        ipcOutVpssPrm.noNotifyMode              = TRUE;
    
        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;
    
        encPrm.numBufPerCh[0] = 6; //D1
        encPrm.numBufPerCh[1] = 6; //CIF
    
        {
            EncLink_ChCreateParams *pLinkChPrm;
            EncLink_ChDynamicParams *pLinkDynPrm;
            VENC_CHN_DYNAMIC_PARAM_S *pDynPrm;
            VENC_CHN_PARAMS_S *pChPrm;
    
            /* Primary Stream Params - D1 */
            for (i=0; i< VCAP_VENC_CHN_MAX/*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              = 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->enableHighSpeed         = TRUE;
                pLinkChPrm->enableSVCExtensionFlag  = pChPrm->enableSVCExtensionFlag;
                pLinkChPrm->numTemporalLayer        = pChPrm->numTemporalLayer;
    
                pLinkDynPrm->targetFrameRate        = pDynPrm->frameRate; //
                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;
        }
    
        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[0].baseCreateParams.inQueParams.prevLinkId    = gVencModuleContext.ipcBitsOutRTOSId;
        ipcBitsInHostPrm[0].baseCreateParams.inQueParams.prevLinkQueId = 0;
        ipcBitsInHostPrm[0].baseCreateParams.numOutQue                 = 1;
        ipcBitsInHostPrm[0].baseCreateParams.outQueParams[0].nextLink   = SYSTEM_LINK_ID_INVALID;
        MultiCh_ipcBitsInitCreateParams_BitsInHLOS(&ipcBitsInHostPrm[0]);
    
        System_linkCreate (gVcapModuleContext.captureId, &capturePrm, sizeof(capturePrm));
        System_linkCreate(dupId[CAPTURE_MERGE_DUP_LINK_IDX], &dupPrm[CAPTURE_MERGE_DUP_LINK_IDX], sizeof(dupPrm[CAPTURE_MERGE_DUP_LINK_IDX]));
    		
        for(i=0; i< 1; i++)
        {
            System_linkCreate(gVcapModuleContext.deiId[i]  , &deiPrm[i], sizeof(deiPrm[i]));
        }
    
        System_linkCreate(mergeId[SC_DEI_MERGE_LINK_IDX], &mergePrm[SC_DEI_MERGE_LINK_IDX], sizeof(mergePrm[SC_DEI_MERGE_LINK_IDX]));
        System_linkCreate(ipcOutVpssId , &ipcOutVpssPrm , sizeof(ipcOutVpssPrm) );
        System_linkCreate(ipcInVideoId , &ipcInVideoPrm , sizeof(ipcInVideoPrm) );
        System_linkCreate(gVencModuleContext.encId, &encPrm, sizeof(encPrm));
        System_linkCreate(gVencModuleContext.ipcBitsOutRTOSId, &ipcBitsOutVideoPrm, sizeof(ipcBitsOutVideoPrm));
        System_linkCreate(gVencModuleContext.ipcBitsInHLOSId, &ipcBitsInHostPrm[0], sizeof(ipcBitsInHostPrm[0]));
    
        System_linkGetInfo(gVencModuleContext.ipcBitsInHLOSId,&bitsProducerLinkInfo);
        OSA_assert(bitsProducerLinkInfo.numQue = 1);
    }
    
    void setInputResolution(UInt32 width, UInt32 height)
    {
        Int32 status = 0;
        CaptureLink_SetResolution vcapSetRes = {0};
        
        vcapSetRes.queId  = 0;
        vcapSetRes.chId = 0;
    
        if(width > CAPTURE_MAX_WIDTH)
           width = CAPTURE_MAX_WIDTH;
    
        if(height > CAPTURE_MAX_HEIGHT)
           height= CAPTURE_MAX_HEIGHT;
        
        vcapSetRes.width = width;
        vcapSetRes.height = height;
        
        status = System_linkControl(
                                    gVcapModuleContext.captureId,
                                    CAPTURE_LINK_CMD_SET_RESOLUTION,
                                    &(vcapSetRes),
                                    sizeof(vcapSetRes),
                                    TRUE
                                    );

    If I detect the input resolution has changed, I will call setInputResolution().

    Can you give some advie?

    Thanks very much.

  • Do you see any change in behavour if you use SYSTEM_VPSS_LINK_ID_DEI_0 instead of SYSTEM_VPSS_LINK_ID_DEI_HQ_0

  • There has no change.

  • DEI does not detect & use output resolution based on incoming frames resolution (dynamic change).
    Use DEI_LINK_CMD_SET_OUTPUTRESOLUTION command after a change in capture resolution.

  • Make sure you do DEI_LINK_CMD_GET_OUTPUTRESOLUTION change the width and height and then do DEI_LINK_CMD_SET_OUTPUTRESOLUTION else pitch may get wrongly set

  • Pitch should be 1920 .You should not change it.Pls enable

    #define SYSTEM_DEBUG_DEI_RT

    in

    /dvr_rdk/mcfw/interfaces/link_api/system_debug.h

    and share the console logs when you switch resolution in capture

  • I define SYSTEM_DEBUG_DEI_RT, and after I change the capture input resolution, the console only print:

    [m3vpss ] [links_m3vpss/capture/captureLink_drv.c:334] 188204: CAPTURE: Dynamic resolution change: width: 1600, height: 900,startx:0,starty:0,pitch0:1920,pitch1:1920!

  • You have to rebuild using make dvr_rdk and use the rebuilt image.Share the full console logs after rebuild and switch resolution

  • What is the expected resolution of DEI? If your input is interlaced & you are enabling DEI, the SET_OUTPUTRESOLUTION height should be twice of captured input height. Dont change the pitch.

  • the expected resolution of DEI is all 518x288, it doesn't need to change.

    The input source is progressive.

    If it need twice, where shoule I SET?

  • Please give a clear description of your use case.

    1. What is your initial capture input resolution / scan type?

    2. Is DEI used only for scaling? What is the DEI intial output resolution?

    3. Please provide the sequence of capture resolution change.

    4. Disable SYSTEM_DEBUG_DEI_RT.

    5. Add printing of pChObj->vipRtOutFrmPrm[].width / height &  pChObj->deiRtOutFrmPrm[].width / height in DeiLink_printStatistics.

    6. Print link statistics intially (before capture resolution change) & later after resolution change.

    Recompile & execute your use case  and attach the log

     

  • The logs show  both capture and DEI correctly detecting the resolution change.

    [m3vpss ] [links_m3vpss/capture/captureLink_drv.c:334] 149411: CAPTURE: Dynamic resolution change: width: 1600, height: 900,startx:0,starty:0,pitch0:1920,pitch1:1920!

     [m3vpss ]  149425: DEI: CH0: Input Picture Size is changed to width = 1600, height = 900!!

    Have you done any change in DEI link like disabling scaler or enabling lazyLoading ?

     

  • I enable lazyLoading. If I disable, it's OK now.

    Thanks very much.

    BTW, What is the purpose of using LazyLoading?