return os;
}
-struct GAPI_Streaming: public ::testing::TestWithParam<KernelPackage> {
- GAPI_Streaming() { initTestDataPath(); }
+struct GAPI_Streaming: public ::testing::TestWithParam<std::tuple<KernelPackage,
+ cv::optional<size_t>>> {
+ GAPI_Streaming() {
+ initTestDataPath();
+ KernelPackage pkg_kind;
+ std::tie(pkg_kind, cap) = GetParam();
+ pkg = getKernelPackage(pkg_kind);
+ }
- cv::gapi::GKernelPackage getKernelPackage()
+ const cv::optional<size_t>& getQueueCapacity()
+ {
+ return cap;
+ }
+
+ cv::gapi::GKernelPackage getKernelPackage(KernelPackage pkg_kind)
{
using namespace cv::gapi;
- switch (GetParam())
+ switch (pkg_kind)
{
case KernelPackage::OCV:
return cv::gapi::combine(core::cpu::kernels(),
}
throw std::logic_error("Unknown package");
}
+
+ cv::GCompileArgs getCompileArgs() {
+ using namespace cv::gapi;
+ auto args = cv::compile_args(use_only{pkg});
+ if (cap) {
+ args += cv::compile_args(streaming::queue_capacity{cap.value()});
+ }
+ return args;
+ }
+
+ cv::gapi::GKernelPackage pkg;
+ cv::optional<size_t> cap;
};
G_API_OP(Delay, <cv::GMat(cv::GMat, int)>, "org.opencv.test.delay") {
}
// Compilation & testing
- auto ccomp = c.compileStreaming(cv::descr_of(in_mat),
- cv::compile_args(cv::gapi::use_only{getKernelPackage()}));
+ auto ccomp = c.compileStreaming(cv::descr_of(in_mat), getCompileArgs());
EXPECT_TRUE(ccomp);
EXPECT_FALSE(ccomp.running());
// Compilation & testing
auto ccomp = c.compileStreaming(cv::GMatDesc{CV_8U,3,cv::Size{768,576}},
- cv::compile_args(cv::gapi::use_only{getKernelPackage()}));
+ getCompileArgs());
EXPECT_TRUE(ccomp);
EXPECT_FALSE(ccomp.running());
cv::GComputation c(cv::GIn(in), cv::GOut(tmp, tmp + 1));
auto ccomp = c.compileStreaming(cv::GMatDesc{CV_8U,3,cv::Size{768,512}},
- cv::compile_args(cv::gapi::use_only{getKernelPackage()}));
+ getCompileArgs());
cv::Mat in_mat = cv::imread(findDataFile("cv/edgefilter/kodim23.png"));
cv::Mat out_mat1, out_mat2;
cv::GComputation c(cv::GIn(in), cv::GOut(cv::gapi::copy(in), out));
auto ccomp = c.compileStreaming(cv::GMatDesc{CV_8U,3,cv::Size{768,576}},
- cv::compile_args(cv::gapi::use_only{getKernelPackage()}));
+ getCompileArgs());
EXPECT_TRUE(ccomp);
EXPECT_FALSE(ccomp.running());
auto refc = cv::GComputation([](){
cv::GMat in;
return cv::GComputation(in, cv::gapi::copy(in));
- }).compileStreaming(cv::GMatDesc{CV_8U,3,cv::Size{768,576}},
- cv::compile_args(cv::gapi::use_only{getKernelPackage()}));
+ }).compileStreaming(cv::GMatDesc{CV_8U,3,cv::Size{768,576}}, getCompileArgs());
auto path = findDataFile("cv/video/768x576.avi");
try {
auto testc = cv::GComputation(cv::GIn(in, in2), cv::GOut(out))
.compileStreaming(cv::GMatDesc{CV_8U,3,cv::Size{256,256}},
cv::GMatDesc{CV_8U,3,cv::Size{768,576}},
- cv::compile_args(cv::gapi::use_only{getKernelPackage()}));
+ getCompileArgs());
cv::Mat in_const = cv::Mat::eye(cv::Size(256,256), CV_8UC3);
testc.setSource(cv::gin(in_const,
cv::GMat out = blr - in;
auto testc = cv::GComputation(cv::GIn(in, in2), cv::GOut(out))
- .compileStreaming(cv::compile_args(cv::gapi::use_only{getKernelPackage()}));
+ .compileStreaming(getCompileArgs());
cv::Mat in_const = cv::Mat::eye(cv::Size(256,256), CV_8UC3);
cv::Mat tmp;
cv::GMat out = blr - in;
auto testc = cv::GComputation(cv::GIn(in, in2), cv::GOut(out))
- .compileStreaming(cv::compile_args(cv::gapi::use_only{getKernelPackage()}));
+ .compileStreaming(getCompileArgs());
cv::Mat in_const = cv::Mat::eye(cv::Size(256,256), CV_8UC3);
cv::Mat tmp;
cv::GMat out_m = in_m * in_s;
auto testc = cv::GComputation(cv::GIn(in_m, in_s), cv::GOut(out_m))
- .compileStreaming(cv::compile_args(cv::gapi::use_only{getKernelPackage()}));
+ .compileStreaming(getCompileArgs());
cv::Mat tmp;
// Test with one video source and scalar
}
INSTANTIATE_TEST_CASE_P(TestStreaming, GAPI_Streaming,
- Values( KernelPackage::OCV
- //, KernelPackage::OCL // FIXME: Fails bit-exactness check, maybe relax it?
- , KernelPackage::OCV_FLUID
- //, KernelPackage::OCL // FIXME: Fails bit-exactness check, maybe relax it?
- ));
+ Combine(Values( KernelPackage::OCV
+ //, KernelPackage::OCL // FIXME: Fails bit-exactness check, maybe relax it?
+ , KernelPackage::OCV_FLUID
+ //, KernelPackage::OCL // FIXME: Fails bit-exactness check, maybe relax it?
+ ),
+ Values(cv::optional<size_t>{}, 1u, 4u))
+ );
namespace TypesTest
{
cv::GMat out_m = TypesTest::AddV::on(in_m, in_v) - in_m;
// Run pipeline
+ auto args = cv::compile_args(cv::gapi::kernels<TypesTest::OCVAddV>());
+ auto capacity = getQueueCapacity();
+ if (capacity)
+ {
+ args += cv::compile_args(
+ cv::gapi::streaming::queue_capacity{capacity.value()});
+ }
auto testc = cv::GComputation(cv::GIn(in_m, in_v), cv::GOut(out_m))
- .compileStreaming(cv::compile_args(cv::gapi::kernels<TypesTest::OCVAddV>()));
+ .compileStreaming(std::move(args));
cv::Mat tmp;
// Test with one video source and vector