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.

slow resizer and previewer

Dear All:

 

I tried to use resizer and previewer on DM365 to convert Bayer CMOS input to yuv420,

so that H264 encoder can read them and encode them.

I check the dvsdk_2_10_01_18/PSP_02_10_00_14/examples/dm365/previewer_resizer/capture_prev_rsz_ss_raw_bayer_userptr.c

out and write my own code.

When I tested it, the result is OK, but the performance is terrible.

The resizer and previewer will take up to 200ms to do a 1280x720 video frame.

I know it shall be much faster, but I do not know how I shall change the parameters or any other way to implement it.

The code is using one-shot mode. External allocated continuous memory from Memory_contigAlloc are used.

Is there anything I need to pay attention or make changes?

Any suggestion will be welcome.

 

Best regards,

 

Ray

 

  • Hi Ray,

    I suspect that the resizer is running quite slow with the default settings. I have taken the code from capture_prev_rsz_ss_raw_bayer_userptr.c and added the code shown in red. I am trying to print the clock divider values and change the ratio to 1/6. You can try increasing the clock of resizer even more, depending on your DDR bandwidth. For the exact description of clock divider, please refer to VPFE PRG IPIPEIF section.

      if (ioctl(rsz_fd, RSZ_G_CONFIG, &rsz_chan_config) < 0) {
      perror("Error in getting resizer channel configuration from driver\n");
      close(rsz_fd);
      return -1;
     }

    //Anshuman - Adding this line to print the clock divider
     printf("init_resizer, clk_div.m = %d, clk_div.n = %d \r\n",rsz_ss_config.input.clk_div.m, rsz_ss_config.input.clk_div.n);
    .

    .

    .

       //Anshuman - Chaging the clock divider for resizer to 1/6

       rsz_ss_config.input.clk_div.m = 10;
        rsz_ss_config.input.clk_div.n = 60;
     rsz_chan_config.len = sizeof(struct rsz_single_shot_config);
     rsz_chan_config.config = &rsz_ss_config;
     if (ioctl(rsz_fd, RSZ_S_CONFIG, &rsz_chan_config) < 0) {
      perror("Error in setting configuration in resizer\n");
      close(rsz_fd);
      return -1;
     }

    Regards,

    Anshuman

    PS: Please mark this post as verified, if you think this answers your question. Thanks.

  • Dear Anshuman:


    I add these lines.

    It prints out clk_div.m = 1 and clk_div.n = 6.

    I also set clk_div.m = 10 and clk_div.n = 60, but nothing is changed.

    Is there anything I missed?

    regards,

     

    Ray

  • Hi Ray,

    Your settings look good for the clock. You can try changing the clk_div.n to 40 and clk_div.m = 10 but with current settings of clock and expected DM365 clocking, you should have taken only 28 msec for resizer operation of 1280x720 input.

    Can you confirm your following parameters just before RSZ_S_CONFIG?

     rsz_ss_config.input.image_width 
     rsz_ss_config.input.image_height 
     rsz_ss_config.input.ppln 
     rsz_ss_config.input.lpfr

     

    Also, can you please share the clock settings for DM365 that you are using? It would be printed during kernel bootup.

    Regards,

    Anshuman

     

  •  

    Dear Anshuman:

     

    Here is the clock setting for DM365:


    EMPT Fri Apr 2 16:56:28 CST 2010
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    Machine: DaVinci DM365 EVM
    Memory policy: ECC disabled, Data cache writeback
    DaVinci DM0365 variant 0x0
    PLL0: fixedrate: 24000000, commonrate: 121500000, vpssrate: 243000000
    PLL0: vencrate_sd: 27000000, ddrrate: 243000000 mmcsdrate: 121500000
    PLL1: armrate: 297000000, voicerate: 99000000, vencrate_hd: 74250000
    CPU0: D VIVT write-back cache
    CPU0: I cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
    CPU0: D cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
    Built 1 zonelists.  Total pages: 16384

     

    And, the following are the settings just before RSZ_S_CONFIG:


    init_resizer rsz_ss_config.input.image_width  = 640
    init_resizer rsz_ss_config.input.image_height = 480
    init_resizer rsz_ss_config.input.ppln = 648
    init_resizer rsz_ss_config.input.lpfr = 490
    init_resizer rsz_ss_config.input.lpfr = 490

    Hope they can help.

     

    regards,

     

    Ray

     

  • Hi Ray,

    The settings you mentioned are for 640x480 and not for 1280x720 as you mentioned earlier. Are you using the single shot mode of resizer and getting the correct output?

    Where exactly are you profiling the code and seeing 200 msec? Based on your settings i would expect that your do_resize() function should not take more than

    (648*490)/(243*(1/6)) = 8 msec approx.

    Regards,

    Anshuman

  •  

    Dear Anshuman:


    I found the problem may be caused by wrong Makefile.

    It only compile a part of the program, so that some object codes are

    not compiled and they use the original settings.

    That is why it uses 640x480 instead of 1280x720.

     

    Now the actual resizer performance is about 24ms.

    I am sorry to bring such a mess.

    Thanks for your patient to help us to locate the problem.

     

    Best regards,

     

    Ray


  • Hi Ray,

    Thanks for the confirmation and good to see that your problem is solved.

     

    Regards,

    Anshuman