how xavier convert sensor raw16 data to memory

We found the image raw16 data output from sensor is different from the data we get from v4l2.

For example, one pixel of output data from sensor is
0x201c,

but the pixel we get from v4l2 is
0x1c10.

We guess maybe xavier move low eight bits(0x1c) to the high eight bits, and use the original high eight bits subtract 16, then move to the low eight bits.

why does xavier do this? The shift operation is easy to understand, but why is there subtraction?

The attachments are image output from sensor and get from v4l2.

We add one item like this in 《vi5_formats.h》 to support raw16,

TEGRA_VIDEO_FORMAT(RAW16, 16, SRGGB16_1X16, 2, 1, T_R16,
	    RAW16, SRGGB16, "RGRG.. GBGB.."),

We use “T_R16” to process raw16 data, but we cannot find how “T_R16” process raw16 data. We can only find “T_R16_I” in datasheet, but “T_R16_I” cannot process raw16.
image.7z (7.21 KB)

Looks like TRM lost this.
Checking and will update to you.

Hi, ShaneCCC.

Not only do we want to know how T_R16 handled the data, what’s more, can the processing procedure be changed?

We want the raw16 data from sensor to be not changed.

To say the least, the shift operation can be accepted, but subtraction cannot be accepted in our system.

Do you have any idea about this?

Now we find xavier is Little-Endian, and the image from our sensor is Big-endian. So there is the shift operation.

Now the only different is the subtraction of 16. We want to know why there is the subtraction and how to cancel it.

How did you know the data from sensor is 0x201c, is it from a fixed pattern?
Could you try if configure VI to T_R32?

yes, we use a fixed pattern.

When I tried configure VI to T_R32, there are some errors in drivers.

You have to modify the DT for your HW.

[url]Welcome — Jetson Linux<br/>Developer Guide 34.1 documentation

I don’t know how to modify the DT if configure VI to T_R32, and I can’t find anything about it in the web you send.

I think the configurations don’t need to be changed, because the input from sensor doesn’t changed. And I should use 4 bytes to store a image in v4l2 software. I did this but failed.

So I don’t know how to do now.

I think you need to modify the VI or nvcsi driver instead of the DT.

Hi lisubin328719,

Have you managed to get issue resolved? Any further supported needed?