Fixing iOS clang warnings, part 1
This commit is contained in:
parent
630eddf25a
commit
420737e098
modules
imgcodecs/src
imgproc/src
videoio/src
platforms/ios/cmake/Modules/Platform
@ -47,6 +47,9 @@
|
|||||||
#include "opencv2/core.hpp"
|
#include "opencv2/core.hpp"
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
|
|
||||||
|
UIImage* MatToUIImage(const cv::Mat& image);
|
||||||
|
void UIImageToMat(const UIImage* image, cv::Mat& m, bool alphaExist);
|
||||||
|
|
||||||
UIImage* MatToUIImage(const cv::Mat& image) {
|
UIImage* MatToUIImage(const cv::Mat& image) {
|
||||||
|
|
||||||
NSData *data = [NSData dataWithBytes:image.data
|
NSData *data = [NSData dataWithBytes:image.data
|
||||||
|
@ -368,7 +368,8 @@ public:
|
|||||||
uint16x8_t g0 = vaddq_u16(vshrq_n_u16(r0, 8), vshrq_n_u16(r2, 8));
|
uint16x8_t g0 = vaddq_u16(vshrq_n_u16(r0, 8), vshrq_n_u16(r2, 8));
|
||||||
uint16x8_t g1 = vandq_u16(r1, masklo);
|
uint16x8_t g1 = vandq_u16(r1, masklo);
|
||||||
g0 = vaddq_u16(g0, vaddq_u16(g1, vextq_u16(g1, g1, 1)));
|
g0 = vaddq_u16(g0, vaddq_u16(g1, vextq_u16(g1, g1, 1)));
|
||||||
g1 = vshlq_n_u16(vextq_u16(g1, g1, 1), 2);
|
uint16x8_t rot = vextq_u16(g1, g1, 1)
|
||||||
|
g1 = vshlq_n_u16(rot, 2);
|
||||||
// g0 = b0 b2 b4 ...
|
// g0 = b0 b2 b4 ...
|
||||||
// g1 = b1 b3 b5 ...
|
// g1 = b1 b3 b5 ...
|
||||||
|
|
||||||
|
@ -240,14 +240,18 @@ struct PyrDownVec_32s16u
|
|||||||
int32x4_t v_r20 = vld1q_s32(row2 + x), v_r21 = vld1q_s32(row2 + x + 4);
|
int32x4_t v_r20 = vld1q_s32(row2 + x), v_r21 = vld1q_s32(row2 + x + 4);
|
||||||
int32x4_t v_r30 = vld1q_s32(row3 + x), v_r31 = vld1q_s32(row3 + x + 4);
|
int32x4_t v_r30 = vld1q_s32(row3 + x), v_r31 = vld1q_s32(row3 + x + 4);
|
||||||
int32x4_t v_r40 = vld1q_s32(row4 + x), v_r41 = vld1q_s32(row4 + x + 4);
|
int32x4_t v_r40 = vld1q_s32(row4 + x), v_r41 = vld1q_s32(row4 + x + 4);
|
||||||
|
int32x4_t shifted;
|
||||||
|
|
||||||
v_r00 = vaddq_s32(vqaddq_s32(v_r00, v_r40), vqaddq_s32(v_r20, v_r20));
|
v_r00 = vaddq_s32(vqaddq_s32(v_r00, v_r40), vqaddq_s32(v_r20, v_r20));
|
||||||
v_r10 = vaddq_s32(vqaddq_s32(v_r10, v_r20), v_r30);
|
v_r10 = vaddq_s32(vqaddq_s32(v_r10, v_r20), v_r30);
|
||||||
int32x4_t v_dst0 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r00, vshlq_n_s32(v_r10, 2)), v_delta), 8);
|
|
||||||
|
shifted = vshlq_n_s32(v_r10, 2);
|
||||||
|
int32x4_t v_dst0 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r00, shifted), v_delta), 8);
|
||||||
|
|
||||||
v_r01 = vaddq_s32(vqaddq_s32(v_r01, v_r41), vqaddq_s32(v_r21, v_r21));
|
v_r01 = vaddq_s32(vqaddq_s32(v_r01, v_r41), vqaddq_s32(v_r21, v_r21));
|
||||||
v_r11 = vaddq_s32(vqaddq_s32(v_r11, v_r21), v_r31);
|
v_r11 = vaddq_s32(vqaddq_s32(v_r11, v_r21), v_r31);
|
||||||
int32x4_t v_dst1 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r01, vshlq_n_s32(v_r11, 2)), v_delta), 8);
|
shifted = vshlq_n_s32(v_r11, 2)
|
||||||
|
int32x4_t v_dst1 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r01, shifted), v_delta), 8);
|
||||||
|
|
||||||
vst1q_u16(dst + x, vcombine_u16(vqmovun_s32(v_dst0), vqmovun_s32(v_dst1)));
|
vst1q_u16(dst + x, vcombine_u16(vqmovun_s32(v_dst0), vqmovun_s32(v_dst1)));
|
||||||
}
|
}
|
||||||
@ -271,14 +275,17 @@ struct PyrDownVec_32s16s
|
|||||||
int32x4_t v_r20 = vld1q_s32(row2 + x), v_r21 = vld1q_s32(row2 + x + 4);
|
int32x4_t v_r20 = vld1q_s32(row2 + x), v_r21 = vld1q_s32(row2 + x + 4);
|
||||||
int32x4_t v_r30 = vld1q_s32(row3 + x), v_r31 = vld1q_s32(row3 + x + 4);
|
int32x4_t v_r30 = vld1q_s32(row3 + x), v_r31 = vld1q_s32(row3 + x + 4);
|
||||||
int32x4_t v_r40 = vld1q_s32(row4 + x), v_r41 = vld1q_s32(row4 + x + 4);
|
int32x4_t v_r40 = vld1q_s32(row4 + x), v_r41 = vld1q_s32(row4 + x + 4);
|
||||||
|
int32x4_t shifted;
|
||||||
|
|
||||||
v_r00 = vaddq_s32(vqaddq_s32(v_r00, v_r40), vqaddq_s32(v_r20, v_r20));
|
v_r00 = vaddq_s32(vqaddq_s32(v_r00, v_r40), vqaddq_s32(v_r20, v_r20));
|
||||||
v_r10 = vaddq_s32(vqaddq_s32(v_r10, v_r20), v_r30);
|
v_r10 = vaddq_s32(vqaddq_s32(v_r10, v_r20), v_r30);
|
||||||
int32x4_t v_dst0 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r00, vshlq_n_s32(v_r10, 2)), v_delta), 8);
|
shifted = vshlq_n_s32(v_r10, 2);
|
||||||
|
int32x4_t v_dst0 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r00, shifted), v_delta), 8);
|
||||||
|
|
||||||
v_r01 = vaddq_s32(vqaddq_s32(v_r01, v_r41), vqaddq_s32(v_r21, v_r21));
|
v_r01 = vaddq_s32(vqaddq_s32(v_r01, v_r41), vqaddq_s32(v_r21, v_r21));
|
||||||
v_r11 = vaddq_s32(vqaddq_s32(v_r11, v_r21), v_r31);
|
v_r11 = vaddq_s32(vqaddq_s32(v_r11, v_r21), v_r31);
|
||||||
int32x4_t v_dst1 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r01, vshlq_n_s32(v_r11, 2)), v_delta), 8);
|
shifted = vshlq_n_s32(v_r11, 2);
|
||||||
|
int32x4_t v_dst1 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r01, shifted), v_delta), 8);
|
||||||
|
|
||||||
vst1q_s16(dst + x, vcombine_s16(vqmovn_s32(v_dst0), vqmovn_s32(v_dst1)));
|
vst1q_s16(dst + x, vcombine_s16(vqmovn_s32(v_dst0), vqmovn_s32(v_dst1)));
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,6 @@ class CvVideoWriter_AVFoundation : public CvVideoWriter{
|
|||||||
AVAssetWriterInput* mMovieWriterInput;
|
AVAssetWriterInput* mMovieWriterInput;
|
||||||
AVAssetWriterInputPixelBufferAdaptor* mMovieWriterAdaptor;
|
AVAssetWriterInputPixelBufferAdaptor* mMovieWriterAdaptor;
|
||||||
|
|
||||||
unsigned char* imagedata;
|
|
||||||
NSString* path;
|
NSString* path;
|
||||||
NSString* codec;
|
NSString* codec;
|
||||||
NSString* fileType;
|
NSString* fileType;
|
||||||
@ -490,15 +489,15 @@ double CvCaptureCAM::getProperty(int property_id){
|
|||||||
CMFormatDescriptionRef format = [[ports objectAtIndex:0] formatDescription];
|
CMFormatDescriptionRef format = [[ports objectAtIndex:0] formatDescription];
|
||||||
CGSize s1 = CMVideoFormatDescriptionGetPresentationDimensions(format, YES, YES);
|
CGSize s1 = CMVideoFormatDescriptionGetPresentationDimensions(format, YES, YES);
|
||||||
|
|
||||||
int width=(int)s1.width, height=(int)s1.height;
|
int w=(int)s1.width, h=(int)s1.height;
|
||||||
|
|
||||||
[localpool drain];
|
[localpool drain];
|
||||||
|
|
||||||
switch (property_id) {
|
switch (property_id) {
|
||||||
case CV_CAP_PROP_FRAME_WIDTH:
|
case CV_CAP_PROP_FRAME_WIDTH:
|
||||||
return width;
|
return w;
|
||||||
case CV_CAP_PROP_FRAME_HEIGHT:
|
case CV_CAP_PROP_FRAME_HEIGHT:
|
||||||
return height;
|
return h;
|
||||||
|
|
||||||
case CV_CAP_PROP_IOS_DEVICE_FOCUS:
|
case CV_CAP_PROP_IOS_DEVICE_FOCUS:
|
||||||
return mCaptureDevice.focusMode;
|
return mCaptureDevice.focusMode;
|
||||||
@ -659,6 +658,8 @@ fromConnection:(AVCaptureConnection *)connection{
|
|||||||
|
|
||||||
// Failed
|
// Failed
|
||||||
// connection.videoOrientation = AVCaptureVideoOrientationPortrait;
|
// connection.videoOrientation = AVCaptureVideoOrientationPortrait;
|
||||||
|
(void)captureOutput;
|
||||||
|
(void)connection;
|
||||||
|
|
||||||
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
|
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
|
||||||
|
|
||||||
@ -1009,7 +1010,7 @@ double CvCaptureFile::getFPS() {
|
|||||||
return 30.0; //TODO: Debugging
|
return 30.0; //TODO: Debugging
|
||||||
}
|
}
|
||||||
|
|
||||||
double CvCaptureFile::getProperty(int property_id){
|
double CvCaptureFile::getProperty(int /*property_id*/){
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (mCaptureSession == nil) return 0;
|
if (mCaptureSession == nil) return 0;
|
||||||
@ -1050,7 +1051,7 @@ double CvCaptureFile::getProperty(int property_id){
|
|||||||
return 1.0; //Debugging
|
return 1.0; //Debugging
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CvCaptureFile::setProperty(int property_id, double value) {
|
bool CvCaptureFile::setProperty(int /*property_id*/, double /*value*/) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (mCaptureSession == nil) return false;
|
if (mCaptureSession == nil) return false;
|
||||||
|
@ -308,7 +308,7 @@
|
|||||||
if ([device position] == desiredPosition) {
|
if ([device position] == desiredPosition) {
|
||||||
[self.captureSession beginConfiguration];
|
[self.captureSession beginConfiguration];
|
||||||
|
|
||||||
NSError* error;
|
NSError* error = nil;
|
||||||
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
|
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
|
||||||
if (!input) {
|
if (!input) {
|
||||||
NSLog(@"error creating input %@", [error localizedDescription]);
|
NSLog(@"error creating input %@", [error localizedDescription]);
|
||||||
@ -316,7 +316,7 @@
|
|||||||
|
|
||||||
// support for autofocus
|
// support for autofocus
|
||||||
if ([device isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) {
|
if ([device isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) {
|
||||||
NSError *error = nil;
|
error = nil;
|
||||||
if ([device lockForConfiguration:&error]) {
|
if ([device lockForConfiguration:&error]) {
|
||||||
device.focusMode = AVCaptureFocusModeContinuousAutoFocus;
|
device.focusMode = AVCaptureFocusModeContinuousAutoFocus;
|
||||||
[device unlockForConfiguration];
|
[device unlockForConfiguration];
|
||||||
|
@ -101,7 +101,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
|
|||||||
[super start];
|
[super start];
|
||||||
|
|
||||||
if (self.recordVideo == YES) {
|
if (self.recordVideo == YES) {
|
||||||
NSError* error;
|
NSError* error = nil;
|
||||||
if ([[NSFileManager defaultManager] fileExistsAtPath:[self videoFileString]]) {
|
if ([[NSFileManager defaultManager] fileExistsAtPath:[self videoFileString]]) {
|
||||||
[[NSFileManager defaultManager] removeItemAtPath:[self videoFileString] error:&error];
|
[[NSFileManager defaultManager] removeItemAtPath:[self videoFileString] error:&error];
|
||||||
}
|
}
|
||||||
@ -424,6 +424,8 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
|
|||||||
|
|
||||||
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
|
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
|
||||||
{
|
{
|
||||||
|
(void)captureOutput;
|
||||||
|
(void)connection;
|
||||||
if (self.delegate) {
|
if (self.delegate) {
|
||||||
|
|
||||||
// convert from Core Media to Core Video
|
// convert from Core Media to Core Video
|
||||||
@ -464,7 +466,6 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
|
|||||||
// delegate image processing to the delegate
|
// delegate image processing to the delegate
|
||||||
cv::Mat image(height, width, format_opencv, bufferAddress, bytesPerRow);
|
cv::Mat image(height, width, format_opencv, bufferAddress, bytesPerRow);
|
||||||
|
|
||||||
cv::Mat* result = NULL;
|
|
||||||
CGImage* dstImage;
|
CGImage* dstImage;
|
||||||
|
|
||||||
if ([self.delegate respondsToSelector:@selector(processImage:)]) {
|
if ([self.delegate respondsToSelector:@selector(processImage:)]) {
|
||||||
|
@ -44,7 +44,7 @@ set (CMAKE_CXX_FLAGS "-stdlib=libc++ -fvisibility=hidden -fvisibility-inlines-hi
|
|||||||
set (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -fomit-frame-pointer -ffast-math")
|
set (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -fomit-frame-pointer -ffast-math")
|
||||||
|
|
||||||
# Silence some warnings
|
# Silence some warnings
|
||||||
set (no_warn "-Wno-unused-function -Wno-unused-parameter -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-unused-const-variable -Wno-overloaded-virtual")
|
set (no_warn "-Wno-semicolon-before-method-body -Wno-unused-function -Wno-unused-parameter -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-unused-const-variable -Wno-overloaded-virtual")
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${no_warn}")
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${no_warn}")
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${no_warn}")
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${no_warn}")
|
||||||
# Additional linker flag
|
# Additional linker flag
|
||||||
|
Loading…
Reference in New Issue
Block a user