mirror of
https://github.com/Ascend/ascend-opencv.git
synced 2025-10-06 00:37:03 +08:00
update
This commit is contained in:
@@ -174,7 +174,7 @@ aclMat &aclMat::operator*=(const aclMat &m) {
|
||||
vector<aclMat> output_Mat;
|
||||
vector<aclDataBuffer *> inputBuffers_;
|
||||
vector<aclDataBuffer *> outputBuffers_;
|
||||
aclMat newMat{this->rows, m.cols, this->type(), this->acl_context};
|
||||
aclMat newMat {this->rows, m.cols, this->type(), this->acl_context};
|
||||
|
||||
input_Mat.emplace_back(*this);
|
||||
input_Mat.emplace_back(m);
|
||||
|
@@ -53,7 +53,7 @@ void Convolution(const aclMat& src, const aclMat& kernel, aclMat& dest,
|
||||
const vector<int64_t>& padsList, int stream_id) {
|
||||
vector<aclDataBuffer*> inputBuffers_;
|
||||
vector<aclDataBuffer*> outputBuffers_;
|
||||
vector<int64_t> dilationsList{1, 1, 1, 1};
|
||||
vector<int64_t> dilationsList {1, 1, 1, 1};
|
||||
string opType = "Conv2D";
|
||||
int dest_rows =
|
||||
(src.rows + padsList[0] + padsList[1] - (1 * (kernel.rows - 1) + 1)) /
|
||||
@@ -65,9 +65,9 @@ void Convolution(const aclMat& src, const aclMat& kernel, aclMat& dest,
|
||||
1;
|
||||
aclMat acl_dest {dest_rows, dest_cols, src.type(), src.acl_context};
|
||||
|
||||
vector<int64_t> shape{1, 1, src.rows, src.cols};
|
||||
vector<int64_t> shape1{1, 1, kernel.rows, kernel.cols};
|
||||
vector<int64_t> shape2{1, 1, acl_dest.rows, acl_dest.cols};
|
||||
vector<int64_t> shape {1, 1, src.rows, src.cols};
|
||||
vector<int64_t> shape1 {1, 1, kernel.rows, kernel.cols};
|
||||
vector<int64_t> shape2 {1, 1, acl_dest.rows, acl_dest.cols};
|
||||
|
||||
aclDataType dataType = type_transition(src.depth());
|
||||
aclFormat format = ACL_FORMAT_NCHW;
|
||||
|
@@ -105,15 +105,15 @@ void transpose(const aclMat &src, aclMat &dest, int stream_id) {
|
||||
OperatorDesc opDesc("Transpose");
|
||||
aclDataType dataType = type_transition(src.depth());
|
||||
|
||||
vector<int64_t> inputShape1{1, src.rows, src.cols, src.channels()};
|
||||
vector<int64_t> inputShape1 {1, src.rows, src.cols, src.channels()};
|
||||
opDesc.AddInputTensorDesc(dataType, inputShape1.size(), inputShape1.data(),
|
||||
ACL_FORMAT_ND);
|
||||
|
||||
vector<int64_t> inputShape2{4};
|
||||
vector<int64_t> inputShape2 {4};
|
||||
opDesc.AddInputTensorDesc(ACL_INT32, inputShape2.size(), inputShape2.data(),
|
||||
ACL_FORMAT_ND);
|
||||
|
||||
vector<int64_t> outputShape{-1, -1, -1, -1};
|
||||
vector<int64_t> outputShape {-1, -1, -1, -1};
|
||||
opDesc.AddOutputTensorDesc(dataType, outputShape.size(), outputShape.data(),
|
||||
ACL_FORMAT_ND);
|
||||
|
||||
@@ -198,12 +198,12 @@ void split(const aclMat &src, vector<aclMat> &mv, int stream_id) {
|
||||
aclDataType dataType = type_transition(src.depth());
|
||||
|
||||
int cols = src.step / src.elemSize();
|
||||
vector<int64_t> inputShape1{1, src.rows, cols, src.channels()};
|
||||
vector<int64_t> inputShape1 {1, src.rows, cols, src.channels()};
|
||||
opDesc.AddInputTensorDesc(dataType, inputShape1.size(), inputShape1.data(),
|
||||
ACL_FORMAT_ND);
|
||||
|
||||
for (int i = 0; i < num_split; ++i) {
|
||||
vector<int64_t> outputShape{1, src.rows, cols, 1};
|
||||
vector<int64_t> outputShape {1, src.rows, cols, 1};
|
||||
opDesc.AddOutputTensorDesc(dataType, outputShape.size(), outputShape.data(),
|
||||
ACL_FORMAT_ND);
|
||||
}
|
||||
@@ -239,15 +239,15 @@ static void flip_(const aclMat &src, aclMat &dest, int axis, int stream_id) {
|
||||
OperatorDesc opDesc("ReverseV2");
|
||||
aclDataType dataType = type_transition(src.depth());
|
||||
|
||||
vector<int64_t> inputShape1{1, src.rows, src.cols, src.channels()};
|
||||
vector<int64_t> inputShape1 {1, src.rows, src.cols, src.channels()};
|
||||
opDesc.AddInputTensorDesc(dataType, inputShape1.size(), inputShape1.data(),
|
||||
ACL_FORMAT_ND);
|
||||
|
||||
vector<int64_t> inputShape2{1};
|
||||
vector<int64_t> inputShape2 {1};
|
||||
opDesc.AddInputTensorDesc(ACL_INT32, inputShape2.size(), inputShape2.data(),
|
||||
ACL_FORMAT_ND);
|
||||
|
||||
vector<int64_t> outputShape{1, dest.rows, dest.cols, dest.channels()};
|
||||
vector<int64_t> outputShape {1, dest.rows, dest.cols, dest.channels()};
|
||||
opDesc.AddOutputTensorDesc(dataType, outputShape.size(), outputShape.data(),
|
||||
ACL_FORMAT_ND);
|
||||
|
||||
|
@@ -67,11 +67,11 @@ OperatorDesc CreateOpDesc(const string opType, const vector<aclMat>& input_Mat,
|
||||
for (i = 0; i < input_Mat.size(); ++i) {
|
||||
if (config == TWO_DIMS) {
|
||||
int cols = input_Mat[i].step / input_Mat[i].elemSize();
|
||||
vector<int64_t> shape{input_Mat[i].rows, cols};
|
||||
vector<int64_t> shape {input_Mat[i].rows, cols};
|
||||
opDesc.AddInputTensorDesc(dataType, shape.size(), shape.data(), format);
|
||||
} else if (config == FOUR_DIMS) {
|
||||
int cols = input_Mat[i].step / input_Mat[i].elemSize();
|
||||
vector<int64_t> shape{1, input_Mat[i].rows, cols,
|
||||
vector<int64_t> shape {1, input_Mat[i].rows, cols,
|
||||
input_Mat[i].channels()};
|
||||
opDesc.AddInputTensorDesc(dataType, shape.size(), shape.data(), format);
|
||||
}
|
||||
@@ -80,11 +80,11 @@ OperatorDesc CreateOpDesc(const string opType, const vector<aclMat>& input_Mat,
|
||||
for (i = 0; i < output_Mat.size(); ++i) {
|
||||
if (config == TWO_DIMS) {
|
||||
int cols = output_Mat[i].step / output_Mat[i].elemSize();
|
||||
vector<int64_t> shape{output_Mat[i].rows, cols};
|
||||
vector<int64_t> shape {output_Mat[i].rows, cols};
|
||||
opDesc.AddOutputTensorDesc(dataType, shape.size(), shape.data(), format);
|
||||
} else if (config == FOUR_DIMS) {
|
||||
int cols = output_Mat[i].step / output_Mat[i].elemSize();
|
||||
vector<int64_t> shape{1, output_Mat[i].rows, cols,
|
||||
vector<int64_t> shape {1, output_Mat[i].rows, cols,
|
||||
output_Mat[i].channels()};
|
||||
opDesc.AddOutputTensorDesc(dataType, shape.size(), shape.data(), format);
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ void PERF_TEST::Test_operator_add_perf(aclCxt *acl_context) {
|
||||
constexpr int rand_data_range = 1;
|
||||
constexpr int min_format_flag = 128;
|
||||
|
||||
vector<int> type{CV_8UC1, CV_32FC1, CV_32SC1, CV_64FC1};
|
||||
vector<int> type {CV_8UC1, CV_32FC1, CV_32SC1, CV_64FC1};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
test.PrintLog("Perf test : Function: operator+=()", type[i]);
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
@@ -72,7 +72,7 @@ void PERF_TEST::Test_operator_sub_perf(aclCxt *acl_context) {
|
||||
constexpr int rand_data_range2 = 32;
|
||||
constexpr int min_format_flag = 128;
|
||||
|
||||
vector<int> type{CV_8UC1, CV_32FC1, CV_32SC1, CV_64FC1};
|
||||
vector<int> type {CV_8UC1, CV_32FC1, CV_32SC1, CV_64FC1};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
test.PrintLog("Perf test : Function: operator-=()", type[i]);
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
@@ -124,7 +124,7 @@ void PERF_TEST::Test_operator_div_perf(aclCxt *acl_context) {
|
||||
constexpr int s_val4 = 4, s_val8 = 8;
|
||||
constexpr int min_format_flag = 128;
|
||||
|
||||
vector<int> type{CV_8UC1, CV_32FC1, CV_32SC1, CV_64FC1};
|
||||
vector<int> type {CV_8UC1, CV_32FC1, CV_32SC1, CV_64FC1};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
test.PrintLog("Perf test : Function: operator/=()", type[i]);
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
@@ -172,7 +172,7 @@ void PERF_TEST::Test_operator_mul_perf(aclCxt *acl_context) {
|
||||
constexpr int rand_data_range = 1;
|
||||
constexpr int min_format_flag = 128;
|
||||
|
||||
vector<int> type{CV_32FC1};
|
||||
vector<int> type {CV_32FC1};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
n = cycle_index;
|
||||
|
@@ -3,10 +3,10 @@
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
typedef enum TestDatatype { INT = 1, FLOAT } TestDatatype;
|
||||
using TestDatatype = enum TestDatatype { INT = 1, FLOAT };
|
||||
|
||||
class CV_EXPORTS Common_Test {
|
||||
public:
|
||||
public:
|
||||
Common_Test();
|
||||
~Common_Test();
|
||||
CV_EXPORTS bool Test_Diff(
|
||||
|
@@ -43,7 +43,7 @@
|
||||
// arising in any way out of the use of this software, even if advised of the
|
||||
// possibility of such damage.
|
||||
//
|
||||
// M*/
|
||||
// M */
|
||||
|
||||
#include "test_correctness.hpp"
|
||||
|
||||
|
@@ -27,7 +27,7 @@ class CV_EXPORTS AclMat_Test {
|
||||
/* test aclMat (const Mat &m, cv::acl::aclCxt* acl_context, aclrtMemMallocPolicy policy
|
||||
* = ACL_MEM_MALLOC_HUGE_FIRST) */
|
||||
CV_EXPORTS void Test_constructor_MAT(cv::acl::aclCxt *acl_context);
|
||||
/* test upload download*/
|
||||
/* test upload download */
|
||||
CV_EXPORTS void Test_DATA_TRANSFER(cv::acl::aclCxt *acl_context);
|
||||
/* test upload_2d download_2d */
|
||||
CV_EXPORTS void Test_DATA_TRANSFERASYNC(cv::acl::aclCxt *acl_context);
|
||||
|
@@ -13,7 +13,7 @@ void PERF_TEST::Test_MatMul(aclCxt *acl_context) {
|
||||
int cycle_index = 10; // 100;
|
||||
double begin, end, time, acltime;
|
||||
Common_Test test;
|
||||
vector<int> type{CV_32FC1};
|
||||
vector<int> type {CV_32FC1};
|
||||
constexpr int base = 2;
|
||||
constexpr int start_val = 8;
|
||||
constexpr int rand_data_range = 32;
|
||||
@@ -68,7 +68,7 @@ void PERF_TEST::Test_Convolution(aclCxt *acl_context) {
|
||||
int cycle_index = 10;
|
||||
double begin, end, time, acltime;
|
||||
Common_Test test;
|
||||
vector<int> type{CV_32FC1};
|
||||
vector<int> type {CV_32FC1};
|
||||
constexpr int base = 2;
|
||||
constexpr int start_val = 8;
|
||||
constexpr int min_format_flag = 128;
|
||||
@@ -78,9 +78,9 @@ void PERF_TEST::Test_Convolution(aclCxt *acl_context) {
|
||||
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
Mat mat_src(val, val, type[i], Scalar{s_val1, s_val2});
|
||||
Mat mat_kernel(kernel_val, kernel_val, type[i], Scalar(s_val1, s_val4));
|
||||
Mat mat_dest(val, val, type[i], Scalar{s_val6});
|
||||
Mat mat_src(val, val, type[i], Scalar {s_val1, s_val2});
|
||||
Mat mat_kernel(kernel_val, kernel_val, type[i], Scalar (s_val1, s_val4));
|
||||
Mat mat_dest(val, val, type[i], Scalar {s_val6});
|
||||
|
||||
aclMat aclmat_src(val, val, type[i], mat_src.data, acl_context);
|
||||
aclMat aclmat_kernel(kernel_val, kernel_val, type[i], mat_kernel.data, acl_context);
|
||||
@@ -92,8 +92,8 @@ void PERF_TEST::Test_Convolution(aclCxt *acl_context) {
|
||||
end = static_cast<double>(getTickCount());
|
||||
time = (end - begin) / getTickFrequency() / cycle_index;
|
||||
|
||||
vector<int64_t> strides{1, 1, 1, 1};
|
||||
vector<int64_t> pads{1, 1, 1, 1};
|
||||
vector<int64_t> strides {1, 1, 1, 1};
|
||||
vector<int64_t> pads {1, 1, 1, 1};
|
||||
n = (cycle_index - 1);
|
||||
Convolution(aclmat_src, aclmat_kernel, aclmat_dest, strides, pads, 0);
|
||||
wait_stream(acl_context, 0);
|
||||
|
@@ -18,14 +18,14 @@ void PERF_TEST::Test_Abs(aclCxt *acl_context) {
|
||||
constexpr int start_val = 8;
|
||||
constexpr int min_format_flag = 128;
|
||||
|
||||
vector<int> type{CV_32FC1, CV_32SC1};
|
||||
vector<int> type {CV_32FC1, CV_32SC1};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
test.PrintLog("Perf test : Function: Abs()", type[i]);
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
n = cycle_index;
|
||||
Mat mat_src(val, val, type[i], Scalar{s_val_2});
|
||||
Mat mat_dest(val, val, type[i], Scalar{s_val_4});
|
||||
Mat mat_dest1(val, val, type[i], Scalar{s_val_6});
|
||||
Mat mat_src(val, val, type[i], Scalar {s_val_2});
|
||||
Mat mat_dest(val, val, type[i], Scalar {s_val_4});
|
||||
Mat mat_dest1(val, val, type[i], Scalar {s_val_6});
|
||||
|
||||
aclMat aclmat_src(val, val, type[i], mat_src.data, acl_context);
|
||||
aclMat aclmat_dest(val, val, type[i], mat_dest.data, acl_context);
|
||||
@@ -68,7 +68,7 @@ void PERF_TEST::Test_Pow(aclCxt *acl_context) {
|
||||
constexpr int rand_data_range = 32;
|
||||
constexpr int min_format_flag = 128;
|
||||
|
||||
vector<int> type{CV_8UC1, CV_32FC1, CV_32SC1};
|
||||
vector<int> type {CV_8UC1, CV_32FC1, CV_32SC1};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
test.PrintLog("Perf test : Function: Pow()", type[i]);
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
@@ -119,7 +119,7 @@ void PERF_TEST::Test_Sqrt(aclCxt *acl_context) {
|
||||
constexpr int min_format_flag = 128;
|
||||
constexpr int rand_data_range = 32;
|
||||
|
||||
vector<int> type{CV_32FC1, CV_64FC1};
|
||||
vector<int> type {CV_32FC1, CV_64FC1};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
n = cycle_index;
|
||||
@@ -169,7 +169,7 @@ void PERF_TEST::Test_Add(aclCxt *acl_context) {
|
||||
constexpr int min_format_flag = 128;
|
||||
constexpr int rand_data_range = 32;
|
||||
|
||||
vector<int> type{CV_8UC1, CV_32FC1, CV_32SC1, CV_64FC1};
|
||||
vector<int> type {CV_8UC1, CV_32FC1, CV_32SC1, CV_64FC1};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
n = cycle_index;
|
||||
@@ -225,7 +225,7 @@ void PERF_TEST::Test_Divide(aclCxt *acl_context) {
|
||||
constexpr int rand_data_range1 = 32;
|
||||
constexpr int rand_data_range2 = 4;
|
||||
|
||||
vector<int> type{CV_8UC1, CV_32FC1, CV_32SC1};
|
||||
vector<int> type {CV_8UC1, CV_32FC1, CV_32SC1};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
n = cycle_index;
|
||||
@@ -279,7 +279,7 @@ void PERF_TEST::Test_Exp(aclCxt *acl_context) {
|
||||
constexpr int rand_data_range1 = 32;
|
||||
constexpr int rand_data_range2 = 2;
|
||||
|
||||
vector<int> type{CV_32FC1, CV_64FC1};
|
||||
vector<int> type {CV_32FC1, CV_64FC1};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
n = cycle_index;
|
||||
@@ -329,7 +329,7 @@ void PERF_TEST::Test_Log(aclCxt *acl_context) {
|
||||
constexpr int min_format_flag = 128;
|
||||
constexpr int rand_data_range = 32;
|
||||
|
||||
vector<int> type{CV_32FC1, CV_64FC1};
|
||||
vector<int> type {CV_32FC1, CV_64FC1};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
n = cycle_index;
|
||||
@@ -379,7 +379,7 @@ void PERF_TEST::Test_Max(aclCxt *acl_context) {
|
||||
constexpr int min_format_flag = 128;
|
||||
constexpr int rand_data_range = 32;
|
||||
|
||||
vector<int> type{CV_32FC2, CV_32SC2, CV_64FC2};
|
||||
vector<int> type {CV_32FC2, CV_32SC2, CV_64FC2};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
n = cycle_index;
|
||||
@@ -434,7 +434,7 @@ void PERF_TEST::Test_Min(aclCxt *acl_context) {
|
||||
constexpr int min_format_flag = 128;
|
||||
constexpr int rand_data_range = 32;
|
||||
|
||||
vector<int> type{CV_32FC3, CV_32SC3, CV_64FC3};
|
||||
vector<int> type {CV_32FC3, CV_32SC3, CV_64FC3};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
n = cycle_index;
|
||||
|
@@ -19,9 +19,9 @@ void PERF_TEST::Test_Merge(aclCxt *acl_context) {
|
||||
constexpr int s_val1 = 1, s_val2 = 2, s_val3 = 3;
|
||||
constexpr int min_format_flag = 128;
|
||||
|
||||
vector<int> srcType{CV_8UC1, CV_32FC1, CV_32SC1};
|
||||
vector<int> srcType {CV_8UC1, CV_32FC1, CV_32SC1};
|
||||
|
||||
vector<int> destType{CV_8UC3, CV_32FC3, CV_32SC3};
|
||||
vector<int> destType {CV_8UC3, CV_32FC3, CV_32SC3};
|
||||
for (size_t i = 0; i < srcType.size(); ++i) {
|
||||
test.PrintLog("Perf test : Function: merge()", srcType[i]);
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
@@ -88,7 +88,7 @@ void PERF_TEST::Test_Transpose(aclCxt *acl_context) {
|
||||
constexpr int rand_data_range = 32;
|
||||
constexpr int min_format_flag = 128;
|
||||
|
||||
vector<int> type{CV_32FC1, CV_32SC1};
|
||||
vector<int> type {CV_32FC1, CV_32SC1};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
test.PrintLog("Perf test : Function: transpose()", type[i]);
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
@@ -141,8 +141,8 @@ void PERF_TEST::Test_Split(aclCxt *acl_context) {
|
||||
constexpr int min_format_flag = 128;
|
||||
constexpr int index0 = 0, index1 = 1, index2 = 2;
|
||||
|
||||
vector<int> srcType{CV_8UC3, CV_32FC3, CV_32SC3};
|
||||
vector<int> destType{CV_8UC1, CV_32FC1, CV_32SC1};
|
||||
vector<int> srcType {CV_8UC3, CV_32FC3, CV_32SC3};
|
||||
vector<int> destType {CV_8UC1, CV_32FC1, CV_32SC1};
|
||||
for (size_t i = 0; i < srcType.size(); ++i) {
|
||||
test.PrintLog("Perf test : Function: split()", srcType[i]);
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
@@ -212,7 +212,7 @@ void PERF_TEST::Test_Flip(aclCxt *acl_context) {
|
||||
constexpr int rand_data_range = 32;
|
||||
constexpr int min_format_flag = 128;
|
||||
|
||||
vector<int> type{CV_8UC1, CV_32FC1, CV_32SC1, CV_64FC1};
|
||||
vector<int> type {CV_8UC1, CV_32FC1, CV_32SC1, CV_64FC1};
|
||||
for (size_t i = 0; i < type.size(); ++i) {
|
||||
test.PrintLog("Perf test : Function: flip()", type[i]);
|
||||
for (val = start_val; val <= valmax; val *= base) {
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
class PERF_TEST {
|
||||
public:
|
||||
public:
|
||||
CV_EXPORTS void Test_operator_add_perf(cv::acl::aclCxt *acl_context);
|
||||
CV_EXPORTS void Test_operator_sub_perf(cv::acl::aclCxt *acl_context);
|
||||
CV_EXPORTS void Test_operator_div_perf(cv::acl::aclCxt *acl_context);
|
||||
|
@@ -1,18 +1,19 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "acl/acl.h"
|
||||
#include "opencv2/acl/acl.hpp"
|
||||
#include "opencv2/core.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include "opencv2/imgcodecs.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include "opencv2/acl/acl.hpp"
|
||||
#include "acl/acl.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace cv;
|
||||
using namespace cv::acl;
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* @brief A simple example of the split and merge functions,Using a different Stream
|
||||
*
|
||||
* @brief A simple example of the split and merge functions, Using a different
|
||||
* Stream
|
||||
*/
|
||||
int test_func1(aclCxt *acl_context_0) {
|
||||
Mat src = imread("../cat1.jpg");
|
||||
@@ -22,7 +23,7 @@ int test_func1(aclCxt *acl_context_0) {
|
||||
}
|
||||
|
||||
// 上传数据到aclMat对象中
|
||||
aclMat acl_src(src, acl_context_0);
|
||||
aclMat acl_src (src, acl_context_0);
|
||||
aclMat acl_dest1;
|
||||
aclMat acl_dest2;
|
||||
aclMat acl_dest3;
|
||||
@@ -36,7 +37,7 @@ int test_func1(aclCxt *acl_context_0) {
|
||||
split(acl_src, mv, 0);
|
||||
wait_stream(acl_context_0, 0);
|
||||
|
||||
//下载aclMat数据到Mat类中
|
||||
// 下载aclMat数据到Mat类中
|
||||
Mat dest1 = mv.data()[0].operator cv::Mat();
|
||||
Mat dest2 = mv.data()[1].operator cv::Mat();
|
||||
Mat dest3 = mv.data()[2].operator cv::Mat();
|
||||
@@ -53,10 +54,8 @@ int test_func1(aclCxt *acl_context_0) {
|
||||
imshow("imgdest", imgdest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief A demo of use a stream to synchronize multiple functions
|
||||
*
|
||||
*/
|
||||
int test_func2(aclCxt *acl_context_0) {
|
||||
Mat src = imread("../cat1.jpg");
|
||||
@@ -71,7 +70,6 @@ int test_func2(aclCxt *acl_context_0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// 待split操作数据上传数据到aclMat对象中
|
||||
aclMat acl_src(src, acl_context_0);
|
||||
aclMat acl_dest1;
|
||||
@@ -110,17 +108,15 @@ int test_func2(aclCxt *acl_context_0) {
|
||||
imshow("flip_dest", flip_dest);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// 初始化
|
||||
aclCxt *acl_context_0 = set_device("../acl.json", 1, 2);
|
||||
|
||||
test_func2(acl_context_0);
|
||||
|
||||
// 去初始化
|
||||
release_device(acl_context_0);
|
||||
release_device (acl_context_0);
|
||||
waitKey(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user