|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
xscale ( pxa270 ) supportHello,
I am writing a preliminary object tracking on a type of pda with a camera, decoding a datamatrix (1mm x 1mm and rounded matrix dots) based on the pxa270. Using Wireless MMX is a tremendous speedup. The platform is a Marvell pxa270, which Marvell isn't up to speed with the ipp libraries. So i have hacked the intel's v5.0 libraries, and changed the elf version to 4 ( to be able to link with eabi compiler ). I have commented out some machine checking code in cxcore/src/cxswitcher.cpp to be able to load libipp.so. ( got threshold, arithmetic, and some binary operations to load). 1. My question(s) is, has there been anyone else attempting to get opencv to load xscale ipp libraries? I would like to use erode, dilate, resize etc. and benefit from the opencv abstraction. If not, is there any interest for patches for this? Our next platform will be a blackfin 549, so would like only to change opencv backend to load the correct libraries :) 2. Where do i start for patches? I mean, do i need to add a machine id, etc. which cxcore looks for, etc.? Thanks, Ryan Raasch ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Opencvlibrary-devel mailing list Opencvlibrary-devel@... https://lists.sourceforge.net/lists/listinfo/opencvlibrary-devel |
|
|
Re: xscale ( pxa270 ) supportHi Ryan,
I was disappointed when I saw that Intel/Marvell dropped IPP support for the XScale. It was a real shame. Did you actually get the PXA270 to use IPP? This is great and I would be very interested to hear more about how you did this. Do you think this hack will also work for the PXA3xx?
Thanks! Adi
Hello, I am writing a preliminary object tracking on a type of pda with a camera, decoding a datamatrix (1mm x 1mm and rounded matrix dots) based on the pxa270. Using Wireless MMX is a tremendous speedup. The platform is a Marvell pxa270, which Marvell isn't up to speed with the ipp libraries. So i have hacked the intel's v5.0 libraries, and changed the elf version to 4 ( to be able to link with eabi compiler ). I have commented out some machine checking code in cxcore/src/cxswitcher.cpp to be able to load libipp.so. ( got threshold, arithmetic, and some binary operations to load). 1. My question(s) is, has there been anyone else attempting to get opencv to load xscale ipp libraries? I would like to use erode, dilate, resize etc. and benefit from the opencv abstraction. If not, is there any interest for patches for this? Our next platform will be a blackfin 549, so would like only to change opencv backend to load the correct libraries :) 2. Where do i start for patches? I mean, do i need to add a machine id, etc. which cxcore looks for, etc.? Thanks, Ryan Raasch ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Opencvlibrary-devel mailing list Opencvlibrary-devel@... https://lists.sourceforge.net/lists/listinfo/opencvlibrary-devel ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Opencvlibrary-devel mailing list Opencvlibrary-devel@... https://lists.sourceforge.net/lists/listinfo/opencvlibrary-devel |
|
|
Re: xscale ( pxa270 ) supportYea, us too. We based our decision for the pxa270 on the Ipp libraries.
But using an eabi compiler ruins everything. 1. Using ar, extract all object files. 2. Change each object file's elf version flag to 4. 3. Use gcc to create new library (shared) VERY BIG hack, but it works. I have made another patch for cxswitcher.cpp to also accept WMMX platforms. Will submit after testing. However, the morphology functions, wavelet stuff are not in opencv, which i would like to use. Anyways, here ya go. Should work for the pxa3x. I suspect there isn't any os calls in the ipp libraries (that would make the oabi/eabi interface break). Ryan ******************************************************************* #!/bin/bash if [ ! -d "tmp" ] ; then mkdir tmp else cd tmp rm -f *.o fi path="/home/ryan/git-svn/libraries/intel/xscale-ipp" if [ ! -z "$1" ] ; then path="$1" fi echo $path FILENAME = "" for file in `ls $path/*.a` do arm-iwmmx-linux-gnueabi-ar -x $file ../read-elf `ls *.o` arm-iwmmx-linux-gnueabi-ar rcs `basename $file` *.o arm-iwmmx-linux-gnueabi-gcc -shared -Wl,-export-dynamic *.o -o `echo \`basename $file\` | cut -d "_" -f 1`.so rm *.o done ******************************************************* #include <err.h> #include <fcntl.h> #include <libelf.h> #include <stdio.h> #include <stdlib.h> #include <sysexits.h> #include <unistd.h> #include <gelf.h> #include <string.h> int main(int argc, char **argv) { int i; char *id, bytes[5]; size_t n; int fd; Elf *e; Elf_Scn *scn = NULL; Elf_Data *data; // Elf32_Ehdr ehdr; GElf_Ehdr ehdr; Elf_Arhdr *arh; if (elf_version(EV_CURRENT) == EV_NONE) errx(EX_SOFTWARE, "ELF library initialization failed: %s", elf_errmsg(-1)); for( i = 1; i < argc; i++) { if( !strcmp( "read-elf", argv[i] )) continue; if ((fd = open(argv[ i ], O_RDWR, 0)) < 0) err(EX_OSERR, "open \%s\" failed", argv[i]); if( ( e = elf_begin(fd, ELF_C_RDWR, NULL )) != NULL) { gelf_getehdr(e, &ehdr ); if( ehdr.e_flags != 0x4000000 ) { ehdr.e_flags = 0x4000000 ; printf("Updating -- %s \n", argv[i]); gelf_update_ehdr(e, &ehdr ) ; elf_update(e, ELF_C_NULL); elf_update(e, ELF_C_WRITE ); } } close(fd); } exit(EX_OK); } *********************************************************** Adi Shavit wrote: > > Hi Ryan, > > > I was disappointed when I saw that Intel/Marvell dropped IPP support > for the XScale. > > It was a real shame. > > Did you actually get the PXA270 to use IPP? > > This is great and I would be very interested to hear more about how > you did this. > > Do you think this hack will also work for the PXA3xx? > > > Thanks! > > Adi > > > Ryan Raasch wrote: > >> Hello, >> >> I am writing a preliminary object tracking on a type of pda with a >> camera, decoding a datamatrix (1mm x 1mm and rounded matrix dots) based >> on the pxa270. Using Wireless MMX is a tremendous speedup. >> >> The platform is a Marvell pxa270, which Marvell isn't up to speed with >> the ipp libraries. So i have hacked the intel's v5.0 libraries, and >> changed the elf version to 4 ( to be able to link with eabi compiler ). >> >> I have commented out some machine checking code in >> cxcore/src/cxswitcher.cpp to be able to load libipp.so. ( got threshold, >> arithmetic, and some binary operations to load). >> >> 1. My question(s) is, has there been anyone else attempting to get >> opencv to load xscale ipp libraries? I would like to use erode, dilate, >> resize etc. and benefit from the opencv abstraction. If not, is there >> any interest for patches for this? Our next platform will be a blackfin >> 549, so would like only to change opencv backend to load the correct >> libraries :) >> >> 2. Where do i start for patches? I mean, do i need to add a machine id, >> etc. which cxcore looks for, etc.? >> >> >> Thanks, >> Ryan Raasch >> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >> Build the coolest Linux based applications with Moblin SDK & win great prizes >> Grand prize is a trip for two to an Open Source event anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Opencvlibrary-devel mailing list >> Opencvlibrary-devel@... >> https://lists.sourceforge.net/lists/listinfo/opencvlibrary-devel >> >> ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Opencvlibrary-devel mailing list Opencvlibrary-devel@... https://lists.sourceforge.net/lists/listinfo/opencvlibrary-devel |
|
|
Re: xscale ( pxa270 ) supportThanks! I'll look into it, it is a bit over my head. Thanks! Adi
Yea, us too. We based our decision for the pxa270 on the Ipp libraries. But using an eabi compiler ruins everything. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Opencvlibrary-devel mailing list Opencvlibrary-devel@... https://lists.sourceforge.net/lists/listinfo/opencvlibrary-devel |
|
|
|
|
|
Re: xscale ( pxa270 ) supportHi Ryan,
Thanks for the patch. I will look at it. As for loading IPP libraries, I do not think OpenCV should exit with an error if the libraries are of the wrong format. First of all, such a situation is very rare (regular IPP libraries have correct format, right?) and second - OpenCV can perfectly work w/o IPP, just a bit slower, so there is no reason to exit (such situation may happen on end-user machine for different reason, and it's better to continue work than to crash). Still, I admit that this part is not very well though, there are different ideas how to extend OpenCV-IPP interaction, e.g. add some config file that would contain the libraries' names and the list of the functions to load. Then, some extra function can be exported that will take the table of function pointers, so that user himself could load IPP libraries (or take the pointers from statically linked IPP) and pass it to OpenCV, etc. Vadim On Wed, Aug 13, 2008 at 1:36 PM, Ryan Raasch <ryan.raasch@...> wrote: Hey, ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Opencvlibrary-devel mailing list Opencvlibrary-devel@... https://lists.sourceforge.net/lists/listinfo/opencvlibrary-devel |
|
|
Re: xscale ( pxa270 ) supportThanks.
The reason i am poking on the issue is that we would like to also use our algorithm running on a blackfin processor, which, of course, does not have ipp libraries, but has an optimized image processing library. So i am trying to think of a more generic way of loading a using optimized libraries. Any thoughts? Your idea on a config for a architecture would be nice. Each platform specific file would contain the loading, etc., where the main cxswitcher would just call load_libs(), and based on the prepocessor stuff, the correct function would be called. Of course this approach would be compile time. Just thinkin. Ryan Vadim Pisarevsky wrote: > Hi Ryan, > > Thanks for the patch. I will look at it. > > As for loading IPP libraries, I do not think OpenCV should exit with an > error if the libraries are of the wrong format. First of all, such a > situation is very rare (regular IPP libraries have correct format, right?) > and second - OpenCV can perfectly work w/o IPP, just a bit slower, so there > is no reason to exit (such situation may happen on end-user machine for > different reason, and it's better to continue work than to crash). > Still, I admit that this part is not very well though, there are different > ideas how to extend OpenCV-IPP interaction, e.g. add some config file that > would contain the libraries' names and the list of the functions to load. > Then, some extra function can be exported that will take the table of > function pointers, so that user himself could load IPP libraries (or take > the pointers from statically linked IPP) and pass it to OpenCV, etc. > > Vadim > > On Wed, Aug 13, 2008 at 1:36 PM, Ryan Raasch <ryan.raasch@...> wrote: > >> Hey, >> >> Just one question, why is is so strict to load the libraries? I mean, >> can't OpenCV just load the libraries if they are present, then die ( with a >> message) if they are the wrong format? All the pre-processor stuff is really >> hard to follow. >> >> Debug output... >> libippi.so ippiCopy_8u_C1R loaded >> libippi.so ippiSet_8u_C1R loaded >> libippi.so ippiAdd_8u_C1RSfs loaded >> libippi.so ippiSub_8u_C1RSfs loaded >> libippi.so ippiNot_8u_C1R loaded >> libippi.so ippiThreshold_GT_8u_C1R loaded >> libippi.so ippiThreshold_LT_8u_C1R loaded >> libippi.so ippiFilterMedian_8u_C1R loaded >> libippi.so ippiFilterMedian_8u_C3R loaded >> libippi.so ippiRGBToXYZ_8u_C3R loaded >> libippi.so ippiXYZToRGB_8u_C3R loaded >> libippi.so ippiRGBToHSV_8u_C3R loaded >> libippi.so ippiHSVToRGB_8u_C3R loaded >> libippi.so ippiRGBToHLS_8u_C3R loaded >> libippi.so ippiHLSToRGB_8u_C3R loaded >> libippi.so ippiRGBToLUV_8u_C3R loaded >> libippi.so ippiLUVToRGB_8u_C3R loaded >> libippi.so ippiAndC_8u_C1R loaded >> libippi.so ippiThreshold_GTVal_8u_C1R loaded >> libippi.so ippiThreshold_LTVal_8u_C1R loaded >> >> Here is the patch to load the ipp libraries on the PXA platform. >> >> ============= PATCH ================ >> Index: cxswitcher.cpp >> =================================================================== >> RCS file: /cvsroot/opencvlibrary/opencv/cxcore/src/cxswitcher.cpp,v >> retrieving revision 1.34 >> diff -c -r1.34 cxswitcher.cpp >> *** cxswitcher.cpp 7 Jan 2008 13:52:11 -0000 1.34 >> --- cxswitcher.cpp 13 Aug 2008 09:16:40 -0000 >> *************** >> *** 72,77 **** >> --- 72,78 ---- >> #define CV_PROC_IA32_WITH_MMX (CV_PROC_IA32_GENERIC|(2 << >> CV_PROC_SHIFT)) >> #define CV_PROC_IA32_WITH_SSE (CV_PROC_IA32_GENERIC|(3 << >> CV_PROC_SHIFT)) >> #define CV_PROC_IA32_WITH_SSE2 (CV_PROC_IA32_GENERIC|(4 << >> CV_PROC_SHIFT)) >> + #define CV_PROC_IA32_WITH_IWMMX (CV_PROC_IA32_GENERIC|(5 << >> CV_PROC_SHIFT)) >> #define CV_PROC_IA64 2 >> #define CV_PROC_EM64T 3 >> #define CV_GET_PROC_ARCH(model) ((model) & CV_PROC_ARCH_MASK) >> *************** >> *** 213,230 **** >> if( QueryPerformanceFrequency( &freq ) ) >> cpu_info->frequency = (double)freq.QuadPart; >> } >> ! #else >> cpu_info->frequency = 1; >> >> #ifdef __x86_64__ >> cpu_info->model = CV_PROC_EM64T; >> #elif defined __ia64__ >> cpu_info->model = CV_PROC_IA64; >> - #elif !defined __i386__ >> - cpu_info->model = CV_PROC_GENERIC; >> #else >> ! cpu_info->model = CV_PROC_IA32_GENERIC; >> ! >> // reading /proc/cpuinfo file (proc file system must be supported) >> FILE *file = fopen( "/proc/cpuinfo", "r" ); >> >> --- 214,230 ---- >> if( QueryPerformanceFrequency( &freq ) ) >> cpu_info->frequency = (double)freq.QuadPart; >> } >> ! #else // defined WIN32 || defined WIN64 >> ! >> cpu_info->frequency = 1; >> >> #ifdef __x86_64__ >> cpu_info->model = CV_PROC_EM64T; >> #elif defined __ia64__ >> cpu_info->model = CV_PROC_IA64; >> #else >> ! cpu_info->model = CV_PROC_GENERIC; >> ! >> // reading /proc/cpuinfo file (proc file system must be supported) >> FILE *file = fopen( "/proc/cpuinfo", "r" ); >> >> *************** >> *** 251,256 **** >> --- 251,269 ---- >> } >> } >> } >> + else if( strncmp( buffer, "Processor", 9 ) == 0 ) >> + { >> + if( strstr( buffer, "XScale-PXA" ) ) >> + { >> + cpu_info->model = CV_PROC_IA32_WITH_IWMMX; >> + } >> + } >> + else if( strncmp( buffer, "BogoMIPS", 8 ) == 0 ) >> + { >> + char* pos = strchr( buffer, ':' ); >> + if( pos ) >> + cpu_info->frequency = strtod( pos + 1, &pos ); >> + } >> else if( strncmp( buffer, "cpu MHz", 7 ) == 0 ) >> { >> char* pos = strchr( buffer, ':' ); >> *************** >> *** 586,592 **** >> continue; >> >> if( load_flag && plugins[i].basename && >> ! (arch == CV_PROC_IA32_GENERIC || arch == CV_PROC_IA64 || arch >> == CV_PROC_EM64T) ) >> { >> const char** suffix = i == CV_PLUGIN_OPTCV ? opencv_sfx : >> i < CV_PLUGIN_MKL ? ipp_suffix : mkl_suffix; >> --- 599,608 ---- >> continue; >> >> if( load_flag && plugins[i].basename && >> ! ( arch == CV_PROC_IA32_WITH_IWMMX || >> ! arch == CV_PROC_IA32_GENERIC || >> ! arch == CV_PROC_IA64 || >> ! arch == CV_PROC_EM64T) ) >> { >> const char** suffix = i == CV_PLUGIN_OPTCV ? opencv_sfx : >> i < CV_PLUGIN_MKL ? ipp_suffix : mkl_suffix; >> >> >> >> Vadim Pisarevsky wrote: >> >>> Hello Ryan, >>> Thank you. >>> Such a patch is welcome as long as it does not break compatibility with >>> x86 >>> and x64 platforms. >>> I think, you are moving in the right direction - most of the platform >>> specific code resides in cxswitcher.cpp. >>> You need to add some constant for the processor, e.g. #define >>> CV_PROC_ARM_WMMX 4, or something like that. >>> Then, you need to modify icvInitProcessorInfo to identify the processor. >>> and then you need to modify cvUseOptimized to load the appropriate >>> libraries. >>> All those modifications depend on the OS as much as, or even more than on >>> the CPU. Which is your software plaform - WinCE? Linux? >>> As I understood, you already did part/all of that, then probably just need >>> to polish these patches. >>> >>> When you are ready, you can send these patches to me for integration, and >>> then check if it works well. >>> >>> Regards, >>> Vadim >>> >>> On Mon, Aug 11, 2008 at 12:45 PM, Ryan Raasch <ryan.raasch@...> >>> wrote: >>> >>> Hello, >>>> I am writing a preliminary object tracking on a type of pda with a >>>> camera, decoding a datamatrix (1mm x 1mm and rounded matrix dots) based >>>> on the pxa270. Using Wireless MMX is a tremendous speedup. >>>> >>>> The platform is a Marvell pxa270, which Marvell isn't up to speed with >>>> the ipp libraries. So i have hacked the intel's v5.0 libraries, and >>>> changed the elf version to 4 ( to be able to link with eabi compiler ). >>>> >>>> I have commented out some machine checking code in >>>> cxcore/src/cxswitcher.cpp to be able to load libipp.so. ( got threshold, >>>> arithmetic, and some binary operations to load). >>>> >>>> 1. My question(s) is, has there been anyone else attempting to get >>>> opencv to load xscale ipp libraries? I would like to use erode, dilate, >>>> resize etc. and benefit from the opencv abstraction. If not, is there >>>> any interest for patches for this? Our next platform will be a blackfin >>>> 549, so would like only to change opencv backend to load the correct >>>> libraries :) >>>> >>>> 2. Where do i start for patches? I mean, do i need to add a machine id, >>>> etc. which cxcore looks for, etc.? >>>> >>>> >>>> Thanks, >>>> Ryan Raasch >>>> >>>> >>>> ------------------------------------------------------------------------- >>>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>>> challenge >>>> Build the coolest Linux based applications with Moblin SDK & win great >>>> prizes >>>> Grand prize is a trip for two to an Open Source event anywhere in the >>>> world >>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>>> _______________________________________________ >>>> Opencvlibrary-devel mailing list >>>> Opencvlibrary-devel@... >>>> https://lists.sourceforge.net/lists/listinfo/opencvlibrary-devel >>>> >>>> > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Opencvlibrary-devel mailing list Opencvlibrary-devel@... https://lists.sourceforge.net/lists/listinfo/opencvlibrary-devel |
|
|
Re: xscale ( pxa270 ) supportRyan, Since OpenCV is not obligated anymore to use Intel libraries exclusively, we can consider other optimized libraries. It should be quite easy to load any library and load an optimized function from it as long as API is the same as in IPP, then it's just function pointers. But if the function of interest has different API, we would need to either 1) modify OpenCV itself or 2) build a bridge library emulating IPP API. If we go too far with (1), OpenCV source code can quickly become a mess, if we go with (2) when we may have potential legal problems and sometimes may also find IPP API being too low-level. We now have IPP (multi-OS, but restricted to x86, x64 and Itanium), CUDA (multi-OS, but restricted to a subset of NVidia cards), there is some framework announced by Apple, not restricted to particular GPU, but obviously restricted to MacOSX, then we have a bunch of free optimized libraries (such as Atlas, FFTW ...), then I plan to put some SSE2 code to OpenCV (multi-OS, but restricted to x86 and x64). That is, if a certain acceleration library/tool is quite important for many users, we can try to add the support right into OpenCV, if it is more specific tool, I would prefer a bridge library, but then we would probably need to define some low-level API using no or less IPP conventions to avoid legal problems. Actually, there is yet another way to go. We do not integrate anything in order to use it, right. If there is software or hardware that can do certain things very fast, it can be made a separate toolbox around it with OpenCV-compatible interface, e.g. taking IplImage as parameters. The toolbox can be made smart enough to emulate the whole algorithm in software using stock OpenCV if the acceleration s/w or h/w is not available. For example, let's say, we want to implement some algorithms using CUDA. We create a module called opencv-cuda, or cuda-opencv, or cuda-cv or whatever, containing, e.g.: void cvResizeCUDA( const CvArr* src, CvArr* dst, int method ) { if( nvidia_card_available && (method == CV_INTER_LINEAR || method == CV_INTER_CUBIC) && <images are large enough> ) { ... // do resize using GPU } else cvResize( src, dst, method ); } In this case there is no need to modify anything, just replace cvResize in your application with cvResizeCUDA, it can be even done using batch replace or using the preprocessor. Later on, if proven useful, such frameworks can be fully integrated into OpenCV, then cvResizeCUDA replaces cvResize etc. Vadim On Fri, Aug 15, 2008 at 10:57 AM, Ryan Raasch <ryan.raasch@...> wrote: Thanks. |