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.

DM648 VPort Capture issue

I'm using customed DM648 board to capture YUV data at 80MHz pixel clock via VPort0. The image size is 2448 x 2048. The YUV data is a striple-tes-data with fixed width 306. But the image I captured via VP0 is like below:

:

image1: the input YUV data is 2448x2048, the capture params setting is 2448x2048.

 The first column and the last two columns data of captured yuv data are wrong.  

 

I tried to captured YUV data(2448x2048)  via different image width settings in VPORTCAP_Params , and find that when the image width setting is below 2048, the captured YUV data is right.  IfVPORTCAP_Params.fldXStop1 is setted above 2048, the captured YUV data will be wrong. I don't konw why.

.

 image2: the input YUV data is 2448x2048, the capture params setting is 2048x2048. The  

  The captured yuv data is correct

 

.

   image3: the input YUV data is 2448x2048, the capture params setting is 2080x2048. The  

 The last columns data of captured yuv data is wrong.  The Y data, U data and V data of the last column are all zeros. the yuv2rgb   formula is 

 R = Y + 1.402*(V-128);
G = Y - 0.344*(U-128) -0.714*(V-128);
B = Y + 1.772*(U-128);
 YUV(0,0,0) is RGB(179, 135, 226),
so the last little column zero data is displayed in purple color.

 

Throught image1~3, u'll find that tha image width > 2048, the captured data is zero.

 

My  CAP_PARAMS is like below: 

 

 

#define CAP_YUV_LINE_SZ (2048)
#define CAP_YUV_NUM_LINES (2048)

#define CAP_PARAMS_CHAN_YUV{ \
VPORT_MODE_YCBCR_8BIT, /* cmode:3 */ \
VPORT_FLDOP_PROGRESSIVE, /* fldOp: FRAME, CF2, CF1. VPORT_FLDOP_PROGRESSIVE: only capture field 1.*/ \
\
VPORT_SCALING_DISABLE, /* scale:1 */ \
VPORT_RESMPL_DISABLE, /* resmpl:1 */ \
VPORTCAP_BPK_10BIT_ZERO_EXTENDED, /* bpk10Bit:2 */ \
\
VPORTCAP_HRST_START_HSYNC, /* hCtRst:1 */ \
VPORTCAP_VRST_START_VSYNC, /* vCtRst:1 */ \
\
VPORTCAP_FLDD_ENABLE, /* fldDect:1 */ \
VPORTCAP_EXC_ENABLE, /* fldInv:1 */ \
VPORTCAP_FINV_DISABLE, /* fldInv:1 */ \
\
0, /* fldXStrt1 */ \
1, /* fldYStrt1 */ \
0, /* fldXStrt2 */ \
1, /* fldYStrt2 */ \
\
(CAP_YUV_LINE_SZ - 1), /* fldXStop1 */ \
(CAP_YUV_NUM_LINES), /* fldYStop1 */ \
(CAP_YUV_LINE_SZ - 1), /* fldXStop2 */ \
(CAP_YUV_NUM_LINES), /* fldYStop2 */ \
\
(CAP_YUV_LINE_SZ >> 3), /* thrld */ \
\
3, /* numFrmBufs */ \
128, /* alignment */ \
VPORT_FLDS_SEPARATED, /* mergeFlds */ \
\
NULL, /* segId */ \
TRUE, /* autoSyncEnable */ \
NULL /* hEdma */ \
}

and the segment program is like below:

tskImg()
{
   capChInfo.chanHandle = FVID_create(vPortCapStrings, IOM_INPUT, &status, (Ptr)&vCapParamsChan, NULL);
   if (IOM_COMPLETED == status)
   {
       status |= FVID_control(capChInfo.chanHandle, VPORT_CMD_START, NULL);
       if (IOM_COMPLETED == status)
       status = FVID_alloc(capChInfo.chanHandle, &(capChInfo.frame));
   }
   while(1)
   {
        send_YUV_data_via_NET();
        BCACHE_inv((Uint8 *)capChInfo.frame->frame.iFrm.y1, (imgSz), TRUE);
        BCACHE_inv((Uint8 *)capChInfo.frame->frame.iFrm.cb1, (imgSz/2), TRUE);
        BCACHE_inv((Uint8 *)capChInfo.frame->frame.iFrm.cr1, (imgSz/2), TRUE);
        status = FVID_exchange(capChInfo.chanHandle, &(capChInfo.frame));
        if (IOM_COMPLETED != status)
                break; 

    }
}

My Question is:

1. Does VPort ensure data integrity  at 80M pixel clock?

2. the VPort FIFO size is 2560 bytes in Y/C capture mode.  and Y buffer is 1280 bytes.  As far as image width 2448 is concerned, how should VPort FIFO threshold  set? 

3. when I captured data with image width 2448,  the vport capture driver will run into _covrRecover() all the time.

   It must be that some error happened. what kind of error will result in this error?  I just change the captured image width below 2048, the demo and driver run well. Why?

 4.  why the captured data will be wrong in width above 2048? what's possible reasons? 

 

Any help will be appreciated.

dp

dpinglee@163.com 

 

 

 

  • Hi,

    Since the line size is very large (very close to that of the internal FIFO), you should set the threshold to half or quarter line size. Otherwise the VPORT cant flush out the data present in its FIFO and hence you are seeing the capture over run error.

    Kindly change the line

    (CAP_YUV_LINE_SZ >> 3), /* thrld */ \

    to

    (CAP_YUV_LINE_SZ >> 4), /* thrld */ \

    And check if you still get this error.

    One caution, while giving the threshold make sure that the line size is a multiple of the threshold. In you case you can't give the threshold as quarter line size since 2448/8/4 is not an integer.

  • Thanks Sivaraj R.

    I have fixed these problems. 

    The reason for zero captured data is that the width of line valid signal is just 2048 pixel clock which's insufficient. After changing the horizental line valid to 2448 pixel clock,  the captured YUV data are all right.

    As far as fifo over-run err,  changing the fifo threshold to half of line width avoid this err happening again.

     As far as image width of 2448,  Y thrld is setted 2448/2/8=153,  C thrld  2448/2/2/8=76.5 is not an integer. So the image width must be multipler of 32.  And the image width need to be cut down to floor(2448/32) * 32 = 2432.

    Is there   any way to capture the image with width 2448 without losing so many column pixels ? 

  • The only way to capture 2448 pixels per line is to move to the next 32 byte boundary i.e. 2464, increase the horizontal line width from the external source and then discard the last 16 pixels.

     

    Regards,

    Sivaraj R

  • Thansk for your quick reply, Sivaraj R.

    I'll take it into consideration.