Skip to content

V4L2: Add multi-planar capture support#22236

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
mizo:v4l2-multi-planar-v2
Aug 26, 2022
Merged

V4L2: Add multi-planar capture support#22236
asmorkalov merged 1 commit intoopencv:4.xfrom
mizo:v4l2-multi-planar-v2

Conversation

@mizo
Copy link
Copy Markdown
Contributor

@mizo mizo commented Jul 13, 2022

Devices which only support multi-planar capture cannot be processed as
single-planar.

Add multi-planar support to v4l driver.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@asmorkalov
Copy link
Copy Markdown
Contributor

@mizo Thanks for the PR. What camera do you use to test the code?

@mizo
Copy link
Copy Markdown
Contributor Author

mizo commented Jul 19, 2022

@mizo Thanks for the PR. What camera do you use to test the code?

@asmorkalov Thank you for watching.

I use KBCR-S08MM. The host is Armadillo-IoT G4 (SoC: NXP i.MX 8M Plus).

i.MX 8M Plus only supports multi-planar. Therefore, I made it because it needs multi-planar support.

@martinetd
Copy link
Copy Markdown

Hello,

is there anything that can be done to help move forward with this PR?
(disclaimer: I'm a coworker of @mizo and did the initial internal review)

@asmorkalov
Copy link
Copy Markdown
Contributor

@martinetd Thanks for the contribution and sorry for the delay. We are looking how to test the solution on our side, if it's possible. I try v4l2loopback to emulate your camera and have not reached the goal. Please let me know, if you have some solution.

@martinetd
Copy link
Copy Markdown

Thanks for the quick reply!

I took a quick look at other devices in the linux tree that have V4L2_CAP_VIDEO_CAPTURE_MPLANE cap, perhaps you might have any of these available somewhere by chance? Our device's driver isn't even mainline yet so that's out of question, but any driver compatible with these should work:

drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
drivers/media/platform/qcom/camss/camss-video.c
drivers/media/platform/renesas/renesas-ceu.c
drivers/media/platform/renesas/vsp1/vsp1_video.c
drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
drivers/media/platform/samsung/exynos4-is/fimc-isp-video.c
drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c
drivers/staging/media/ipu3/ipu3-v4l2.c

That sounds easier than trying to emulate multiplanar; I gave v4l2loopback a quick look as well but it only supports V4L2_CAP_VIDEO_CAPTURE and nothing in the code hints as mplane support, so while it could also be added you'd be testing two freshly implemented features together and that doesn't really prove anything (if we misunderstood something, we'll probably add the same bug to both sides...)

Ultimately if you cannot test any mplane-compatible device yet, I think what's most important is that we didn't break the existing: have you tested wtih normal capture support yet?
I think it's fine to treat mplane as experimental with the feature available (perhaps gated by a config flag if you want to play safe) while we gather more user input, how does that sound?

@mizo mizo force-pushed the v4l2-multi-planar-v2 branch from 264f40a to ec6a2c8 Compare August 22, 2022 07:49
Devices which only support multi-planar capture cannot be processed as
single-planar.

Add multi-planar support to v4l driver.
@mizo mizo force-pushed the v4l2-multi-planar-v2 branch from ec6a2c8 to a001ab3 Compare August 23, 2022 07:49
Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me. I cannot test multi-plane branch, but default branch works well. Tested with Logitech and Genius cams in both BGR and JPEG mode, timestamps and some properties.

@asmorkalov asmorkalov requested a review from alalek August 23, 2022 10:54
@asmorkalov
Copy link
Copy Markdown
Contributor

@alalek please take a look.

@asmorkalov asmorkalov merged commit 67fa8a2 into opencv:4.x Aug 26, 2022
@asmorkalov asmorkalov self-assigned this Aug 26, 2022
@martinetd
Copy link
Copy Markdown

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants