@@ -151,86 +151,5 @@ INSTANTIATE_TEST_CASE_P(CUDA_Warping, ResizeLanczosSameAsHost, testing::Combine(
151151 testing::Values(0.3 , 0.5 , 1.5 , 2.0 ),
152152 WHOLE_SUBMAT));
153153
154- // ///////////////
155- // Performance Test
156-
157- PARAM_TEST_CASE (ResizeLanczosPerformance, cv::cuda::DeviceInfo, cv::Size, MatType, double )
158- {
159- cv::cuda::DeviceInfo devInfo;
160- cv::Size size;
161- double coeff;
162- int type;
163-
164- virtual void SetUp ()
165- {
166- devInfo = GET_PARAM (0 );
167- size = GET_PARAM (1 );
168- type = GET_PARAM (2 );
169- coeff = GET_PARAM (3 );
170-
171- cv::cuda::setDevice (devInfo.deviceID ());
172- }
173- };
174-
175- CUDA_TEST_P (ResizeLanczosPerformance, Performance)
176- {
177- cv::Mat src = randomMat (size, type);
178- cv::Size dsize (cv::saturate_cast<int >(src.cols * coeff), cv::saturate_cast<int >(src.rows * coeff));
179-
180- // Warm up
181- {
182- cv::cuda::GpuMat gpuSrc, gpuDst;
183- gpuSrc.upload (src);
184- gpuDst.create (dsize, type);
185- cv::cuda::resize (gpuSrc, gpuDst, cv::Size (), coeff, coeff, cv::INTER_LANCZOS4);
186- cv::Mat dummy;
187- gpuDst.download (dummy); // Synchronize
188- }
189-
190- // GPU performance
191- const int iterations = 100 ;
192- cv::TickMeter tm_gpu;
193- cv::cuda::GpuMat gpuSrc, gpuDst;
194- gpuSrc.upload (src);
195- gpuDst.create (dsize, type);
196-
197- tm_gpu.start ();
198- for (int i = 0 ; i < iterations; ++i)
199- {
200- cv::cuda::resize (gpuSrc, gpuDst, cv::Size (), coeff, coeff, cv::INTER_LANCZOS4);
201- }
202- cv::Mat dummy;
203- gpuDst.download (dummy); // Synchronize
204- tm_gpu.stop ();
205-
206- // CPU performance
207- cv::TickMeter tm_cpu;
208- cv::Mat dst_cpu;
209-
210- tm_cpu.start ();
211- for (int i = 0 ; i < iterations; ++i)
212- {
213- cv::resize (src, dst_cpu, cv::Size (), coeff, coeff, cv::INTER_LANCZOS4);
214- }
215- tm_cpu.stop ();
216-
217- double gpu_time = tm_gpu.getTimeMilli () / iterations;
218- double cpu_time = tm_cpu.getTimeMilli () / iterations;
219- double speedup = cpu_time / gpu_time;
220-
221- std::cout << " Size: " << size << " -> " << dsize
222- << " , Type: " << type
223- << " , Coeff: " << coeff << std::endl;
224- std::cout << " CPU: " << cpu_time << " ms" << std::endl;
225- std::cout << " GPU: " << gpu_time << " ms" << std::endl;
226- std::cout << " Speedup: " << speedup << " x" << std::endl;
227- }
228-
229- INSTANTIATE_TEST_CASE_P (CUDA_Warping, ResizeLanczosPerformance, testing::Combine(
230- testing::Values (cv::cuda::DeviceInfo()),
231- testing::Values(cv::Size(512 , 512 ), cv::Size(1024 , 1024 ), cv::Size(2048 , 2048 )),
232- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_32FC1), MatType(CV_32FC3)),
233- testing::Values(0.5 , 1.5 , 2.0 )));
234-
235154}} // namespace
236155#endif // HAVE_CUDA
0 commit comments