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.

encode issue on DM365

Hi

   1. As I know, DM365 support one-Shot mode and Continous-mode, in DVSDK sample code, we use Continous-mode, and driver will allocate 3 buffers to storage the raw data, my question is if Application don't call Capture_get(), what would happened? Driver will overwirte the buffers? or stop capture raw data just discard it or something else?

    2. Now I want to encode 3 channel streamings, the input is 720P, output is 720P, VGA, CIF, I can update the DMAI code to got the VGA/CIF raw data, but I don't know how to get the 720P raw data under Continous mode. Does continous mode support this? if not, I need use one-shot mode, could any one help apply the sample code?

  Any comments would be appriciated!

Best Regards,
Tracy

  • Hi Tracy,

    Tracy lee said:

       1. As I know, DM365 support one-Shot mode and Continous-mode, in DVSDK sample code, we use Continous-mode, and driver will allocate 3 buffers to storage the raw data, my question is if Application don't call Capture_get(), what would happened? Driver will overwirte the buffers? or stop capture raw data just discard it or something else?

    Capture driver will overwrite the last buffer in the capture queue. The capture driver does not stop capturing. So in summary, if you had three buffers in the queue, the capture driver will put the captured data in first 2 buffers and allow it to dequeue, but the third buffer will be held with the driver till a new buffer is queued. This third buffer will always have the latest captured data.

    Tracy lee said:

        2. Now I want to encode 3 channel streamings, the input is 720P, output is 720P, VGA, CIF, I can update the DMAI code to got the VGA/CIF raw data, but I don't know how to get the 720P raw data under Continous mode. Does continous mode support this? if not, I need use one-shot mode, could any one help apply the sample code?

    There are only two resizers available in DM365. So in continuous mode, at a time you can get only two resolutions output. If you want three resolutions, the easier approach is to use single shot mode. The data flow would change as follows
    Input device --> ISIF-->DDR (720P) --> IPIPE/RSZ |--> DDR (CIF)
                                                                                              |--> DDR (VGA)
    The above dataflow is assuming you have YUV input source and hence you can get 720P YUV data, CIF YUV data and VGA YUV data. If you had raw data capture from a sensor, then you would have to run one more resizer operation as the 720P captured from ISIF on DDR would be in Bayer format and not YUV format. So you would need one more round of IPIPE/RSZ operation for converting 720P bayer to 720P YUV data.
    Hope this helps.
    Regards,
    Anshuman

  • Hi Anshuman Saxena:

      Appreciate for you quick response, it's helpful for me.

      I got RGB 720P raw data from sensor, i need transfer RGB to YUV420SP by previewer, could i config the capture->previewer  to continous mode? could you help draw the data flow of me?

      Continous-mode should have better performance than one-shot mode, right? Do you have any test report for comparision for Continous-mode VS one-shot mode under the same settings? I just concern that the performance will bad if I use one-shot mode.

  • Hi Tracy,

    For your usecase, the data flow will be as follows. This will work in one shote mode.

    Sensor -->iSIF-->DDR (RGB 720P) -->iPIPE/RSZA |--> DDR (720p YUV)

                                                                           IPIPE/RSZB|--> DDR (VGA YUV)  --> RSZ --> DDR (CIF YUV)

     

    you are right, in continuous mode the DDR bandwidth would have been much lower. But for this use case in particular, you can achieve the required performance with one shot mode also. actually, in one shote mode you can run the IPIPE/RSZ much faster and is decoupled from the pixel clock of the sensor. So if sensor is running at say 48MHz, you can run resizer at say 120MHz which is much faster as compared to the continuous mode 48MHz clock.

    Other approach can be using continuous mode and getting 720P, VGA from first pass resizer operation. And then use some ARM based resize algorithm to resize VGA to CIF. The problem would be limited ARM MIPS.

     

    Regards,

    Anshuman

  • Hi Anshuman Saxena:

        1. I'm a little confused about you data flow, how can we do resize 3 times at one circle, it won't cost too many times? Could you help explain for apply the sample code for this?

       2 In PSP_02_10_00_14\examples\dm365\previewer_resizer\capture_prev_rsz_ss_raw_bayer_userptr.c, you can find an API:

                                              int do_preview_resize(int preview_fd,
                                                                                        int in_width,
                                                                                       int in_height,
                                                                                       void *capbuf_addr, 
                                                                                       void *display_buf,
                                                                                       int out_width,
                                                                                       int out_height);
          Seems previewer can do resize, is this HW solution? seems this API don't take any action on "/dev/davinci_resizer".

          Thanks.

  • Hi Tracy,

    Tracy lee said:

        1. I'm a little confused about you data flow, how can we do resize 3 times at one circle, it won't cost too many times? Could you help explain for apply the sample code for this?

     

    In my dataflow, i explained that you have to run resizer in two pass in single shot mode. First pass will generate 720P and VGA size YUV data. The second pass will take in VGA data and generate CIF YUV data. The whole idea is that you should be able to do Pass 1 and Pass 2 of this resize operation with in 33 msec (for 30fps capture). And you can surely do this, by running resizer clock much faster than the capture pixel clock. For single shot mode, the resizer clock can be governed by changing rsz_ss_config.clk_div.m and rsz_ss_config.clk_div.n in Resize_config function of <DMAI>/packages/ti/sdo/dmai/linux/dm365/resize.c. Please refer to the VPFE PRG document to understand the implication of this clocking.

    Tracy lee said:

     2 In PSP_02_10_00_14\examples\dm365\previewer_resizer\capture_prev_rsz_ss_raw_bayer_userptr.c, you can find an API:

                                              int do_preview_resize(int preview_fd,
                                                                                        int in_width,
                                                                                       int in_height,
                                                                                       void *capbuf_addr, 
                                                                                       void *display_buf,
                                                                                       int out_width,
                                                                                       int out_height);
          Seems previewer can do resize, is this HW solution? seems this API don't take any action on "/dev/davinci_resizer".

    Yes, this example uses hardware resizer. It uses "/dev/davinci_resizer" in single shot mode.

    Regards,

    Anshuman

  • Hi Anshuman Saxena:

       Coud you tell me where i can get Resizer Driver User's Guide and Previewer  Driver User's Guide for DM365? I can't get this under PSP_02_10_00_14\docs\dm365\.

       Thanks.

  • Hi Tracy,

    please refer to SPRUthe following link for capture drivers usage

    http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent/psp/mv_lsp_2_10/02_10_00_14/exports/docs/DaVinciLinux_VPFECaptureDriverUsersGuide_SPRUGP6.pdf

    http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent/psp/mv_lsp_2_10/02_10_00_14/exports/lsp_psp_02_10_00_14_release_notes.html

     

    Also, there have been many threads talking about data flows that you need. Please refer to earlier posts on E2E forum for some more details.

    Regards,

    Anshuman

  • Hi Anshuman:

       Thanks for you support, one more issue about the resizer:

              my sensor input is 720P RGB, and I just want to encode VGA+CIF streaming, Could I use continous mode to reach this?  The data flow is:

                      Sensor -->iSIF-->DDR (RGB 720P) -->iPIPE/RSZA |--> DDR (VGA YUV)

                                                                                            IPIPE/RSZB|--> DDR (CIF YUV) 

            or we MUST set the RSZA output as 720P YUV?

  • Hi Tracy,

    Tracy lee said:

           my sensor input is 720P RGB, and I just want to encode VGA+CIF streaming, Could I use continous mode to reach this?  The data flow is:

                      Sensor -->iSIF-->DDR (RGB 720P) -->iPIPE/RSZA |--> DDR (VGA YUV)

                                                                                            IPIPE/RSZB|--> DDR (CIF YUV) 

    Yes, you can use the above data flow. I thought you wanted three resolution of YUV output (720P, VGA and CIF), so i had proposed my data flow. Can you please confirm if you need only two resolutions (VGA and CIF)?

    If yes, then you can use the following data flow, and use continuous mode operation of capture driver and save some DDR bandwidth. Please note that this is useful for ONLY two resolution output and i thought the whole thread started because you wanted three resolutions.

                      Sensor -->iSIF-->iPIPE -> RSZA |--> DDR (VGA YUV)

                                                                -> RSZB|--> DDR (CIF YUV) 

     

    Regards,

    Anshuman

  • Hi Anshuman:

       Appreciate for you help.

       In our product user can set 3 resolution or 2 resolution or just single resolution, so I just want confirm the solution under difference case, as you suggest:

              1. We can ONLY use One-shot mode if i want three resolutions.

              2. We can use continous mode if i want 720P+VGA resolution.

              3. We can use continous mode if i want VGA + CIF resolution?

      Right?

        I had tryed the #3 under continous mode, but failed, seems the RSZA output is still 720P raw data, here is my update code for you reference:

                               /* we can ignore the input spec since we are chaining. So only
                               set output specs */
                               rsz_cont_config.output1.enable = 1;
                               rsz_cont_config.output1.width = 640;
                               rsz_cont_config.output1.height = 480; 

       Could you give some comments on this issue?

       Thanks very much!

  • Hi Anshuman:

          I'm sorry i made a mistake:

                               /* we can ignore the input spec since we are chaining. So only
                               set output specs */
                               rsz_cont_config.output1.enable = 1;
                               rsz_cont_config.output1.width = 640;
                               rsz_cont_config.output1.height = 480;
     

          The bold code is failed to compile.

          Could you give an example about how to set the RESA to VGA? 

          Thanks very much.

  • Hi Tracy,

    If you notice, there is no parameter as "width" and "height" in the rsz_continuous_config structures element  struct rsz_part_output_spec output1;. You cannot set width and height of RSZA output, the way you are trying to do.

    Please use VIDIOC_S_FMT IOCTL as shown in dmai/linux/capture.c file. You can set fmt.fmt.pix.width = 640 and fmt.fmt.pix.height = 480 and then call VIDIOC_S_FMT IOCTL to change the output resolution of RSZA to 640x480

     

    Regards,

    Anshuman

  • Hi Anshuman:

         Cause my sensor input is RGB format, so I need call previewer to transter RGB to YUV format, the sequence should be:

          capture --> previewer -> Resizer 

         Under continous mode,  we can chain all the 3 steps together. Under single-shot mode, we can chain previewer and resizer together.  

          My question is: Could we chain the captue and previewer together?

          Thanks.

  • Tracy,

    Actually, resizer is the output port for the hardware ISP module. So there is no way you can get the output from "previewer" driver which corresponds to the image processing block of ISP. Because of this reason, you cannot club together capture and previwer and remove resizer from the chain.

    Hope this answers your question.

    Regards,

    Anshuman

  • why  there is no parameter as "width" and "height" in the rsz_continuous_config structures element  struct rsz_part_output_spec output1. why? does it mean under chained mode, RSZA can not do resizing?

    does VIDIOC_S_FMT IOCT change output resolution of RSZA? seems it just does cropping..