Skip to content

Conversation

avolmat-st
Copy link

The STM32 DCMIPP pipe 1 (main) is able to generate semi planar and planar formats such as NV12/NV16 or YUV420.
This PR adds definition of those formats as well as their description in the API header and add their support within the dcmipp driver.

@avolmat-st
Copy link
Author

Added NV24/NV42 as well

@avolmat-st
Copy link
Author

Mark the PR as Ready for review now that I have validated all 6 formats the DCMIPP can output (NV12/NV21/NV16/NV61/YUV420/YVU420)

@hfruchet-st
Copy link
Contributor

Tested OK on N6 for NV12 with #92884

Copy link
Contributor

@ngphibang ngphibang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a minor comment on format documentation

Copy link
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see this coming.
A few suggestions for how to improve it just a bit, though all can be done in the future as well.

@avolmat-st avolmat-st force-pushed the pr-dcmipp-planar-addition branch from 0108872 to 85c17b2 Compare August 14, 2025 13:58
@avolmat-st
Copy link
Author

@ngphibang @josuah , I've only updated the video.h header with the formats description for now.

@avolmat-st
Copy link
Author

@josuah, @ngphibang, Sorry for the delay in the update. Hopefully fixed all open points.

Comment on lines +137 to +151
#define VIDEO_FMT_IS_SEMI_PLANAR(fmt) \
(((fmt)->pixelformat == VIDEO_PIX_FMT_NV12 || \
(fmt)->pixelformat == VIDEO_PIX_FMT_NV21 || \
(fmt)->pixelformat == VIDEO_PIX_FMT_NV16 || \
(fmt)->pixelformat == VIDEO_PIX_FMT_NV61) ? true : false)

#define VIDEO_FMT_IS_PLANAR(fmt) \
(((fmt)->pixelformat == VIDEO_PIX_FMT_YUV420 || \
(fmt)->pixelformat == VIDEO_PIX_FMT_YVU420) ? true : false)

#define VIDEO_Y_PLANE_PITCH(fmt) \
((VIDEO_FMT_IS_PLANAR(fmt) || VIDEO_FMT_IS_SEMI_PLANAR(fmt)) ? \
(fmt)->width : (fmt)->pitch)

#define VIDEO_FMT_PLANAR_Y_PLANE_SIZE(fmt) ((fmt)->width * (fmt)->height)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these go into video.h so that others could use ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have actually been wondering about that yesterday when I wrote them, however, this would potentially put a penalty for a driver which only implement say NV12 / NV21 since this would lead to checking for more pixelformat than the driver can actually support. Hence I kept this within the driver to only check what is applicable.
That said, the name of the macro might be better with a more "STM32" specific name since current name make it think that this is a generic function ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right ! Other drivers may just support one or two formats and even don't need a macro. The name is Ok I think.

ngphibang
ngphibang previously approved these changes Sep 11, 2025
Copy link
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the build preview, there seems to be a few doc glitches:
https://builds.zephyrproject.io/zephyr/pr/94081/docs/doxygen/html/group__video__pixel__formats.html

Solved by adding extra @code{.unparsed} and @endcode.

Other than that, I did not find any issue.

Thank you for the modifications!

@josuah
Copy link
Contributor

josuah commented Sep 11, 2025

screenshot_2025_0911_1348_45

screenshot_2025_0911_1348_50

Alain Volmat added 3 commits September 11, 2025 13:54
Add description and fourcc define for some of the 2 and 3 planes
pixel formats.

Signed-off-by: Alain Volmat <[email protected]>
ISP is part of the pixel pipes hence it doesn't make any sense to
try to call ISP external handlers if the DCMIPP doesn't have pixel
pipes available.

Signed-off-by: Alain Volmat <[email protected]>
Add support for NV12/NV21, NV16/NV61 and YUV420/YVU420
(semi)planar formats which can be output by the main zephyrproject-rtos#1 pipe.

Signed-off-by: Alain Volmat <[email protected]>
Copy link

@fabiobaltieri fabiobaltieri merged commit a5bc5fa into zephyrproject-rtos:main Sep 11, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Video Video subsystem platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants