Jetson Nano - Support format Grayscale 14

Hello Nvidia developpers,

I am working on a sensor which outputs two different formats : Grayscale8 and Grayscale14.

I achieved to add the support of the grayscale8 format on the Jetson nano. To do that, I edited three files :

  1. vi2_formats.h :
static const struct tegra_video_format vi2_video_formats[] = {
        /* GRAYSCALE */
        TEGRA_VIDEO_FORMAT(RAW8, 8, Y8_1X8, 1, 1, T_L8, RAW8, GREY, "GRAY8"),
  1. camera_common.c :
static const struct camera_common_colorfmt camera_common_color_fmts[]
        {        
                MEDIA_BUS_FMT_Y8_1X8, //GRAYSCALE 8 BITS
                V4L2_COLORSPACE_RAW, //RAW
                V4L2_PIX_FMT_GREY,
        },
  1. sensor_common.c :
static int extract_pixel_format
//grayscale format
        else if (strncmp(pixel_t, "gray", size) == 0)
                *format = V4L2_PIX_FMT_GREY;

That allowed me to use this format in the .dtsi file of my sensor, and it’s working well.

Now I want to do the same process but with Grayscale14. The problem is that it seems to be much more complicated that grayscale8 according to what has been said here : support for grayscale sensors is missing - #6 by JerryChang

It seems that @JerryChang knows a bit in this domain, maybe you could help me.

Do you think that I just have to do the same process as with Grayscale8 ? Or is it more complicated ?

Thank you for reading me and any help would be appreciated !
Adrien.

hello adrien.leroy2,

please check the sensor capability via v4l2 utility, i.e. $ v4l2-ctl -d /dev/video0 --list-formats-ext
it’ll report available sensor formats if you’d implementation correctly.
after that,
please enable the gstreamer pipeline with v4l2src for verification,
for example,
$ gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw, format=GRAY8, width=640, height=480, framerate=30/1' ! fakesink
or
$ gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw, format=GRAY8, width=320,height=240' ! glimagesink

BTW,
you may also refer to Topic 51136 , and Topic 175089 as see-also.
thanks

Hello @JerryChang ,

Maybe you didn’t notice but the second link you send is my previous topic.

So, I previously added the support of grayscale8 format. Now I want to do the same with grayscale14 and I would like to know the procedure.

thanks

Adrien

hello adrien.leroy2,

would you also like to output 14-bit data?

Hello @JerryChang ,

I have a sensor which can be configured in Gray8 and Gray14. So I first validated Gray8 fonction, and now I want to do the same with Gray14. So, I put the sensor in Gray14 mode and the Jetson Nano will receive video stream via MIPI in Gray14.

So my question is : How to add the support of grayscale14 in the kernel ?

Adrien

Hello @JerryChang ,
I searched a bit more in the source files and found a file named : videodev2.h where a lot of formats are listed (including greyscale) :

I see that a lot of grayscale are available : from 4 to 16 but not 14 so my question is : is grayscale14 possible or not ?

Thanks
Adrien

hello adrien.leroy2,

that’s linux driver to define all the standards. so you could mapping the pixel formats into fourcc.
you may have a try since Raw14 is one of the supported CSI formats. (i.e. just as same we consider Gray8 as Raw8)
however, I’ve never test with Gray14 on Nano platforms, neither Raw14 did not verified on Nano.

I checked for RAW14 and I can’t find it !
The only thing close that I have is RAW12 in vi2_formats.h

Or maybe is it SRGGB14_1X14 ?

Thanks
Adrien

hello adrien.leroy2,

you need to have implementation since Raw14 did not verified on Nano.
here’s an example to define Raw10, Raw12.

        /* RAW 10 */
        TEGRA_VIDEO_FORMAT(RAW10, 10, SRGGB10_1X10, 2, 1, T_R16_I,
                                RAW10, SRGGB10, "RGRG.. GBGB.."),
...
        /* RAW 12 */
        TEGRA_VIDEO_FORMAT(RAW12, 12, SRGGB12_1X12, 2, 1, T_R16_I,
                                RAW12, SRGGB12, "RGRG.. GBGB.."),

Raw14 also uses the memory format with T_R16_I, which you can see TRM, see the table, [Raw Supported Memory Formats] in Video Input (VI) chapter for more details.
thanks