Sensor-based JPEG encoding on i.MX6UL

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

Sensor-based JPEG encoding on i.MX6UL

1,210件の閲覧回数
kosma_moczek
Contributor I

I'd like to use the OV5640's built-in JPEG encoder on a small cheap i.MX6ULL board. However, I'm struggling to find a way to configure the CSI peripheral for receiving variable-length compressed JPEG data - it seems it only supports fixed-size raw frames. Has anyone successfully used sensor-based compression with i.MX6UL or other i.MX chips?

ラベル(3)
0 件の賞賛
返信
4 返答(返信)

1,177件の閲覧回数
kosma_moczek
Contributor I

Another piece of wisdom/research: the newest kernel sources from https://github.com/torvalds/linux have redone this driver, it's now called drivers/media/platform/nxp/imx7-media-csi.c. It's been significantly redone; I will try to run tests with the latest kernel (6.1.10).

0 件の賞賛
返信

1,184件の閲覧回数
kosma_moczek
Contributor I

To elaborate a little bit:

1. OV5640 has an internal JPEG encoder and it can output the data over DVP/MIPI in different ways (see attachment). Some modes output a fixed size frame with "emulated" lines, others output a single line, and depending on the mode the frame can be padded with dummy data to make it appear fixed size.

2. Looking at IMX6ULLRM, it seems that the End of Frame Interrupt can only be generated based on the pixel/byte count:

kosma_moczek_0-1675864469582.png

Based on this, I think the only way to receive JPEG data from the sensor is to use one of the "emulated" modes where the sensor sends something that looks like a normal, fixed-size frame (RGB888 or Bayer), and then unpack the data in software? Am I correct? Can I program the emulated frame size on the sensor, and then set the same frame size on the CPU?

Another reason I asked is because I would appreciate code examples - looking at the kernel sources (mxc_v4l2_capture.c from Variscite sources) it seems that the MXC V4L2 driver doesn't support JPEG natively, so I suspect some custom driver work might be needed?

static inline int valid_mode(u32 palette)
{
        return ((palette == V4L2_PIX_FMT_RGB565) ||
                (palette == V4L2_PIX_FMT_BGR24) ||
                (palette == V4L2_PIX_FMT_RGB24) ||
                (palette == V4L2_PIX_FMT_BGR32) ||
                (palette == V4L2_PIX_FMT_RGB32) ||
                (palette == V4L2_PIX_FMT_YUV422P) ||
                (palette == V4L2_PIX_FMT_UYVY) ||
                (palette == V4L2_PIX_FMT_YUYV) ||
                (palette == V4L2_PIX_FMT_YUV420) ||
                (palette == V4L2_PIX_FMT_YVU420) ||
                (palette == V4L2_PIX_FMT_NV12));
}

Notably missing from the list is V4L2_PIX_FMT_JPEG.

0 件の賞賛
返信

1,172件の閲覧回数
joanxie
NXP TechSupport
NXP TechSupport

yes, you are correct, for csi supported format on imx6ul, you can refer to the Table 19-3. CSI input data format of reference manual, and current CSI couldn't support JPEC data, maybe you need convert them to csi supported format

you also can check driver

https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/media/platform/mxc/capture/mx6s_ca...

0 件の賞賛
返信

1,190件の閲覧回数
joanxie
NXP TechSupport
NXP TechSupport

what format do you want to set in the ov5640? what do you mean variable-length compressed JPEG data ?

0 件の賞賛
返信