Skip to content

drivers: video: introduce an API for collecting statistics #85811

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

josuah
Copy link
Collaborator

@josuah josuah commented Feb 14, 2025

This is an implementation for this RFC:

Downstream:

This is an implementation used on a private repo to implement a basic ISP that does auto-exposure from main().

Hardware -> RGB stats -> YRGB stats -> Y channel used for computing how far we are from a "goal" value -> video controls.

@josuah josuah added RFC Request For Comments: want input from the community area: API Changes to public APIs area: Video Video subsystem labels Feb 14, 2025
@josuah josuah marked this pull request as draft February 14, 2025 22:01
@josuah
Copy link
Collaborator Author

josuah commented Feb 14, 2025

Roadmap:

  • Implement a library to convert data between pixel formats
  • Use this to implement a video_sw_stats.c driver that randomly samples pixels through a frame and converts them from i.e. RGB565 to RGB888, and use that to provide statistics to any hardware that does not have built-in statistics.
  • Come back to this PR and use that software video statistics device to add unit tests to that PR
  • Provide a very basic ISP to Zephyr using this API, maybe in subsys/video/video_isp.c

@josuah josuah force-pushed the pr-video-stats branch 3 times, most recently from bc382bc to e854911 Compare March 9, 2025 15:12
@josuah josuah marked this pull request as ready for review March 9, 2025 15:15
@zephyrbot zephyrbot added the area: Samples Samples label Mar 9, 2025
@zephyrbot zephyrbot requested review from kartben and nashif March 9, 2025 15:15
@josuah josuah force-pushed the pr-video-stats branch 2 times, most recently from 05fe9a6 to 4483961 Compare March 11, 2025 16:44
@kartben kartben assigned josuah and unassigned kartben Mar 12, 2025
@josuah josuah force-pushed the pr-video-stats branch 2 times, most recently from a61cb8f to a4b397a Compare March 12, 2025 21:47
@josuah josuah marked this pull request as draft April 18, 2025 02:06
@josuah josuah marked this pull request as ready for review April 18, 2025 02:07
josuah added 2 commits April 28, 2025 00:54
Introduce an abstraction layer handling the diversity of ways hardware
have to report statistics. This allows to take advantage of the various
channel average or histograms present on some hardware, that skip the
need to manually compute statistics.
Fixes zephyrproject-rtos#85457

Signed-off-by: Josuah Demangeon <me@josuah.net>
Add support for the new API video_set_stats() to the emulated video RX
driver, and use it to implement simple API tests. The data returned
is arbitrary for the sake of testing the API itself.

Signed-off-by: Josuah Demangeon <me@josuah.net>
@josuah
Copy link
Collaborator Author

josuah commented Apr 28, 2025

Force-push:

  • rebase on latest main

@josuah
Copy link
Collaborator Author

josuah commented May 1, 2025

Embedded Recipes 2025 will be a good opportunity to ask libcamera folks what high-level model could be applied to the context of Zephyr. I propose holding reviews until May 17th.

@josuah josuah added the In progress For PRs: is work in progress and should not be merged yet. For issues: Is being worked on label May 1, 2025
@josuah josuah marked this pull request as draft May 1, 2025 13:15
@josuah
Copy link
Collaborator Author

josuah commented May 26, 2025

Summary from the libcamera workshop regarding this issue:

  • Porting the entire libcamera (C++) to Zephyr sounds like a bad strategy given the divergence between the APIs and the constrained situation of RTOS.
  • Taking some elements of libcamera to make them usable inside of Zephyr sounds more promising, and the statistics collection API needs to be studied to make it as close as possible to libcamera.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: Samples Samples area: Video Video subsystem In progress For PRs: is work in progress and should not be merged yet. For issues: Is being worked on RFC Request For Comments: want input from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants