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.

Linux/AM5728: Color space conversion in VIP

Part Number: AM5728

Tool/software: Linux


Hello. I'm use ti-processor-sdk-linux-am57xx-evm-03.03.00.04 on AM5728.

I have parallel RGB24 1024x768 video source with discrete syncs. I got my driver and can capture images with ti-vip driver. But I want to get image in UYVY pixel format.

I found, that TI VIP module can do this conversion, but I cannot found how enable it.

when I call :
yavta -s1024x768 -c4 -n4 -Fres#.data -fRGB24 /dev/video2

I got right frames in RGB24 format.

when I call :

yavta -s1024x768 -c4 -n4 -Fres#.data -fuyvy /dev/video2

I got frames in RGB24 and in dmesg output I got:

[  453.468591] vip2-s1: vip_open
[  453.468610] my_cam : get fmt
[  453.470722] vip2-s1: vip_init_port: g_mbus_fmt subdev mbus_code: 100A fourcc:RGB3 size: 1024x768
[  453.470738] vip2-s1: calc_format_size: fourcc:RGB3 size: 1024x768 bpl:3072 img_size:2359296
[  453.470746] vip2-s1: init_stream fourcc:RGB3 size: 1024x768 bpl:3072 img_size:2359296
[  453.470754] vip2-s1: init_stream vpdma data type: 0x16
[  453.470763] vip2-s1: vip_init_stream: stream instance 0x00000001ecb99000
[  453.470892] vip2-s1: s_fmt input fourcc:UYVY size: 1024x768
[  453.470902] vip2-s1: try_fmt fourcc:UYVY size: 1024x768
[  453.470910] vip2-s1: Fourcc format (0x59565955) not found.
[  453.470917] vip_csc_direction VIP_CSC_NA
[  453.474855] my_cam: enum frame size index 0
[  453.487372] vip2-s1: try_fmt loop:0 fourcc:RGB3 size: 1024x768
[  453.487383] vip2-s1: try_fmt loop:0 found new larger: 1024x768
[  453.487392] vip2-s1: try_fmt loop:0 found at least larger: 1024x768
[  453.487400] vip2-s1: try_fmt loop:0 found new best: 1024x768
[  453.487408] vip2-s1: try_fmt loop:0 found direct match: 1024x768
[  453.487417] vip2-s1: calc_format_size: fourcc:RGB3 size: 1024x768 bpl:3072 img_size:2359296
[  453.487425] vip2-s1: s_fmt try_fmt fourcc:RGB3 size: 1024x768
[  453.487430] vip_csc_direction VIP_CSC_NA
[  453.491404] vip2-s1: s_fmt fourcc:RGB3 size: 1024x768 bpl:3072 img_size:2359296
[  453.491422] vip2-s1: s_fmt pix_to_mbus mbus_code: 100A size: 1024x768
[  453.491431] set format 1024x768
[  453.494584] vip2-s1: s_fmt subdev fmt mbus_code: 100A size: 1024x768
[  453.494591] vip2-s1: s_fmt vpdma data type: 0x16
[  453.494597] my_cam: get_selection
[  453.498246] vip2-s1: g_fmt fourcc:RGB3 code: 100a size: 1024x768 bpl:3072 img_size:2359296
[  453.498254] vip2-s1: g_fmt vpdma data type: 0x16
[  453.498285] vip2-s1: get 4 buffer(s) of size 2359296 each.
[  453.505282] vip2-s1: vip_set_slice_path:
[  453.505296] vip2-s1: vip_set_slice_path: DATA_PATH_SELECT(00000110): 80008080
[  453.505304] vip2-s1: vip_set_slice_path:
[  453.505313] vip2-s1: vip_set_slice_path: DATA_PATH_SELECT(00000110): 40008080
[  453.505594] set_crop_parser: left 0, top 0
[  453.510007] my_cam: s_stream enable 1
[  453.512998] vip2-s1: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:0
[  453.514127] vip2-s1: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:1
[  453.916727] vip2-s1: vip_stop_streaming:
[  453.916742] vip2-s1: vip_disable_sc_path:
[  453.916752] my_cam: s_stream enable 0
[  453.919773] vip2-s1: Clear channel no: 177
[  453.921522] vip2-s1: vip_release
[  453.921537] vip2-s1: vip_release_stream: stream instance 0xee8adef0ecb99000
[  453.921546] vip2-s1: vip_release_port: port instance 0xece3e780ecb67410

i.e. uyvy discarded by driver


in my_cam driver enum_mbus_code call i'm set code->code=MEDIA_BUS_FMT_RGB888_1X24 or return -EINVAL if  code->index>=1

in get_fmt and set_fmt :

        fmt->format.width  = 1024;
        fmt->format.height = 768;
        fmt->format.colorspace = V4L2_COLORSPACE_SRGB;
        fmt->format.code   = MEDIA_BUS_FMT_RGB888_1X24;
        fmt->format.field = V4L2_FIELD_NONE;



How I should configure VIP pipeline or change my driver for read RGB24 from inputs and write UYVY to memory? I can't change video source pixel's format

  • Hello,

    Please check this guide for more information, regarding VIP.
    processors.wiki.ti.com/.../Linux_Core_VIP_User's_Guide
    I would recommend you to take a look into this thread also:
    e2e.ti.com/.../642369

    Hope this helps.

    BR
    Margarita
  • I'm readed Linux_Core_VIP_User's_Guide but not found description about how to configure VIP pipeline.
    I use vin4a (vin4b not used and disabled) and CSC module should be available.

    In suggested thread used inverse conversion from yuv to rgb and mem-to-mem, that can be done in vpe.
    I'm not interested in get rgb to memory, then convert it to yuyv. I want to get directly yuyv frame from rgb24 source with help of internal VIP CSC.

    I think problem in my v4l2-subdevice driver. where I can find some driver example, that will able use VIP CSC?
  • After experiments and log analysis of other video sources I found solution.
    For enable conversion between formats need addi new record to static struct vip_fmt vip_formats[VIP_MAX_ACTIVE_FMT] in VIP driver.
    I addedd

    {
    .fourcc = V4L2_PIX_FMT_YUYV, //you target capture fourcc
    .code = MEDIA_BUS_FMT_RGB888_1X24, //you return enum_mbus_code
    .colorspace = V4L2_COLORSPACE_SMPTE170M,
    .coplanar = 0,
    .vpdma_fmt = { &vpdma_yuv_fmts[VPDMA_DATA_FMT_YCB422],
    },
    },

    in end of list and increment VIP_MAX_ACTIVE_FMT. And after rebuild, driver can capture video in RGB or in YUYV colorspaces.