RAW10 sizeimage, bytesperline, bpp, data_alignment in iMX8M Mini

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RAW10 sizeimage, bytesperline, bpp, data_alignment in iMX8M Mini

1,103 Views
khang_letruong
Senior Contributor III

Dear MIPI CSI sensor experts,

I'm currently porting the driver of Sony IMX296 to iMX8M Mini platform using the BSP-5.4.24_2.2.0. The sensor spec and its RAW output is described in the attached file.

As for the recommended recording area which is 1440x1080, I assume that the  sizeimage would be : 1440x1080x10/8 = 1944000 bytes, and the bytesperline would be 1440x10/8 = 1800 bytes.

However,  in mx6s_capture.c,  the calculation of image size and bytesperline are as following :

 

static int mx6s_vidioc_try_fmt_vid_cap(struct file *file, void *priv,
				      struct v4l2_format *f)
{
	...
	pix->sizeimage = fmt->bpp * pix->height * pix->width;
	pix->bytesperline = fmt->bpp * pix->width;

	return ret;
}

 

According to the above code snippet :

pix->sizeimage = 2 x 1080 x 1440 =  3110400 bytes (instead of 1944000)

pix->bytesperline = 2 x 1440 = 2880 bytes (instead of 1800)

Note : bpp = 2 in case of RAW10.

In mxc_mipi_csi.c, there's also data_alignment attribute in the following table :

 

static const struct csis_pix_format mipi_csis_formats[] = {
	{
		...
	}, {
		.code = MEDIA_BUS_FMT_SBGGR10_1X10,
		.fmt_reg = MIPI_CSIS_ISPCFG_FMT_RAW10,
		.data_alignment = 10,
	}
};

 

I was hesitating to use 10 or 16 but finally I see that the only reference to this attribute is

 

static void mipi_csis_set_params(struct csi_state *state)
{
	...

	val = mipi_csis_read(state, MIPI_CSIS_ISPCONFIG_CH0);
	if (state->csis_fmt->data_alignment == 32)
		val |= MIPI_CSIS_ISPCFG_ALIGN_32BIT;
	else /* Normal output */
		val &= ~MIPI_CSIS_ISPCFG_ALIGN_32BIT;
	mipi_csis_write(state, MIPI_CSIS_ISPCONFIG_CH0, val);

	...
}

 

So data_alignment does not participating in the calculation of the either sizeimage or bytesperline.

My question is that will the data in the recording buffer be the same order as the output of the sensor (RAW10 : P0, P1, P2, P3 P0+1+2+3 LSB, P4, P5, P6, ... ) or will they be extended to 16-bit ?

Thanks in advance and best regard,

K.

 

 

 

 

 

 

0 Kudos
3 Replies

1,095 Views
joanxie
NXP TechSupport
NXP TechSupport

you can refer to the another topic

https://community.nxp.com/t5/i-MX-Processors/Confirmed-support-for-RAW12-through-4-lane-CSI-2-sensor...

so should be extend to the 16bits

0 Kudos

1,092 Views
khang_letruong
Senior Contributor III

Dear @joanxie ,

By reading the RAW file captured from our sensor on IMX8M Mini, my understanding is as below :

RAW10-extended.png

If the above info is TRUE, then the bytesperline and imagesize are correct according to the current calculation within mx6s_vidioc_try_fmt_vid_cap().

Can you confirm my understanding about RAW10 extended to 16 bit on iMX8M Mini, please ?

Best regards,

K.

 

0 Kudos

1,030 Views
joanxie
NXP TechSupport
NXP TechSupport

yes, raw10 extend to 16bits

 

0 Kudos