Skip to content

Commit e53f1b2

Browse files
authored
Merge pull request opencv#9808 from alalek:backport_fixes
(2.4) backport fixes
2 parents ae52d94 + 621a1d3 commit e53f1b2

File tree

8 files changed

+35
-26
lines changed

8 files changed

+35
-26
lines changed

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
1111
message(FATAL_ERROR "
1212
FATAL: In-source builds are not allowed.
13-
You should create separate directory for build files.
13+
You should create a separate directory for build files.
1414
")
1515
endif()
1616

@@ -77,8 +77,8 @@ ocv_clear_vars(OpenCVModules_TARGETS)
7777
# Break in case of popular CMake configuration mistakes
7878
# ----------------------------------------------------------------------------
7979
if(NOT CMAKE_SIZEOF_VOID_P GREATER 0)
80-
message(FATAL_ERROR "CMake fails to deterimine the bitness of target platform.
81-
Please check your CMake and compiler installation. If you are crosscompiling then ensure that your CMake toolchain file correctly sets the compiler details.")
80+
message(FATAL_ERROR "CMake fails to determine the bitness of the target platform.
81+
Please check your CMake and compiler installation. If you are cross-compiling then ensure that your CMake toolchain file correctly sets the compiler details.")
8282
endif()
8383

8484
# ----------------------------------------------------------------------------
@@ -189,7 +189,7 @@ OCV_OPTION(BUILD_PACKAGE "Enables 'make package_source' command"
189189
OCV_OPTION(BUILD_PERF_TESTS "Build performance tests" ON IF (NOT IOS) )
190190
OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" ON IF (NOT IOS) )
191191
OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs (not MSCV only)" ON )
192-
OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC )
192+
OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of statically linked CRT for staticaly linked OpenCV" ON IF MSVC )
193193
OCV_OPTION(BUILD_FAT_JAVA_LIB "Create fat java wrapper containing the whole OpenCV library" ON IF NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX )
194194
OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID AND ANDROID_SOURCE_TREE )
195195
OCV_OPTION(BUILD_ANDROID_PACKAGE "Build platform-specific package for Google Play" OFF IF ANDROID )

cmake/OpenCVUtils.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ if(UNIX)
55
find_package(PkgConfig)
66
endif()
77

8-
# Search packages for host system instead of packages for target system
9-
# in case of cross compilation thess macro should be defined by toolchain file
8+
# Search packages for the host system instead of packages for target system
9+
# in case of cross compilation these macros should be defined by the toolchain file
1010
if(NOT COMMAND find_host_package)
1111
macro(find_host_package)
1212
find_package(${ARGN})
@@ -82,7 +82,7 @@ macro(ocv_check_environment_variables)
8282
endforeach()
8383
endmacro()
8484

85-
# adds include directories in such way that directories from the OpenCV source tree go first
85+
# adds include directories in such a way that directories from the OpenCV source tree go first
8686
function(ocv_include_directories)
8787
set(__add_before "")
8888
foreach(dir ${ARGN})
@@ -337,7 +337,7 @@ macro(ocv_check_modules define)
337337
endmacro()
338338

339339

340-
# Macros that checks if module have been installed.
340+
# Macro that checks if module has been installed.
341341
# After it adds module to build and define
342342
# constants passed as second arg
343343
macro(CHECK_MODULE module_name define)
@@ -526,7 +526,7 @@ macro(ocv_list_add_suffix LST SUFFIX)
526526
endmacro()
527527

528528

529-
# gets and removes the first element from list
529+
# gets and removes the first element from the list
530530
macro(ocv_list_pop_front LST VAR)
531531
if(${LST})
532532
list(GET ${LST} 0 ${VAR})

cmake/OpenCVVersion.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ endif()
1414
set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
1515
set(OPENCV_LIBVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
1616

17-
# create a dependency on version file
18-
# we never use output of the following command but cmake will rerun automatically if the version file changes
17+
# create a dependency on the version file
18+
# we never use the output of the following command but cmake will rerun automatically if the version file changes
1919
configure_file("${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}/junk/version.junk" COPYONLY)

cmake/templates/OpenCVConfig.cmake.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,14 @@ foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS})
219219
string(TOUPPER "${__cvcomponent}" __cvcomponent)
220220
set(${__cvcomponent}_FOUND 1)
221221
endif()
222+
# OpenCV supports Debug and Release only.
223+
# RelWithDebInfo and MinSizeRel are mapped to Release
224+
if(TARGET ${__cvcomponent})
225+
set_target_properties(${__cvcomponent} PROPERTIES
226+
MAP_IMPORTED_CONFIG_MINSIZEREL "Release"
227+
MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Release"
228+
)
229+
endif()
222230
endforeach()
223231
set(OpenCV_FIND_COMPONENTS ${OpenCV_FIND_COMPONENTS_})
224232

modules/core/doc/utility_and_system_functions_and_macros.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Aligns a buffer size to the specified number of bytes.
3131

3232
:param n: Alignment size that must be a power of two.
3333

34-
The function returns the minimum number that is greater or equal to ``sz`` and is divisible by ``n`` :
34+
The function returns the minimum number that is greater than or equal to ``sz`` and is divisible by ``n`` :
3535

3636
.. math::
3737
@@ -363,7 +363,7 @@ Always returns 0 if called outside of parallel region.
363363

364364
.. ocv:function:: int getThreadNum()
365365
366-
The exact meaning of return value depends on the threading framework used by OpenCV library:
366+
The exact meaning of the return value depends on the threading framework used by OpenCV library:
367367

368368
* **TBB** – Unsupported with current 4.1 TBB release. May be will be supported in future.
369369
* **OpenMP** – The thread number, within the current team, of the calling thread.
@@ -450,22 +450,22 @@ This operation is used in the simplest or most complex image processing function
450450
setNumThreads
451451
-----------------
452452
OpenCV will try to set the number of threads for the next parallel region.
453-
If ``threads == 0``, OpenCV will disable threading optimizations and run all it's
453+
If ``threads == 0``, OpenCV will disable threading optimizations and run all its
454454
functions sequentially. Passing ``threads < 0`` will reset threads number to system default.
455455
This function must be called outside of parallel region.
456456

457457
.. ocv:function:: void setNumThreads(int nthreads)
458458
459459
:param nthreads: Number of threads used by OpenCV.
460460

461-
OpenCV will try to run it's functions with specified threads number, but
461+
OpenCV will try to run its functions with specified threads number, but
462462
some behaviour differs from framework:
463463

464464
* **TBB** – User-defined parallel constructions will run with the same threads number,
465-
if another does not specified. If late on user creates own scheduler, OpenCV will be use it.
465+
if another is not specified. If late on user creates his own scheduler, OpenCV will be use it.
466466
* **OpenMP** – No special defined behaviour.
467467
* **Concurrency** – If ``threads == 1``, OpenCV will disable threading optimizations
468-
and run it's functions sequentially.
468+
and run its functions sequentially.
469469
* **GCD** – Supports only values <= 0.
470470
* **C=** – No special defined behaviour.
471471

modules/highgui/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ endif(HAVE_INTELPERC)
241241
if(IOS)
242242
add_definitions(-DHAVE_IOS=1)
243243
list(APPEND highgui_srcs src/ios_conversions.mm src/cap_ios_abstract_camera.mm src/cap_ios_photo_camera.mm src/cap_ios_video_camera.mm)
244-
list(APPEND HIGHGUI_LIBRARIES "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore" "-framework AssetsLibrary")
244+
list(APPEND HIGHGUI_LIBRARIES "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore" "-framework UIKit")
245245
endif()
246246

247247
if(WIN32)

modules/highgui/src/cap_ios_video_camera.mm

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#import "opencv2/highgui/cap_ios.h"
3333
#include "precomp.hpp"
34-
#import <AssetsLibrary/AssetsLibrary.h>
34+
#import <UIKit/UIKit.h>
3535

3636

3737
static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;};
@@ -595,11 +595,7 @@ - (void)saveVideo;
595595
return;
596596
}
597597

