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.

DEI change resolution dynamicly

Hi, we use RDK4.0, DM8168.

The data flow is:

 capture(1 ch) --> dup ---> DEI_H   ----> enc

                                   -----> DEI 

The resolution of 2 encode channel  can separatly change dynamicly?

I use                 status = System_linkControl(
                                            gVcapModuleContext.deiId[deiId],
                                            DEI_LINK_CMD_SET_OUTPUTRESOLUTION,
                                            &(params),
                                            sizeof(params),
                                            TRUE
                                            );

It can not change.

Is there another method?

Thanks.

  • The cmd is correct. Add prints in deiLink to confirm the parameters you are passing are correct and the output rtParams are set correctly. Refer case of DEI_LINK_CMD_SET_OUTPUTRESOLUTION in deiLink_tsk.c for understanding the codeflow

  • Hi, Badri.

    I printf the width and height in DeiLink_drvSetChDynamicOutputRes();

           pChObj->deiRtOutFrmPrm[outId].width    = params->width;
            pChObj->deiRtOutFrmPrm[outId].height   = params->height;
            pChObj->deiRtOutFrmPrm[outId].pitch[0] = params->pitch[0];
            pChObj->deiRtOutFrmPrm[outId].pitch[1] = params->pitch[1];
            Vps_printf("\n 0729--0729--0729--0729--0729--0729--0729--0729-- the width = %d...the height = %d...\n", params->width, params->height);

    the console prints:

     [m3vpss ]  0729--0729--0729--0729--0729--0729--0729--0729-- outId = 0...
     [m3vpss ]  0729--0729--0729--0729--0729--0729--0729--0729-- the width = 740...the height = 560...

    The value is I set using cmd System_linkControl(
                                                gVcapModuleContext.deiId[deiId],
                                                DEI_LINK_CMD_SET_OUTPUTRESOLUTION,
                                                &(params),
                                                sizeof(params),
                                                TRUE
                                                );

    But the resolution of encoded file is also the creating values when creating DEI LINK.

  • When the encode is started, call the function System_linkControl to send the cmd DEI_LINK_CMD_SET_OUTPUTRESOLUTION.

  • Can you add a prints in /dvr_rdk/mcfw/src_bios6/links_m3video/iva_enc/encLink_common.c EncLink_codecDynamicResolutionChange() and check if the print is coming and if the resolution is correct.DEI link will align to 16 pixel output width so maybe it is aligning your output width , height wrongly. Print the DEI output RtChInfo also to confirm that the change is taking effect,

    If GET_OUTPUT_RESOLUTION is returning zero it means you are not passing correct outQueId.

  • Hi, Badri

    I add a prints in encLink_common.c as following:

       1)  pFrameInfo = (System_FrameInfo *)   reqObj->InFrameList.frames[0]->appData;
            reqObj->OutBuf->inputFileChanged = FALSE;
            Vps_printf("\n 0730--0730--0730--0730--0730--0730--0730--Encode:pFrameInfo height = %d...pFrameInfo width = %d\n", pFrameInfo->rtChInfo.height, pFrameInfo >rtChInfo.width);

     2) Vps_printf("\n 0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = %d...width = %d\n", chDynamicParams->inputHeight, chDynamicParams->inputWidth);

    The DEI Link output resolution is 1280x720, the dynamic resolution is 736x560.

    The console print as the following:

     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode:pFrameInfo height = 720...pFrameInfo width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 720...width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode:pFrameInfo height = 576...pFrameInfo width = 560
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 576...width = 560
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode:pFrameInfo height = 720...pFrameInfo width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 720...width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode:pFrameInfo height = 576...pFrameInfo width = 560
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 576...width = 560
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode:pFrameInfo height = 720...pFrameInfo width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 720...width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode:pFrameInfo height = 576...pFrameInfo width = 560
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 576...width = 560
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode:pFrameInfo height = 720...pFrameInfo width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 720...width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode:pFrameInfo height = 576...pFrameInfo width = 560
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 576...width = 560
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode:pFrameInfo height = 720...pFrameInfo width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 720...width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode:pFrameInfo height = 576...pFrameInfo width = 560
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 576...width = 560 DEI output RtChInfo is 736x560.

    576 is the Height of DEI[1] .

    I don't know what is the problem.

  • I don't see any issue. Encoder is correctly receiving resolution of 576 x 560.First put the print inside if (rtParamUpdatePerFrame == TRUE) and second print the channel number so that you can verify the correct channel number is receiveing the correct resolution.

    How are you verifying that resolution is not changed ?

  • Hi, Badri.

    I use Elecard to play the encoded file, the info is 1280x720;

    I don't know why sometimes --Encode:pFrameInfo height = 720...pFrameInfo width = 1280,

    but sometimes --Encode:pFrameInfo height = 576...pFrameInfo width = 560.

    The first print is: Encode:pFrameInfo height = 720...pFrameInfo width = 1280, it's before if (rtParamUpdatePerFrame == TRUE);

    The second print is: Encode dynamic resolution: height = 720...width = 1280, it's inside if (rtParamUpdatePerFrame == TRUE);

    Why the value is mutative?

    And the resolution I set is 736x560, just not 560x576.

  • This print will happen for all encode channels. Make sure you print only for the specific channels for which you are changing resolution and also print only inside the if (rtParamUpdatePerFrame == TRUE) case. Printing it outside will cause print for every frame.

  • Hi, Badri.

    I set the output Que of DEI[0] is the input Que 0 of merge. So the DEI[0] output que should be the channel 0 in encode.

    I use the CMD:

         System_linkControl(
                         gVcapModuleContext.deiId[0],
                         DEI_LINK_CMD_SET_OUTPUTRESOLUTION,
                         &(params),
                         sizeof(params),
                         TRUE
                         );

    So it should change the resolution of channel 0;

    I add a prints in if (rtParamUpdatePerFrame == TRUE) case when chId is equal to 0.

    The console prints:

     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 720...width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 720...width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 720...width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 720...width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 720...width = 1280
     [m3video]  0730--0730--0730--0730--0730--0730--0730--Encode dynamic resolution: height = 720...width = 1280

    It can not change.

  • Can you do DEI_LINK_CMD_GET_OUTPUTRESOLUTION, DEI_LINK_CMD_SET_OUTPUTRESOLUTION,DEI_LINK_CMD_GET_OUTPUTRESOLUTION and print the parameters. I think you are either not setting chNum correctly or queId correctly. Also do OSA_assert that the linkControl command returned success (status == 0)

  • Hi, Badri.

    The values of GET and SET  status of  are  all 0;

    But the resolution doing DEI_LINK_CMD_GET_OUTPUTRESOLUTION is also 0;

    My setting is:

           gVcapModuleContext.deiId[0]     = SYSTEM_LINK_ID_DEI_HQ_0;
           gVcapModuleContext.deiId[1]     = SYSTEM_LINK_ID_DEI_0;
           gVcapModuleContext.deiId[2]     = SYSTEM_LINK_ID_DEI_HQ_1; 

    dup:

               dupPrm[CAPTURE_MERGE_DUP_LINK_IDX].numOutQue = 3; //2;
               dupPrm[CAPTURE_MERGE_DUP_LINK_IDX].outQueParams[0].nextLink = gVcapModuleContext.deiId[0];
               dupPrm[CAPTURE_MERGE_DUP_LINK_IDX].outQueParams[1].nextLink = gVcapModuleContext.deiId[1];
               dupPrm[CAPTURE_MERGE_DUP_LINK_IDX].outQueParams[2].nextLink = gVcapModuleContext.deiId[2];

    dei:

    if(i == 0)
              {
                  deiPrm[i].outScaleFactor[DEI_LINK_OUT_QUE_VIP_SC][0].absoluteResolution. outWidth  = 1280; //VcapVencSettingPrm.width[0];
                  deiPrm[i].outScaleFactor[DEI_LINK_OUT_QUE_VIP_SC][0].absoluteResolution. outHeight = 720; //VcapVencSettingPrm.height[0];
              }
              else if (i == 1)
              {
               deiPrm[i].outScaleFactor[DEI_LINK_OUT_QUE_VIP_SC][0].absoluteResolution. outWidth  = 740;//1920; //vcapvencPrm.width[1];
               deiPrm[i].outScaleFactor[DEI_LINK_OUT_QUE_VIP_SC][0].absoluteResolution. outHeight = 576; //vcapvencPrm.height[1];
              }
              else
              {
                  deiPrm[i].outScaleFactor[DEI_LINK_OUT_QUE_VIP_SC][0].absoluteResolution. outWidth  = 352; //vcapvencPrm.width[2];
                  deiPrm[i].outScaleFactor[DEI_LINK_OUT_QUE_VIP_SC][0].absoluteResolution. outHeight = 288; //vcapvencPrm.height[2];
              }

               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;

    merge:

           mergePrm[SC_DEI_MERGE_LINK_IDX].numInQue = 3;
           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 = gVcapModuleContext.deiId[1];
           mergePrm[SC_DEI_MERGE_LINK_IDX].inQueParams[1].prevLinkQueId = DEI_LINK_OUT_QUE_VIP_SC;
           mergePrm[SC_DEI_MERGE_LINK_IDX].inQueParams[2].prevLinkId = gVcapModuleContext.deiId[2];
           mergePrm[SC_DEI_MERGE_LINK_IDX].inQueParams[2].prevLinkQueId = DEI_LINK_OUT_QUE_VIP_SC;

    The CMD:

    params.width = 736;
        params.height = 560;
     //params.height = SystemUtils_align(VcapVencSettingPrm.height, 1);

     System_linkControl(
                         /*gVcapModuleContext.deiId[0]*/SYSTEM_LINK_ID_DEI_HQ_0,
                         DEI_LINK_CMD_SET_OUTPUTRESOLUTION,
                         &(params),
                         sizeof(params),
                         TRUE
                         );

    the first encoded file resolution is 1280x720;

    the second encoded file resolution is 560x576;

    the third encoded file resolution is 352x288.

    I can't find the problem.

  • You are not populating outQueId and chNum in the param.Also check the param type is really what is expected by linkControl cmd DEI_LINK_CMD_SET_OUTPUTRESOLUTION.If you pass wrong structure you will not get any compile time warnings.

  • Hi, Badri.

    I set    

        params.chId = 0;
        params.queId = 1;
        params.width = 736;
        params.height = 560;
        params.pitch[0] = params.width * 2;
        params.pitch[1] = params.width;
        params.pitch[2] = params.width;

    The queId is the DEI outQueId just the merge preLinkQueId DEI_LINK_OUT_QUE_VIP_SC, right?

    The chId is the DEI output chId, is the all DEILink chId 0? or the chId of DEI[0] is 0, the chId of DEI[1] is 1, the chId of DEI[2] is 2?

    The pitch setting seems have some problem, the color of encode file is not right.

    The resolution of encoded file 0 has changed to 736x560, but the resolution of encode file1 is also 560x570, it's wrong.

  • You should not modufy pitch. This is because buffer is allocated at create time and pitch cannot change. You should only modify widtha dn height. That is why you should do GET_RESOLUTION and change only width and height and then do SET RESOLUTION. Use the correct define for queId.Dont use numbers. If you outputting on VIP_SC then set queId as DEI_LINK_OUT_QUE_VIP_SC

  • Hi, Badri.

    It's OK now.

    But I want to ask another question about the chId.

    The chId is the channel number in Encode?

    In my usecase, if I want to change the resolution of DEI[0], the chId shoule be 0;

    if I want to  DEI[1], the chId shoule be 1;

    if I want to DEI[2],, the chId shoule be 2, is it right?

  • No channel numbers are DEI channel numbers for all DEI link control cmds. chId will start from 0 for each dei  link instance  for each DEI output queue

  • I'm clear now. I have tested, it has no problem now.

    Thanks very much for all your help.