Skip to content

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

Merged
asmorkalov merged 3 commits intoopencv:4.xfrom
cudawarped:cudacodec_add_resize_crop
Sep 22, 2022
Merged

Add scaling and cropping options to cudacodec::VideoReader#3355
asmorkalov merged 3 commits intoopencv:4.xfrom
cudawarped:cudacodec_add_resize_crop

Conversation

@cudawarped
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@asmorkalov
Copy link
Copy Markdown
Contributor

The issue is still there.

@cudawarped
Copy link
Copy Markdown
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
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.

👍

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