598-
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
599-
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:[self videoFileURL]]) {
600-
[library writeVideoAtPathToSavedPhotosAlbum:[self videoFileURL]
601-
completionBlock:^(NSURL *assetURL, NSError *error){ (void)assetURL; (void)error; }];
602-
}
598+
UISaveVideoAtPathToSavedPhotosAlbum([self videoFileString], nil, nil, NULL);
603599
}
604600

605601

modules/highgui/src/grfmt_bmp.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,9 @@ decode_rle4_bad: ;
367367
gray_palette[code] );
368368

369369
line_end_flag = y - prev_y;
370+
371+
if( y >= m_height )
372+
break;
370373
}
371374
else if( code > 2 ) // absolute mode
372375
{
@@ -470,8 +473,10 @@ decode_rle8_bad: ;
470473

471474
if( !color )
472475
icvCvt_BGRA2Gray_8u_C4C1R( src, 0, data, 0, cvSize(m_width,1) );
473-
else
474-
icvCvt_BGRA2BGR_8u_C4C3R( src, 0, data, 0, cvSize(m_width,1) );
476+
else if( img.channels() == 3 )
477+
icvCvt_BGRA2BGR_8u_C4C3R(src, 0, data, 0, cvSize(m_width, 1));
478+
else if( img.channels() == 4 )
479+
memcpy(data, src, m_width * 4);
475480
}
476481
result = true;
477482
break;

0 commit comments

Comments
 (0)