Skip to content

Conversation

@hfruchet-st
Copy link
Contributor

@hfruchet-st hfruchet-st commented Jul 9, 2025

This PR introduces H264 hardware video compression thanks to VENC peripheral of STM32N6.

A new stm32 video encoder driver has been introduced which relies on vc8000nanoe software stack [1].
This is a first basic porting to enable H264 encoding use-case.
RAM memory resources required by VENC encoding process are allocated in external PSRAM, camera frames
captured by DCMIPP and encoded by VENC are also allocated in external PSRAM.
The video encoder driver currently lack of controls to configure the encoding process, default configuration
targets H264 1080p 2Mb/s constant bitrate.

In order to test, the tcpserversink video sample has been enhanced to support video compression in order to stream small H264 compressed video chunks instead of big raw uncompressed images [2].

[1] zephyrproject-rtos/hal_stm32#295
[2] #95862

@github-actions
Copy link

github-actions bot commented Jul 9, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 9, 2025

@avolmat-st avolmat-st self-requested a review July 9, 2025 11:12
@josuah josuah added the area: Video Video subsystem label Jul 19, 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.

Thank you for preparing VENC!

This will really make video over network on Zephyr interesting.

It seems like Zephyr lacks a few APIs from Linux (no H.264 format definition, no planar API for NV12...), so if anything feels like missing, let us know so that the missing API can be provided in parallel.

@josuah josuah added the platform: STM32 ST Micro STM32 label Jul 19, 2025
hfruchet-st referenced this pull request in avolmat-st/zephyr-stm32-mw-isp Aug 13, 2025
No specific processing is necessary currently as part of the
stm32_dcmipp_isp_start function hence remove the assert(0)
currently preventing stop of the isp.

Signed-off-by: Alain Volmat <[email protected]>
hfruchet-st referenced this pull request in avolmat-st/hal_stm32 Aug 13, 2025
Allow to call HAL_DCMIPP_PIPE_SetConfig when the pipe state
is READY. Currently it is only possible to use this function
if the pipe state is RESET and ERROR states.
Indeed, it is possible to reconfigure the PIPE as soon as the
pipe is not currently being used, aka in the READY state.
With that done, it becomes possible to change the PIPE
configuration between two use-cases without having to
DeInit / Init the HAL_DCMIPP or use the unitary pixel packer
functions.

Signed-off-by: Alain Volmat <[email protected]>
@ngphibang ngphibang self-requested a review August 14, 2025 06:29
Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

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

First round of comment, driver aside.
Please split the PR and do a specific PR for the first commits that are not directly linked to the VENC driver. These can be reviewed and integrated faster.
For the changes on the sample, I let video team decide if this should be kept within the tcpserver sample or split into a different sample

Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

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

Some pending comments, not sure why they were missing

@hfruchet-st hfruchet-st force-pushed the iso_stm32n6_1080p_h264_streaming branch from a32b1da to deac1fb Compare September 11, 2025 14:14
@github-actions github-actions bot removed the manifest label Sep 11, 2025
@hfruchet-st hfruchet-st marked this pull request as ready for review September 11, 2025 14:19
JarmouniA
JarmouniA previously approved these changes Oct 9, 2025
@hfruchet-st
Copy link
Contributor Author

@josuah all is OK including CI build, could you approve and remove DNM label ?

avolmat-st
avolmat-st previously approved these changes Oct 9, 2025
erwango
erwango previously approved these changes Oct 9, 2025
josuah
josuah previously approved these changes Oct 9, 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.

Quoting #92884 (comment)

Otherwise, I can make an enhancement commit and rebase #97197 if this one is merged first.

So looks like everybody is aligned on merging this now.

@josuah josuah removed the DNM This PR should not be merged (Do Not Merge) label Oct 9, 2025
@josuah
Copy link
Contributor

josuah commented Oct 9, 2025

Everybody is rushing for the release, so CI seems pretty busy and "PR Metadata Check / Preventing Merging (pull_request)" job will start in a few minutes.

[EDIT: it's https://www.githubstatus.com/ is orange]

@hfruchet-st hfruchet-st dismissed stale reviews from josuah, erwango, avolmat-st, and JarmouniA via d1a963b October 9, 2025 16:57
@zephyrbot zephyrbot requested review from erwango and josuah October 9, 2025 16:59
thecapn32 and others added 7 commits October 9, 2025 19:02
Add H264 pixel format support.

Signed-off-by: Mohammad Massoudi <[email protected]>
Add size field to the video_format structure which needs to be set by the
driver and exposed to the application.

For uncompressed formats, this is the size of the raw data buffer in
bytes, which could be the whole raw image or a portion of the raw image
in cases the receiver / dma supports it.

For compressed formats, this is the estimated maximum number of bytes
required to hold a complete compressed frame.

Signed-off-by: Hugues Fruchet <[email protected]>
Signed-off-by: Phi Bang Nguyen <[email protected]>
Document introduction of the new size field inside video_format struct
as visible on the <zephyr/drivers/video.h> header.

Signed-off-by: Hugues Fruchet <[email protected]>
Addition of description for the STM32 Video encoder (VENC).

Signed-off-by: Hugues Fruchet <[email protected]>
The STM32 video encoder (VENC) peripheral is a hardware
accelerator allowing to compress RGB/YUV frames into
H264 video bitstream chunks.

Signed-off-by: Hugues Fruchet <[email protected]>
Add node describing the venc in stm32n6.dtsi

Signed-off-by: Hugues Fruchet <[email protected]>
Required to build VIDEO_STM32_VENC.

Signed-off-by: Erwan Gouriou <[email protected]>
Signed-off-by: Hugues Fruchet <[email protected]>
@hfruchet-st hfruchet-st force-pushed the iso_stm32n6_1080p_h264_streaming branch from d1a963b to 4907906 Compare October 9, 2025 17:11
@hfruchet-st
Copy link
Contributor Author

Rebased on main to fix merge conflict in doc/releases/release-notes-4.3.rst

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 9, 2025

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

Sorry for the late nitpicking comments, none are blocking. I'm fine getting the current series merged.

@jhedberg jhedberg merged commit 5c8380d into zephyrproject-rtos:main Oct 9, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Boards/SoCs area: Devicetree Bindings area: Samples Samples area: Tests Issues related to a particular existing or missing test area: Video Video subsystem platform: STM32 ST Micro STM32 Release Notes To be mentioned in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.