OpenCV update and x86/x86_64 CPU fetures
v2 cover OpenCV update and x86/x86_64 CPU fetures
The 1st try of bumping OpenCV package has highlighted the lack of some CPU feature symbols.
This patch series define symbols for some of these features for x86 and x86_64 architures.
These new symbols are used in this 2nd version of the OpenCV patch, as well as in some other packages.
Changes since v1:
- add CPU features symbols
- use those symbols in the opencv, sdl_gfx and sdl_sound packages
- opencv: add missing zlib dependency
Samuel Martin (5):
target: add symbols for i386/x86_64 cpu features
libevas: refactor *_CONF_OPT assignment with cpu-feature options
sdl_gfx: refactor *_CONF_OPT assignment with cpu-feature options
sdl_sound: refactor *_CONF_OPT assignment with cpu-feature options
opencv: bump to version 2.4.0
package/efl/libevas/libevas.mk | 24 ++-- package/opencv/Config.in | 120 ++++++++++++++++---- ...pencv-uclibc-optional-long-double-support.patch | 40 ------- package/opencv/opencv.mk | 78 ++++++++----- package/sdl_gfx/sdl_gfx.mk | 10 +- package/sdl_sound/sdl_sound.mk | 3 +- target/Config.in.arch | 117 ++++++++++++++++++- 7 files changed, 281 insertions(+), 111 deletions(-) delete mode 100644 package/opencv/opencv-uclibc-optional-long-double-support.patch
--
1.7.10.3
PATCH v2 1/5 target: add symbols for i386/x86_64 cpu features
Selecting the target architecture variant automatically selects the appropriated set of features.
target/Config.in.arch +116 -1
@@ -242,7 +242,7 @@ choice default BR2_mips_1 if BR2_mipsel help Specific CPU variant to use - + 64bit cabable: 3, 4, 64, 64r2 non-64bit capable: 1, 2, 32, 32r2
@@ -325,6 +325,31 @@ endchoice # gcc builds libstdc++ differently depending on the # host tuplet given to it, so let people choose # + +# i386/x86_64 cpu features +config BR2_CPU_HAS_MMX + bool +config BR2_CPU_HAS_SSE + bool +config BR2_CPU_HAS_SSE2 + bool +config BR2_CPU_HAS_SSE3 + bool +config BR2_CPU_HAS_SSSE3 + bool +config BR2_CPU_HAS_SSE41 + bool +config BR2_CPU_HAS_SSE42 + bool +config BR2_CPU_HAS_SSE4 + bool +config BR2_CPU_HAS_SSE4A + bool +config BR2_CPU_HAS_3DNOW + bool +config BR2_CPU_HAS_ABM + bool + choice prompt "Target Architecture Variant" depends on BR2_i386
@@ -344,46 +369,106 @@ config BR2_x86_pentiumpro bool "pentium pro" config BR2_x86_pentium_mmx bool "pentium MMX" + select BR2_CPU_HAS_MMX config BR2_x86_pentium_m bool "pentium mobile" config BR2_x86_pentium2 bool "pentium2" + select BR2_CPU_HAS_MMX config BR2_x86_pentium3 bool "pentium3" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_SSE config BR2_x86_pentium4 bool "pentium4" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 config BR2_x86_prescott bool "prescott" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 + select BR2_CPU_HAS_SSE3 config BR2_x86_nocona bool "nocona" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 + select BR2_CPU_HAS_SSE3 config BR2_x86_core2 bool "core2" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 + select BR2_CPU_HAS_SSE3 + select BR2_CPU_HAS_SSSE3 config BR2_x86_atom bool "atom" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 + select BR2_CPU_HAS_SSE3 + select BR2_CPU_HAS_SSSE3 config BR2_x86_k6 bool "k6" + select BR2_CPU_HAS_MMX config BR2_x86_k6_2 bool "k6-2" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_3DNOW config BR2_x86_athlon bool "athlon" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_3DNOW config BR2_x86_athlon_4 bool "athlon-4" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_3DNOW + select BR2_CPU_HAS_SSE config BR2_x86_opteron bool "opteron" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_3DNOW + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 config BR2_x86_opteron_sse3 bool "opteron w/ SSE3" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_3DNOW + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 + select BR2_CPU_HAS_SSE3 config BR2_x86_barcelona bool "barcelona" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_3DNOW + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 + select BR2_CPU_HAS_SSE3 + select BR2_CPU_HAS_SSE4A + select BR2_CPU_HAS_ABM config BR2_x86_geode bool "geode" + # Don't include MMX support because there several variant of geode + # processor, some with MMX support, some without. + # See: http://en.wikipedia.org/wiki/Geode_%28processor%29 + select BR2_CPU_HAS_3DNOW config BR2_x86_c3 bool "Via/Cyrix C3 (Samuel/Ezra cores)" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_3DNOW config BR2_x86_c32 bool "Via C3-2 (Nehemiah cores)" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_SSE config BR2_x86_winchip_c6 bool "IDT Winchip C6" + select BR2_CPU_HAS_MMX config BR2_x86_winchip2 bool "IDT Winchip 2" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_3DNOW endchoice choice
@@ -397,16 +482,46 @@ config BR2_x86_64_generic bool "generic" config BR2_x86_64_barcelona bool "barcelona" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_3DNOW + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 + select BR2_CPU_HAS_SSE3 + select BR2_CPU_HAS_SSE4A + select BR2_CPU_HAS_ABM config BR2_x86_64_opteron_sse3 bool "opteron w/ sse3" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_3DNOW + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 + select BR2_CPU_HAS_SSE3 config BR2_x86_64_opteron bool "opteron" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_3DNOW + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 config BR2_x86_64_nocona bool "nocona" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 + select BR2_CPU_HAS_SSE3 config BR2_x86_64_core2 bool "core2" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 + select BR2_CPU_HAS_SSE3 + select BR2_CPU_HAS_SSSE3 config BR2_x86_64_atom bool "atom" + select BR2_CPU_HAS_MMX + select BR2_CPU_HAS_SSE + select BR2_CPU_HAS_SSE2 + select BR2_CPU_HAS_SSE3 + select BR2_CPU_HAS_SSSE3 endchoice choice
Signature · 1 line
1.7.10.3
PATCH v2 1/5 target: add symbols for i386/x86_64 cpu features
Le Sun, 3 Jun 2012 00:09:43 +0200,
Samuel Martin <[email protected]> a ?crit :
Quoted 10 lines
Selecting the target architecture variant automatically selects the appropriated set of features.
Signed-off-by Samuel Martin <[email protected]>target/Config.in.arch +0
-0
target/Config.in.arch choice · line 245
Quoted 5 lines
target/Config.in.arch +1
-1@@ -242,7 +242,7 @@ choice default BR2_mips_1 if BR2_mipsel help Specific CPU variant to use - +
Unrelated change.
Quoted 13 lines
target/Config.in.arch +13
-0+# i386/x86_64 cpu features +config BR2_CPU_HAS_MMX + bool +config BR2_CPU_HAS_SSE + bool +config BR2_CPU_HAS_SSE2 + bool +config BR2_CPU_HAS_SSE3 + bool +config BR2_CPU_HAS_SSSE3 + bool +config BR2_CPU_HAS_SSE41 + bool
target/Config.in.arch endchoice · line 351
Quoted 10 lines
target/Config.in.arch +10
-0+config BR2_CPU_HAS_SSE42 + bool +config BR2_CPU_HAS_SSE4 + bool +config BR2_CPU_HAS_SSE4A + bool +config BR2_CPU_HAS_3DNOW + bool +config BR2_CPU_HAS_ABM + bool
Should we name those options BR2_X86_CPU_HAS_* ?
Otherwise, this looks good to me.
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v2 2/5 libevas: refactor *_CONF_OPT assignment with cpu-feature options
In reply to Samuel Martinpackage/efl/libevas/libevas.mk +12 -12
@@ -115,23 +115,23 @@ LIBEVAS_CONF_OPT += --enable-gl-flavor-gles --enable-gles-variety-s3c6410 endif # code options -ifeq ($(BR2_i386)$(BR2_x86_64),y) -# defaults -LIBEVAS_CONF_OPT += --disable-cpu-mmx --disable-cpu-sse --disable-cpu-sse3 - -# enable if cpu variant has mmx support -ifneq ($(BR2_x86_i386)$(BR2_x86_i486)$(BR2_x86_i586)$(BR2_x86_i686)$(BR2_x86_pentiumpro)$(BR2_x86_geode),y) +ifeq ($(BR2_CPU_HAS_MMX),y) LIBEVAS_CONF_OPT += --enable-cpu-mmx +else +LIBEVAS_CONF_OPT += --disable-cpu-mmx +endif -ifneq ($(BR2_x86_pentium_mmx)$(BR2_x86_pentium2)$(BR2_x86_k6)$(BR2_x86_k6_2)$(BR2_x86_athlon)$(BR2_x86_c3)$(BR2_x86_winchip_c6)$(BR2_x86_winchip2),y) +ifeq ($(BR2_CPU_HAS_SSE),y) LIBEVAS_CONF_OPT += --enable-cpu-sse +else +LIBEVAS_CONF_OPT += --disable-cpu-sse +endif -ifneq ($(BR2_x86_pentium3)$(BR2_x86_pentium4)$(BR2_x86_prescott)$(BR2_x86_athlon_4)$(BR2_x86_opteron)$(BR2_x86_c32)$(BR2_x86_64_opteron),y) +ifeq ($(BR2_CPU_HAS_SSE3),y) LIBEVAS_CONF_OPT += --enable-cpu-sse3 -endif # sse3 -endif # sse -endif # mmx -endif # x86 +else +LIBEVAS_CONF_OPT += --disable-cpu-sse3 +endif ifeq ($(BR2_powerpc_7400)$(BR2_powerpc_7450)$(BR2_powerpc_970),y) LIBEVAS_CONF_OPT += --enable-cpu-altivec
Signature · 1 line
1.7.10.3
PATCH v2 3/5 sdl_gfx: refactor *_CONF_OPT assignment with cpu-feature options
In reply to Samuel Martinpackage/sdl_gfx/sdl_gfx.mk +2 -8
@@ -11,13 +11,7 @@ SDL_GFX_DEPENDENCIES:=sdl SDL_GFX_CONF_OPT = \ --with-sdl-prefix=$(STAGING_DIR)/usr \ --disable-sdltest \ - --enable-static - -# enable mmx for newer x86's -ifeq ($(BR2_i386)$(BR2_x86_i386)$(BR2_x86_i486)$(BR2_x86_i586)$(BR2_x86_pentiumpro)$(BR2_x86_geode),y) -SDL_GFX_CONF_OPT += --enable-mmx -else -SDL_GFX_CONF_OPT += --disable-mmx -endif + --enable-static \ + $(if $(BR2_CPU_HAS_MMX),--enable-mmx,--disable-mmx) $(eval $(call AUTOTARGETS))
Signature · 1 line
1.7.10.3
PATCH v2 4/5 sdl_sound: refactor *_CONF_OPT assignment with cpu-feature options
In reply to Samuel Martinpackage/sdl_sound/sdl_sound.mk +1 -2
@@ -32,8 +32,7 @@ SDL_SOUND_CONF_OPT = \ --disable-sdltest \ --enable-static -# enable mmx for newer x86's -ifeq ($(BR2_i386)$(BR2_x86_i386)$(BR2_x86_i486)$(BR2_x86_i586)$(BR2_x86_pentiumpro)$(BR2_x86_geode),y) +ifeq ($(BR2_CPU_HAS_MMX),y) SDL_SOUND_CONF_OPT += --enable-mmx else SDL_SOUND_CONF_OPT += --disable-mmx
Signature · 1 line
1.7.10.3
PATCH v2 5/5 opencv: bump to version 2.4.0
In reply to Samuel MartinUpdate Config.in and .mk according to the new features.
Remove the pacth the uclibc without long double support, which seems not necessary anymore.
delete mode 100644 package/opencv/opencv-uclibc-optional-long-double-support.patch
package/opencv/Config.in +100 -20
@@ -1,4 +1,4 @@ -config BR2_PACKAGE_OPENCV +menuconfig BR2_PACKAGE_OPENCV bool "opencv" select BR2_PACKAGE_ZLIB depends on BR2_INSTALL_LIBSTDCPP
@@ -11,28 +11,90 @@ config BR2_PACKAGE_OPENCV if BR2_PACKAGE_OPENCV -config BR2_PACKAGE_OPENCV_BUILD_TESTS - bool "build tests" +comment "OpenCV modules" -config BR2_PACKAGE_OPENCV_INSTALL_DATA - bool "install extra data" - help - Install various data that is used by cv libraries and/or demo - applications, specifically for haarcascades and lbpcascades - features. +config BR2_PACKAGE_OPENCV_BUILD_opencv_calib3d + bool "include opencv_calib3d module into the OpenCV build" + default y - For further information: see OpenCV documentation. +config BR2_PACKAGE_OPENCV_BUILD_opencv_contrib + bool "include opencv_contrib module into the OpenCV build" + default y + +config BR2_PACKAGE_OPENCV_BUILD_opencv_core + bool "include opencv_core module into the OpenCV build" + default y + +config BR2_PACKAGE_OPENCV_BUILD_opencv_features2d + bool "include opencv_features2d module into the OpenCV build" + default y + +config BR2_PACKAGE_OPENCV_BUILD_opencv_flann + bool "include opencv_flann module into the OpenCV build" + default y -comment "Build options" +config BR2_PACKAGE_OPENCV_BUILD_opencv_gpu + bool "include opencv_gpu module into the OpenCV build" -config BR2_PACKAGE_OPENCV_WITH_PYTHON - bool "python support" - depends on BR2_PACKAGE_PYTHON +config BR2_PACKAGE_OPENCV_BUILD_opencv_highgui + bool "include opencv_highgui module into the OpenCV build" + default y + +config BR2_PACKAGE_OPENCV_BUILD_opencv_imgproc + bool "include opencv_imgproc module into the OpenCV build" + default y + +config BR2_PACKAGE_OPENCV_BUILD_opencv_legacy + bool "include opencv_legacy module into the OpenCV build" + default y + +config BR2_PACKAGE_OPENCV_BUILD_opencv_ml + bool "include opencv_ml module into the OpenCV build" + default y + +config BR2_PACKAGE_OPENCV_BUILD_opencv_nonfree + bool "include opencv_nonfree module into the OpenCV build" + +config BR2_PACKAGE_OPENCV_BUILD_opencv_objdetect + bool "include opencv_objdetect module into the OpenCV build" + default y + +config BR2_PACKAGE_OPENCV_BUILD_opencv_photo + bool "include opencv_photo module into the OpenCV build" + default y + +comment "opencv_python module requires numpy which is not yet available." + +config BR2_PACKAGE_OPENCV_BUILD_opencv_stitching + bool "include opencv_stitching module into the OpenCV build" + default y + +config BR2_PACKAGE_OPENCV_BUILD_opencv_ts + bool "include opencv_ts module into the OpenCV build" + default y + +config BR2_PACKAGE_OPENCV_BUILD_opencv_video + bool "include opencv_video module into the OpenCV build" + default y + +config BR2_PACKAGE_OPENCV_BUILD_opencv_videostab + bool "include opencv_videostab module into the OpenCV build" + default y + +comment "Test sets" +config BR2_PACKAGE_OPENCV_BUILD_TESTS + bool "build tests" + +config BR2_PACKAGE_OPENCV_BUILD_PERF_TESTS + bool "build performance tests" + +comment "3rd party support" config BR2_PACKAGE_OPENCV_WITH_FFMPEG bool "ffmpeg support" depends on BR2_LARGEFILE depends on BR2_INET_IPV6 + select BR2_PACKAGE_BZIP2 select BR2_PACKAGE_FFMPEG select BR2_PACKAGE_FFMPEG_SWSCALE help
@@ -43,18 +105,17 @@ comment "ffmpeg support requires a toolchain with LARGEFILE and IPV6 support" config BR2_PACKAGE_OPENCV_WITH_GSTREAMER bool "gstreamer support" + depends on BR2_USE_WCHAR select BR2_PACKAGE_GSTREAMER select BR2_PACKAGE_GST_PLUGINS_BASE select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_APP config BR2_PACKAGE_OPENCV_WITH_GTK bool "gtk support" - depends on BR2_PACKAGE_LIBGTK2 - -config BR2_PACKAGE_OPENCV_WITH_QT - bool "qt backend support" - depends on BR2_PACKAGE_QT - default y + depends on BR2_PACKAGE_XORG7||BR2_PACKAGE_DIRECTFB + depends on BR2_USE_WCHAR + depends on BR2_INSTALL_LIBSTDCPP + select BR2_PACKAGE_LIBGTK2 config BR2_PACKAGE_OPENCV_WITH_JPEG bool "jpeg support"
@@ -68,6 +129,12 @@ config BR2_PACKAGE_OPENCV_WITH_PNG help Use shared libpng from the target system. +config BR2_PACKAGE_OPENCV_WITH_QT + bool "qt backend support" + depends on BR2_INSTALL_LIBSTDCPP + select BR2_PACKAGE_QT + default y + config BR2_PACKAGE_OPENCV_WITH_TIFF bool "tiff support" select BR2_PACKAGE_TIFF
@@ -81,6 +148,18 @@ config BR2_PACKAGE_OPENCV_WITH_V4L help Enable Video 4 Linux support. +comment "Install options" + +config BR2_PACKAGE_OPENCV_INSTALL_DATA + bool "install extra data" + help + Install various data that is used by cv libraries and/or demo + applications, specifically for haarcascades and lbpcascades + features. + + For further information: see OpenCV documentation. + + comment "v4l support requires a toolchain with LARGEFILE support" depends on !BR2_LARGEFILE
@@ -88,3 +167,4 @@ endif # BR2_PACKAGE_OPENCV comment "opencv requires a toolchain with C++ and WCHAR support" depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR +
package/opencv/opencv-uclibc-optional-long-double-support.patch deleted +0 -40
@@ -1,40 +0,0 @@ -Upstream: https://code.ros.org/trac/opencv/ticket/1515 - -[PATCH] Fix compile issue in flann module on uClibc without long double support - -uClibc configured without UCLIBC_HAS_LONG_DOUBLE_MATH (because of user -choice or simply that the arch doesn't provide long doubles) doesn't -provide fabsl(), breaking the build in the flann module. - -Work around it by not providing the long double template specialization. - -Signed-off-by: Peter Korsgaard <[email protected]> ---- - modules/flann/include/opencv2/flann/dist.h | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -Index: opencv-2.3.1a/modules/flann/include/opencv2/flann/dist.h -=================================================================== ---- opencv-2.3.1a.orig/modules/flann/include/opencv2/flann/dist.h -+++ opencv-2.3.1a/modules/flann/include/opencv2/flann/dist.h -@@ -40,6 +40,7 @@ - #else - #include <stdint.h> - #endif -+#include <features.h> - - #include "defines.h" - -@@ -59,9 +60,11 @@ - template<> - inline double abs<double>(double x) { return fabs(x); } - -+/* uClibc configured without long double math doesn't provide fabsl */ -+#if !(defined(__UCLIBC__) && !defined(__UCLIBC_HAS_LONG_DOUBLE_MATH__)) - template<> - inline long double abs<long double>(long double x) { return fabsl(x); } -- -+#endif - - template<typename T> - struct Accumulator { typedef T Type; };
package/opencv/opencv.mk +50 -28
130 lines not on this page · raw message
Signature · 1 line
1.7.10.3
PATCH v2 5/5 opencv: bump to version 2.4.0
Le Sun, 3 Jun 2012 00:09:47 +0200,
Samuel Martin <[email protected]> a ?crit :
package/opencv/Config.in config BR2_PACKAGE_OPENCV · line 18
Quoted 3 lines
package/opencv/Config.in +3
-0+config BR2_PACKAGE_OPENCV_BUILD_opencv_calib3d + bool "include opencv_calib3d module into the OpenCV build" + default y
We normally use capital letters for options names. And the _BUILD_ part is, IMO, useless. What about simply:
config BR2_PACKAGE_OPENCV_CALIB3D
or
config BR2_PACKAGE_OPENCV_MODULE_CALIB3D
for this specific case?
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v2 5/5 opencv: bump to version 2.4.0
Quoted 10 lines · Thomas Petazzoni
Le Sun, 3 Jun 2012 00:09:47 +0200,
Samuel Martin<[email protected]> a ?crit :package/opencv/Config.in config BR2_PACKAGE_OPENCV · line 18
Quoted 3 lines
package/opencv/Config.in +3
-0+config BR2_PACKAGE_OPENCV_BUILD_opencv_calib3d + bool "include opencv_calib3d module into the OpenCV build" + default yWe normally use capital letters for options names. And the _BUILD_ part is, IMO, useless. What about simply:
Quoted 7 lines
config
BR2_PACKAGE_OPENCV_CALIB3Dor
config
BR2_PACKAGE_OPENCV_MODULE_CALIB3Dfor this specific case?
And also the menu text should be abbreviated to "calib3d". The more verbose
text you have now could be used as a help text. Even better would be to include some explanation about what the module does in the help text, but that's a lot more effort of course.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286540 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F