i.mx8mp raw10 to raw8

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

i.mx8mp raw10 to raw8

ソリューションへジャンプ
2,533件の閲覧回数
kiyoung
Contributor III

I am trying to operate gray camera using i.mx8mp.
It is captured as shown in the attached picture, but when converting from raw10 to raw8, it seems that the upper bits were just removed.
To make a normal bit change, where should I modify it?

grey.png

ラベル(1)
0 件の賞賛
返信
1 解決策
2,360件の閲覧回数
kiyoung
Contributor III

 

imx335 is also used in other CPU, and is converted to 8bit.
The reason for converting to 8bit is, of course, because the data size is small.
Processing this via S/W takes a lot of time, so ISP processes it.

As the title of this subject suggests, I expected i.MX8MP to convert 10bit to 8bit ISI.
In i.MX8MP, I need to receive 10bit and convert it to 8bit in S/W.
Thank you for answer.

 

元の投稿で解決策を見る

0 件の賞賛
返信
11 返答(返信)
2,439件の閲覧回数
joanxie
NXP TechSupport
NXP TechSupport

your information is too limited, did you use ISI or ISP to capture? what source code do you change?

0 件の賞賛
返信
2,434件の閲覧回数
kiyoung
Contributor III
I inform you of the changes below.
 
OK8MP-C.dts
&mipi_csi_0 {
    status = "disable";
};
 
&mipi_csi_1 {
    status = "okay";
 
    port@1 {
        reg = <1>;
        mipi_csi1_ep: endpoint {
          remote-endpoint = <&imx335_mipi_1_ep>;
          data-lanes = <4>;
          csis-hs-settle = <26>;
          csis-clk-settle = <4>;
          csis-wclk;
      };
   };
};
 
&isi_0 {
    status = "disabled";
};
 
&isi_1 {
    status = "okay";
 
    cap_device {
        status = "okay";
    };
 
    m2m_device {
        status = "disabled";
    };
};
 
imx8-isi-cap.c
struct mxc_isi_fmt mxc_isi_out_formats[] = {
         ...
    {
        .name = "GREY8 (Y8)",
        .fourcc = V4L2_PIX_FMT_GREY,
        .depth = { 8 },
        .color = MXC_ISI_OUT_FMT_RAW8,
        .memplanes = 1,
        .colplanes = 1,
        .mbus_code = MEDIA_BUS_FMT_SRGGB10_1X10,
    }
}
 
struct mxc_isi_fmt mxc_isi_src_formats[] = {
    {
        .....
    }, {
        ....
    }
    , {
        .name = "GREY8 (Y8)",
        .fourcc = V4L2_PIX_FMT_Y10,
        .depth = {16},
        .memplanes = 1,
        .colplanes = 1,
    }
};
 
imx8-mipi-csi2-sam.c
static const struct csis_pix_format mipi_csis_formats[] = {
    {
        .code = MEDIA_BUS_FMT_SBGGR10_1X10,
        .fmt_reg = MIPI_CSIS_ISPCFG_FMT_RAW10,
        .data_alignment = 16,
    },
     ....
}
 
0 件の賞賛
返信
2,426件の閲覧回数
joanxie
NXP TechSupport
NXP TechSupport

is this code for raw8? if yes, I don't think you can use mbus_code = MEDIA_BUS_FMT_SRGGB10_1X10 for raw8, any code for raw10, you need to change it for raw8

0 件の賞賛
返信
2,422件の閲覧回数
kiyoung
Contributor III
I am re-posting the corrections.
 
imx8-isi-cap.c
struct mxc_isi_fmt mxc_isi_out_formats[] = {
         ...
    {
        .name = "GREY8 (Y8)",
        .fourcc = V4L2_PIX_FMT_GREY,
        .depth = { 8 },
        .color = MXC_ISI_OUT_FMT_RAW8,
        .memplanes = 1,
        .colplanes = 1,
        .mbus_code = MEDIA_BUS_FMT_Y10_1X10,
    }
}
 
struct mxc_isi_fmt mxc_isi_src_formats[] = {
    {
        .....
    }, {
        ....
    }
    , {
        .name = "GREY8 (Y8)",
        .fourcc = V4L2_PIX_FMT_GREY,
        .depth = {8},
        .memplanes = 1,
        .colplanes = 1,
    }
};
 
imx8-mipi-csi2-sam.c
static const struct csis_pix_format mipi_csis_formats[] = {
    {
        .code = MEDIA_BUS_FMT_SBGGR10_1X10,
        .fmt_reg = MIPI_CSIS_ISPCFG_FMT_RAW10,
        .data_alignment = 16,
    },
     ....
}
 

Camera output is Raw10. If I force this to be changed to Raw8, more strange images will be captured.

If I change .code = MEDIA_BUS_FMT_SBGGR10_1X10 in imx8-mipi-csi2-sam.c to MEDIA_BUS_FMT_Y8_1X8 or MEDIA_BUS_FMT_Y10_1X10, the message below will appear and capture will not work.
gasket not support format 8193
gasket not support format 8202

Since it operates in bypass mode, I thought there would be no problem with MEDIA_BUS_FMT_SBGGR10_1X10.

I am concerned about the part below in the CHNL_IMG_CTRL register description in IMX8MPRM.pdf.
NOTE: For RAW pixel formats, if the output pixel format has few bits per pixel than the input pixel
format, the most significant bits of each pixel are truncated by the ISP.

 

 
0 件の賞賛
返信
2,404件の閲覧回数
joanxie
NXP TechSupport
NXP TechSupport

