RAW10 Differences in pixel packing and unpacking between Xavier NX and nano

Hi
Currently I am porting an existing solution from Nano to Xavier-nx for one of our cameras. I noticed a difference between RAW10 conversion to 16 bit data. What I noticed was a pixel value of 48 (0x30) in jetson nano is retrieved as 1537 (0x601) in jetson xavier-nx (for a custom camera). I am trying to understand how the jetson nano is able to retrieve the correct value from pixel-packing where as the xavier-nx is not able to and how i can handle the behaviour ?? I am acquiring the images using standard v4l2-ctl commands for the same camera and similar hardware base.

Video capture information:
From Nano:
Format Video Capture:
Width/Height : 2592/1944
Pixel Format : ‘BG10’
Field : None
Bytes per Line : 5184
Size Image : 10077696
Colorspace : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)

From Xavier-nx:
Format Video Capture:
Width/Height : 2592/1944
Pixel Format : ‘BG10’
Field : None
Bytes per Line : 5184
Size Image : 10077696
Colorspace : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)

Why does the pixel packing and unpacking seems to be quite unseemingly done with Nano and not with XavierNX, what might I be missing.

Below is XNX pixel to memory placement. Have check the TX1 TRM for Nano for the different.

Yes I understand the pixel packing, but what I don’t understand is that there is also a pixel packing with Jetson Nano, but the v4l2 output is as expected (without any pixelpacking or automatic unpacking) … So when my test pixel value is 48, I receive 48 as the v4l2-output without me doing anything special whereas with Xavier NX I am getting the output with the pixel packing , I tried both T_R16 and T_R16_I

Output from nano (which is same as expected):
[ 48 8 48 … 784 384 784]
Output from Xavier :
[ 3075 512 3075 … 50225 24600 50225]

Do you think that the pixel unpacking has to be handled explicitly ???

The different is T_R16 and T_R16_I

So if I use T_R16, you think that the pixel unpacking will automatically happen in V4l2 ?? I will give it a try and see again

I have now placed the default l4t on both my Xavier and nano and tried to grab images from imx219 (raspberry pi camera v2.1)… I see the same behaviour in this one as well. I see also in the imx219 code that for Xavier-nx it’s using T_R16 (vi5_formats.h) and nano is using T_R16_I. They are not exactly taken at the same time, but I would expect the results to be close …

v4l2-ctl -d /dev/video0 --set-fmt-video=width=3264,height=2464,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=imx219_nano.raw --verbose
hexdump imx219_nano.raw | head -n 10
0000000 005b 007b 005c 007d 0058 007d 005a 0085
0000010 005a 0084 005b 007c 005c 0083 005b 007b
0000020 005b 0085 005c 0082 005c 007a 005e 007e
0000030 0059 0080 005d 0085 005e 0084 005f 007e
0000040 0062 007f 005d 0087 0061 0084 005d 008f
0000050 0062 0087 0062 0089 0061 0092 0064 0090
0000060 0062 0092 0060 0092 0064 0095 0069 009a
0000070 0064 0095 006b 0099 0068 0098 0067 00a3
0000080 0068 0099 0069 00a2 006e 00a1 006b 009f
0000090 0068 009d 0069 00a3 006b 00a9 006e 00a1

v4l2-ctl -d /dev/video0 --set-fmt-video=width=3264,height=2464,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=imx219_xavier.raw --verbose
hexdump imx219_xavier.raw | head -n 10
0000000 1a06 2789 1986 23c8 1a86 2689 1b06 280a
0000010 1b46 2589 19c6 27c9 1a86 2689 1ac6 2609
0000020 1bc6 2709 1a46 284a 1986 2649 1ac6 2589
0000030 18c6 25c9 1ac6 2789 1c47 2689 1b06 2789
0000040 1a86 2589 1a86 280a 1b46 290a 1a86 2509
0000050 1986 2749 1946 2709 1a86 2609 1a46 284a
0000060 1a06 2689 1a86 2709 19c6 2709 1b86 2749
0000070 19c6 2689 1a46 2489 1a86 280a 1ac6 26c9
0000080 1986 2789 1a86 2789 18c6 2649 19c6 2749
0000090 1a46 2649 1a06 2709 1ac6 26c9 1986 280a