@@ -788,6 +788,44 @@ PERF_TEST_P_(EqHistPerfTest, TestPerformance)
788
788
789
789
// ------------------------------------------------------------------------------
790
790
791
+ PERF_TEST_P_ (BGR2RGBPerfTest, TestPerformance)
792
+ {
793
+ compare_f cmpF;
794
+ cv::Size sz;
795
+ cv::GCompileArgs compile_args;
796
+ std::tie (cmpF, sz, compile_args) = GetParam ();
797
+
798
+ initMatrixRandN (CV_8UC3, sz, CV_8UC3, false );
799
+
800
+ // OpenCV code /////////////////////////////////////////////////////////////
801
+ {
802
+ cv::cvtColor (in_mat1, out_mat_ocv, cv::COLOR_BGR2RGB);
803
+ }
804
+
805
+ // G-API code //////////////////////////////////////////////////////////////
806
+ cv::GMat in;
807
+ auto out = cv::gapi::BGR2RGB (in);
808
+ cv::GComputation c (in, out);
809
+
810
+ // Warm-up graph engine:
811
+ c.apply (in_mat1, out_mat_gapi, std::move (compile_args));
812
+
813
+ TEST_CYCLE ()
814
+ {
815
+ c.apply (in_mat1, out_mat_gapi);
816
+ }
817
+
818
+ // Comparison //////////////////////////////////////////////////////////////
819
+ {
820
+ EXPECT_TRUE (cmpF (out_mat_gapi, out_mat_ocv));
821
+ EXPECT_EQ (out_mat_gapi.size (), sz);
822
+ }
823
+
824
+ SANITY_CHECK_NOTHING ();
825
+ }
826
+
827
+ // ------------------------------------------------------------------------------
828
+
791
829
PERF_TEST_P_ (RGB2GrayPerfTest, TestPerformance)
792
830
{
793
831
compare_f cmpF = get<0 >(GetParam ());
@@ -940,6 +978,158 @@ PERF_TEST_P_(YUV2RGBPerfTest, TestPerformance)
940
978
941
979
// ------------------------------------------------------------------------------
942
980
981
+ PERF_TEST_P_ (BGR2I420PerfTest, TestPerformance)
982
+ {
983
+ compare_f cmpF;
984
+ cv::Size sz;
985
+ cv::GCompileArgs compile_args;
986
+ std::tie (cmpF, sz, compile_args) = GetParam ();
987
+
988
+ initMatrixRandN (CV_8UC3, sz, CV_8UC1, false );
989
+
990
+ // OpenCV code /////////////////////////////////////////////////////////////
991
+ {
992
+ cv::cvtColor (in_mat1, out_mat_ocv, cv::COLOR_BGR2YUV_I420);
993
+ }
994
+
995
+ // G-API code //////////////////////////////////////////////////////////////
996
+ cv::GMat in;
997
+ auto out = cv::gapi::BGR2I420 (in);
998
+ cv::GComputation c (in, out);
999
+
1000
+ // Warm-up graph engine:
1001
+ c.apply (in_mat1, out_mat_gapi, std::move (compile_args));
1002
+
1003
+ TEST_CYCLE ()
1004
+ {
1005
+ c.apply (in_mat1, out_mat_gapi);
1006
+ }
1007
+
1008
+ // Comparison //////////////////////////////////////////////////////////////
1009
+ {
1010
+ EXPECT_TRUE (cmpF (out_mat_gapi, out_mat_ocv));
1011
+ EXPECT_EQ (out_mat_gapi.size (), Size (sz.width , sz.height * 3 / 2 ));
1012
+ }
1013
+
1014
+ SANITY_CHECK_NOTHING ();
1015
+ }
1016
+
1017
+ // ------------------------------------------------------------------------------
1018
+
1019
+ PERF_TEST_P_ (RGB2I420PerfTest, TestPerformance)
1020
+ {
1021
+ compare_f cmpF;
1022
+ cv::Size sz;
1023
+ cv::GCompileArgs compile_args;
1024
+ std::tie (cmpF, sz, compile_args) = GetParam ();
1025
+
1026
+ initMatrixRandN (CV_8UC3, sz, CV_8UC1, false );
1027
+
1028
+ // OpenCV code /////////////////////////////////////////////////////////////
1029
+ {
1030
+ cv::cvtColor (in_mat1, out_mat_ocv, cv::COLOR_RGB2YUV_I420);
1031
+ }
1032
+
1033
+ // G-API code //////////////////////////////////////////////////////////////
1034
+ cv::GMat in;
1035
+ auto out = cv::gapi::RGB2I420 (in);
1036
+ cv::GComputation c (in, out);
1037
+
1038
+ // Warm-up graph engine:
1039
+ c.apply (in_mat1, out_mat_gapi, std::move (compile_args));
1040
+
1041
+ TEST_CYCLE ()
1042
+ {
1043
+ c.apply (in_mat1, out_mat_gapi);
1044
+ }
1045
+
1046
+ // Comparison //////////////////////////////////////////////////////////////
1047
+ {
1048
+ EXPECT_TRUE (cmpF (out_mat_gapi, out_mat_ocv));
1049
+ EXPECT_EQ (out_mat_gapi.size (), Size (sz.width , sz.height * 3 / 2 ));
1050
+ }
1051
+
1052
+ SANITY_CHECK_NOTHING ();
1053
+ }
1054
+
1055
+ // ------------------------------------------------------------------------------
1056
+
1057
+ PERF_TEST_P_ (I4202BGRPerfTest, TestPerformance)
1058
+ {
1059
+ compare_f cmpF;
1060
+ cv::Size sz;
1061
+ cv::GCompileArgs compile_args;
1062
+ std::tie (cmpF, sz, compile_args) = GetParam ();
1063
+
1064
+ initMatrixRandN (CV_8UC1, sz, CV_8UC3, false );
1065
+
1066
+ // OpenCV code /////////////////////////////////////////////////////////////
1067
+ {
1068
+ cv::cvtColor (in_mat1, out_mat_ocv, cv::COLOR_YUV2BGR_I420);
1069
+ }
1070
+
1071
+ // G-API code //////////////////////////////////////////////////////////////
1072
+ cv::GMat in;
1073
+ auto out = cv::gapi::I4202BGR (in);
1074
+ cv::GComputation c (in, out);
1075
+
1076
+ // Warm-up graph engine:
1077
+ c.apply (in_mat1, out_mat_gapi, std::move (compile_args));
1078
+
1079
+ TEST_CYCLE ()
1080
+ {
1081
+ c.apply (in_mat1, out_mat_gapi);
1082
+ }
1083
+
1084
+ // Comparison //////////////////////////////////////////////////////////////
1085
+ {
1086
+ EXPECT_TRUE (cmpF (out_mat_gapi, out_mat_ocv));
1087
+ EXPECT_EQ (out_mat_gapi.size (), Size (sz.width , sz.height * 2 / 3 ));
1088
+ }
1089
+
1090
+ SANITY_CHECK_NOTHING ();
1091
+ }
1092
+
1093
+ // ------------------------------------------------------------------------------
1094
+
1095
+ PERF_TEST_P_ (I4202RGBPerfTest, TestPerformance)
1096
+ {
1097
+ compare_f cmpF;
1098
+ cv::Size sz;
1099
+ cv::GCompileArgs compile_args;
1100
+ std::tie (cmpF, sz, compile_args) = GetParam ();
1101
+
1102
+ initMatrixRandN (CV_8UC1, sz, CV_8UC3, false );
1103
+
1104
+ // OpenCV code /////////////////////////////////////////////////////////////
1105
+ {
1106
+ cv::cvtColor (in_mat1, out_mat_ocv, cv::COLOR_YUV2RGB_I420);
1107
+ }
1108
+
1109
+ // G-API code //////////////////////////////////////////////////////////////
1110
+ cv::GMat in;
1111
+ auto out = cv::gapi::I4202RGB (in);
1112
+ cv::GComputation c (in, out);
1113
+
1114
+ // Warm-up graph engine:
1115
+ c.apply (in_mat1, out_mat_gapi, std::move (compile_args));
1116
+
1117
+ TEST_CYCLE ()
1118
+ {
1119
+ c.apply (in_mat1, out_mat_gapi);
1120
+ }
1121
+
1122
+ // Comparison //////////////////////////////////////////////////////////////
1123
+ {
1124
+ EXPECT_TRUE (cmpF (out_mat_gapi, out_mat_ocv));
1125
+ EXPECT_EQ (out_mat_gapi.size (), Size (sz.width , sz.height * 2 / 3 ));
1126
+ }
1127
+
1128
+ SANITY_CHECK_NOTHING ();
1129
+ }
1130
+
1131
+ // ------------------------------------------------------------------------------
1132
+
943
1133
PERF_TEST_P_ (RGB2LabPerfTest, TestPerformance)
944
1134
{
945
1135
compare_f cmpF = get<0 >(GetParam ());
0 commit comments