how to make 10bit gray image to 8 bit(use only MSB) gray image using VI4 or ISP module on tx2 ?

Hi,

I want to design test board using image sensor (10bit gray color) and will attach tx2 board on my test board.

My 10bit gray sensor will send 10 bit image from csi to VI4

sequences is csi -> csi mux -> chansel -> pixfmt -> ispbuf -> ispa

my questions

#1. i want to use just MSB 8bit image from my 10bit gray sensor.

I printed in tegra_channel_capture_setup function(vi4_fops.c) belows.

vi4_channel_write(chan, vnc_id, PIXFMT_FORMAT, format);
printk("[dooman:%s] pixfmt-%d\n", func, format);

and results is 32, 32 means T_R16_I
[dooman:tegra_channel_capture_setup] pixfmt-32

T_R16_I is
RAW10 - | 0 | 0 | D9 | D8 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 | D9(MSB replicated) | D8(MSB repl) | D7(MSB repl) | D6(MSB repl) |

I guess that PIXFMT just make 10bit image to 16bit format add dummy data.

if i set VI_CH_PIXFMT_FORMAT_0 register to T_L8, can i get raw 8 bit image from my 10bit gray sensor like belows??

RAW10 - | D9 | D8 | D7 | D6 | D5 | D4 | D3 | D2 | LSB Thrown away

Thanks,
Doohan93

@doohan93
The ISP pipeline definitely not your case due to the ISP driver looking into the output format to set the PIXFMT_FORMAT. But for the vi mode you can try it or just get the raw data from the and doing a post processing.

To ShaneCCC,

Thank you for your answer. I have more questions.

question 1

What means “just get the raw data from the and doing a post processing.”

question 2

You means that i can make 10bit raw data to 8 bit raw data by setting VI_CH_PIXFMT_FORMAT_0 register.

Thansks,
Doohan93

  1. You can get the raw data by user tools like v4l2-ctl or follow the v4l2 API to get the frame from /dev/videox
  2. Yes, you can try modify this REG.