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.

DM6467 VPIF Capture HBI info or SAV info

Hi all,

Because Video decoder (Capture IC) is put Channel ID in HBI and SAV, I can get channel ID from each of them.

but it seem vpif driver doesn't support to get HBI or SAV info even lastest version.

Please kindly let me know if you know how to get infomation from HBI or SAV. thanks!

 

  • I am moving this to Linux forum. Please refer to figure 8 of the VPIF user guide just to make sure your "HBI" is the same as "VBI" in our usere guide

  • Thanks for reply.

    But I don't understand what is your mean in "make sure your "HBI" is the same as "VBI" in our usere guide".  The definition of HBI in BT656 means between EAV and SAV. (EAV HBI SAV ACTIVE-DATA) while VBI is located on L1 to L2 (line 4 to line 19 usually) between SAV and EAV (EAV HBI SAV VBI). so the cannel ID is hidden in HBI blanking in my case.

    Does latest LSP and dvsdk supported this function or could patch it to get those information? Please tell me if you have experience, thanks!

     

  • Can someone know how to capture HBI(Horizontal Blanking Interval) in VPIF driver? Currently, I just follow CAPTURE_VIDEO way to modify driver but it seems it can't work ...

    I'm afraid that if DM6467 didn't support "Capture HBI".  Another question, who knows that how work in Kernel after fd = open("/dev/video0", ...) because the return code from fd is 16 (Device or Resource is busy), but trace the Kernel and then see vpif_open(....), but vpif_open is returned 0, so maybe more path were before or after vpif_open() when you open the /dev/video0. Please have hint to me, thanks!!

    ps: My english is poor, so please forgive me or ask me again if you can't understand my english.

  • Hi Scott,

     

    If you are using older kernel, RAW HBI is supported in the driver. To capture RAW HBI data, open the video device i.e. /dev/video0 and set the format with the buffer type as RAW_HBI. This enables RAW HBI capture in the VPIF. After this, it is normal streaming model of the V4L2, enqueue buffers, start streaming, dequeu buffers to get the captured frames and enqueue empty buffers. At the end, stop the streaming.

     

    I could not understand fully, can you explain it more?

     

    Thanks,

    Brijesh

  • Hi Brijesh,

    Thanks for reply, the kernel version is 2.6.10 (LSP1.3) and it seems it was implemented for capture HBI.

    I have fill out related registers (SAV2EAV:1440 / EAV2SAV:268, CH1_HSIZE_CFG, CH1_HA_ADD_OFST : 0x0 and CH1_CTRL for CH1_HANC_EN) but it can't get data from V4L2.

    so what do you have any idea, thanks!

  • Hi Scott,

    There are few bugs in the driver. Because of these bugs, RAW VBI/HBI capture will not work. Please try after fixing them. The bugs and solutions are given below.

    Format for HBI data structure in VPIF object was never initialized, but compared against valid values in the vpif_try_raw_format function when enabling HBI capture using VIDIOC_STREAMON ioctl call. Hence, I have added the following code to initiailze the HBI format in the VPIF driver’s init function vpif_init


           for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) {
                    vpif_obj.dev[i]->common[VPIF_HBI_INDEX].fmt.fmt.vbi = vpif_raw_hbi_formats[0];
            }


    2.  Function vpif_config_addr in davincihd_capture.c has an obvious bug. It sets buf_type_index as:

           int buf_type_index = (V4L2_BUF_TYPE_VIDEO_CAPTURE == buftype) ? VPIF_VIDEO_INDEX : VPIF_VBI_INDEX;

    I fixed this to set buf_type_index as:

           int buf_type_index = (V4L2_BUF_TYPE_VIDEO_CAPTURE  == buftype) ? VPIF_VIDEO_INDEX :
                                ((V4L2_BUF_TYPE_HBI_CAPTURE == buftype) ? VPIF_HBI_INDEX : VPIF_VBI_INDEX);

    3. Function vpif_calculate_offsets_vbi calculates the offsets as follows -

           common->ytop_off = 0;
            common->ctop_off = 0;
            common->ybtm_off = ((common->fmt.fmt.vbi.count[0]))*
                (common->fmt.fmt.vbi.samples_per_line);
            common->cbtm_off = 0;

    With this, for NTSC closed caption, ybtm_off (bottom field offset) gets set to 263*268 which when added to a base that is 8-byte aligned results in an address that is not 8-byte aligned. There is an 8-byte alignment check in  vpif_buffer_prepare that fails. I have hacked this for now to set ybtm_off to 262*525 – this will overwrite the HBI data for the last line in the top field, but I don’t care about this line.

     

    Thanks,

    Brijesh Jadav

  • Hi Brijesh,

    Thanks, I have success to get HBI infomation today and I found another problem.

    after following your advice, I still failed to get HBI only, but it's works to capture HBI with video.  (do you know I mean?)

    How to get video with HBI at the same time, that is

    1. kmalloc two buffer for top and bottom, (size : 268 * 263)

    2. enable HANC_EN bits on.

    3. set the physical addr to register THA_STARTADR and BHA_STARTADR in ISR routine.

    that's ok, but this way is not stable (failed to run second time sometime).

    Currently, the biggest problem is that how can sync channel id (which is hidding in hbi) and video frame ?

    because video frame is following V4L2 flow but HBI is not, so it's a big trouble.

     

    Sorry, a bunch of problem but I want to sure if vpif driver only can get hbi with video first.

    second, how to sync channel id with video frame if my ways is legal.


  • Hi Scott,

     

    i dont think i understood, Are you able to get hbi data in the application? Both the video and HBI streams are as per the V4L2 flow. After starting video streaming, you can start hbi streaming in the same way.

     

    As such driver does not support feature of syncing hbi data with video. This has to be taken care in the application. You can sync hbi data with video by the timestamp field provided in both hbi and video buffer.

     

    Thx,

    Brijesh

  • Hi Brijesh,

    I can get hbi information in Driver not application because it is not following V4L2 flow. The devide (dev/video1) only could be open one time and there has error when you open it second time (err num is 17 (device or resource busy)). I used my own way to get hbi as descripting upon so that I have sync problem (hbi info not saving in V4L2 queue).

    So, how to get hbi and video data in the same time by one 'file description' ?

  • Hi,

     

    It is not allowed to open the driver two times. With the same descriptor i,e, file id, you should be able to do streaming for video and for vbi as well. Following below steps to do streaming on both video and vbi

    1, Start streaming on video

    2, Enable HBI by calling S_FMT ioctl with buf type as HBI.

    3, Enqueue VBI buffer with the buffer type as HBI

    4, Start streaming for HBI by calling STREAMON ioctl with argument saying buffer type is hbi

     

    Now you can do enqueue/dequeue for both video as well as hbi data.

     

    Thx,

    Brijesh