1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

This commit is contained in:
Alexander Alekhin
2019-11-11 18:24:05 +00:00
20 changed files with 354 additions and 299 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ if(HAVE_CUDA)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wenum-compare -Wunused-function -Wshadow)
endif()
if(CV_TRACE AND HAVE_ITT AND BUILD_ITT)
if(CV_TRACE AND HAVE_ITT)
add_definitions(-DOPENCV_WITH_ITT=1)
endif()
@@ -64,33 +64,30 @@ static void dumpOpenCLInformation()
std::vector<PlatformInfo> platforms;
cv::ocl::getPlatfomsInfo(platforms);
if (platforms.size() > 0)
{
DUMP_MESSAGE_STDOUT("OpenCL Platforms: ");
for (size_t i = 0; i < platforms.size(); i++)
{
const PlatformInfo* platform = &platforms[i];
DUMP_MESSAGE_STDOUT(" " << platform->name().c_str());
Device current_device;
for (int j = 0; j < platform->deviceNumber(); j++)
{
platform->getDevice(current_device, j);
const char* deviceTypeStr = current_device.type() == Device::TYPE_CPU
? ("CPU") : (current_device.type() == Device::TYPE_GPU ? current_device.hostUnifiedMemory() ? "iGPU" : "dGPU" : "unknown");
DUMP_MESSAGE_STDOUT( " " << deviceTypeStr << ": " << current_device.name().c_str() << " (" << current_device.version().c_str() << ")");
DUMP_CONFIG_PROPERTY( cv::format("cv_ocl_platform_%d_device_%d", (int)i, (int)j ),
cv::format("(Platform=%s)(Type=%s)(Name=%s)(Version=%s)",
platform->name().c_str(), deviceTypeStr, current_device.name().c_str(), current_device.version().c_str()) );
}
}
}
else
if (platforms.empty())
{
DUMP_MESSAGE_STDOUT("OpenCL is not available");
DUMP_CONFIG_PROPERTY("cv_ocl", "not available");
return;
}
DUMP_MESSAGE_STDOUT("OpenCL Platforms: ");
for (size_t i = 0; i < platforms.size(); i++)
{
const PlatformInfo* platform = &platforms[i];
DUMP_MESSAGE_STDOUT(" " << platform->name());
Device current_device;
for (int j = 0; j < platform->deviceNumber(); j++)
{
platform->getDevice(current_device, j);
const char* deviceTypeStr = (current_device.type() == Device::TYPE_CPU) ? "CPU" :
(current_device.type() == Device::TYPE_GPU ? current_device.hostUnifiedMemory() ? "iGPU" : "dGPU" : "unknown");
DUMP_MESSAGE_STDOUT( " " << deviceTypeStr << ": " << current_device.name() << " (" << current_device.version() << ")");
DUMP_CONFIG_PROPERTY( cv::format("cv_ocl_platform_%d_device_%d", (int)i, j ),
cv::format("(Platform=%s)(Type=%s)(Name=%s)(Version=%s)",
platform->name().c_str(), deviceTypeStr, current_device.name().c_str(), current_device.version().c_str()) );
}
}
const Device& device = Device::getDefault();
if (!device.available())
CV_Error(Error::OpenCLInitError, "OpenCL device is not available");
@@ -102,8 +99,8 @@ static void dumpOpenCLInformation()
DUMP_CONFIG_PROPERTY("cv_ocl_current_platformName", device.getPlatform().name());
#endif
const char* deviceTypeStr = device.type() == Device::TYPE_CPU
? ("CPU") : (device.type() == Device::TYPE_GPU ? device.hostUnifiedMemory() ? "iGPU" : "dGPU" : "unknown");
const char* deviceTypeStr = (device.type() == Device::TYPE_CPU) ? "CPU" :
(device.type() == Device::TYPE_GPU ? device.hostUnifiedMemory() ? "iGPU" : "dGPU" : "unknown");
DUMP_MESSAGE_STDOUT(" Type = " << deviceTypeStr);
DUMP_CONFIG_PROPERTY("cv_ocl_current_deviceType", deviceTypeStr);
@@ -156,7 +153,7 @@ static void dumpOpenCLInformation()
}
pos = pos2 + 1;
}
DUMP_CONFIG_PROPERTY("cv_ocl_current_extensions", extensionsStr.c_str());
DUMP_CONFIG_PROPERTY("cv_ocl_current_extensions", extensionsStr);
const char* haveAmdBlasStr = haveAmdBlas() ? "Yes" : "No";
DUMP_MESSAGE_STDOUT(" Has AMD Blas = " << haveAmdBlasStr);
+18 -4
View File
@@ -2032,16 +2032,25 @@ struct Context::Impl
0
};
cl_uint i, nd0 = 0, nd = 0;
cl_uint nd0 = 0;
int dtype = dtype0 & 15;
CV_OCL_DBG_CHECK(clGetDeviceIDs(pl, dtype, 0, 0, &nd0));
cl_int status = clGetDeviceIDs(pl, dtype, 0, NULL, &nd0);
if (status != CL_DEVICE_NOT_FOUND) // Not an error if platform has no devices
{
CV_OCL_DBG_CHECK_RESULT(status,
cv::format("clGetDeviceIDs(platform=%p, device_type=%d, num_entries=0, devices=NULL, numDevices=%p)", pl, dtype, &nd0).c_str());
}
if (nd0 == 0)
return;
AutoBuffer<void*> dlistbuf(nd0*2+1);
cl_device_id* dlist = (cl_device_id*)dlistbuf.data();
cl_device_id* dlist_new = dlist + nd0;
CV_OCL_DBG_CHECK(clGetDeviceIDs(pl, dtype, nd0, dlist, &nd0));
String name0;
cl_uint i, nd = 0;
String name0;
for(i = 0; i < nd0; i++)
{
Device d(dlist[i]);
@@ -5941,7 +5950,12 @@ void convertFromImage(void* cl_mem_image, UMat& dst)
static void getDevices(std::vector<cl_device_id>& devices, cl_platform_id platform)
{
cl_uint numDevices = 0;
CV_OCL_DBG_CHECK(clGetDeviceIDs(platform, (cl_device_type)Device::TYPE_ALL, 0, NULL, &numDevices));
cl_int status = clGetDeviceIDs(platform, (cl_device_type)Device::TYPE_ALL, 0, NULL, &numDevices);
if (status != CL_DEVICE_NOT_FOUND) // Not an error if platform has no devices
{
CV_OCL_DBG_CHECK_RESULT(status,
cv::format("clGetDeviceIDs(platform, Device::TYPE_ALL, num_entries=0, devices=NULL, numDevices=%p)", &numDevices).c_str());
}
if (numDevices == 0)
{
+1 -1
View File
@@ -6,7 +6,7 @@
#define OPENCV_DNN_VERSION_HPP
/// Use with major OpenCV version only.
#define OPENCV_DNN_API_VERSION 20191024
#define OPENCV_DNN_API_VERSION 20191111
#if !defined CV_DOXYGEN && !defined CV_STATIC_ANALYSIS && !defined CV_DNN_DONT_ADD_INLINE_NS
#define CV__DNN_INLINE_NS __CV_CAT(dnn4_v, OPENCV_DNN_API_VERSION)
+3 -6
View File
@@ -3450,14 +3450,11 @@ Ptr<Layer> Net::getLayer(LayerId layerId)
std::vector<Ptr<Layer> > Net::getLayerInputs(LayerId layerId)
{
LayerData &ld = impl->getLayerData(layerId);
if (!ld.layerInstance)
CV_Error(Error::StsNullPtr, format("Requested layer \"%s\" was not initialized", ld.name.c_str()));
std::vector<Ptr<Layer> > inputLayers;
inputLayers.reserve(ld.inputLayersId.size());
std::set<int>::iterator it;
for (it = ld.inputLayersId.begin(); it != ld.inputLayersId.end(); ++it) {
inputLayers.push_back(getLayer(*it));
inputLayers.reserve(ld.inputBlobsId.size());
for (int i = 0; i < ld.inputBlobsId.size(); ++i) {
inputLayers.push_back(getLayer(ld.inputBlobsId[i].lid));
}
return inputLayers;
}
+24 -2
View File
@@ -68,6 +68,7 @@ public:
PROD = 0,
SUM = 1,
MAX = 2,
DIV = 3
} op;
std::vector<float> coeffs;
bool variableChannels;
@@ -85,6 +86,8 @@ public:
op = SUM;
else if (operation == "max")
op = MAX;
else if (operation == "div")
op = DIV;
else
CV_Error(cv::Error::StsBadArg, "Unknown operation type \"" + operation + "\"");
}
@@ -104,8 +107,8 @@ public:
virtual bool supportBackend(int backendId) CV_OVERRIDE
{
return backendId == DNN_BACKEND_OPENCV ||
backendId == DNN_BACKEND_CUDA ||
backendId == DNN_BACKEND_HALIDE ||
(backendId == DNN_BACKEND_CUDA && op != DIV) || // TODO: not implemented, see PR #15811
(backendId == DNN_BACKEND_HALIDE && op != DIV) || // TODO: not implemented, see PR #15811
(backendId == DNN_BACKEND_INFERENCE_ENGINE && !variableChannels &&
(preferableTarget != DNN_TARGET_OPENCL || coeffs.empty()));
}
@@ -278,6 +281,18 @@ public:
srcptr0 = (const float*)dstptr;
}
}
else if( op == DIV )
{
for( k = 1; k < n; k++ )
{
const float* srcptr1 = srcs[k]->ptr<float>() + globalDelta;
for( j = 0; j < blockSize; j++ )
{
dstptr[j] = srcptr0[j]/srcptr1[j];
}
srcptr0 = (const float*)dstptr;
}
}
else if( op == MAX )
{
for( k = 1; k < n; k++ )
@@ -400,6 +415,11 @@ public:
for (int i = 2; i < inputs.size(); ++i)
multiply(inputs[i], outputs[0], outputs[0]);
break;
case DIV:
divide(inputs[0], inputs[1], outputs[0]);
for (int i = 2; i < inputs.size(); ++i)
divide(outputs[0], inputs[i], outputs[0]);
break;
case MAX:
max(inputs[0], inputs[1], outputs[0]);
for (int i = 2; i < inputs.size(); ++i)
@@ -515,6 +535,8 @@ public:
ieLayer.setEltwiseType(InferenceEngine::Builder::EltwiseLayer::EltwiseType::SUM);
else if (op == PROD)
ieLayer.setEltwiseType(InferenceEngine::Builder::EltwiseLayer::EltwiseType::MUL);
else if (op == DIV)
ieLayer.setEltwiseType(InferenceEngine::Builder::EltwiseLayer::EltwiseType::DIV);
else if (op == MAX)
ieLayer.setEltwiseType(InferenceEngine::Builder::EltwiseLayer::EltwiseType::MAX);
else
+43 -9
View File
@@ -520,19 +520,27 @@ void ONNXImporter::populateNet(Net dstNet)
}
else if (layer_type == "Div")
{
Mat blob = getBlob(node_proto, constBlobs, 1);
CV_Assert_N(blob.type() == CV_32F, blob.total());
if (blob.total() == 1)
if (constBlobs.find(node_proto.input(1)) == constBlobs.end())
{
layerParams.set("scale", 1.0f / blob.at<float>(0));
layerParams.type = "Power";
layerParams.type = "Eltwise";
layerParams.set("operation", "div");
}
else
{
layerParams.type = "Scale";
divide(1.0, blob, blob);
layerParams.blobs.push_back(blob);
layerParams.set("bias_term", false);
Mat blob = getBlob(node_proto, constBlobs, 1);
CV_Assert_N(blob.type() == CV_32F, blob.total());
if (blob.total() == 1)
{
layerParams.set("scale", 1.0f / blob.at<float>(0));
layerParams.type = "Power";
}
else
{
layerParams.type = "Scale";
divide(1.0, blob, blob);
layerParams.blobs.push_back(blob);
layerParams.set("bias_term", false);
}
}
}
else if (layer_type == "Neg")
@@ -771,6 +779,32 @@ void ONNXImporter::populateNet(Net dstNet)
continue;
}
}
else if (layer_type == "ReduceL2")
{
CV_Assert_N(node_proto.input_size() == 1, layerParams.has("axes"));
CV_Assert(graph_proto.node_size() > li + 1 && graph_proto.node(li + 1).op_type() == "Div");
++li;
layerParams.type = "Normalize";
DictValue axes_dict = layerParams.get("axes");
if (axes_dict.size() != 1)
CV_Error(Error::StsNotImplemented, "Multidimensional reduceL2");
int axis = axes_dict.getIntValue(0);
layerParams.set("axis",axis);
layerParams.set("end_axis", axis);
}
else if (layer_type == "Squeeze")
{
CV_Assert_N(node_proto.input_size() == 1, layerParams.has("axes"));
DictValue axes_dict = layerParams.get("axes");
if (axes_dict.size() != 1)
CV_Error(Error::StsNotImplemented, "Multidimensional squeeze");
int axis = axes_dict.getIntValue(0);
layerParams.set("axis", axis - 1);
layerParams.set("end_axis", axis);
layerParams.type = "Flatten";
}
else if (layer_type == "Unsqueeze")
{
CV_Assert(node_proto.input_size() == 1);
+2
View File
@@ -86,6 +86,8 @@ TEST_P(dump, Regression)
Net net = readNet(findDataFile("dnn/squeezenet_v1.1.prototxt"),
findDataFile("dnn/squeezenet_v1.1.caffemodel", false));
ASSERT_EQ(net.getLayerInputs(net.getLayerId("fire2/concat")).size(), 2);
int size[] = {1, 3, 227, 227};
Mat input = cv::Mat::ones(4, size, CV_32F);
net.setInput(input);
+32
View File
@@ -322,6 +322,28 @@ TEST_P(Test_ONNX_layers, MultyInputs)
expectNoFallbacksFromIE(net);
}
TEST_P(Test_ONNX_layers, Div)
{
const String model = _tf("models/div.onnx");
Net net = readNetFromONNX(model);
ASSERT_FALSE(net.empty());
net.setPreferableBackend(backend);
net.setPreferableTarget(target);
Mat inp1 = blobFromNPY(_tf("data/input_div_0.npy"));
Mat inp2 = blobFromNPY(_tf("data/input_div_1.npy"));
Mat ref = blobFromNPY(_tf("data/output_div.npy"));
checkBackend(&inp1, &ref);
net.setInput(inp1, "0");
net.setInput(inp2, "1");
Mat out = net.forward();
normAssert(ref, out, "", default_l1, default_lInf);
expectNoFallbacksFromIE(net);
}
TEST_P(Test_ONNX_layers, DynamicReshape)
{
if (backend == DNN_BACKEND_INFERENCE_ENGINE)
@@ -337,6 +359,16 @@ TEST_P(Test_ONNX_layers, Reshape)
testONNXModels("unsqueeze");
}
TEST_P(Test_ONNX_layers, Squeeze)
{
testONNXModels("squeeze");
}
TEST_P(Test_ONNX_layers, ReduceL2)
{
testONNXModels("reduceL2");
}
TEST_P(Test_ONNX_layers, Slice)
{
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_LT(2019010000)
+35 -125
View File
@@ -38,8 +38,10 @@
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "precomp.hpp"
#include "opencl_kernels_imgproc.hpp"
#include "opencv2/core/hal/intrin.hpp"
namespace cv
{
@@ -211,7 +213,7 @@ struct MomentsInTile_SIMD
}
};
#if CV_SSE2
#if CV_SIMD128
template <>
struct MomentsInTile_SIMD<uchar, int, int>
@@ -226,115 +228,33 @@ struct MomentsInTile_SIMD<uchar, int, int>
int x = 0;
{
__m128i dx = _mm_set1_epi16(8);
__m128i z = _mm_setzero_si128(), qx0 = z, qx1 = z, qx2 = z, qx3 = z, qx = _mm_setr_epi16(0, 1, 2, 3, 4, 5, 6, 7);
v_int16x8 dx = v_setall_s16(8), qx = v_int16x8(0, 1, 2, 3, 4, 5, 6, 7);
v_uint32x4 z = v_setzero_u32(), qx0 = z, qx1 = z, qx2 = z, qx3 = z;
for( ; x <= len - 8; x += 8 )
{
__m128i p = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i*)(ptr + x)), z);
__m128i sx = _mm_mullo_epi16(qx, qx);
v_int16x8 p = v_reinterpret_as_s16(v_load_expand(ptr + x));
v_int16x8 sx = v_mul_wrap(qx, qx);
qx0 = _mm_add_epi16(qx0, p);
qx1 = _mm_add_epi32(qx1, _mm_madd_epi16(p, qx));
qx2 = _mm_add_epi32(qx2, _mm_madd_epi16(p, sx));
qx3 = _mm_add_epi32(qx3, _mm_madd_epi16( _mm_mullo_epi16(p, qx), sx));
qx0 += v_reinterpret_as_u32(p);
qx1 = v_reinterpret_as_u32(v_dotprod(p, qx, v_reinterpret_as_s32(qx1)));
qx2 = v_reinterpret_as_u32(v_dotprod(p, sx, v_reinterpret_as_s32(qx2)));
qx3 = v_reinterpret_as_u32(v_dotprod(v_mul_wrap(p, qx), sx, v_reinterpret_as_s32(qx3)));
qx = _mm_add_epi16(qx, dx);
qx += dx;
}
__m128i qx01_lo = _mm_unpacklo_epi32(qx0, qx1);
__m128i qx23_lo = _mm_unpacklo_epi32(qx2, qx3);
__m128i qx01_hi = _mm_unpackhi_epi32(qx0, qx1);
__m128i qx23_hi = _mm_unpackhi_epi32(qx2, qx3);
qx01_lo = _mm_add_epi32(qx01_lo, qx01_hi);
qx23_lo = _mm_add_epi32(qx23_lo, qx23_hi);
__m128i qx0123_lo = _mm_unpacklo_epi64(qx01_lo, qx23_lo);
__m128i qx0123_hi = _mm_unpackhi_epi64(qx01_lo, qx23_lo);
qx0123_lo = _mm_add_epi32(qx0123_lo, qx0123_hi);
_mm_store_si128((__m128i*)buf, qx0123_lo);
x0 = (buf[0] & 0xffff) + (buf[0] >> 16);
x1 = buf[1];
x2 = buf[2];
x3 = buf[3];
x0 = v_reduce_sum(qx0);
x0 = (x0 & 0xffff) + (x0 >> 16);
x1 = v_reduce_sum(qx1);
x2 = v_reduce_sum(qx2);
x3 = v_reduce_sum(qx3);
}
return x;
}
int CV_DECL_ALIGNED(16) buf[4];
};
#elif CV_NEON
template <>
struct MomentsInTile_SIMD<uchar, int, int>
{
MomentsInTile_SIMD()
{
ushort CV_DECL_ALIGNED(8) init[4] = { 0, 1, 2, 3 };
qx_init = vld1_u16(init);
v_step = vdup_n_u16(4);
}
int operator() (const uchar * ptr, int len, int & x0, int & x1, int & x2, int & x3)
{
int x = 0;
uint32x4_t v_z = vdupq_n_u32(0), v_x0 = v_z, v_x1 = v_z,
v_x2 = v_z, v_x3 = v_z;
uint16x4_t qx = qx_init;
for( ; x <= len - 8; x += 8 )
{
uint16x8_t v_src = vmovl_u8(vld1_u8(ptr + x));
// first part
uint32x4_t v_qx = vmovl_u16(qx);
uint16x4_t v_p = vget_low_u16(v_src);
uint32x4_t v_px = vmull_u16(qx, v_p);
v_x0 = vaddw_u16(v_x0, v_p);
v_x1 = vaddq_u32(v_x1, v_px);
v_px = vmulq_u32(v_px, v_qx);
v_x2 = vaddq_u32(v_x2, v_px);
v_x3 = vaddq_u32(v_x3, vmulq_u32(v_px, v_qx));
qx = vadd_u16(qx, v_step);
// second part
v_qx = vmovl_u16(qx);
v_p = vget_high_u16(v_src);
v_px = vmull_u16(qx, v_p);
v_x0 = vaddw_u16(v_x0, v_p);
v_x1 = vaddq_u32(v_x1, v_px);
v_px = vmulq_u32(v_px, v_qx);
v_x2 = vaddq_u32(v_x2, v_px);
v_x3 = vaddq_u32(v_x3, vmulq_u32(v_px, v_qx));
qx = vadd_u16(qx, v_step);
}
vst1q_u32(buf, v_x0);
x0 = buf[0] + buf[1] + buf[2] + buf[3];
vst1q_u32(buf, v_x1);
x1 = buf[0] + buf[1] + buf[2] + buf[3];
vst1q_u32(buf, v_x2);
x2 = buf[0] + buf[1] + buf[2] + buf[3];
vst1q_u32(buf, v_x3);
x3 = buf[0] + buf[1] + buf[2] + buf[3];
return x;
}
uint CV_DECL_ALIGNED(16) buf[4];
uint16x4_t qx_init, v_step;
};
#endif
#if CV_SSE4_1
template <>
struct MomentsInTile_SIMD<ushort, int, int64>
{
@@ -348,49 +268,39 @@ struct MomentsInTile_SIMD<ushort, int, int64>
int x = 0;
{
__m128i v_delta = _mm_set1_epi32(4), v_zero = _mm_setzero_si128(), v_x0 = v_zero,
v_x1 = v_zero, v_x2 = v_zero, v_x3 = v_zero, v_ix0 = _mm_setr_epi32(0, 1, 2, 3);
v_int32x4 v_delta = v_setall_s32(4), v_ix0 = v_int32x4(0, 1, 2, 3);
v_uint32x4 z = v_setzero_u32(), v_x0 = z, v_x1 = z, v_x2 = z;
v_uint64x2 v_x3 = v_reinterpret_as_u64(z);
for( ; x <= len - 4; x += 4 )
{
__m128i v_src = _mm_loadl_epi64((const __m128i *)(ptr + x));
v_src = _mm_unpacklo_epi16(v_src, v_zero);
v_int32x4 v_src = v_reinterpret_as_s32(v_load_expand(ptr + x));
v_x0 = _mm_add_epi32(v_x0, v_src);
v_x1 = _mm_add_epi32(v_x1, _mm_mullo_epi32(v_src, v_ix0));
v_x0 += v_reinterpret_as_u32(v_src);
v_x1 += v_reinterpret_as_u32(v_src * v_ix0);
__m128i v_ix1 = _mm_mullo_epi32(v_ix0, v_ix0);
v_x2 = _mm_add_epi32(v_x2, _mm_mullo_epi32(v_src, v_ix1));
v_int32x4 v_ix1 = v_ix0 * v_ix0;
v_x2 += v_reinterpret_as_u32(v_src * v_ix1);
v_ix1 = _mm_mullo_epi32(v_ix0, v_ix1);
v_src = _mm_mullo_epi32(v_src, v_ix1);
v_x3 = _mm_add_epi64(v_x3, _mm_add_epi64(_mm_unpacklo_epi32(v_src, v_zero), _mm_unpackhi_epi32(v_src, v_zero)));
v_ix1 = v_ix0 * v_ix1;
v_src = v_src * v_ix1;
v_uint64x2 v_lo, v_hi;
v_expand(v_reinterpret_as_u32(v_src), v_lo, v_hi);
v_x3 += v_lo + v_hi;
v_ix0 = _mm_add_epi32(v_ix0, v_delta);
v_ix0 += v_delta;
}
__m128i v_x01_lo = _mm_unpacklo_epi32(v_x0, v_x1);
__m128i v_x22_lo = _mm_unpacklo_epi32(v_x2, v_x2);
__m128i v_x01_hi = _mm_unpackhi_epi32(v_x0, v_x1);
__m128i v_x22_hi = _mm_unpackhi_epi32(v_x2, v_x2);
v_x01_lo = _mm_add_epi32(v_x01_lo, v_x01_hi);
v_x22_lo = _mm_add_epi32(v_x22_lo, v_x22_hi);
__m128i v_x0122_lo = _mm_unpacklo_epi64(v_x01_lo, v_x22_lo);
__m128i v_x0122_hi = _mm_unpackhi_epi64(v_x01_lo, v_x22_lo);
v_x0122_lo = _mm_add_epi32(v_x0122_lo, v_x0122_hi);
_mm_store_si128((__m128i*)buf64, v_x3);
_mm_store_si128((__m128i*)buf, v_x0122_lo);
x0 = buf[0];
x1 = buf[1];
x2 = buf[2];
x0 = v_reduce_sum(v_x0);
x1 = v_reduce_sum(v_x1);
x2 = v_reduce_sum(v_x2);
v_store_aligned(buf64, v_reinterpret_as_s64(v_x3));
x3 = buf64[0] + buf64[1];
}
return x;
}
int CV_DECL_ALIGNED(16) buf[4];
int64 CV_DECL_ALIGNED(16) buf64[2];
};
+4
View File
@@ -38,6 +38,10 @@
// the use of this software, even if advised of the possibility of such damage.
//
if (typeof Module.FS === 'undefined' && typeof FS !== 'undefined') {
Module.FS = FS;
}
Module['imread'] = function(imageSource) {
var img = null;
if (typeof imageSource === 'string') {
+5 -3
View File
@@ -687,18 +687,20 @@ bool GStreamerCapture::open(const String &filename_)
// else, we might have a file or a manual pipeline.
// if gstreamer cannot parse the manual pipeline, we assume we were given and
// ordinary file path.
CV_LOG_INFO(NULL, "OpenCV | GStreamer: " << filename);
if (!gst_uri_is_valid(filename))
{
if (utils::fs::exists(filename_))
{
uri.attach(g_filename_to_uri(filename, NULL, NULL));
GSafePtr<GError> err;
uri.attach(gst_filename_to_uri(filename, err.getRef()));
if (uri)
{
file = true;
}
else
{
CV_WARN("Error opening file: " << filename << " (" << uri.get() << ")");
CV_WARN("Error opening file: " << filename << " (" << err->message << ")");
return false;
}
}
@@ -718,7 +720,7 @@ bool GStreamerCapture::open(const String &filename_)
{
uri.attach(g_strdup(filename));
}
CV_LOG_INFO(NULL, "OpenCV | GStreamer: mode - " << (file ? "FILE" : manualpipeline ? "MANUAL" : "URI"));
bool element_from_uri = false;
if (!uridecodebin)
{