Xavier about the camera raw data format setting

Hi teams

We are working on the AGX Xavier platform.
When we light up the camera sensor, we find that the original data has a reverse color difference.
The raw data of our camera is yuyv422.Our code modify as below:
dtsi:


driver file tegracam_v4l2.c

When I use command “v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=YUYV --stream-mmap --stream-count=1 -d /dev/video4 --stream-to=ov5693.raw” get the raw data…

Open the raw data file with YUYV is abnormal,but UYVY is ok.
YUYV:


UYVY:

Why I change the data format from UYVY to YUYV,it didn’t work ?

BRs
thanks

Could you print the format(img_fmt) in the vi5_fops.c in below function to confirm the setting.

static void vi5_setup_surface(struct tegra_channel *chan,
  	struct tegra_channel_buffer *buf, unsigned int descr_index)
  {
  	dma_addr_t offset = buf->addr + chan->buffer_offset[0];
  	u32 height = chan->format.height;
  	u32 width = chan->format.width;
  	u32 format = chan->fmtinfo->img_fmt;

Hi ShaneCCC

thanks for your reply.
I print the format[img_fmt],the result as below:

The setting is correct to set as YUYV, not sure what happened for it.
Could you try to configure the sensor output UYVY and VI configure as YUYV for experiment.

Hi ShaneCCC

I use the command of “v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=YUYV --stream-mmap --stream-count=1 -d /dev/video4 --stream-to=ov5693.raw” to get the image data.
1 ) Does it get the raw data ?
2) Does this command( v4l2-ctl ) do data format conversion or not ?

OK, Let make the problem clear.
Do you set the YUYV by the v4l2-ctl command line but didn’t modify the sensor REG to output YUYV data format? If yes that could be the problem. You need to configure the sensor REG to output pixel format match the dt setting instead of use the command to configure it.

Hi ShaneCCC

  1. First, Our image sensor supplier said that the default output of the original data format is yuyv. Secondly, I modified the data image format to yuyv in dtsi file to match the image sensor consistency.Then,I use the above command to get a frame of image data. So I use yuv tool to preview the photo.:
    When I set the data format of yuyv to preview the image data, it does not display properly
    When I set the data format of uyvy to preview the image data, it displays normally
    But the original image data is yuyv, and I have set it to yuyv. I don’t know why it doesn’t work ?

  2. I asked the supplier to change the sensor register to uyvy. No matter whether my device tree is changed to uyvy or yuyv, it will display normally.,I have a little confused.

What’s tools to check the raw data? Could you attached the raw data to check.

Hi ShaneCCC

I used 7yuv to check the raw data.
Attached is the image data captured with the command of v4l2-ctl
The imager sensor output YUYV and I set to YUYV,But it can not display normal.

953.zip (2.3 MB)

I change to BIg Endian byte order to show the correct color of this raw file.

Hi ShaneCCC

I use Xavier platform,it is arm architecture.
How to fix it ?

It’s the 7yuv setting problem doesn’t matter with Xavier.
I set BIg Endian byte order in 7yuv get get the normal color as early comment.

On Xavier you can run below command to check the preview.

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1920,height=1080,format=(string)YUYV' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=(string)NV12' ! queue ! nvvidconv ! nvoverlaysink -e

Hi ShaneCCC

When I execute above command,it shows below error…

Try below two.

export DISPLAY=:0
gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw, width=1920, height=1080, format=YUYV" ! nvvidconv ! "video/x-raw, width=1920, height=1080, format=YUYV" ! xvimagesink sync=false -e
gst-launch-1.0 v4l2src ! 'video/x-raw, width=1920, height=1080, framerate=60/1, format=YUYV' ! nvvidconv ! 'video/x-raw(memory:NVMM), width=1920, height=1080, framerate=60/1, format=I420' ! nvoverlaysink sync=false

Hi ShaneCCC

it still error

Does your system connect HDMI display?

  • YUYV is usually referred as YUY2 in gstreamer framework.
  • nvvidconv expects at least one among its input or output to be in NVMM memory.

You don’t need nvvidconv for displaying to xvimagesink as it accepts YUY2:

gst-launch-1.0 -v v4l2src device=/dev/video0 ! video/x-raw, width=1920, height=1080, format=YUY2 ! xvimagesink

You would use nvvidconv for copying into NVMM memory for nvoverlaysink, for example (need a local monitor):

gst-launch-1.0 -v v4l2src device=/dev/video0 ! video/x-raw, width=1920, height=1080, format=YUY2 ! nvvidconv ! nvoverlaysink

Hi ShaneCCC

Our board connect to HDMI display

hello JCap,

may I know what’s the format types reported via v4l2 standard controls.

$ v4l2-ctl -d /dev/video0 --list-formats-ext

Hi JerryChang

The result is below: