-
Notifications
You must be signed in to change notification settings - Fork 7.4k
drivers: video: sw_pipeline: glue lib/pixel and drivers/video #88839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: video: sw_pipeline: glue lib/pixel and drivers/video #88839
Conversation
The logs give performance statistics for each block of the pipeline:
|
Nothing specific to UVC though: network capture or a display also work for instance. This is a video device for connecting to any input/output and do some processing in-between. In |
Converted to draft until the dependencies are merged :) |
70bee3f
to
ff6694a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a comprehensive set of changes to integrate and extend the pixel library and associated video driver components, enabling a new software video pipeline and generator implementation. Key changes include:
- New header files and implementations for pixel stream processing, resizing, color conversions, kernel filtering, and bayer pattern processing.
- Addition of device driver support for video software pipelines and generators with updated DTS bindings.
- Update of documentation and maintainers metadata for the pixel library.
Reviewed Changes
Copilot reviewed 82 out of 87 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
include/zephyr/usb/class/usbd_uvc.h | Added UVC header but with DFU documentation that needs updating. |
include/zephyr/pixel/stats.h | New statistics functions with a spelling error in channel naming. |
include/zephyr/pixel/resize.h | Added resizing functions with a minor typographical error. |
include/zephyr/pixel/kernel.h | Added kernel filter definitions with a minor grammatical error. |
drivers/video/video_sw_pipeline.c | Introduced video pipeline thread and buffer handling logic. |
drivers/video/video_sw_generator.c | Updated generator driver with new macro-based device definition. |
dts/bindings/* | New DTS bindings for video pipeline, generator, and UVC device. |
MAINTAINERS.yml | Updated metadata for the pixel library. |
Files not reviewed (5)
- drivers/video/CMakeLists.txt: Language not supported
- drivers/video/Kconfig: Language not supported
- drivers/video/Kconfig.sw_generator: Language not supported
- drivers/video/Kconfig.sw_pipeline: Language not supported
- lib/CMakeLists.txt: Language not supported
config VIDEO_SW_PIPELINE_THREAD_PRIORITY | ||
int "Video Software Pipeline thread priority" | ||
default 2 | ||
help |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depends on VIDEO_SW_PIPELINE
zephyr_library_sources(bayer.c) | ||
zephyr_library_sources(formats.c) | ||
zephyr_library_sources(kernel.c) | ||
zephyr_library_sources(print.c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this only be included if the Kconfig is set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIU it is already done from the parent CMakeLists.txt
https://github.com/zephyrproject-rtos/zephyr/pull/88839/files#diff-4803677bd280f4dded52c428e3c8ac6c618508dcabcbe880b68be85897c2ad41:
add_subdirectory_ifdef(CONFIG_PIXEL pixel)
Let me know if there should also be a _ifdef
condition on the inside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github shows 4 lines but was only meaning the print.c line since there's a Kconfig for selecting that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONFIG_PIXEL_PRINT_NONE=y
allows to keep all the pixel_print_
debug statements which help for troubleshooting the tests and useful in samples, but turn them off the rest of the time.
So when it is on, the pixel.c
functions are still called but do nothing.
Bad idea?
target_sources(app PRIVATE src/main.c) | ||
target_sources(app PRIVATE src/pipeline.c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target_sources(app PRIVATE src/main.c) | |
target_sources(app PRIVATE src/pipeline.c) | |
target_sources(app PRIVATE src/main.c src/pipeline.c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know about this, I will preserve this style in future PRs.
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(usb_video) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should match name of sample
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I must have forgotten to change it. Adjusted thank you.
ff6694a
to
9881636
Compare
By having an "auto-fallback" mechanism, the VIDEO_SW_GENERATOR did shadow the fact that "platform:mimxrt1064_evk:SHIELD=dvp_fpc24_mt9m114" was missing the full specification, and therefore was not matched at all: the shield was not selected, but the CI still worked. Signed-off-by: Josuah Demangeon <me@josuah.net>
Make the video software generator a devicetree node, which allows enabling several instances, and select it as chosen { zephyr,camera = &... }; node. It can be enabled via a `video-sw-generator` snippet. Signed-off-by: Josuah Demangeon <me@josuah.net>
Convert the log module declarationto the new syntax introduced in 5e34681 proposing a more compact syntax. This fixes the log level not being updated in the "capture" sample. Signed-off-by: Josuah Demangeon <me@josuah.net>
Variables that holds pointers to 'const struct device' typically end-up with '_dev'. The tcpserversink video sample did not have it. Add it. Signed-off-by: Josuah Demangeon <me@josuah.net>
The zephyr,camera was used in several samples, but was not documented. Add the missing documentation entry for it in the list. Signed-off-by: Josuah Demangeon <me@josuah.net>
Add all the base controls present like they are in Linux into Zephyr, limited to those that can apply in the current system: - Buttons are left as integer for now. - Some description is modified to fit the Zephyr situation. - For the minimum number of buffer, Zephyr uses a different mechanism. - No audio support through the video subsystem. - Homogenize the wording Signed-off-by: Josuah Demangeon <me@josuah.net>
Introduce a new USB Video Class (UVC) implementation from scratch. It exposes a native Zephyr Video driver interface, allowing to call the video_enqueue()/video_dequeue() interface. It will query the attached video device to learn about the pipeline capabilities, and use this to configure the USB descriptors. At runtime, this UVC implementation will send this device all the control requests, which it can then dispatch to the rest of the pipeline. The application can poll the format currently selected by the host, but will not be alerted when the host configures a new format, as there is no video.h API for it yet. Signed-off-by: Josuah Demangeon <me@josuah.net>
The Arduino Nicla Vision board supports the new device_next USB stack and can be used for testing USB Device features such as UVC. Signed-off-by: Josuah Demangeon <me@josuah.net>
Following the addition of USB Video Class, this adds a sample that makes use of the &zephyr,camera chosen node of any board to stream the video source to the host. A fallback video-emul.overlay is provided for test and debugging purpose for devices without a camera. Signed-off-by: Josuah Demangeon <me@josuah.net>
9881636
to
adf0a85
Compare
Force-push:
Note, this might crrash due to a bug in the video-sw-generator fixed in #85968 (not merged yet). In order to test it, you will need to specify a framerate manually, such as |
adf0a85
to
4ac3514
Compare
4ac3514
to
728155d
Compare
The "pixel" library aims facilitating the implementation of all image processing tasks, such as pixel conversion, with a focus on low-resource environments. The processing functions scale down to per-pixel "kernels" to line-based conversion to full streams of several frames. Signed-off-by: Josuah Demangeon <me@josuah.net>
The newly introduced lib/pixel features utilities that help composing video pipelines together for the purpose of stream processing, as well as debug utilities. Signed-off-by: Josuah Demangeon <me@josuah.net>
Introduce a connector between the lib/pixel API to the drivers/video API. An function loads a lib/pixel stream into this new driver, then the driver will load the frames in and out of this stream. Signed-off-by: Josuah Demangeon <me@josuah.net>
728155d
to
fadb076
Compare
A driver is not a good place for the application: In firmware the barrier between driver and application is thin, but good to have still: Grateful for the reviews, applied to the upstream PR. |
Dependencies:
Sibling:
This allows some very short applications be written to see a video stream from their host as a webcam
Input from the webcam (after commenting out

&step_resize_rgb24, &step_tune_rgb24,
thenWIDTH/HEIGHT_OUT=64
):Input from the webcam (after commenting out

&step_tune_rgb24
):Output from the webcam (nothing commented):
