We are working on a camera system with ap1302, and Xavier AGX and are having image quailty issues when streaming
at 4208x3120 resolution.
The device tree and driver we made following the Sensor Software Driver Programming guide.
ap1302.dtsi (4.1 KB)
For calculating pix_clk_hz we used (data_rate*num_lanes)/bpp for all supported modes. Is this correct?
We are using gst-launch-1.0 and v4l2-ctrl to capture stream:
v4l2-ctl --set-fmt-video=width=4208,height=3120,pixelformat=YUYV --stream-mmap -d /dev/video0 --stream-count=50
gst-launch-1.0 v4l2src device=/dev/video0 ! “video/x-raw,width=4208,height=3120,format=YUY2” ! xvimagesink
Result of v4l2-ctrl --list-formats-ext:
Index : 0
Type : Video Capture
Pixel Format: 'YUYV'
Name : YUYV 4:2:2
Size: Discrete 4192x3120
Interval: Discrete 0.050s (20.000 fps)
Size: Discrete 4208x3120
Interval: Discrete 0.050s (20.000 fps)
Size: Discrete 3840x2160
Interval: Discrete 0.033s (30.000 fps)
When streaming at 3840x2160 and 4192x3120 the image quality is good:
But at 13mp(4208x3120) we get quality issues. It seems like every second row is offset by 16 pixels, it is noticeable around edges and there is a green line 16 pixel wide(missing pixels) at the right border:
We boost the nvcsi, isp and vi clocks to max values always and the logs look like this:
trace.log (35.8 KB)
for the most part. Occasionally there is a CHANSEL_NOMATCH with code 0x3c9 when streaming at max resolution.
Our configuration does not have these issues in our reference system.
Could something like this be related to vi or nvcsi?
How about reduce the frame rate to try?
I have tried reducing the frame rate. The problem is still there.
Here is a raw image captured using v4l2-ctl method.
4208x3120.yuv (25.0 MB)
At the end of every second line there are 16 pixels all set to zero.
I have found more forum posts that report the same image issues.
Yes, i assumed that there is an problem with the frame size.
when i trying to convert this VYUY image i get image with aliasing, maybe it’s stride problem? but it not made sense cause gstreamer know VYUY format…
3 files are attached
test.vyuy vyuy file grubbed using video4linux
test.vyuy (23.6 MB)
gst-launch-1.0 -e filesrc location=test.vyuy ! videoparse format=vyuy width=4112 height=3008 framerate=15/1 ! videoconvert ! jpegenc ! filesink locat…
Could you give a a response regarding the pixel_clk_hz setting (see my question below) ?
Regarding our main issue with images with less than 640 pixels per line: even if we solve the issue by adding 240 pixels to our 400 pixels lines, it’s not an elegant way to solve the problem. I would like to give you another information. Even if the streaming was working with v4l2-ctl, we had an issue with the pixels in the images: the odd lines were OK, but for the even lines were shifted by 16 pix…
It seems to be a problem with alignment but I can’t find any info on what the constrain is.
Why is the image okay at 4192 width and not at 4208? Is there a way to make 4208 work?
I have also tried the solution from this post:
I am trying to capture video from a 3848 2168 YUV422 (YUY2) GMSL2 camera on Xavier.
When using another 3840 2160 resolution GMSL2 camera sensor, everything works just as fine, I can get the correct image and data. However when I change to a new 3848*2168 YUY2 GMSL2 camera (after updating necessary kernel drivers), I get distorted image from v4l2src through:
gst-launch-1.0 v4l2src device="/dev/video0" ! video/x-raw, width=3848, height=2168, format=YUY2, framerate=30/1 ! xvimagesink
prefered_stride 256 had no effect. I’m not sure i understand the setting. What does it do? Is it even enabled?
Tegra release version:
# R32 (release), REVISION: 5.2, GCID: 27767740, BOARD: t186ref, EABI: aarch64, DATE: Fri Jul 9 16:05:07 UTC 2021
Could you try the size have 64 alignment.
Tried the folowing:
4192x3120 image is clear
4224x3120 image is clear
4224 is 64 aligned but 4192 is not. Why is 4192x3120 working? How do I make 4208x3120 work?
Could you try prefered_stride as 32, 263, 526
v4l2-ctl --set-ctrl prefered_stride = 32
Using v4l2-ctl for capture, like this:
v4l2-ctl --set-fmt-video=width=4208,height=3120,pixelformat=UYVY --stream-mmap -d /dev/video0 --stream-count=10 --set-ctrl preferred_stride=526 --stream-to=stride-test.yuv
and vooya for checking.
No changes in image quality for all suggested stride values.
Looks like need 32 alignment for the VI engine.
Can that be changed? Setting preferred stride with v4l2-ctl yields no results. Do I need to edit something in tegra drivers and if so what? How do I set it to 16?
Try remove below code from the …/kernel/nvidia/drivers/media/platform/tegra/camera/vi/channel.c to verify.
*height = clamp(*height, TEGRA_MIN_HEIGHT, TEGRA_MAX_HEIGHT);
Removing this line doesn’t help. Is there something else that I can change?
Please checking the VI driver if able to configure it as your wish. Otherwise I think it’s VI limitation for Jetson platform.
v4l2-ctl --set-ctrl preferred_stride=8448 fixed the issue
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.