#include <xdc/std.h>
#include <xdc/runtime/Assert.h>
#include <xdc/runtime/Core.h>
#include <xdc/runtime/Defaults.h>
#include <xdc/runtime/Diags.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Gate.h>
#include <xdc/runtime/GateNull.h>
#include <xdc/runtime/Log.h>
#include <xdc/runtime/Main.h>
#include <xdc/runtime/Memory.h>
#include <xdc/runtime/Startup.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Text.h>
#include <xdc/runtime/Timestamp.h>
#include <xdc/runtime/knl/GateProcess.h>
#include <xdc/runtime/knl/GateThread.h>
#include <xdc/runtime/knl/SemProcess.h>
#include <xdc/runtime/knl/SemThread.h>
#include <xdc/runtime/knl/Thread.h>
template<typename _Tp> static inline _Tp* alignPtr(_Tp* ptr, int n=(int)sizeof(_Tp))
{
return (_Tp*)(((size_t)ptr + n-1) & -n);
}
CV_IMPL void* fastMalloc(size_t alignment , size_t size )
{
unsigned char* udata = (unsigned char*)malloc(size + sizeof(void*) + alignment);
unsigned char** adata = alignPtr((unsigned char**)udata + 1, alignment);
adata[-1] = udata;
return adata;
}
CV_IMPL void fastFree(size_t alignment, void* ptr)
{
if(ptr)
{
uchar* udata = ((uchar**)ptr)[-1];
assert(udata < (uchar*)ptr &&
((uchar*)ptr - udata) <= (ptrdiff_t)(sizeof(void*)+alignment));
free(udata);
}
}
CV_IMPL void* cvAlloc( size_t size )
{
#if 1
void* ptr = 0;
#if 1
CV_FUNCNAME( "cvAlloc" );
__BEGIN__;
if( (size_t)size > CV_MAX_ALLOC_SIZE )
CV_ERROR( CV_StsOutOfRange,
"Negative or too large argument of cvAlloc function" );
ptr = fastMalloc( CV_MALLOC_ALIGN, size);
//ptr = memalign( CV_MALLOC_ALIGN, size);
if( !ptr )
CV_ERROR( CV_StsNoMem, "Out of memory" );
__END__;
#endif
return ptr;
#endif
}
CV_IMPL void cvFree_( void* ptr )
{
CV_FUNCNAME( "cvFree_" );
__BEGIN__;
if( ptr )
{
if( ((size_t)ptr & (CV_MALLOC_ALIGN-1)) != 0 )
CV_ERROR( CV_BADARG_ERR, "Deallocation error" );
// free( ptr );
fastFree(CV_MALLOC_ALIGN, ptr);
}
__END__;
}
2.又是dsp库的问题
EMCV/cxcore/cxcmp.cpp:97: error: '_amem4' was not declared in this scope
EMCV/cxcore/cxcmp.cpp:97: error: '_amem4_const' was not declared in this scope
EMCV/cxcore/cxcmp.cpp:97: error: '_subabs4' was not declared in this scope
EMCV/cxcore/cxcmp.cpp:114: error: '_ssub' was not declared in this scope
EMCV/cxcore/cxcmp.cpp:114: error: '_abs' was not declared in this scope
修改如下:
CV_IMPL void
cvAbsDiff( const void* srcarr1, const void* srcarr2, void* dstarr )
{
CV_FUNCNAME( "cvAbsDiff" );
__BEGIN__;
int coi1 = 0, coi2 = 0, coi3 = 0;
CvMat srcstub1, *src1 = (CvMat*)srcarr1;
CvMat srcstub2, *src2 = (CvMat*)srcarr2;
CvMat dststub, *dst = (CvMat*)dstarr;
CvSize size;
int type, depth, pixel_size;
CV_CALL( src1 = cvGetMat( src1, &srcstub1, &coi1 ));
CV_CALL( src2 = cvGetMat( src2, &srcstub2, &coi2 ));
CV_CALL( dst = cvGetMat( dst, &dststub, &coi3 ));
if( coi1 != 0 || coi2 != 0 || coi3 != 0 )
CV_ERROR( CV_BadCOI, "" );
if( !CV_ARE_SIZES_EQ( src1, src2 ) )
CV_ERROR_FROM_CODE( CV_StsUnmatchedSizes );
type = CV_MAT_TYPE(src1->type);
depth = CV_MAT_DEPTH(type);
if( !CV_ARE_SIZES_EQ( src1, dst ))
CV_ERROR_FROM_CODE( CV_StsUnmatchedSizes );
if( !CV_ARE_TYPES_EQ( src1, src2 ))
CV_ERROR_FROM_CODE( CV_StsUnmatchedFormats );
if( !CV_ARE_TYPES_EQ( src1, dst ))
CV_ERROR_FROM_CODE( CV_StsUnmatchedFormats );
size.width = src1->step * src1->height;
size.height = 1;
pixel_size = CV_DEPTH_BYTES[depth];
if(depth == CV_8U)
{
int idx;
unsigned char * p1;
unsigned char * p2;
unsigned char * pdst;
p1 = src1->data.ptr ;
p2 = src2->data.ptr;
pdst = dst->data.ptr;
for (idx = 0; idx < size.width/pixel_size; idx+=4)
{
*(pdst) = _abs(*(p1), *(p2) );
p1 += 4;
p2 += 4;
pdst += 4;
}
}
else if(depth == CV_32S)
{
int idx;
int * p1;
int * p2;
int * pdst;
p1 = src1->data.i;
p2 = src2->data.i;
pdst = dst->data.i;
for (idx = 0; idx < size.width/pixel_size; idx++)
{
*pdst = _abs(_ssub(*p1, *p2)); 这个ssub还是报错 如果不用这个,注释掉他
p1 += 1;
p2 += 1;
pdst += 1;
}
}
else
{
CV_ERROR( CV_StsUnsupportedFormat, "unsupported matrix type." );
}
__END__;
}
做完上面的步骤,可以编译通过,但下载到板子上,还有有待验证