Why v4l2 dump data bpp is 16 not 12?

Hi, I have a question when I dump with v4l2.

First of all, I’ll explain the environment.
My camera info is

Priority: 2
Video input : 0 (Camera 0: ok)
Format Video Capture:
Width/Height : 3840/1920
Pixel Format : ‘RG12’ (12-bit Bayer RGRG/GBGB)
Field : None
Bytes per Line : 7680
Size Image : 14745600
Colorspace : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)
Flags :

and, I try to camera dump using below command.

v4l2-ctl --set-fmt-video=width=3840,height=1920,pixelformat=RG12 --stream-mmap -d /dev/video0 --set-ctrl bypass_mode=0

Of course, dump data can be obtained.
but When I read it using some hex edit program, it’s 16bit full, not 12bit.
like this :

12 EC AD DC 4E EC DE E4 DE EB FE E4 0E EC 3E E0 …

I think it should come out as below.

97 03 FA 01 84 03 E3 01 A9 03 E1 01 9B 03 E7 01 …

Can anyone tell me why?

thank you.

Check the TRM for the pixel format in memory layout.

OK.
just replicating.

I have another questions!

If T_R16 (not T_R16_I) format,
RAW12 is

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 D11 D10 D9 D8

right?

thank you!

It’s should be the same with t_r16_i

Really?
But, When I look at the dump file, MSB is not 0.
Also, replicated LSBs is 4 space not 3 space. like below

hex : FF F5 6C C5 EF F2 7C CF …

bin : 6C C5 --LE–> C5 6C

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 0 0 1 0 1 0 1 1 0 1 1 0 0

Am I doing something wrong?

Sorry it’s my mistake.

T_R16_I has 0 on MSB, so it’s 1-bit right shifted from T_R16