mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #20664 from anna-khakimova:ak/resize_simd
Fluid: SIMD for Resize Linear 8UC3 * SIMD for fluid::Resize 8U3C * Rework horizontal pass + add 8U4C case * Reproduce stackoverflow test * StackOverflow test * SSE42 impl * SSE42 impl improvement * GAPI:SSE42 simd opt for Resize 8UC3. Final version * Fix tests * Conditional compilation fix * Applied comments * Applied comments. Step2 * Applied comments. Step2
This commit is contained in:
@@ -393,7 +393,7 @@ INSTANTIATE_TEST_CASE_P(ResizeTestFluid, ResizeTest,
|
||||
cv::Size(30, 30)),
|
||||
Values(-1),
|
||||
Values(CORE_FLUID),
|
||||
Values(AbsExact().to_compare_obj()),
|
||||
Values(Tolerance_FloatRel_IntAbs(1e-5, 1).to_compare_obj()),
|
||||
Values(/*cv::INTER_NEAREST,*/ cv::INTER_LINEAR/*, cv::INTER_AREA*/),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480),
|
||||
@@ -410,7 +410,7 @@ INSTANTIATE_TEST_CASE_P(ResizeTestFxFyFluid, ResizeTestFxFy,
|
||||
cv::Size(30, 30)),
|
||||
Values(-1),
|
||||
Values(CORE_FLUID),
|
||||
Values(AbsExact().to_compare_obj()),
|
||||
Values(Tolerance_FloatRel_IntAbs(1e-5, 1).to_compare_obj()),
|
||||
Values(/*cv::INTER_NEAREST,*/ cv::INTER_LINEAR/*, cv::INTER_AREA*/),
|
||||
Values(0.5, 1, 2),
|
||||
Values(0.5, 1, 2)));
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#include "gapi_fluid_test_kernels.hpp"
|
||||
#include "common/gapi_tests_common.hpp"
|
||||
|
||||
namespace opencv_test
|
||||
{
|
||||
@@ -749,8 +750,7 @@ TEST_P(NV12PlusResizeTest, Test)
|
||||
cv::Mat rgb_mat;
|
||||
cv::cvtColor(in_mat, rgb_mat, cv::COLOR_YUV2RGB_NV12);
|
||||
cv::resize(rgb_mat, out_mat_ocv, out_sz, 0, 0, interp);
|
||||
|
||||
EXPECT_EQ(0, cvtest::norm(out_mat(roi), out_mat_ocv(roi), NORM_INF));
|
||||
EXPECT_TRUE(Tolerance_FloatRel_IntAbs(1e-5, 1).to_compare_f()(out_mat(roi), out_mat_ocv(roi)));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Fluid, NV12PlusResizeTest,
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
|
||||
#include "../test_precomp.hpp"
|
||||
#include "../common/gapi_tests_common.hpp"
|
||||
#include "api/gcomputation_priv.hpp"
|
||||
|
||||
#include <opencv2/gapi/fluid/gfluidkernel.hpp>
|
||||
@@ -115,9 +116,10 @@ TEST(GComputationCompile, FluidReshapeResizeDownScale)
|
||||
cv::Mat cv_out_mat1, cv_out_mat2;
|
||||
cv::resize(in_mat1, cv_out_mat1, szOut);
|
||||
cv::resize(in_mat2, cv_out_mat2, szOut);
|
||||
|
||||
EXPECT_EQ(0, cvtest::norm(out_mat1, cv_out_mat1, NORM_INF));
|
||||
EXPECT_EQ(0, cvtest::norm(out_mat2, cv_out_mat2, NORM_INF));
|
||||
// Fluid's and OpenCV's resizes aren't bit exact.
|
||||
// So 1 is here because it is max difference between them.
|
||||
EXPECT_TRUE(Tolerance_FloatRel_IntAbs(1e-5, 1).to_compare_f()(out_mat1, cv_out_mat1));
|
||||
EXPECT_TRUE(Tolerance_FloatRel_IntAbs(1e-5, 1).to_compare_f()(out_mat2, cv_out_mat2));
|
||||
}
|
||||
|
||||
TEST(GComputationCompile, FluidReshapeSwitchToUpscaleFromDownscale)
|
||||
@@ -150,10 +152,11 @@ TEST(GComputationCompile, FluidReshapeSwitchToUpscaleFromDownscale)
|
||||
cv::resize(in_mat1, cv_out_mat1, szOut);
|
||||
cv::resize(in_mat2, cv_out_mat2, szOut);
|
||||
cv::resize(in_mat3, cv_out_mat3, szOut);
|
||||
|
||||
EXPECT_EQ(0, cvtest::norm(out_mat1, cv_out_mat1, NORM_INF));
|
||||
EXPECT_EQ(0, cvtest::norm(out_mat2, cv_out_mat2, NORM_INF));
|
||||
EXPECT_EQ(0, cvtest::norm(out_mat3, cv_out_mat3, NORM_INF));
|
||||
// Fluid's and OpenCV's Resizes aren't bit exact.
|
||||
// So 1 is here because it is max difference between them.
|
||||
EXPECT_TRUE(Tolerance_FloatRel_IntAbs(1e-5, 1).to_compare_f()(out_mat1, cv_out_mat1));
|
||||
EXPECT_TRUE(Tolerance_FloatRel_IntAbs(1e-5, 1).to_compare_f()(out_mat2, cv_out_mat2));
|
||||
EXPECT_TRUE(Tolerance_FloatRel_IntAbs(1e-5, 1).to_compare_f()(out_mat3, cv_out_mat3));
|
||||
}
|
||||
|
||||
TEST(GComputationCompile, ReshapeBlur)
|
||||
@@ -224,8 +227,9 @@ TEST(GComputationCompile, ReshapeRois)
|
||||
cv::Mat blur_mat, cv_out_mat;
|
||||
cv::blur(in_mat, blur_mat, kernelSize);
|
||||
cv::resize(blur_mat, cv_out_mat, szOut);
|
||||
|
||||
EXPECT_EQ(0, cvtest::norm(out_mat(roi), cv_out_mat(roi), NORM_INF));
|
||||
// Fluid's and OpenCV's resizes aren't bit exact.
|
||||
// So 1 is here because it is max difference between them.
|
||||
EXPECT_TRUE(Tolerance_FloatRel_IntAbs(1e-5, 1).to_compare_f()(out_mat(roi), cv_out_mat(roi)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -353,7 +353,9 @@ TEST_P(GAPI_Streaming, SmokeTest_ConstInput_GMat)
|
||||
// With constant inputs, the stream is endless so
|
||||
// the blocking pull() should never return `false`.
|
||||
EXPECT_TRUE(ccomp.pull(cv::gout(out_mat_gapi)));
|
||||
EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF));
|
||||
// Fluid's and OpenCV's Resizes aren't bit exact.
|
||||
// So 1% is here because it is max difference between them.
|
||||
EXPECT_TRUE(AbsSimilarPoints(0, 1).to_compare_f()(out_mat_gapi, out_mat_ocv));
|
||||
}
|
||||
|
||||
EXPECT_TRUE(ccomp.running());
|
||||
@@ -405,7 +407,9 @@ TEST_P(GAPI_Streaming, SmokeTest_VideoInput_GMat)
|
||||
frames++;
|
||||
cv::Mat out_mat_ocv;
|
||||
opencv_ref(in_mat_gapi, out_mat_ocv);
|
||||
EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF));
|
||||
// Fluid's and OpenCV's Resizes aren't bit exact.
|
||||
// So 1% is here because it is max difference between them.
|
||||
EXPECT_TRUE(AbsSimilarPoints(0, 1).to_compare_f()(out_mat_gapi, out_mat_ocv));
|
||||
}
|
||||
EXPECT_LT(0u, frames);
|
||||
EXPECT_FALSE(ccomp.running());
|
||||
|
||||
Reference in New Issue
Block a user