Skip to content
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

Add scaling and cropping options to cudacodec::VideoReader #3355

Merged
merged 3 commits into from
Sep 22, 2022

Conversation

cudawarped
Copy link
Contributor

@cudawarped cudawarped commented Sep 16, 2022

Nivida's Video Codec SDK allows the user to specify the following parameters to control the final output:

  • Scaling dimension
  • Cropping dimension
  • Dimension if the user wants to change the aspect ratio

this pull request adds this capability to cudacodec::VideoReader.

From local experiments this does not effect the decoding utilization, however choosing for example a smaller ROI from the decoded video stream reduces the CUDA overhead from the post processing routines (ConvertNV12BLtoNV12).

Additionaly this addition makes the checks described in #3001 unecessary.

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
Contributor

In file included from /mnt/projects/Projects/OpenCV/opencv_contrib/modules/cudacodec/test/test_main.cpp:43:0:
/mnt/projects/Projects/OpenCV/opencv_contrib/modules/cudacodec/test/test_precomp.hpp:50:10: fatal error: opencv2/cudawarping.hpp: Нет такого файла или каталога
 #include "opencv2/cudawarping.hpp"
          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
modules/cudacodec/CMakeFiles/opencv_test_cudacodec.dir/build.make:75: recipe for target 'modules/cudacodec/CMakeFiles/opencv_test_cudacodec.dir/test/test_main.cpp.o' failed
make[2]: *** [modules/cudacodec/CMakeFiles/opencv_test_cudacodec.dir/test/test_main.cpp.o] Error 1
CMakeFiles/Makefile2:6646: recipe for target 'modules/cudacodec/CMakeFiles/opencv_test_cudacodec.dir/all' failed

@asmorkalov asmorkalov self-requested a review September 16, 2022 17:34
@cudawarped
Copy link
Contributor Author

Sorry I missed that, that will teach me to be lazy and just build on Windows!

@asmorkalov
Copy link
Contributor

The issue is still there.

@cudawarped
Copy link
Contributor Author

cudawarped commented Sep 21, 2022

I've added the other missing target but I am at a loss as to why it builds without it, I tried both make and ninja on WSL Ubuntu 20.04 and it built without the cudawapring target. Maybe I'm missing something.

Copy link
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.

👍

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