-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: IBA::unsharp_mask() speed and memory optimization (#4513)
Replacing 3x IBA + Helper function that generate 4 fulls size image buffers with single unsharp_mask_impl() that use parallel_image() to compute unsharp: src + contr * (((src - blur) < threshold) ? 0.0 : (src - blur)) Added two pass 1D convolution for a kernels higher than 3x3 ## Tests ``` ImageBuf sharped(input.spec()); const int repeats = 50; std::cout << "Start sharpening\n"; auto start = std::chrono::high_resolution_clock::now(); for (int i = 0; i < repeats; i++) { //ok = ImageBufAlgo::unsharp_mask(sharped, input, "gaussian", 15.0f, 10.0f, 0.01f); ok = ImageBufAlgo::unsharp_mask(sharped, input, "gaussian", 5.0f, 2.0f, 0.05f); std::cout << "."; } std::cout << "\n"; auto part1 = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> elapsed_part1 = part1 - start; std::cout << "Elapsed time: " << elapsed_part1.count() << " s\n"; ``` both single threaded (one IB at time) and multithreaded (multiply IB at time) show pretty good speedup: ~30-40% with less memory use. for 5x5 gaussian kernels two pass mode should add at least 20% speedup. (if someone can do independent benchmark, will be great. As soon as I had a big differences on them depend on real or synthetic use) --------- Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
- Loading branch information
Showing
5 changed files
with
42 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters