8000 G-API gst source gray support by dbudniko · Pull Request #21560 · opencv/opencv · GitHub
[go: up one dir, main page]

Skip to content

G-API gst source gray support #21560

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

Merged

Conversation

dbudniko
Copy link
@dbudniko dbudniko commented Feb 3, 2022

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
force_builders=Custom,Custom Win,Custom Mac
build_gapi_standalone:Linux x64=ade-0.1.1f
build_gapi_standalone:Win64=ade-0.1.1f
build_gapi_standalone:Mac=ade-0.1.1f
build_gapi_standalone:Linux x64 Debug=ade-0.1.1f

Xbuild_image:Custom=centos:7
Xbuildworker:Custom=linux-1
build_gapi_standalone:Custom=ade-0.1.1f

build_image:Custom=ubuntu-openvino-2021.4.1:20.04
build_image:Custom Win=openvino-2021.4.1
build_image:Custom Mac=openvino-2021.4.1

test_modules:Custom=gapi,python2,python3,java
test_modules:Custom Win=gapi,python2,python3,java
test_modules:Custom Mac=gapi,python2,python3,java

buildworker:Custom=linux-1
# disabled due high memory usage: test_opencl:Custom=ON
test_opencl:Custom=OFF
test_bigdata:Custom=1
test_filter:Custom=*

GAPI_Assert(GST_VIDEO_INFO_FORMAT(m_videoInfo.get()) == GST_VIDEO_FORMAT_NV12);
//GAPI_Assert(GST_VIDEO_INFO_N_PLANES(m_videoInfo.get()) == 2);
GAPI_Assert(GST_VIDEO_INFO_FORMAT(m_videoInfo.get()) == GST_VIDEO_FORMAT_NV12 ||
GST_VIDEO_INFO_FORMAT(m_videoInfo.get()) == GST_VIDEO_FORMAT_GRAY8);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe, these asserts above should be combined, like

GAPI_Assert((GST_VIDEO_INFO_N_PLANES(m_videoInfo.get()) == 2 &&
                    GST_VIDEO_INFO_FORMAT(m_videoInfo.get()) == GST_VIDEO_FORMAT_NV12)
                          ||
                    (GST_VIDEO_INFO_N_PLANES(m_videoInfo.get()) == 1 &&
                    GST_VIDEO_INFO_FORMAT(m_videoInfo.get()) == GST_VIDEO_FORMAT_GRAY8));

But perhaps it looks too heavy

@dmatveev dmatveev self-assigned this Feb 4, 2022
@dmatveev dmatveev added this to the 4.6.0 milestone Feb 4, 2022
Copy link
Contributor
@dmatveev dmatveev left a comment

Choose a reason for hiding this comment

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

68 commits is way too large, recommend to squash it before merge

break;
}
case GST_VIDEO_FORMAT_GRAY8: {
m_mediaFrameMeta = GFrameDesc{ cv::MediaFormat::GRAY, cv::Size(width, height) };
Copy link
Contributor

Choose a reason for hiding this comment

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

so is it GRAY or GRAY8? I believe I've seen GRAY8 somewhere in the doxygen comments (and I believe it is quite legit)

Copy link
Author

Choose a reason for hiding this comment

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

There are different Gst gray formats. GRAY8 GRAY16. MediaFormat GRAY assumes 8-bit integer numbers. Should we align our naming approach with Gst. I have some doubts that 16 bit will be asked by someone.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have some doubts that 16 bit will be asked by someone.

It seem to be useful for some scenarios, see #18694. Furthermore, there are two variants of this format: GRAY16_LE and GRAY16_BE

@@ -59,6 +59,7 @@ class GStreamerSource::Priv
bool m_isPipelinePlaying = false;

int64_t m_frameId = 0L;
size_t m_type = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this?

Copy link A3E2
Author

Choose a reason for hiding this comment

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

Comment added.

@dbudniko
Copy link
Author
dbudniko commented Feb 7, 2022

68 commits is probably result of master merge with media format gray PR merged. I assume that these commits will be automatically squashed during PR final merge. Please correct me if I'm wrong. What is the right way to squash such commits in OpenCV GitHub?

Copy link
Contributor
@OrestChura OrestChura left a comment

Choose a reason for hiding this comment

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

Thanks!

@dbudniko
Copy link
Author
dbudniko commented Feb 8, 2022

@alalek could you please merge this PR?

Comment on lines 294 to 301
Combine(Values("videotestsrc pattern=colors num-buffers=10 ! "
"videorate ! videoscale ! "
"video/x-raw,width=640,height=420,framerate=3/1 ! "
"video/x-raw,format=NV12,width=640,height=420,framerate=3/1 ! "
"appsink",
"videotestsrc pattern=colors num-buffers=10 ! "
"videorate ! videoscale ! "
"video/x-raw,format=GRAY8,width=640,height=420,framerate=3/1 ! "
"appsink"),
Copy link
Member

Choose a reason for hiding this comment

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

It makes sense to add extra indentation for concatenated strings to improve readability of the code.

@alalek alalek merged commit 3eeec4f into opencv:4.x Feb 8, 2022
TolyaTalamanov pushed a commit to TolyaTalamanov/opencv that referenced this pull request Feb 18, 2022
…mat_gray_plus_gst_source

G-API gst source gray support
@alalek alalek mentioned this pull request Feb 22, 2022
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
…mat_gray_plus_gst_source

G-API gst source gray support
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.

6 participants
0