1)if you need raw8, as I mentioned before,

struct mxc_isi_fmt mxc_isi_out_formats[] = {
...
{
.name = "GREY8 (Y8)",
.fourcc = V4L2_PIX_FMT_GREY,
.depth = { 8 },
.color = MXC_ISI_OUT_FMT_RAW8,
.memplanes = 1,
.colplanes = 1,
.mbus_code = MEDIA_BUS_FMT_Y10_1X10,
}
}

you need change mbus_code to MEDIA_BUS_FMT_SRGGB8_1X8

2)since you add new member in the mxc_isi_src_formats,did you change the code in the function mxc_isi_get_src_fmt? if no, how could you successfully capture raw10?

3)for imx8-mipi-csi2-sam.c, you don't need change anything, already includes raw8 and raw10 format

0 件の賞賛
返信
2,400件の閲覧回数
kiyoung
Contributor III

1)

I tested by modifying the mbus_code of mxc_isi_out_formats to MEDIA_BUS_FMT_SRGGB8_1X8.
Below (fsize->code != supported_mode.code) an error occurs.
imx335 does not have an 8bit mode, but as you indicated, supported_mode.code was changed from MEDIA_BUS_FMT_Y10_1X10 to MEDIA_BUS_FMT_SRGGB8_1X8.

static int imx335_enum_frame_size(struct v4l2_subdev *sd,
  struct v4l2_subdev_pad_config *cfg,
  struct v4l2_subdev_frame_size_enum *fsize)
{
if (fsize->index > 0)
return -EINVAL;
 
if (fsize->code != supported_mode.code)
return -EINVAL;
 
fsize->min_width = supported_mode.width;
fsize->max_width = fsize->min_width;
fsize->min_height = supported_mode.height;
fsize->max_height = fsize->min_height;
 
return 0;
}

 

2)

mxc_isi_get_src_fmt was modified as below.
struct mxc_isi_fmt *mxc_isi_get_src_fmt(struct v4l2_subdev_format *sd_fmt)
{
u32 index;
 
/* two fmt RGB32 and YUV444 from pixellink */
if (sd_fmt->format.code == MEDIA_BUS_FMT_YUYV8_1X16 ||
    sd_fmt->format.code == MEDIA_BUS_FMT_YVYU8_2X8 ||
    sd_fmt->format.code == MEDIA_BUS_FMT_AYUV8_1X32 ||
    sd_fmt->format.code == MEDIA_BUS_FMT_UYVY8_2X8 ||
    sd_fmt->format.code == MEDIA_BUS_FMT_YUYV8_2X8)
index = 1;
else
index = 0;
index = 2;
return &mxc_isi_src_formats[index];
}

3)

If I use mipi_csis_formats as MEDIA_BUS_FMT_SBGGR10_1X10, it will be captured like the attached picture, and if I use MEDIA_BUS_FMT_SBGGR8_1X8, a more strange video will be captured.

 

0 件の賞賛
返信
2,375件の閲覧回数
joanxie
NXP TechSupport
NXP TechSupport

all of settings I told you is about raw8 capture, since your camera only supports raw10, why do yo need to test raw8 capture? if you already capture raw10 successfully, I'm confused with why you need to test raw8 capture

0 件の賞賛
返信
2,361件の閲覧回数
kiyoung
Contributor III

 

imx335 is also used in other CPU, and is converted to 8bit.
The reason for converting to 8bit is, of course, because the data size is small.
Processing this via S/W takes a lot of time, so ISP processes it.

As the title of this subject suggests, I expected i.MX8MP to convert 10bit to 8bit ISI.
In i.MX8MP, I need to receive 10bit and convert it to 8bit in S/W.
Thank you for answer.

 

0 件の賞賛
返信
2,390件の閲覧回数
joanxie
NXP TechSupport
NXP TechSupport

imx335 does not have an 8bit mode

> what do you mean? imx355 doesn't have 8bit mode, why do you test 8bit mode?

0 件の賞賛
返信
2,383件の閲覧回数
kiyoung
Contributor III
The imx335 driver is set to 10bit, so I think supported_mode.code should be MEDIA_BUS_FMT_Y10_1X10.
If supported_mode.code is set to MEDIA_BUS_FMT_Y10_1X10, the value will be different from the mbus_code=MEDIA_BUS_FMT_SRGGB8_1X8 part of mxc_isi_out_formats you provided.
So, below (fsize->code != supported_mode.code) an error occurs.
 
static int imx335_enum_frame_size(struct v4l2_subdev *sd,
  struct v4l2_subdev_pad_config *cfg,
  struct v4l2_subdev_frame_size_enum *fsize)
{
   if (fsize->index > 0)
      return -EINVAL;
 
   if (fsize->code != supported_mode.code)
     return -EINVAL;
 
   fsize->min_width = supported_mode.width;
   fsize->max_width = fsize->min_width;
   fsize->min_height = supported_mode.height;
   fsize->max_height = fsize->min_height;
 
   return 0;
}
Capture is also possible in this state, but the result is similar to the attached video (it becomes a little darker).

 

0 件の賞賛
返信
2,490件の閲覧回数
kiyoung
Contributor III

Please, any advice...

0 件の賞賛
返信