mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #18257 from OrestChura:oc/fluid_operator_bitwise_and_scalar
[G-API]: Add Fluid bitwise operations implementation for (GMat, GScalar) * Added Fluid `bitwise` with `Scalar` + acc.tests - simple loop implementation for Fluid used (no `hal`); - `Scalar` is casted to `int` in the beginning - tests just modified to work with `Scalar` - expected output in operators' tests fixed (operators can't change Mat's depth) - `float` `Scalar` `RNG` added, `RNG` reworked (`time` is used now), initialization of test fixtures reworked - if input or output is `float` Scalar is initialized by `float` - some problems with Fluid/OCV floating-point comparison difference stashed by `AbsSimilarPoints()` usage, FIXME added - divide-by-zero is now fixed differently and everywhere * - Added perf_tests for bitwise_Scalar operations - due to errors of Fluid floating-point comparison operations, added support of different validation in Cmp perf_tests; added FIXME - reworked integral initialization of Scalar * Addressing comments - NULL -> nullptr - Scalar convertion moved to the function - avoid -> avoiding * Addressing comments * CV_assert -> GAPI_assert * Addressed DM comments - refactored convertScalarForBitwise() - removed unnecessary braces for switch * Changed the operators tests - switch via `enum` implemented - infrastructure for that refactored
This commit is contained in:
@@ -155,7 +155,8 @@ INSTANTIATE_TEST_CASE_P(CompareTestCPU, CmpTest,
|
||||
Values(CV_8U),
|
||||
Values(CORE_CPU),
|
||||
Values(CMP_EQ, CMP_GE, CMP_NE, CMP_GT, CMP_LT, CMP_LE),
|
||||
testing::Bool()));
|
||||
testing::Bool(),
|
||||
Values(AbsExact().to_compare_obj())));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BitwiseTestCPU, BitwiseTest,
|
||||
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
|
||||
@@ -164,7 +165,8 @@ INSTANTIATE_TEST_CASE_P(BitwiseTestCPU, BitwiseTest,
|
||||
cv::Size(128, 128)),
|
||||
Values(-1),
|
||||
Values(CORE_CPU),
|
||||
Values(AND, OR, XOR)));
|
||||
Values(AND, OR, XOR),
|
||||
testing::Bool()));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BitwiseNotTestCPU, NotTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
|
||||
|
||||
@@ -89,7 +89,8 @@ INSTANTIATE_TEST_CASE_P(BitwiseTestFluid, BitwiseTest,
|
||||
cv::Size(128, 128)),
|
||||
Values(-1),
|
||||
Values(CORE_FLUID),
|
||||
Values(AND, OR, XOR)));
|
||||
Values(AND, OR, XOR),
|
||||
testing::Bool()));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BitwiseNotTestFluid, NotTest,
|
||||
Combine(Values(CV_8UC3, CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
@@ -136,7 +137,21 @@ INSTANTIATE_TEST_CASE_P(CompareTestFluid, CmpTest,
|
||||
Values(CV_8U),
|
||||
Values(CORE_FLUID),
|
||||
Values(CMP_EQ, CMP_GE, CMP_NE, CMP_GT, CMP_LT, CMP_LE),
|
||||
testing::Bool()));
|
||||
Values(false),
|
||||
Values(AbsExact().to_compare_obj())));
|
||||
|
||||
// FIXME: solve comparison error to unite with the test above
|
||||
INSTANTIATE_TEST_CASE_P(CompareTestFluidScalar, CmpTest,
|
||||
Combine(Values(CV_8UC3, CV_8UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::Size(1920, 1080),
|
||||
cv::Size(1280, 720),
|
||||
cv::Size(640, 480),
|
||||
cv::Size(128, 128)),
|
||||
Values(CV_8U),
|
||||
Values(CORE_FLUID),
|
||||
Values(CMP_EQ, CMP_GE, CMP_NE, CMP_GT, CMP_LT, CMP_LE),
|
||||
Values(true),
|
||||
Values(AbsSimilarPoints(1, 0.01).to_compare_obj())));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AddWeightedTestFluid, AddWeightedTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
|
||||
@@ -23,23 +23,24 @@ INSTANTIATE_TEST_CASE_P(MathOperatorTestCPU, MathOperatorMatMatTest,
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480),
|
||||
cv::Size(128, 128)),
|
||||
Values(-1, CV_8U, CV_32F),
|
||||
Values(-1),
|
||||
Values(CORE_CPU),
|
||||
Values(AbsExact().to_compare_obj()),
|
||||
Values( opPlusM, opMinusM, opDivM,
|
||||
opGreater, opLess, opGreaterEq, opLessEq, opEq, opNotEq)));
|
||||
Values( ADD, SUB, DIV,
|
||||
GT, LT, GE, LE, EQ, NE)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MathOperatorTestCPU, MathOperatorMatScalarTest,
|
||||
Combine(Values(CV_8UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480),
|
||||
cv::Size(128, 128)),
|
||||
Values(-1, CV_8U, CV_32F),
|
||||
Values(-1),
|
||||
Values(CORE_CPU),
|
||||
Values(AbsExact().to_compare_obj()),
|
||||
Values( opPlus, opPlusR, opMinus, opMinusR, opMul, opMulR, // FIXIT avoid division by values near zero: opDiv, opDivR,
|
||||
opGT, opLT, opGE, opLE, opEQ, opNE,
|
||||
opGTR, opLTR, opGER, opLER, opEQR, opNER)));
|
||||
Values( ADD, SUB, MUL, DIV,
|
||||
ADDR, SUBR, MULR, DIVR,
|
||||
GT, LT, GE, LE, EQ, NE,
|
||||
GTR, LTR, GER, LER, EQR, NER)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BitwiseOperatorTestCPU, MathOperatorMatMatTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
@@ -49,7 +50,7 @@ INSTANTIATE_TEST_CASE_P(BitwiseOperatorTestCPU, MathOperatorMatMatTest,
|
||||
Values(-1),
|
||||
Values(CORE_CPU),
|
||||
Values(AbsExact().to_compare_obj()),
|
||||
Values( opAnd, opOr, opXor )));
|
||||
Values( AND, OR, XOR )));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BitwiseOperatorTestCPU, MathOperatorMatScalarTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
@@ -59,7 +60,8 @@ INSTANTIATE_TEST_CASE_P(BitwiseOperatorTestCPU, MathOperatorMatScalarTest,
|
||||
Values(-1),
|
||||
Values(CORE_CPU),
|
||||
Values(AbsExact().to_compare_obj()),
|
||||
Values( opAND, opOR, opXOR, opANDR, opORR, opXORR )));
|
||||
Values( AND, OR, XOR,
|
||||
ANDR, ORR, XORR )));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BitwiseNotOperatorTestCPU, NotOperatorTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
|
||||
@@ -21,24 +21,34 @@ INSTANTIATE_TEST_CASE_P(MathOperatorTestFluid, MathOperatorMatMatTest,
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480),
|
||||
cv::Size(128, 128)),
|
||||
Values(-1, CV_8U, CV_32F),
|
||||
Values(-1),
|
||||
Values(CORE_FLUID),
|
||||
Values(AbsExact().to_compare_obj()),
|
||||
Values( opPlusM, opMinusM, opDivM,
|
||||
opGreater, opLess, opGreaterEq, opLessEq, opEq, opNotEq)));
|
||||
Values( ADD, SUB, DIV,
|
||||
GT, LT, GE, LE, EQ, NE)));
|
||||
|
||||
//FIXME: Some Mat/Scalar Fluid kernels are not there yet!
|
||||
INSTANTIATE_TEST_CASE_P(DISABLED_MathOperatorTestFluid, MathOperatorMatScalarTest,
|
||||
INSTANTIATE_TEST_CASE_P(MathOperatorArithmeticTestFluid, MathOperatorMatScalarTest,
|
||||
Combine(Values(CV_8UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480),
|
||||
cv::Size(128, 128)),
|
||||
Values(-1, CV_8U, CV_32F),
|
||||
Values(-1),
|
||||
Values(CORE_FLUID),
|
||||
Values(AbsExact().to_compare_obj()),
|
||||
Values( opPlus, opPlusR, opMinus, opMinusR, opMul, opMulR, // FIXIT avoid division by values near zero: opDiv, opDivR,
|
||||
opGT, opLT, opGE, opLE, opEQ, opNE,
|
||||
opGTR, opLTR, opGER, opLER, opEQR, opNER)));
|
||||
Values( ADD, SUB, MUL, DIV,
|
||||
ADDR, SUBR, MULR, DIVR)));
|
||||
|
||||
// FIXME: solve comparison error
|
||||
INSTANTIATE_TEST_CASE_P(MathOperatorCompareTestFluid, MathOperatorMatScalarTest,
|
||||
Combine(Values(CV_8UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480),
|
||||
cv::Size(128, 128)),
|
||||
Values(-1),
|
||||
Values(CORE_FLUID),
|
||||
Values(AbsSimilarPoints(1, 0.01).to_compare_obj()),
|
||||
Values( GT, LT, GE, LE, EQ, NE,
|
||||
GTR, LTR, GER, LER, EQR, NER)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BitwiseOperatorTestFluid, MathOperatorMatMatTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
@@ -48,10 +58,9 @@ INSTANTIATE_TEST_CASE_P(BitwiseOperatorTestFluid, MathOperatorMatMatTest,
|
||||
Values(-1),
|
||||
Values(CORE_FLUID),
|
||||
Values(AbsExact().to_compare_obj()),
|
||||
Values( opAnd, opOr, opXor )));
|
||||
Values( AND, OR, XOR )));
|
||||
|
||||
//FIXME: Some Mat/Scalar Fluid kernels are not there yet!
|
||||
INSTANTIATE_TEST_CASE_P(DISABLED_BitwiseOperatorTestFluid, MathOperatorMatScalarTest,
|
||||
INSTANTIATE_TEST_CASE_P(BitwiseOperatorTestFluid, MathOperatorMatScalarTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480),
|
||||
@@ -59,7 +68,8 @@ INSTANTIATE_TEST_CASE_P(DISABLED_BitwiseOperatorTestFluid, MathOperatorMatScalar
|
||||
Values(-1),
|
||||
Values(CORE_FLUID),
|
||||
Values(AbsExact().to_compare_obj()),
|
||||
Values( opAND, opOR, opXOR, opANDR, opORR, opXORR )));
|
||||
Values( AND, OR, XOR,
|
||||
ANDR, ORR, XORR )));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BitwiseNotOperatorTestFluid, NotOperatorTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
|
||||
Reference in New Issue
Block a user