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

Reduce the buffer usage in QualitySSIM::compute #3797

Open
wants to merge 1 commit into
base: 4.x
Choose a base branch
from

Conversation

lumina37
Copy link

Reduce the buffer usage in QualitySSIM::compute by safely reusing I1_I2, mu1_mu2 and sigma12.

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

Reduce the buffer usage in `QualitySSIM::compute`
by reusing `I1_I2`, `mu1_mu2` and `sigma12`.
@lumina37
Copy link
Author

The test result on my own PC:

CTEST_FULL_OUTPUT
OpenCV version: 4.10.0-dev
OpenCV VCS version: b2e118e
Build type: Debug
Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe  (ver 19.41.34120.0)
Algorithm hint: ALGO_HINT_ACCURATE
HAL: NO
[ INFO:0@0.006] global registry_parallel.impl.hpp:96 cv::parallel::ParallelBackendRegistry::ParallelBackendRegistry core(parallel): Enabled backends(3, sorted by priority): ONETBB(1000); TBB(990); OPENMP(980)
[ INFO:0@0.006] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load E:\Code\Cpp\opencv\cmake-build-debug\bin\opencv_core_parallel_onetbb4100_64d.dll => FAILED
[ INFO:0@0.007] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_core_parallel_onetbb4100_64d.dll => FAILED
[ INFO:0@0.007] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load E:\Code\Cpp\opencv\cmake-build-debug\bin\opencv_core_parallel_tbb4100_64d.dll => FAILED
[ INFO:0@0.008] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_core_parallel_tbb4100_64d.dll => FAILED
[ INFO:0@0.008] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load E:\Code\Cpp\opencv\cmake-build-debug\bin\opencv_core_parallel_openmp4100_64d.dll => FAILED
[ INFO:0@0.008] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_core_parallel_openmp4100_64d.dll => FAILED
Parallel framework: ms-concurrency (nthreads=24)
CPU features: SSE SSE2 SSE3 SSSE3 SSE4.1 POPCNT SSE4.2 AVX FP16 AVX2 FMA3
TEST: Skip tests with tags: 'mem_6gb', 'verylong', 'debug_verylong'
[==========] Running 17 tests from 5 test cases.
[----------] Global test environment set-up.
[----------] 5 tests from CV_Quality_BRISQUE
[ RUN      ] CV_Quality_BRISQUE.static_
[     SKIP ] OpenCV tests: Can't find data file: brisque_range_live.yml
[       OK ] CV_Quality_BRISQUE.static_ (1 ms)
[ RUN      ] CV_Quality_BRISQUE.single_channel
[     SKIP ] OpenCV tests: Can't find data file: brisque_model_live.yml
[       OK ] CV_Quality_BRISQUE.single_channel (1 ms)
[ RUN      ] CV_Quality_BRISQUE.multi_channel
[     SKIP ] OpenCV tests: Can't find data file: brisque_model_live.yml
[       OK ] CV_Quality_BRISQUE.multi_channel (9 ms)
[ RUN      ] CV_Quality_BRISQUE.model_persistence
[     SKIP ] OpenCV tests: Can't find data file: brisque_model_live.yml
[       OK ] CV_Quality_BRISQUE.model_persistence (0 ms)
[ RUN      ] CV_Quality_BRISQUE.compute_features
[     SKIP ] OpenCV tests: Can't find data file: brisque_model_live.yml
[       OK ] CV_Quality_BRISQUE.compute_features (0 ms)
[----------] 5 tests from CV_Quality_BRISQUE (11 ms total)

[----------] 3 tests from CV_Quality_GMSD
[ RUN      ] CV_Quality_GMSD.static_
[       OK ] CV_Quality_GMSD.static_ (7 ms)
[ RUN      ] CV_Quality_GMSD.single_channel
[       OK ] CV_Quality_GMSD.single_channel (12 ms)
[ RUN      ] CV_Quality_GMSD.multi_channel
[       OK ] CV_Quality_GMSD.multi_channel (57 ms)
[----------] 3 tests from CV_Quality_GMSD (76 ms total)

[----------] 3 tests from CV_Quality_MSE
[ RUN      ] CV_Quality_MSE.static_
[       OK ] CV_Quality_MSE.static_ (3 ms)
[ RUN      ] CV_Quality_MSE.single_channel
[       OK ] CV_Quality_MSE.single_channel (6 ms)
[ RUN      ] CV_Quality_MSE.multi_channel
[       OK ] CV_Quality_MSE.multi_channel (34 ms)
[----------] 3 tests from CV_Quality_MSE (43 ms total)

[----------] 3 tests from CV_Quality_PSNR
[ RUN      ] CV_Quality_PSNR.static_
[       OK ] CV_Quality_PSNR.static_ (3 ms)
[ RUN      ] CV_Quality_PSNR.single_channel
[       OK ] CV_Quality_PSNR.single_channel (5 ms)
[ RUN      ] CV_Quality_PSNR.multi_channel
[       OK ] CV_Quality_PSNR.multi_channel (34 ms)
[----------] 3 tests from CV_Quality_PSNR (42 ms total)

[----------] 3 tests from CV_Quality_SSIM
[ RUN      ] CV_Quality_SSIM.static_
[       OK ] CV_Quality_SSIM.static_ (18 ms)
[ RUN      ] CV_Quality_SSIM.single_channel
[       OK ] CV_Quality_SSIM.single_channel (34 ms)
[ RUN      ] CV_Quality_SSIM.multi_channel
[       OK ] CV_Quality_SSIM.multi_channel (158 ms)
[----------] 3 tests from CV_Quality_SSIM (210 ms total)

[----------] Global test environment tear-down
[ SKIPSTAT ] 5 tests skipped
[ SKIPSTAT ] TAG='skip_other' skip 5 tests
[==========] 17 tests from 5 test cases ran. (382 ms total)
[  PASSED  ] 17 tests.

Thanks for your review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant