1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Normalize line endings and whitespace

This commit is contained in:
OpenCV Buildbot
2012-10-17 03:18:30 +04:00
committed by Andrey Kamaev
parent 69020da607
commit 04384a71e4
1516 changed files with 258846 additions and 258162 deletions
+3 -3
View File
@@ -567,7 +567,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{
CV_Assert( argType == Param::INT );
int val = p->getter ? (algo->*f.get_int)() : *(short*)((uchar*)algo + p->offset);
*(int*)value = val;
}
else if( p->type == Param::BOOLEAN )
@@ -680,8 +680,8 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
{
addParam_(algo, parameter, ParamType<int>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
}
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
bool& value, bool readOnly,
int (Algorithm::*getter)(),
+98 -98
View File
@@ -1044,9 +1044,9 @@ static void binary_op(InputArray _src1, InputArray _src2, OutputArray _dst,
_dst.create(src1.dims, src1.size, src1.type());
Mat dst = _dst.getMat();
// if this is mask operation and dst has been reallocated,
// we have to
// we have to
if( haveMask && reallocate )
dst = Scalar::all(0);
@@ -1071,7 +1071,7 @@ static void binary_op(InputArray _src1, InputArray _src2, OutputArray _dst,
if( blocksize*c > INT_MAX )
blocksize = INT_MAX/c;
if( haveMask )
{
blocksize = std::min(blocksize, blocksize0);
@@ -1352,10 +1352,10 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
_dst.create(src1.dims, src1.size, dtype);
Mat dst = _dst.getMat();
if( haveMask && reallocate )
dst = Scalar::all(0);
BinaryFunc func = tab[CV_MAT_DEPTH(wtype)];
if( !haveScalar )
@@ -1585,7 +1585,7 @@ mul_( const T* src1, size_t step1, const T* src2, size_t step2,
for( ; size.height--; src1 += step1, src2 += step2, dst += step )
{
int i=0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for(; i <= size.width - 4; i += 4 )
{
T t0;
@@ -1610,7 +1610,7 @@ mul_( const T* src1, size_t step1, const T* src2, size_t step2,
for( ; size.height--; src1 += step1, src2 += step2, dst += step )
{
int i = 0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for(; i <= size.width - 4; i += 4 )
{
T t0 = saturate_cast<T>(scale*(WT)src1[i]*src2[i]);
@@ -1639,7 +1639,7 @@ div_( const T* src1, size_t step1, const T* src2, size_t step2,
for( ; size.height--; src1 += step1, src2 += step2, dst += step )
{
int i = 0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for( ; i <= size.width - 4; i += 4 )
{
if( src2[i] != 0 && src2[i+1] != 0 && src2[i+2] != 0 && src2[i+3] != 0 )
@@ -1685,7 +1685,7 @@ recip_( const T*, size_t, const T* src2, size_t step2,
for( ; size.height--; src2 += step2, dst += step )
{
int i = 0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for( ; i <= size.width - 4; i += 4 )
{
if( src2[i] != 0 && src2[i+1] != 0 && src2[i+2] != 0 && src2[i+3] != 0 )
@@ -1710,7 +1710,7 @@ recip_( const T*, size_t, const T* src2, size_t step2,
T z1 = src2[i+1] != 0 ? saturate_cast<T>(scale/src2[i+1]) : 0;
T z2 = src2[i+2] != 0 ? saturate_cast<T>(scale/src2[i+2]) : 0;
T z3 = src2[i+3] != 0 ? saturate_cast<T>(scale/src2[i+3]) : 0;
dst[i] = z0; dst[i+1] = z1;
dst[i+2] = z2; dst[i+3] = z3;
}
@@ -1757,7 +1757,7 @@ static void mul32f( const float* src1, size_t step1, const float* src2, size_t s
{
mul_(src1, step1, src2, step2, dst, step, sz, (float)*(const double*)scale);
}
static void mul64f( const double* src1, size_t step1, const double* src2, size_t step2,
double* dst, size_t step, Size sz, void* scale)
{
@@ -1914,7 +1914,7 @@ addWeighted_( const T* src1, size_t step1, const T* src2, size_t step2,
for( ; size.height--; src1 += step1, src2 += step2, dst += step )
{
int x = 0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for( ; x <= size.width - 4; x += 4 )
{
T t0 = saturate_cast<T>(src1[x]*alpha + src2[x]*beta + gamma);
@@ -1972,7 +1972,7 @@ addWeighted8u( const uchar* src1, size_t step1,
}
}
#endif
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for( ; x <= size.width - 4; x += 4 )
{
float t0, t1;
@@ -2077,7 +2077,7 @@ cmp_(const T* src1, size_t step1, const T* src2, size_t step2,
for( ; size.height--; src1 += step1, src2 += step2, dst += step )
{
int x = 0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for( ; x <= size.width - 4; x += 4 )
{
int t0, t1;
@@ -2091,7 +2091,7 @@ cmp_(const T* src1, size_t step1, const T* src2, size_t step2,
#endif
for( ; x < size.width; x++ )
dst[x] = (uchar)(-(src1[x] > src2[x]) ^ m);
}
}
}
else if( code == CMP_EQ || code == CMP_NE )
{
@@ -2099,7 +2099,7 @@ cmp_(const T* src1, size_t step1, const T* src2, size_t step2,
for( ; size.height--; src1 += step1, src2 += step2, dst += step )
{
int x = 0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for( ; x <= size.width - 4; x += 4 )
{
int t0, t1;
@@ -2122,7 +2122,7 @@ static void cmp8u(const uchar* src1, size_t step1, const uchar* src2, size_t ste
uchar* dst, size_t step, Size size, void* _cmpop)
{
//vz optimized cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
int code = *(int*)_cmpop;
int code = *(int*)_cmpop;
step1 /= sizeof(src1[0]);
step2 /= sizeof(src2[0]);
if( code == CMP_GE || code == CMP_LT )
@@ -2138,47 +2138,47 @@ static void cmp8u(const uchar* src1, size_t step1, const uchar* src2, size_t ste
for( ; size.height--; src1 += step1, src2 += step2, dst += step )
{
int x =0;
#if CV_SSE2
if( USE_SSE2 ){
#if CV_SSE2
if( USE_SSE2 ){
__m128i m128 = code == CMP_GT ? _mm_setzero_si128() : _mm_set1_epi8 (-1);
__m128i c128 = _mm_set1_epi8 (-128);
for( ; x <= size.width - 16; x += 16 )
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
__m128i r10 = _mm_loadu_si128((const __m128i*)(src2 + x));
// no simd for 8u comparison, that's why we need the trick
r00 = _mm_sub_epi8(r00,c128);
r10 = _mm_sub_epi8(r10,c128);
for( ; x <= size.width - 16; x += 16 )
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
__m128i r10 = _mm_loadu_si128((const __m128i*)(src2 + x));
// no simd for 8u comparison, that's why we need the trick
r00 = _mm_sub_epi8(r00,c128);
r10 = _mm_sub_epi8(r10,c128);
r00 =_mm_xor_si128(_mm_cmpgt_epi8(r00, r10), m128);
_mm_storeu_si128((__m128i*)(dst + x),r00);
}
}
r00 =_mm_xor_si128(_mm_cmpgt_epi8(r00, r10), m128);
_mm_storeu_si128((__m128i*)(dst + x),r00);
}
}
#endif
for( ; x < size.width; x++ ){
for( ; x < size.width; x++ ){
dst[x] = (uchar)(-(src1[x] > src2[x]) ^ m);
}
}
}
}
else if( code == CMP_EQ || code == CMP_NE )
{
int m = code == CMP_EQ ? 0 : 255;
for( ; size.height--; src1 += step1, src2 += step2, dst += step )
for( ; size.height--; src1 += step1, src2 += step2, dst += step )
{
int x = 0;
#if CV_SSE2
if( USE_SSE2 ){
#if CV_SSE2
if( USE_SSE2 ){
__m128i m128 = code == CMP_EQ ? _mm_setzero_si128() : _mm_set1_epi8 (-1);
for( ; x <= size.width - 16; x += 16 )
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
__m128i r10 = _mm_loadu_si128((const __m128i*)(src2 + x));
r00 = _mm_xor_si128 ( _mm_cmpeq_epi8 (r00, r10), m128);
_mm_storeu_si128((__m128i*)(dst + x), r00);
}
}
for( ; x <= size.width - 16; x += 16 )
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
__m128i r10 = _mm_loadu_si128((const __m128i*)(src2 + x));
r00 = _mm_xor_si128 ( _mm_cmpeq_epi8 (r00, r10), m128);
_mm_storeu_si128((__m128i*)(dst + x), r00);
}
}
#endif
for( ; x < size.width; x++ )
dst[x] = (uchar)(-(src1[x] == src2[x]) ^ m);
@@ -2203,7 +2203,7 @@ static void cmp16s(const short* src1, size_t step1, const short* src2, size_t st
{
//vz optimized cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
int code = *(int*)_cmpop;
int code = *(int*)_cmpop;
step1 /= sizeof(src1[0]);
step2 /= sizeof(src2[0]);
if( code == CMP_GE || code == CMP_LT )
@@ -2219,69 +2219,69 @@ static void cmp16s(const short* src1, size_t step1, const short* src2, size_t st
for( ; size.height--; src1 += step1, src2 += step2, dst += step )
{
int x =0;
#if CV_SSE2
if( USE_SSE2){//
#if CV_SSE2
if( USE_SSE2){//
__m128i m128 = code == CMP_GT ? _mm_setzero_si128() : _mm_set1_epi16 (-1);
for( ; x <= size.width - 16; x += 16 )
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
__m128i r10 = _mm_loadu_si128((const __m128i*)(src2 + x));
r00 = _mm_xor_si128 ( _mm_cmpgt_epi16 (r00, r10), m128);
__m128i r01 = _mm_loadu_si128((const __m128i*)(src1 + x + 8));
__m128i r11 = _mm_loadu_si128((const __m128i*)(src2 + x + 8));
r01 = _mm_xor_si128 ( _mm_cmpgt_epi16 (r01, r11), m128);
r11 = _mm_packs_epi16(r00, r01);
_mm_storeu_si128((__m128i*)(dst + x), r11);
}
if( x <= size.width-8)
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
__m128i r10 = _mm_loadu_si128((const __m128i*)(src2 + x));
r00 = _mm_xor_si128 ( _mm_cmpgt_epi16 (r00, r10), m128);
r10 = _mm_packs_epi16(r00, r00);
_mm_storel_epi64((__m128i*)(dst + x), r10);
for( ; x <= size.width - 16; x += 16 )
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
__m128i r10 = _mm_loadu_si128((const __m128i*)(src2 + x));
r00 = _mm_xor_si128 ( _mm_cmpgt_epi16 (r00, r10), m128);
__m128i r01 = _mm_loadu_si128((const __m128i*)(src1 + x + 8));
__m128i r11 = _mm_loadu_si128((const __m128i*)(src2 + x + 8));
r01 = _mm_xor_si128 ( _mm_cmpgt_epi16 (r01, r11), m128);
r11 = _mm_packs_epi16(r00, r01);
_mm_storeu_si128((__m128i*)(dst + x), r11);
}
if( x <= size.width-8)
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
__m128i r10 = _mm_loadu_si128((const __m128i*)(src2 + x));
r00 = _mm_xor_si128 ( _mm_cmpgt_epi16 (r00, r10), m128);
r10 = _mm_packs_epi16(r00, r00);
_mm_storel_epi64((__m128i*)(dst + x), r10);
x += 8;
}
}
x += 8;
}
}
#endif
for( ; x < size.width; x++ ){
for( ; x < size.width; x++ ){
dst[x] = (uchar)(-(src1[x] > src2[x]) ^ m);
}
}
}
}
else if( code == CMP_EQ || code == CMP_NE )
{
int m = code == CMP_EQ ? 0 : 255;
for( ; size.height--; src1 += step1, src2 += step2, dst += step )
for( ; size.height--; src1 += step1, src2 += step2, dst += step )
{
int x = 0;
#if CV_SSE2
if( USE_SSE2 ){
#if CV_SSE2
if( USE_SSE2 ){
__m128i m128 = code == CMP_EQ ? _mm_setzero_si128() : _mm_set1_epi16 (-1);
for( ; x <= size.width - 16; x += 16 )
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
__m128i r10 = _mm_loadu_si128((const __m128i*)(src2 + x));
r00 = _mm_xor_si128 ( _mm_cmpeq_epi16 (r00, r10), m128);
__m128i r01 = _mm_loadu_si128((const __m128i*)(src1 + x + 8));
__m128i r11 = _mm_loadu_si128((const __m128i*)(src2 + x + 8));
r01 = _mm_xor_si128 ( _mm_cmpeq_epi16 (r01, r11), m128);
r11 = _mm_packs_epi16(r00, r01);
_mm_storeu_si128((__m128i*)(dst + x), r11);
}
if( x <= size.width - 8)
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
__m128i r10 = _mm_loadu_si128((const __m128i*)(src2 + x));
r00 = _mm_xor_si128 ( _mm_cmpeq_epi16 (r00, r10), m128);
r10 = _mm_packs_epi16(r00, r00);
_mm_storel_epi64((__m128i*)(dst + x), r10);
for( ; x <= size.width - 16; x += 16 )
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
__m128i r10 = _mm_loadu_si128((const __m128i*)(src2 + x));
r00 = _mm_xor_si128 ( _mm_cmpeq_epi16 (r00, r10), m128);
__m128i r01 = _mm_loadu_si128((const __m128i*)(src1 + x + 8));
__m128i r11 = _mm_loadu_si128((const __m128i*)(src2 + x + 8));
r01 = _mm_xor_si128 ( _mm_cmpeq_epi16 (r01, r11), m128);
r11 = _mm_packs_epi16(r00, r01);
_mm_storeu_si128((__m128i*)(dst + x), r11);
}
if( x <= size.width - 8)
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
__m128i r10 = _mm_loadu_si128((const __m128i*)(src2 + x));
r00 = _mm_xor_si128 ( _mm_cmpeq_epi16 (r00, r10), m128);
r10 = _mm_packs_epi16(r00, r00);
_mm_storel_epi64((__m128i*)(dst + x), r10);
x += 8;
}
}
x += 8;
}
}
#endif
for( ; x < size.width; x++ )
dst[x] = (uchar)(-(src1[x] == src2[x]) ^ m);
@@ -2368,13 +2368,13 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
haveScalar = true;
}
int cn = src1.channels(), depth1 = src1.depth(), depth2 = src2.depth();
_dst.create(src1.dims, src1.size, CV_8UC(cn));
src1 = src1.reshape(1); src2 = src2.reshape(1);
Mat dst = _dst.getMat().reshape(1);
size_t esz = src1.elemSize();
size_t blocksize0 = (size_t)(BLOCK_SIZE + esz-1)/esz;
BinaryFunc func = cmpTab[depth1];
@@ -2467,7 +2467,7 @@ inRange_(const T* src1, size_t step1, const T* src2, size_t step2,
for( ; size.height--; src1 += step1, src2 += step2, src3 += step3, dst += step )
{
int x = 0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for( ; x <= size.width - 4; x += 4 )
{
int t0, t1;
@@ -2661,7 +2661,7 @@ void cv::inRange(InputArray _src, InputArray _lowerb,
ptrs[idx] += delta;
}
func( ptrs[0], 0, lptr, 0, uptr, 0, cn == 1 ? ptrs[1] : mbuf, 0, Size(bsz*cn, 1));
if( cn > 1 )
if( cn > 1 )
inRangeReduce(mbuf, ptrs[1], bsz, cn);
ptrs[0] += delta;
ptrs[1] += bsz;
+66 -66
View File
@@ -69,7 +69,7 @@ cvSetIPLAllocators( Cv_iplCreateImageHeader createHeader,
{
int count = (createHeader != 0) + (allocateData != 0) + (deallocate != 0) +
(createROI != 0) + (cloneImage != 0);
if( count != 0 && count != 5 )
CV_Error( CV_StsBadArg, "Either all the pointers should be null or "
"they all should be non-null" );
@@ -144,7 +144,7 @@ cvInitMatHeader( CvMat* arr, int rows, int cols,
if( rows < 0 || cols <= 0 )
CV_Error( CV_StsBadSize, "Non-positive cols or rows" );
type = CV_MAT_TYPE( type );
arr->type = type | CV_MAT_MAGIC_VAL;
arr->rows = rows;
@@ -185,7 +185,7 @@ cvReleaseMat( CvMat** array )
if( *array )
{
CvMat* arr = *array;
if( !CV_IS_MAT_HDR_Z(arr) && !CV_IS_MATND_HDR(arr) )
CV_Error( CV_StsBadFlag, "" );
@@ -280,7 +280,7 @@ cvCreateMatNDHeader( int dims, const int* sizes, int type )
"non-positive or too large number of dimensions" );
CvMatND* arr = (CvMatND*)cvAlloc( sizeof(*arr) );
cvInitMatNDHeader( arr, dims, sizes, type, 0 );
arr->hdr_refcount = 1;
return arr;
@@ -331,19 +331,19 @@ cvGetMatND( const CvArr* arr, CvMatND* matnd, int* coi )
{
if( !((CvMatND*)arr)->data.ptr )
CV_Error( CV_StsNullPtr, "The matrix has NULL data pointer" );
result = (CvMatND*)arr;
}
else
{
CvMat stub, *mat = (CvMat*)arr;
if( CV_IS_IMAGE_HDR( mat ))
mat = cvGetMat( mat, &stub, coi );
if( !CV_IS_MAT_HDR( mat ))
CV_Error( CV_StsBadArg, "Unrecognized or unsupported array type" );
if( !mat->data.ptr )
CV_Error( CV_StsNullPtr, "Input array has NULL data pointer" );
@@ -370,7 +370,7 @@ that needs to have the same size, but 8uC1 or 8sC1 type).
Returns number of dimensions to iterate through:
0 means that all arrays are continuous,
1 means that all arrays are vectors of continuous arrays etc.
and the size of largest common continuous part of the arrays
and the size of largest common continuous part of the arrays
*/
CV_IMPL int
cvInitNArrayIterator( int count, CvArr** arrs,
@@ -395,7 +395,7 @@ cvInitNArrayIterator( int count, CvArr** arrs,
{
const CvArr* arr = i < count ? arrs[i] : mask;
CvMatND* hdr;
if( !arr )
{
if( i < count )
@@ -420,7 +420,7 @@ cvInitNArrayIterator( int count, CvArr** arrs,
if( hdr->dims != hdr0->dims )
CV_Error( CV_StsUnmatchedSizes,
"Number of dimensions is the same for all arrays" );
if( i < count )
{
switch( flags & (CV_NO_DEPTH_CHECK|CV_NO_CN_CHECK))
@@ -566,7 +566,7 @@ cvCreateSparseMat( int dims, const int* sizes, int type )
arr->hashsize = CV_SPARSE_HASH_SIZE0;
size = arr->hashsize*sizeof(arr->hashtable[0]);
arr->hashtable = (void**)cvAlloc( size );
memset( arr->hashtable, 0, size );
@@ -584,7 +584,7 @@ cvReleaseSparseMat( CvSparseMat** array )
if( *array )
{
CvSparseMat* arr = *array;
if( !CV_IS_SPARSE_MAT_HDR(arr) )
CV_Error( CV_StsBadFlag, "" );
@@ -606,7 +606,7 @@ cvCloneSparseMat( const CvSparseMat* src )
CV_Error( CV_StsBadArg, "Invalid sparse array header" );
CvSparseMat* dst = cvCreateSparseMat( src->dims, src->size, src->type );
cvCopy( src, dst );
cvCopy( src, dst );
return dst;
}
@@ -694,7 +694,7 @@ icvGetNodePtr( CvSparseMat* mat, const int* idx, int* _type,
void** newtable;
int newsize = MAX( mat->hashsize*2, CV_SPARSE_HASH_SIZE0);
int newrawsize = newsize*sizeof(newtable[0]);
CvSparseMatIterator iterator;
assert( (newsize & (newsize - 1)) == 0 );
@@ -802,7 +802,7 @@ cvCreateData( CvArr* arr )
if( mat->rows == 0 || mat->cols == 0 )
return;
if( mat->data.ptr != 0 )
CV_Error( CV_StsError, "Data is already allocated" );
@@ -826,7 +826,7 @@ cvCreateData( CvArr* arr )
if( !CvIPL.allocateData )
{
img->imageData = img->imageDataOrigin =
img->imageData = img->imageDataOrigin =
(char*)cvAlloc( (size_t)img->imageSize );
}
else
@@ -851,7 +851,7 @@ cvCreateData( CvArr* arr )
CvMatND* mat = (CvMatND*)arr;
int i;
size_t total_size = CV_ELEM_SIZE(mat->type);
if( mat->dim[0].size == 0 )
return;
@@ -873,7 +873,7 @@ cvCreateData( CvArr* arr )
total_size = size;
}
}
mat->refcount = (int*)cvAlloc( total_size +
sizeof(int) + CV_MALLOC_ALIGN );
mat->data.ptr = (uchar*)cvAlignPtr( mat->refcount + 1, CV_MALLOC_ALIGN );
@@ -896,7 +896,7 @@ cvSetData( CvArr* arr, void* data, int step )
if( CV_IS_MAT_HDR( arr ))
{
CvMat* mat = (CvMat*)arr;
int type = CV_MAT_TYPE(mat->type);
pix_size = CV_ELEM_SIZE(type);
min_step = mat->cols*pix_size;
@@ -918,7 +918,7 @@ cvSetData( CvArr* arr, void* data, int step )
else if( CV_IS_IMAGE_HDR( arr ))
{
IplImage* img = (IplImage*)arr;
pix_size = ((img->depth & 255) >> 3)*img->nChannels;
min_step = img->width*pix_size;
@@ -947,7 +947,7 @@ cvSetData( CvArr* arr, void* data, int step )
CvMatND* mat = (CvMatND*)arr;
int i;
int64 cur_step;
if( step != CV_AUTOSTEP )
CV_Error( CV_BadStep,
"For multidimensional array only CV_AUTOSTEP is allowed here" );
@@ -1097,7 +1097,7 @@ cvGetDims( const CvArr* arr, int* sizes )
if( CV_IS_MAT_HDR( arr ))
{
CvMat* mat = (CvMat*)arr;
dims = 2;
if( sizes )
{
@@ -1120,7 +1120,7 @@ cvGetDims( const CvArr* arr, int* sizes )
{
CvMatND* mat = (CvMatND*)arr;
dims = mat->dims;
if( sizes )
{
int i;
@@ -1132,7 +1132,7 @@ cvGetDims( const CvArr* arr, int* sizes )
{
CvSparseMat* mat = (CvSparseMat*)arr;
dims = mat->dims;
if( sizes )
memcpy( sizes, mat->size, dims*sizeof(sizes[0]));
}
@@ -1184,7 +1184,7 @@ cvGetDimSize( const CvArr* arr, int index )
else if( CV_IS_MATND_HDR( arr ))
{
CvMatND* mat = (CvMatND*)arr;
if( (unsigned)index >= (unsigned)mat->dims )
CV_Error( CV_StsOutOfRange, "bad dimension index" );
@@ -1193,7 +1193,7 @@ cvGetDimSize( const CvArr* arr, int index )
else if( CV_IS_SPARSE_MAT_HDR( arr ))
{
CvSparseMat* mat = (CvSparseMat*)arr;
if( (unsigned)index >= (unsigned)mat->dims )
CV_Error( CV_StsOutOfRange, "bad dimension index" );
@@ -1350,7 +1350,7 @@ cvGetCols( const CvArr* arr, CvMat* submat, int start_col, int end_col )
if( !submat )
CV_Error( CV_StsNullPtr, "" );
cols = mat->cols;
if( (unsigned)start_col >= (unsigned)cols ||
(unsigned)end_col > (unsigned)cols )
@@ -1385,7 +1385,7 @@ cvGetDiag( const CvArr* arr, CvMat* submat, int diag )
{
CvMat* res = 0;
CvMat stub, *mat = (CvMat*)arr;
int len, pix_size;
int len, pix_size;
if( !CV_IS_MAT( mat ))
mat = cvGetMat( mat, &stub );
@@ -1407,7 +1407,7 @@ cvGetDiag( const CvArr* arr, CvMat* submat, int diag )
if( diag >= 0 )
{
len = mat->cols - diag;
if( len <= 0 )
CV_Error( CV_StsOutOfRange, "" );
@@ -1417,7 +1417,7 @@ cvGetDiag( const CvArr* arr, CvMat* submat, int diag )
else
{
len = mat->rows + diag;
if( len <= 0 )
CV_Error( CV_StsOutOfRange, "" );
@@ -1526,7 +1526,7 @@ cvRawDataToScalar( const void* data, int flags, CvScalar* scalar )
int cn = CV_MAT_CN( flags );
assert( scalar && data );
if( (unsigned)(cn - 1) >= 4 )
CV_Error( CV_StsOutOfRange, "The number of channels must be 1, 2, 3 or 4" );
@@ -1646,7 +1646,7 @@ cvPtr1D( const CvArr* arr, int idx, int* _type )
if( _type )
*_type = type;
// the first part is mul-free sufficient check
// that the index is within the matrix
if( (unsigned)idx >= (unsigned)(mat->rows + mat->cols - 1) &&
@@ -1720,7 +1720,7 @@ cvPtr1D( const CvArr* arr, int idx, int* _type )
int i, n = m->dims;
CV_DbgAssert( n <= CV_MAX_DIM_HEAP );
int _idx[CV_MAX_DIM_HEAP];
for( i = n - 1; i >= 0; i-- )
{
int t = idx / m->size[i];
@@ -1811,7 +1811,7 @@ cvPtr2D( const CvArr* arr, int y, int x, int* _type )
{
CvMatND* mat = (CvMatND*)arr;
if( mat->dims != 2 ||
if( mat->dims != 2 ||
(unsigned)y >= (unsigned)(mat->dim[0].size) ||
(unsigned)x >= (unsigned)(mat->dim[1].size) )
CV_Error( CV_StsOutOfRange, "index is out of range" );
@@ -1843,7 +1843,7 @@ cvPtr3D( const CvArr* arr, int z, int y, int x, int* _type )
{
CvMatND* mat = (CvMatND*)arr;
if( mat->dims != 3 ||
if( mat->dims != 3 ||
(unsigned)z >= (unsigned)(mat->dim[0].size) ||
(unsigned)y >= (unsigned)(mat->dim[1].size) ||
(unsigned)x >= (unsigned)(mat->dim[2].size) )
@@ -1879,7 +1879,7 @@ cvPtrND( const CvArr* arr, const int* idx, int* _type,
CV_Error( CV_StsNullPtr, "NULL pointer to indices" );
if( CV_IS_SPARSE_MAT( arr ))
ptr = icvGetNodePtr( (CvSparseMat*)arr, idx,
ptr = icvGetNodePtr( (CvSparseMat*)arr, idx,
_type, create_node, precalc_hashval );
else if( CV_IS_MATND( arr ))
{
@@ -1913,7 +1913,7 @@ cvGet1D( const CvArr* arr, int idx )
CvScalar scalar = {{0,0,0,0}};
int type = 0;
uchar* ptr;
if( CV_IS_MAT( arr ) && CV_IS_MAT_CONT( ((CvMat*)arr)->type ))
{
CvMat* mat = (CvMat*)arr;
@@ -1990,7 +1990,7 @@ cvGet3D( const CvArr* arr, int z, int y, int x )
int idx[] = { z, y, x };
ptr = icvGetNodePtr( (CvSparseMat*)arr, idx, &type, 0, 0 );
}
if( ptr )
cvRawDataToScalar( ptr, type, &scalar );
return scalar;
@@ -2063,7 +2063,7 @@ cvGetReal2D( const CvArr* arr, int y, int x )
double value = 0;
int type = 0;
uchar* ptr;
if( CV_IS_MAT( arr ))
{
CvMat* mat = (CvMat*)arr;
@@ -2110,7 +2110,7 @@ cvGetReal3D( const CvArr* arr, int z, int y, int x )
int idx[] = { z, y, x };
ptr = icvGetNodePtr( (CvSparseMat*)arr, idx, &type, 0, 0 );
}
if( ptr )
{
if( CV_MAT_CN( type ) > 1 )
@@ -2130,7 +2130,7 @@ cvGetRealND( const CvArr* arr, const int* idx )
double value = 0;
int type = 0;
uchar* ptr;
if( !CV_IS_SPARSE_MAT( arr ))
ptr = cvPtrND( arr, idx, &type );
else
@@ -2154,7 +2154,7 @@ cvSet1D( CvArr* arr, int idx, CvScalar scalar )
{
int type = 0;
uchar* ptr;
if( CV_IS_MAT( arr ) && CV_IS_MAT_CONT( ((CvMat*)arr)->type ))
{
CvMat* mat = (CvMat*)arr;
@@ -2185,7 +2185,7 @@ cvSet2D( CvArr* arr, int y, int x, CvScalar scalar )
{
int type = 0;
uchar* ptr;
if( CV_IS_MAT( arr ))
{
CvMat* mat = (CvMat*)arr;
@@ -2214,7 +2214,7 @@ cvSet3D( CvArr* arr, int z, int y, int x, CvScalar scalar )
{
int type = 0;
uchar* ptr;
if( !CV_IS_SPARSE_MAT( arr ))
ptr = cvPtr3D( arr, z, y, x, &type );
else
@@ -2232,7 +2232,7 @@ cvSetND( CvArr* arr, const int* idx, CvScalar scalar )
{
int type = 0;
uchar* ptr;
if( !CV_IS_SPARSE_MAT( arr ))
ptr = cvPtrND( arr, idx, &type );
else
@@ -2246,7 +2246,7 @@ cvSetReal1D( CvArr* arr, int idx, double value )
{
int type = 0;
uchar* ptr;
if( CV_IS_MAT( arr ) && CV_IS_MAT_CONT( ((CvMat*)arr)->type ))
{
CvMat* mat = (CvMat*)arr;
@@ -2280,7 +2280,7 @@ cvSetReal2D( CvArr* arr, int y, int x, double value )
{
int type = 0;
uchar* ptr;
if( CV_IS_MAT( arr ))
{
CvMat* mat = (CvMat*)arr;
@@ -2314,7 +2314,7 @@ cvSetReal3D( CvArr* arr, int z, int y, int x, double value )
{
int type = 0;
uchar* ptr;
if( !CV_IS_SPARSE_MAT( arr ))
ptr = cvPtr3D( arr, z, y, x, &type );
else
@@ -2335,7 +2335,7 @@ cvSetRealND( CvArr* arr, const int* idx, double value )
{
int type = 0;
uchar* ptr;
if( !CV_IS_SPARSE_MAT( arr ))
ptr = cvPtrND( arr, idx, &type );
else
@@ -2385,7 +2385,7 @@ cvGetMat( const CvArr* array, CvMat* mat,
{
if( !src->data.ptr )
CV_Error( CV_StsNullPtr, "The matrix has NULL data pointer" );
result = (CvMat*)src;
}
else if( CV_IS_IMAGE_HDR(src) )
@@ -2453,7 +2453,7 @@ cvGetMat( const CvArr* array, CvMat* mat,
CvMatND* matnd = (CvMatND*)src;
int i;
int size1 = matnd->dim[0].size, size2 = 1;
if( !src->data.ptr )
CV_Error( CV_StsNullPtr, "Input array has NULL data pointer" );
@@ -2537,7 +2537,7 @@ cvReshapeMatND( const CvArr* arr,
refcount = mat->refcount;
hdr_refcount = mat->hdr_refcount;
}
if( !CV_IS_MAT( mat ))
mat = cvGetMat( mat, &header, &coi, 1 );
@@ -2586,7 +2586,7 @@ cvReshapeMatND( const CvArr* arr,
header.step &= new_rows > 1 ? -1 : 0;
header.refcount = refcount;
header.hdr_refcount = hdr_refcount;
if( sizeof_header == sizeof(CvMat) )
*(CvMat*)_header = header;
else
@@ -2603,7 +2603,7 @@ cvReshapeMatND( const CvArr* arr,
if( sizeof_header != sizeof(CvMatND))
CV_Error( CV_StsBadSize, "The output header should be CvMatND" );
if( !new_sizes )
{
if( !CV_IS_MATND( arr ))
@@ -2636,12 +2636,12 @@ cvReshapeMatND( const CvArr* arr,
CvMatND* mat = (CvMatND*)arr;
int i, size1, size2;
int step;
if( new_cn != 0 )
CV_Error( CV_StsBadArg,
"Simultaneous change of shape and number of channels is not supported. "
"Do it by 2 separate calls" );
if( !CV_IS_MATND( mat ))
{
cvGetMatND( mat, &stub, &coi );
@@ -2786,7 +2786,7 @@ cvGetImage( const CvArr* array, IplImage* img )
if( !CV_IS_IMAGE_HDR(src) )
{
const CvMat* mat = (const CvMat*)src;
if( !CV_IS_MAT_HDR(mat))
CV_Error( CV_StsBadFlag, "" );
@@ -2962,7 +2962,7 @@ cvReleaseImageHeader( IplImage** image )
{
IplImage* img = *image;
*image = 0;
if( !CvIPL.deallocate )
{
cvFree( &img->roi );
@@ -2986,7 +2986,7 @@ cvReleaseImage( IplImage ** image )
{
IplImage* img = *image;
*image = 0;
cvReleaseData( img );
cvReleaseImageHeader( &img );
}
@@ -3004,15 +3004,15 @@ cvSetImageROI( IplImage* image, CvRect rect )
rect.x < image->width && rect.y < image->height &&
rect.x + rect.width >= (int)(rect.width > 0) &&
rect.y + rect.height >= (int)(rect.height > 0) );
rect.width += rect.x;
rect.height += rect.y;
rect.x = std::max(rect.x, 0);
rect.y = std::max(rect.y, 0);
rect.width = std::min(rect.width, image->width);
rect.height = std::min(rect.height, image->height);
rect.width -= rect.x;
rect.height -= rect.y;
@@ -3061,7 +3061,7 @@ cvGetImageROI( const IplImage* img )
img->roi->width, img->roi->height );
else
rect = cvRect( 0, 0, img->width, img->height );
return rect;
}
@@ -3160,7 +3160,7 @@ cvCheckTermCriteria( CvTermCriteria criteria, double default_eps,
"Iterations flag is set and maximum number of iterations is <= 0" );
crit.max_iter = criteria.max_iter;
}
if( (criteria.type & CV_TERMCRIT_EPS) != 0 )
{
if( criteria.epsilon < 0 )
@@ -3182,9 +3182,9 @@ cvCheckTermCriteria( CvTermCriteria criteria, double default_eps,
namespace cv
{
template<> void Ptr<CvMat>::delete_obj()
{ cvReleaseMat(&obj); }
{ cvReleaseMat(&obj); }
template<> void Ptr<IplImage>::delete_obj()
{ cvReleaseImage(&obj); }
+99 -99
View File
@@ -53,48 +53,48 @@ void helpParser()
vector<string> split_string(const string& str, const string& delimiters)
{
vector<string> res;
vector<string> res;
string split_str = str;
size_t pos_delim = split_str.find(delimiters);
string split_str = str;
size_t pos_delim = split_str.find(delimiters);
while ( pos_delim != string::npos)
{
if (pos_delim == 0)
{
res.push_back("");
split_str.erase(0, 1);
}
else
{
res.push_back(split_str.substr(0, pos_delim));
split_str.erase(0, pos_delim + 1);
}
while ( pos_delim != string::npos)
{
if (pos_delim == 0)
{
res.push_back("");
split_str.erase(0, 1);
}
else
{
res.push_back(split_str.substr(0, pos_delim));
split_str.erase(0, pos_delim + 1);
}
pos_delim = split_str.find(delimiters);
}
pos_delim = split_str.find(delimiters);
}
res.push_back(split_str);
res.push_back(split_str);
return res;
return res;
}
string del_space(string name)
{
while ((name.find_first_of(' ') == 0) && (name.length() > 0))
name.erase(0, 1);
while ((name.find_first_of(' ') == 0) && (name.length() > 0))
name.erase(0, 1);
while ((name.find_last_of(' ') == (name.length() - 1)) && (name.length() > 0))
name.erase(name.end() - 1, name.end());
while ((name.find_last_of(' ') == (name.length() - 1)) && (name.length() > 0))
name.erase(name.end() - 1, name.end());
return name;
return name;
}
}//namespace
CommandLineParser::CommandLineParser(int argc, const char* const argv[], const char* keys)
{
std::string keys_buffer;
std::string keys_buffer;
std::string values_buffer;
std::string buffer;
std::string curName;
@@ -125,14 +125,14 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const c
buffer.erase(flagPosition);
paramVector = split_string(buffer, "|");
while (paramVector.size() < 4) paramVector.push_back("");
while (paramVector.size() < 4) paramVector.push_back("");
buffer = paramVector[0];
buffer += '|' + paramVector[1];
buffer = paramVector[0];
buffer += '|' + paramVector[1];
//if (buffer == "") CV_ERROR(CV_StsBadArg, "In CommandLineParser need set short and full name");
//if (buffer == "") CV_ERROR(CV_StsBadArg, "In CommandLineParser need set short and full name");
paramVector.erase(paramVector.begin(), paramVector.begin() + 2);
paramVector.erase(paramVector.begin(), paramVector.begin() + 2);
data[buffer] = paramVector;
}
@@ -159,14 +159,14 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const c
buffer.erase(0, (buffer.find('=') + 1));
}
values_buffer = del_space(values_buffer);
values_buffer = del_space(values_buffer);
for(it = data.begin(); it != data.end(); it++)
{
keys_buffer = it->first;
keysVector = split_string(keys_buffer, "|");
for (size_t j = 0; j < keysVector.size(); j++) keysVector[j] = del_space(keysVector[j]);
for (size_t j = 0; j < keysVector.size(); j++) keysVector[j] = del_space(keysVector[j]);
values_buffer = it->second[0];
if (((curName == keysVector[0]) || (curName == keysVector[1])) && hasValueThroughEq)
@@ -177,10 +177,10 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const c
}
if (!hasValueThroughEq && ((curName == keysVector[0]) || (curName == keysVector[1]))
&& (
values_buffer.find("false") != values_buffer.npos ||
values_buffer == ""
))
&& (
values_buffer.find("false") != values_buffer.npos ||
values_buffer == ""
))
{
it->second[0] = "true";
//isFound = true;
@@ -223,12 +223,12 @@ bool CommandLineParser::has(const std::string& keys)
for(it = data.begin(); it != data.end(); it++)
{
keysVector = split_string(it->first, "|");
for (size_t i = 0; i < keysVector.size(); i++) keysVector[i] = del_space(keysVector[i]);
for (size_t i = 0; i < keysVector.size(); i++) keysVector[i] = del_space(keysVector[i]);
if (keysVector.size() == 1) keysVector.push_back("");
if ((del_space(keys).compare(keysVector[0]) == 0) ||
(del_space(keys).compare(keysVector[1]) == 0))
if ((del_space(keys).compare(keysVector[0]) == 0) ||
(del_space(keys).compare(keysVector[1]) == 0))
return true;
}
@@ -243,12 +243,12 @@ std::string CommandLineParser::getString(const std::string& keys)
for(it = data.begin(); it != data.end(); it++)
{
valueVector = split_string(it->first, "|");
for (size_t i = 0; i < valueVector.size(); i++) valueVector[i] = del_space(valueVector[i]);
for (size_t i = 0; i < valueVector.size(); i++) valueVector[i] = del_space(valueVector[i]);
if (valueVector.size() == 1) valueVector.push_back("");
if ((del_space(keys).compare(valueVector[0]) == 0) ||
(del_space(keys).compare(valueVector[1]) == 0))
if ((del_space(keys).compare(valueVector[0]) == 0) ||
(del_space(keys).compare(valueVector[1]) == 0))
return it->second[0];
}
return string();
@@ -262,68 +262,68 @@ template<typename _Tp>
void CommandLineParser::printParams()
{
int col_p = 30;
int col_d = 50;
int col_p = 30;
int col_d = 50;
std::map<std::string, std::vector<std::string> >::iterator it;
std::vector<string> keysVector;
std::string buf;
for(it = data.begin(); it != data.end(); it++)
{
keysVector = split_string(it->first, "|");
for (size_t i = 0; i < keysVector.size(); i++) keysVector[i] = del_space(keysVector[i]);
std::map<std::string, std::vector<std::string> >::iterator it;
std::vector<string> keysVector;
std::string buf;
for(it = data.begin(); it != data.end(); it++)
{
keysVector = split_string(it->first, "|");
for (size_t i = 0; i < keysVector.size(); i++) keysVector[i] = del_space(keysVector[i]);
cout << " ";
buf = "";
if (keysVector[0] != "")
{
buf = "-" + keysVector[0];
if (keysVector[1] != "") buf += ", --" + keysVector[1];
}
else if (keysVector[1] != "") buf += "--" + keysVector[1];
if (del_space(it->second[0]) != "") buf += "=[" + del_space(it->second[0]) + "]";
cout << " ";
buf = "";
if (keysVector[0] != "")
{
buf = "-" + keysVector[0];
if (keysVector[1] != "") buf += ", --" + keysVector[1];
}
else if (keysVector[1] != "") buf += "--" + keysVector[1];
if (del_space(it->second[0]) != "") buf += "=[" + del_space(it->second[0]) + "]";
cout << setw(col_p-2) << left << buf;
cout << setw(col_p-2) << left << buf;
if ((int)buf.length() > col_p-2)
{
cout << endl << " ";
cout << setw(col_p-2) << left << " ";
}
if ((int)buf.length() > col_p-2)
{
cout << endl << " ";
cout << setw(col_p-2) << left << " ";
}
buf = "";
if (del_space(it->second[1]) != "") buf += del_space(it->second[1]);
buf = "";
if (del_space(it->second[1]) != "") buf += del_space(it->second[1]);
for(;;)
{
bool tr = ((int)buf.length() > col_d-2) ? true: false;
std::string::size_type pos = 0;
for(;;)
{
bool tr = ((int)buf.length() > col_d-2) ? true: false;
std::string::size_type pos = 0;
if (tr)
{
pos = buf.find_first_of(' ');
for(;;)
{
if (buf.find_first_of(' ', pos + 1 ) < (std::string::size_type)(col_d-2) &&
if (tr)
{
pos = buf.find_first_of(' ');
for(;;)
{
if (buf.find_first_of(' ', pos + 1 ) < (std::string::size_type)(col_d-2) &&
buf.find_first_of(' ', pos + 1 ) != std::string::npos)
pos = buf.find_first_of(' ', pos + 1);
else
break;
}
pos++;
cout << setw(col_d-2) << left << buf.substr(0, pos) << endl;
}
else
{
cout << setw(col_d-2) << left << buf<< endl;
break;
}
pos = buf.find_first_of(' ', pos + 1);
else
break;
}
pos++;
cout << setw(col_d-2) << left << buf.substr(0, pos) << endl;
}
else
{
cout << setw(col_d-2) << left << buf<< endl;
break;
}
buf.erase(0, pos);
cout << " ";
cout << setw(col_p-2) << left << " ";
}
}
buf.erase(0, pos);
cout << " ";
cout << setw(col_p-2) << left << " ";
}
}
}
template<>
@@ -331,9 +331,9 @@ bool CommandLineParser::get<bool>(const std::string& name, bool space_delete)
{
std::string str_buf = getString(name);
if (space_delete && str_buf != "")
if (space_delete && str_buf != "")
{
str_buf = del_space(str_buf);
str_buf = del_space(str_buf);
}
if (str_buf == "true")
@@ -346,8 +346,8 @@ std::string CommandLineParser::analyzeValue<std::string>(const std::string& str,
{
if (space_delete)
{
return del_space(str);
}
return del_space(str);
}
return str;
}
+11 -11
View File
@@ -679,7 +679,7 @@ cvtScale_<short, int, float>( const short* src, size_t sstep,
{
int x = 0;
#if CV_SSE2
#if CV_SSE2
if(USE_SSE2)//~5X
{
__m128 scale128 = _mm_set1_ps (scale);
@@ -694,27 +694,27 @@ cvtScale_<short, int, float>( const short* src, size_t sstep,
rf1 = _mm_add_ps(_mm_mul_ps(rf1, scale128), shift128);
r0 = _mm_cvtps_epi32(rf0);
r1 = _mm_cvtps_epi32(rf1);
_mm_storeu_si128((__m128i*)(dst + x), r0);
_mm_storeu_si128((__m128i*)(dst + x + 4), r1);
_mm_storeu_si128((__m128i*)(dst + x + 4), r1);
}
}
#endif
//We will wait Haswell
/*
//We will wait Haswell
/*
#if CV_AVX
if(USE_AVX)//2X - bad variant
{
////TODO:AVX implementation (optimization?) required
////TODO:AVX implementation (optimization?) required
__m256 scale256 = _mm256_set1_ps (scale);
__m256 shift256 = _mm256_set1_ps (shift);
__m256 shift256 = _mm256_set1_ps (shift);
for(; x <= size.width - 8; x += 8 )
{
__m256i buf = _mm256_set_epi32((int)(*(src+x+7)),(int)(*(src+x+6)),(int)(*(src+x+5)),(int)(*(src+x+4)),(int)(*(src+x+3)),(int)(*(src+x+2)),(int)(*(src+x+1)),(int)(*(src+x)));
__m256 r0 = _mm256_add_ps( _mm256_mul_ps(_mm256_cvtepi32_ps (buf), scale256), shift256);
__m256i res = _mm256_cvtps_epi32(r0);
_mm256_storeu_si256 ((__m256i*)(dst+x), res);
__m256i buf = _mm256_set_epi32((int)(*(src+x+7)),(int)(*(src+x+6)),(int)(*(src+x+5)),(int)(*(src+x+4)),(int)(*(src+x+3)),(int)(*(src+x+2)),(int)(*(src+x+1)),(int)(*(src+x)));
__m256 r0 = _mm256_add_ps( _mm256_mul_ps(_mm256_cvtepi32_ps (buf), scale256), shift256);
__m256i res = _mm256_cvtps_epi32(r0);
_mm256_storeu_si256 ((__m256i*)(dst+x), res);
}
}
#endif*/
+29 -29
View File
@@ -87,20 +87,20 @@ copyMask_<uchar>(const uchar* _src, size_t sstep, const uchar* mask, size_t mste
uchar* dst = (uchar*)_dst;
int x = 0;
#if CV_SSE4_2
if(USE_SSE4_2)//
{
__m128i zero = _mm_setzero_si128 ();
for( ; x <= size.width - 16; x += 16 )
{
const __m128i rSrc = _mm_lddqu_si128((const __m128i*)(src+x));
__m128i _mask = _mm_lddqu_si128((const __m128i*)(mask+x));
__m128i rDst = _mm_lddqu_si128((__m128i*)(dst+x));
__m128i _negMask = _mm_cmpeq_epi8(_mask, zero);
rDst = _mm_blendv_epi8(rSrc, rDst, _negMask);
_mm_storeu_si128((__m128i*)(dst + x), rDst);
}
}
if(USE_SSE4_2)//
{
__m128i zero = _mm_setzero_si128 ();
for( ; x <= size.width - 16; x += 16 )
{
const __m128i rSrc = _mm_lddqu_si128((const __m128i*)(src+x));
__m128i _mask = _mm_lddqu_si128((const __m128i*)(mask+x));
__m128i rDst = _mm_lddqu_si128((__m128i*)(dst+x));
__m128i _negMask = _mm_cmpeq_epi8(_mask, zero);
rDst = _mm_blendv_epi8(rSrc, rDst, _negMask);
_mm_storeu_si128((__m128i*)(dst + x), rDst);
}
}
#endif
for( ; x < size.width; x++ )
if( mask[x] )
@@ -113,24 +113,24 @@ copyMask_<ushort>(const uchar* _src, size_t sstep, const uchar* mask, size_t mst
{
for( ; size.height--; mask += mstep, _src += sstep, _dst += dstep )
{
const ushort* src = (const ushort*)_src;
const ushort* src = (const ushort*)_src;
ushort* dst = (ushort*)_dst;
int x = 0;
#if CV_SSE4_2
if(USE_SSE4_2)//
{
__m128i zero = _mm_setzero_si128 ();
for( ; x <= size.width - 8; x += 8 )
{
const __m128i rSrc =_mm_lddqu_si128((const __m128i*)(src+x));
__m128i _mask = _mm_loadl_epi64((const __m128i*)(mask+x));
_mask = _mm_unpacklo_epi8(_mask, _mask);
__m128i rDst = _mm_lddqu_si128((const __m128i*)(dst+x));
__m128i _negMask = _mm_cmpeq_epi8(_mask, zero);
rDst = _mm_blendv_epi8(rSrc, rDst, _negMask);
_mm_storeu_si128((__m128i*)(dst + x), rDst);
}
}
if(USE_SSE4_2)//
{
__m128i zero = _mm_setzero_si128 ();
for( ; x <= size.width - 8; x += 8 )
{
const __m128i rSrc =_mm_lddqu_si128((const __m128i*)(src+x));
__m128i _mask = _mm_loadl_epi64((const __m128i*)(mask+x));
_mask = _mm_unpacklo_epi8(_mask, _mask);
__m128i rDst = _mm_lddqu_si128((const __m128i*)(dst+x));
__m128i _negMask = _mm_cmpeq_epi8(_mask, zero);
rDst = _mm_blendv_epi8(rSrc, rDst, _negMask);
_mm_storeu_si128((__m128i*)(dst + x), rDst);
}
}
#endif
for( ; x < size.width; x++ )
if( mask[x] )
+343 -343
View File
@@ -1,343 +1,343 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "opencv2/gpu/device/saturate_cast.hpp"
#include "opencv2/gpu/device/transform.hpp"
#include "opencv2/gpu/device/functional.hpp"
namespace cv { namespace gpu { namespace device
{
void writeScalar(const uchar*);
void writeScalar(const schar*);
void writeScalar(const ushort*);
void writeScalar(const short int*);
void writeScalar(const int*);
void writeScalar(const float*);
void writeScalar(const double*);
void convert_gpu(PtrStepSzb, int, PtrStepSzb, int, double, double, cudaStream_t);
}}}
namespace cv { namespace gpu { namespace device
{
template <typename T> struct shift_and_sizeof;
template <> struct shift_and_sizeof<signed char> { enum { shift = 0 }; };
template <> struct shift_and_sizeof<unsigned char> { enum { shift = 0 }; };
template <> struct shift_and_sizeof<short> { enum { shift = 1 }; };
template <> struct shift_and_sizeof<unsigned short> { enum { shift = 1 }; };
template <> struct shift_and_sizeof<int> { enum { shift = 2 }; };
template <> struct shift_and_sizeof<float> { enum { shift = 2 }; };
template <> struct shift_and_sizeof<double> { enum { shift = 3 }; };
///////////////////////////////////////////////////////////////////////////
////////////////////////////////// CopyTo /////////////////////////////////
///////////////////////////////////////////////////////////////////////////
template <typename T> void copyToWithMask(PtrStepSzb src, PtrStepSzb dst, int cn, PtrStepSzb mask, bool colorMask, cudaStream_t stream)
{
if (colorMask)
cv::gpu::device::transform((PtrStepSz<T>)src, (PtrStepSz<T>)dst, identity<T>(), SingleMask(mask), stream);
else
cv::gpu::device::transform((PtrStepSz<T>)src, (PtrStepSz<T>)dst, identity<T>(), SingleMaskChannels(mask, cn), stream);
}
void copyToWithMask_gpu(PtrStepSzb src, PtrStepSzb dst, size_t elemSize1, int cn, PtrStepSzb mask, bool colorMask, cudaStream_t stream)
{
typedef void (*func_t)(PtrStepSzb src, PtrStepSzb dst, int cn, PtrStepSzb mask, bool colorMask, cudaStream_t stream);
static func_t tab[] =
{
0,
copyToWithMask<unsigned char>,
copyToWithMask<unsigned short>,
0,
copyToWithMask<int>,
0,
0,
0,
copyToWithMask<double>
};
tab[elemSize1](src, dst, cn, mask, colorMask, stream);
}
///////////////////////////////////////////////////////////////////////////
////////////////////////////////// SetTo //////////////////////////////////
///////////////////////////////////////////////////////////////////////////
__constant__ uchar scalar_8u[4];
__constant__ schar scalar_8s[4];
__constant__ ushort scalar_16u[4];
__constant__ short scalar_16s[4];
__constant__ int scalar_32s[4];
__constant__ float scalar_32f[4];
__constant__ double scalar_64f[4];
template <typename T> __device__ __forceinline__ T readScalar(int i);
template <> __device__ __forceinline__ uchar readScalar<uchar>(int i) {return scalar_8u[i];}
template <> __device__ __forceinline__ schar readScalar<schar>(int i) {return scalar_8s[i];}
template <> __device__ __forceinline__ ushort readScalar<ushort>(int i) {return scalar_16u[i];}
template <> __device__ __forceinline__ short readScalar<short>(int i) {return scalar_16s[i];}
template <> __device__ __forceinline__ int readScalar<int>(int i) {return scalar_32s[i];}
template <> __device__ __forceinline__ float readScalar<float>(int i) {return scalar_32f[i];}
template <> __device__ __forceinline__ double readScalar<double>(int i) {return scalar_64f[i];}
void writeScalar(const uchar* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_8u, vals, sizeof(uchar) * 4) );
}
void writeScalar(const schar* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_8s, vals, sizeof(schar) * 4) );
}
void writeScalar(const ushort* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_16u, vals, sizeof(ushort) * 4) );
}
void writeScalar(const short* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_16s, vals, sizeof(short) * 4) );
}
void writeScalar(const int* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_32s, vals, sizeof(int) * 4) );
}
void writeScalar(const float* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_32f, vals, sizeof(float) * 4) );
}
void writeScalar(const double* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_64f, vals, sizeof(double) * 4) );
}
template<typename T>
__global__ void set_to_without_mask(T* mat, int cols, int rows, size_t step, int channels)
{
size_t x = blockIdx.x * blockDim.x + threadIdx.x;
size_t y = blockIdx.y * blockDim.y + threadIdx.y;
if ((x < cols * channels ) && (y < rows))
{
size_t idx = y * ( step >> shift_and_sizeof<T>::shift ) + x;
mat[idx] = readScalar<T>(x % channels);
}
}
template<typename T>
__global__ void set_to_with_mask(T* mat, const uchar* mask, int cols, int rows, size_t step, int channels, size_t step_mask)
{
size_t x = blockIdx.x * blockDim.x + threadIdx.x;
size_t y = blockIdx.y * blockDim.y + threadIdx.y;
if ((x < cols * channels ) && (y < rows))
if (mask[y * step_mask + x / channels] != 0)
{
size_t idx = y * ( step >> shift_and_sizeof<T>::shift ) + x;
mat[idx] = readScalar<T>(x % channels);
}
}
template <typename T>
void set_to_gpu(PtrStepSzb mat, const T* scalar, PtrStepSzb mask, int channels, cudaStream_t stream)
{
writeScalar(scalar);
dim3 threadsPerBlock(32, 8, 1);
dim3 numBlocks (mat.cols * channels / threadsPerBlock.x + 1, mat.rows / threadsPerBlock.y + 1, 1);
set_to_with_mask<T><<<numBlocks, threadsPerBlock, 0, stream>>>((T*)mat.data, (uchar*)mask.data, mat.cols, mat.rows, mat.step, channels, mask.step);
cudaSafeCall( cudaGetLastError() );
if (stream == 0)
cudaSafeCall ( cudaDeviceSynchronize() );
}
template void set_to_gpu<uchar >(PtrStepSzb mat, const uchar* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template void set_to_gpu<schar >(PtrStepSzb mat, const schar* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template void set_to_gpu<ushort>(PtrStepSzb mat, const ushort* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template void set_to_gpu<short >(PtrStepSzb mat, const short* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template void set_to_gpu<int >(PtrStepSzb mat, const int* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template void set_to_gpu<float >(PtrStepSzb mat, const float* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template void set_to_gpu<double>(PtrStepSzb mat, const double* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template <typename T>
void set_to_gpu(PtrStepSzb mat, const T* scalar, int channels, cudaStream_t stream)
{
writeScalar(scalar);
dim3 threadsPerBlock(32, 8, 1);
dim3 numBlocks (mat.cols * channels / threadsPerBlock.x + 1, mat.rows / threadsPerBlock.y + 1, 1);
set_to_without_mask<T><<<numBlocks, threadsPerBlock, 0, stream>>>((T*)mat.data, mat.cols, mat.rows, mat.step, channels);
cudaSafeCall( cudaGetLastError() );
if (stream == 0)
cudaSafeCall ( cudaDeviceSynchronize() );
}
template void set_to_gpu<uchar >(PtrStepSzb mat, const uchar* scalar, int channels, cudaStream_t stream);
template void set_to_gpu<schar >(PtrStepSzb mat, const schar* scalar, int channels, cudaStream_t stream);
template void set_to_gpu<ushort>(PtrStepSzb mat, const ushort* scalar, int channels, cudaStream_t stream);
template void set_to_gpu<short >(PtrStepSzb mat, const short* scalar, int channels, cudaStream_t stream);
template void set_to_gpu<int >(PtrStepSzb mat, const int* scalar, int channels, cudaStream_t stream);
template void set_to_gpu<float >(PtrStepSzb mat, const float* scalar, int channels, cudaStream_t stream);
template void set_to_gpu<double>(PtrStepSzb mat, const double* scalar, int channels, cudaStream_t stream);
///////////////////////////////////////////////////////////////////////////
//////////////////////////////// ConvertTo ////////////////////////////////
///////////////////////////////////////////////////////////////////////////
template <typename T, typename D> struct Convertor : unary_function<T, D>
{
Convertor(double alpha_, double beta_) : alpha(alpha_), beta(beta_) {}
__device__ __forceinline__ D operator()(const T& src) const
{
return saturate_cast<D>(alpha * src + beta);
}
double alpha, beta;
};
namespace detail
{
template <size_t src_size, size_t dst_size, typename F> struct ConvertTraitsDispatcher : DefaultTransformFunctorTraits<F>
{
};
template <typename F> struct ConvertTraitsDispatcher<1, 1, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_shift = 8 };
};
template <typename F> struct ConvertTraitsDispatcher<1, 2, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_shift = 4 };
};
template <typename F> struct ConvertTraitsDispatcher<1, 4, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_block_dim_y = 8 };
enum { smart_shift = 4 };
};
template <typename F> struct ConvertTraitsDispatcher<2, 2, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_shift = 4 };
};
template <typename F> struct ConvertTraitsDispatcher<2, 4, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_shift = 2 };
};
template <typename F> struct ConvertTraitsDispatcher<4, 2, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_block_dim_y = 8 };
enum { smart_shift = 4 };
};
template <typename F> struct ConvertTraitsDispatcher<4, 4, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_block_dim_y = 8 };
enum { smart_shift = 2 };
};
template <typename F> struct ConvertTraits : ConvertTraitsDispatcher<sizeof(typename F::argument_type), sizeof(typename F::result_type), F>
{
};
}
template <typename T, typename D> struct TransformFunctorTraits< Convertor<T, D> > : detail::ConvertTraits< Convertor<T, D> >
{
};
template<typename T, typename D>
void cvt_(PtrStepSzb src, PtrStepSzb dst, double alpha, double beta, cudaStream_t stream)
{
cudaSafeCall( cudaSetDoubleForDevice(&alpha) );
cudaSafeCall( cudaSetDoubleForDevice(&beta) );
Convertor<T, D> op(alpha, beta);
cv::gpu::device::transform((PtrStepSz<T>)src, (PtrStepSz<D>)dst, op, WithOutMask(), stream);
}
#if defined __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wmissing-declarations"
#endif
void convert_gpu(PtrStepSzb src, int sdepth, PtrStepSzb dst, int ddepth, double alpha, double beta, cudaStream_t stream)
{
typedef void (*caller_t)(PtrStepSzb src, PtrStepSzb dst, double alpha, double beta, cudaStream_t stream);
static const caller_t tab[8][8] =
{
{cvt_<uchar, uchar>, cvt_<uchar, schar>, cvt_<uchar, ushort>, cvt_<uchar, short>,
cvt_<uchar, int>, cvt_<uchar, float>, cvt_<uchar, double>, 0},
{cvt_<schar, uchar>, cvt_<schar, schar>, cvt_<schar, ushort>, cvt_<schar, short>,
cvt_<schar, int>, cvt_<schar, float>, cvt_<schar, double>, 0},
{cvt_<ushort, uchar>, cvt_<ushort, schar>, cvt_<ushort, ushort>, cvt_<ushort, short>,
cvt_<ushort, int>, cvt_<ushort, float>, cvt_<ushort, double>, 0},
{cvt_<short, uchar>, cvt_<short, schar>, cvt_<short, ushort>, cvt_<short, short>,
cvt_<short, int>, cvt_<short, float>, cvt_<short, double>, 0},
{cvt_<int, uchar>, cvt_<int, schar>, cvt_<int, ushort>,
cvt_<int, short>, cvt_<int, int>, cvt_<int, float>, cvt_<int, double>, 0},
{cvt_<float, uchar>, cvt_<float, schar>, cvt_<float, ushort>,
cvt_<float, short>, cvt_<float, int>, cvt_<float, float>, cvt_<float, double>, 0},
{cvt_<double, uchar>, cvt_<double, schar>, cvt_<double, ushort>,
cvt_<double, short>, cvt_<double, int>, cvt_<double, float>, cvt_<double, double>, 0},
{0,0,0,0,0,0,0,0}
};
caller_t func = tab[sdepth][ddepth];
if (!func)
cv::gpu::error("Unsupported convert operation", __FILE__, __LINE__, "convert_gpu");
func(src, dst, alpha, beta, stream);
}
#if defined __clang__
# pragma clang diagnostic pop
#endif
}}} // namespace cv { namespace gpu { namespace device
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "opencv2/gpu/device/saturate_cast.hpp"
#include "opencv2/gpu/device/transform.hpp"
#include "opencv2/gpu/device/functional.hpp"
namespace cv { namespace gpu { namespace device
{
void writeScalar(const uchar*);
void writeScalar(const schar*);
void writeScalar(const ushort*);
void writeScalar(const short int*);
void writeScalar(const int*);
void writeScalar(const float*);
void writeScalar(const double*);
void convert_gpu(PtrStepSzb, int, PtrStepSzb, int, double, double, cudaStream_t);
}}}
namespace cv { namespace gpu { namespace device
{
template <typename T> struct shift_and_sizeof;
template <> struct shift_and_sizeof<signed char> { enum { shift = 0 }; };
template <> struct shift_and_sizeof<unsigned char> { enum { shift = 0 }; };
template <> struct shift_and_sizeof<short> { enum { shift = 1 }; };
template <> struct shift_and_sizeof<unsigned short> { enum { shift = 1 }; };
template <> struct shift_and_sizeof<int> { enum { shift = 2 }; };
template <> struct shift_and_sizeof<float> { enum { shift = 2 }; };
template <> struct shift_and_sizeof<double> { enum { shift = 3 }; };
///////////////////////////////////////////////////////////////////////////
////////////////////////////////// CopyTo /////////////////////////////////
///////////////////////////////////////////////////////////////////////////
template <typename T> void copyToWithMask(PtrStepSzb src, PtrStepSzb dst, int cn, PtrStepSzb mask, bool colorMask, cudaStream_t stream)
{
if (colorMask)
cv::gpu::device::transform((PtrStepSz<T>)src, (PtrStepSz<T>)dst, identity<T>(), SingleMask(mask), stream);
else
cv::gpu::device::transform((PtrStepSz<T>)src, (PtrStepSz<T>)dst, identity<T>(), SingleMaskChannels(mask, cn), stream);
}
void copyToWithMask_gpu(PtrStepSzb src, PtrStepSzb dst, size_t elemSize1, int cn, PtrStepSzb mask, bool colorMask, cudaStream_t stream)
{
typedef void (*func_t)(PtrStepSzb src, PtrStepSzb dst, int cn, PtrStepSzb mask, bool colorMask, cudaStream_t stream);
static func_t tab[] =
{
0,
copyToWithMask<unsigned char>,
copyToWithMask<unsigned short>,
0,
copyToWithMask<int>,
0,
0,
0,
copyToWithMask<double>
};
tab[elemSize1](src, dst, cn, mask, colorMask, stream);
}
///////////////////////////////////////////////////////////////////////////
////////////////////////////////// SetTo //////////////////////////////////
///////////////////////////////////////////////////////////////////////////
__constant__ uchar scalar_8u[4];
__constant__ schar scalar_8s[4];
__constant__ ushort scalar_16u[4];
__constant__ short scalar_16s[4];
__constant__ int scalar_32s[4];
__constant__ float scalar_32f[4];
__constant__ double scalar_64f[4];
template <typename T> __device__ __forceinline__ T readScalar(int i);
template <> __device__ __forceinline__ uchar readScalar<uchar>(int i) {return scalar_8u[i];}
template <> __device__ __forceinline__ schar readScalar<schar>(int i) {return scalar_8s[i];}
template <> __device__ __forceinline__ ushort readScalar<ushort>(int i) {return scalar_16u[i];}
template <> __device__ __forceinline__ short readScalar<short>(int i) {return scalar_16s[i];}
template <> __device__ __forceinline__ int readScalar<int>(int i) {return scalar_32s[i];}
template <> __device__ __forceinline__ float readScalar<float>(int i) {return scalar_32f[i];}
template <> __device__ __forceinline__ double readScalar<double>(int i) {return scalar_64f[i];}
void writeScalar(const uchar* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_8u, vals, sizeof(uchar) * 4) );
}
void writeScalar(const schar* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_8s, vals, sizeof(schar) * 4) );
}
void writeScalar(const ushort* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_16u, vals, sizeof(ushort) * 4) );
}
void writeScalar(const short* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_16s, vals, sizeof(short) * 4) );
}
void writeScalar(const int* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_32s, vals, sizeof(int) * 4) );
}
void writeScalar(const float* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_32f, vals, sizeof(float) * 4) );
}
void writeScalar(const double* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_64f, vals, sizeof(double) * 4) );
}
template<typename T>
__global__ void set_to_without_mask(T* mat, int cols, int rows, size_t step, int channels)
{
size_t x = blockIdx.x * blockDim.x + threadIdx.x;
size_t y = blockIdx.y * blockDim.y + threadIdx.y;
if ((x < cols * channels ) && (y < rows))
{
size_t idx = y * ( step >> shift_and_sizeof<T>::shift ) + x;
mat[idx] = readScalar<T>(x % channels);
}
}
template<typename T>
__global__ void set_to_with_mask(T* mat, const uchar* mask, int cols, int rows, size_t step, int channels, size_t step_mask)
{
size_t x = blockIdx.x * blockDim.x + threadIdx.x;
size_t y = blockIdx.y * blockDim.y + threadIdx.y;
if ((x < cols * channels ) && (y < rows))
if (mask[y * step_mask + x / channels] != 0)
{
size_t idx = y * ( step >> shift_and_sizeof<T>::shift ) + x;
mat[idx] = readScalar<T>(x % channels);
}
}
template <typename T>
void set_to_gpu(PtrStepSzb mat, const T* scalar, PtrStepSzb mask, int channels, cudaStream_t stream)
{
writeScalar(scalar);
dim3 threadsPerBlock(32, 8, 1);
dim3 numBlocks (mat.cols * channels / threadsPerBlock.x + 1, mat.rows / threadsPerBlock.y + 1, 1);
set_to_with_mask<T><<<numBlocks, threadsPerBlock, 0, stream>>>((T*)mat.data, (uchar*)mask.data, mat.cols, mat.rows, mat.step, channels, mask.step);
cudaSafeCall( cudaGetLastError() );
if (stream == 0)
cudaSafeCall ( cudaDeviceSynchronize() );
}
template void set_to_gpu<uchar >(PtrStepSzb mat, const uchar* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template void set_to_gpu<schar >(PtrStepSzb mat, const schar* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template void set_to_gpu<ushort>(PtrStepSzb mat, const ushort* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template void set_to_gpu<short >(PtrStepSzb mat, const short* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template void set_to_gpu<int >(PtrStepSzb mat, const int* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template void set_to_gpu<float >(PtrStepSzb mat, const float* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template void set_to_gpu<double>(PtrStepSzb mat, const double* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
template <typename T>
void set_to_gpu(PtrStepSzb mat, const T* scalar, int channels, cudaStream_t stream)
{
writeScalar(scalar);
dim3 threadsPerBlock(32, 8, 1);
dim3 numBlocks (mat.cols * channels / threadsPerBlock.x + 1, mat.rows / threadsPerBlock.y + 1, 1);
set_to_without_mask<T><<<numBlocks, threadsPerBlock, 0, stream>>>((T*)mat.data, mat.cols, mat.rows, mat.step, channels);
cudaSafeCall( cudaGetLastError() );
if (stream == 0)
cudaSafeCall ( cudaDeviceSynchronize() );
}
template void set_to_gpu<uchar >(PtrStepSzb mat, const uchar* scalar, int channels, cudaStream_t stream);
template void set_to_gpu<schar >(PtrStepSzb mat, const schar* scalar, int channels, cudaStream_t stream);
template void set_to_gpu<ushort>(PtrStepSzb mat, const ushort* scalar, int channels, cudaStream_t stream);
template void set_to_gpu<short >(PtrStepSzb mat, const short* scalar, int channels, cudaStream_t stream);
template void set_to_gpu<int >(PtrStepSzb mat, const int* scalar, int channels, cudaStream_t stream);
template void set_to_gpu<float >(PtrStepSzb mat, const float* scalar, int channels, cudaStream_t stream);
template void set_to_gpu<double>(PtrStepSzb mat, const double* scalar, int channels, cudaStream_t stream);
///////////////////////////////////////////////////////////////////////////
//////////////////////////////// ConvertTo ////////////////////////////////
///////////////////////////////////////////////////////////////////////////
template <typename T, typename D> struct Convertor : unary_function<T, D>
{
Convertor(double alpha_, double beta_) : alpha(alpha_), beta(beta_) {}
__device__ __forceinline__ D operator()(const T& src) const
{
return saturate_cast<D>(alpha * src + beta);
}
double alpha, beta;
};
namespace detail
{
template <size_t src_size, size_t dst_size, typename F> struct ConvertTraitsDispatcher : DefaultTransformFunctorTraits<F>
{
};
template <typename F> struct ConvertTraitsDispatcher<1, 1, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_shift = 8 };
};
template <typename F> struct ConvertTraitsDispatcher<1, 2, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_shift = 4 };
};
template <typename F> struct ConvertTraitsDispatcher<1, 4, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_block_dim_y = 8 };
enum { smart_shift = 4 };
};
template <typename F> struct ConvertTraitsDispatcher<2, 2, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_shift = 4 };
};
template <typename F> struct ConvertTraitsDispatcher<2, 4, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_shift = 2 };
};
template <typename F> struct ConvertTraitsDispatcher<4, 2, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_block_dim_y = 8 };
enum { smart_shift = 4 };
};
template <typename F> struct ConvertTraitsDispatcher<4, 4, F> : DefaultTransformFunctorTraits<F>
{
enum { smart_block_dim_y = 8 };
enum { smart_shift = 2 };
};
template <typename F> struct ConvertTraits : ConvertTraitsDispatcher<sizeof(typename F::argument_type), sizeof(typename F::result_type), F>
{
};
}
template <typename T, typename D> struct TransformFunctorTraits< Convertor<T, D> > : detail::ConvertTraits< Convertor<T, D> >
{
};
template<typename T, typename D>
void cvt_(PtrStepSzb src, PtrStepSzb dst, double alpha, double beta, cudaStream_t stream)
{
cudaSafeCall( cudaSetDoubleForDevice(&alpha) );
cudaSafeCall( cudaSetDoubleForDevice(&beta) );
Convertor<T, D> op(alpha, beta);
cv::gpu::device::transform((PtrStepSz<T>)src, (PtrStepSz<D>)dst, op, WithOutMask(), stream);
}
#if defined __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wmissing-declarations"
#endif
void convert_gpu(PtrStepSzb src, int sdepth, PtrStepSzb dst, int ddepth, double alpha, double beta, cudaStream_t stream)
{
typedef void (*caller_t)(PtrStepSzb src, PtrStepSzb dst, double alpha, double beta, cudaStream_t stream);
static const caller_t tab[8][8] =
{
{cvt_<uchar, uchar>, cvt_<uchar, schar>, cvt_<uchar, ushort>, cvt_<uchar, short>,
cvt_<uchar, int>, cvt_<uchar, float>, cvt_<uchar, double>, 0},
{cvt_<schar, uchar>, cvt_<schar, schar>, cvt_<schar, ushort>, cvt_<schar, short>,
cvt_<schar, int>, cvt_<schar, float>, cvt_<schar, double>, 0},
{cvt_<ushort, uchar>, cvt_<ushort, schar>, cvt_<ushort, ushort>, cvt_<ushort, short>,
cvt_<ushort, int>, cvt_<ushort, float>, cvt_<ushort, double>, 0},
{cvt_<short, uchar>, cvt_<short, schar>, cvt_<short, ushort>, cvt_<short, short>,
cvt_<short, int>, cvt_<short, float>, cvt_<short, double>, 0},
{cvt_<int, uchar>, cvt_<int, schar>, cvt_<int, ushort>,
cvt_<int, short>, cvt_<int, int>, cvt_<int, float>, cvt_<int, double>, 0},
{cvt_<float, uchar>, cvt_<float, schar>, cvt_<float, ushort>,
cvt_<float, short>, cvt_<float, int>, cvt_<float, float>, cvt_<float, double>, 0},
{cvt_<double, uchar>, cvt_<double, schar>, cvt_<double, ushort>,
cvt_<double, short>, cvt_<double, int>, cvt_<double, float>, cvt_<double, double>, 0},
{0,0,0,0,0,0,0,0}
};
caller_t func = tab[sdepth][ddepth];
if (!func)
cv::gpu::error("Unsupported convert operation", __FILE__, __LINE__, "convert_gpu");
func(src, dst, alpha, beta, stream);
}
#if defined __clang__
# pragma clang diagnostic pop
#endif
}}} // namespace cv { namespace gpu { namespace device
+49 -49
View File
@@ -140,11 +140,11 @@ bool clipLine( Rect img_rect, Point& pt1, Point& pt2 )
pt1 -= tl; pt2 -= tl;
bool inside = clipLine(img_rect.size(), pt1, pt2);
pt1 += tl; pt2 += tl;
return inside;
}
/*
/*
Initializes line iterator.
Returns number of points on the line or negative number if error.
*/
@@ -195,7 +195,7 @@ LineIterator::LineIterator(const Mat& img, Point pt1, Point pt2,
istep = (istep ^ s) - s;
s = dy > dx ? -1 : 0;
/* conditional swaps */
dx ^= dy & s;
dy ^= dx & s;
@@ -208,7 +208,7 @@ LineIterator::LineIterator(const Mat& img, Point pt1, Point pt2,
if( connectivity == 8 )
{
assert( dx >= 0 && dy >= 0 );
err = dx - (dy + dy);
plusDelta = dx + dx;
minusDelta = -(dy + dy);
@@ -219,7 +219,7 @@ LineIterator::LineIterator(const Mat& img, Point pt1, Point pt2,
else /* connectivity == 4 */
{
assert( dx >= 0 && dy >= 0 );
err = 0;
plusDelta = (dx + dx) + (dy + dy);
minusDelta = -(dy + dy);
@@ -227,7 +227,7 @@ LineIterator::LineIterator(const Mat& img, Point pt1, Point pt2,
minusStep = bt_pix;
count = dx + dy + 1;
}
this->ptr0 = img.data;
this->step = (int)img.step;
this->elemSize = bt_pix0;
@@ -621,10 +621,10 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
tptr[1] = (uchar)cg; \
tptr[2] = (uchar)cr; \
}
ICV_PUT_POINT((pt2.x + (XY_ONE >> 1)) >> XY_SHIFT,
(pt2.y + (XY_ONE >> 1)) >> XY_SHIFT);
(pt2.y + (XY_ONE >> 1)) >> XY_SHIFT);
if( ax > ay )
{
pt1.x >>= XY_SHIFT;
@@ -640,7 +640,7 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
else
{
pt1.y >>= XY_SHIFT;
while( ecount >= 0 )
{
ICV_PUT_POINT(pt1.x >> XY_SHIFT, pt1.y);
@@ -664,8 +664,8 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
}
ICV_PUT_POINT((pt2.x + (XY_ONE >> 1)) >> XY_SHIFT,
(pt2.y + (XY_ONE >> 1)) >> XY_SHIFT);
(pt2.y + (XY_ONE >> 1)) >> XY_SHIFT);
if( ax > ay )
{
pt1.x >>= XY_SHIFT;
@@ -681,7 +681,7 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
else
{
pt1.y >>= XY_SHIFT;
while( ecount >= 0 )
{
ICV_PUT_POINT(pt1.x >> XY_SHIFT, pt1.y);
@@ -690,7 +690,7 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
ecount--;
}
}
#undef ICV_PUT_POINT
}
else
@@ -706,12 +706,12 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
}
ICV_PUT_POINT((pt2.x + (XY_ONE >> 1)) >> XY_SHIFT,
(pt2.y + (XY_ONE >> 1)) >> XY_SHIFT);
(pt2.y + (XY_ONE >> 1)) >> XY_SHIFT);
if( ax > ay )
{
pt1.x >>= XY_SHIFT;
while( ecount >= 0 )
{
ICV_PUT_POINT(pt1.x, pt1.y >> XY_SHIFT);
@@ -723,7 +723,7 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
else
{
pt1.y >>= XY_SHIFT;
while( ecount >= 0 )
{
ICV_PUT_POINT(pt1.x >> XY_SHIFT, pt1.y);
@@ -732,7 +732,7 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
ecount--;
}
}
#undef ICV_PUT_POINT
}
}
@@ -830,7 +830,7 @@ sincos( int angle, float& cosval, float& sinval )
cosval = SinTable[450 - angle];
}
/*
/*
constructs polygon that represents elliptic arc.
*/
void ellipse2Poly( Point center, Size axes, int angle,
@@ -880,7 +880,7 @@ void ellipse2Poly( Point center, Size axes, int angle,
angle = arc_end;
if( angle < 0 )
angle += 360;
x = size_a * SinTable[450-angle];
y = size_b * SinTable[angle];
Point pt;
@@ -922,7 +922,7 @@ EllipseEx( Mat& img, Point center, Size axes,
/****************************************************************************************\
* Polygons filling *
* Polygons filling *
\****************************************************************************************/
/* helper macros: filling horizontal row */
@@ -1010,7 +1010,7 @@ FillConvexPoly( Mat& img, const Point* v, int npts, const void* color, int line_
LineAA( img, p0, p, color );
p0 = p;
}
xmin = (xmin + delta) >> shift;
xmax = (xmax + delta) >> shift;
ymin = (ymin + delta) >> shift;
@@ -1118,7 +1118,7 @@ CollectPolyEdges( Mat& img, const Point* v, int count, vector<PolyEdge>& edges,
{
Point t0, t1;
PolyEdge edge;
pt1 = v[i];
pt1.x = (pt1.x + offset.x) << (XY_SHIFT - shift);
pt1.y = (pt1.y + delta) >> shift;
@@ -1337,7 +1337,7 @@ Circle( Mat& img, Point center, int radius, const void* color, int fill )
{
uchar *tptr0 = ptr + y11 * step;
uchar *tptr1 = ptr + y12 * step;
if( !fill )
{
ICV_PUT_POINT( tptr0, x11 );
@@ -1374,7 +1374,7 @@ Circle( Mat& img, Point center, int radius, const void* color, int fill )
x11 = std::max( x11, 0 );
x12 = MIN( x12, size.width - 1 );
}
if( (unsigned)y11 < (unsigned)size.height )
{
uchar *tptr = ptr + y11 * step;
@@ -1523,7 +1523,7 @@ ThickLine( Mat& img, Point p0, Point p1, const void* color,
Point center;
center.x = (p0.x + (XY_ONE>>1)) >> XY_SHIFT;
center.y = (p0.y + (XY_ONE>>1)) >> XY_SHIFT;
Circle( img, center, (thickness + (XY_ONE>>1)) >> XY_SHIFT, color, 1 );
Circle( img, center, (thickness + (XY_ONE>>1)) >> XY_SHIFT, color, 1 );
}
else
{
@@ -1544,7 +1544,7 @@ PolyLine( Mat& img, const Point* v, int count, bool is_closed,
{
if( !v || count <= 0 )
return;
int i = is_closed ? count - 1 : 0;
int flags = 2 + !is_closed;
Point p0;
@@ -1575,7 +1575,7 @@ void line( Mat& img, Point pt1, Point pt2, const Scalar& color,
double buf[4];
scalarToRawData( color, buf, img.type(), 0 );
ThickLine( img, pt1, pt2, buf, thickness, line_type, 3, shift );
ThickLine( img, pt1, pt2, buf, thickness, line_type, 3, shift );
}
void rectangle( Mat& img, Point pt1, Point pt2,
@@ -1606,7 +1606,7 @@ void rectangle( Mat& img, Point pt1, Point pt2,
FillConvexPoly( img, pt, 4, buf, lineType, shift );
}
void rectangle( Mat& img, Rect rec,
const Scalar& color, int thickness,
int lineType, int shift )
@@ -1617,7 +1617,7 @@ void rectangle( Mat& img, Rect rec,
color, thickness, lineType, shift );
}
void circle( Mat& img, Point center, int radius,
const Scalar& color, int thickness, int line_type, int shift )
{
@@ -1667,25 +1667,25 @@ void ellipse( Mat& img, Point center, Size axes,
EllipseEx( img, center, axes, _angle, _start_angle,
_end_angle, buf, thickness, line_type );
}
void ellipse(Mat& img, const RotatedRect& box, const Scalar& color,
int thickness, int lineType)
{
if( lineType == CV_AA && img.depth() != CV_8U )
lineType = 8;
CV_Assert( box.size.width >= 0 && box.size.height >= 0 &&
thickness <= 255 );
double buf[4];
scalarToRawData(color, buf, img.type(), 0);
int _angle = cvRound(box.angle);
Point center(cvRound(box.center.x*(1 << XY_SHIFT)),
cvRound(box.center.y*(1 << XY_SHIFT)));
Size axes(cvRound(box.size.width*(1 << (XY_SHIFT - 1))),
cvRound(box.size.height*(1 << (XY_SHIFT - 1))));
EllipseEx( img, center, axes, _angle, 0, 360, buf, thickness, lineType );
EllipseEx( img, center, axes, _angle, 0, 360, buf, thickness, lineType );
}
void fillConvexPoly( Mat& img, const Point* pts, int npts,
@@ -1875,12 +1875,12 @@ static const int HersheyScriptComplex[] = {
2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676,
2225, 2229, 2226, 2246 };
static const int* getFontData(int fontFace)
{
bool isItalic = (fontFace & FONT_ITALIC) != 0;
const int* ascii = 0;
switch( fontFace & 15 )
{
case FONT_HERSHEY_SIMPLEX:
@@ -1912,15 +1912,15 @@ static const int* getFontData(int fontFace)
}
return ascii;
}
void putText( Mat& img, const string& text, Point org,
int fontFace, double fontScale, Scalar color,
int thickness, int line_type, bool bottomLeftOrigin )
{
const int* ascii = getFontData(fontFace);
double buf[4];
scalarToRawData(color, buf, img.type(), 0);
@@ -1959,7 +1959,7 @@ void putText( Mat& img, const string& text, Point org,
if( *ptr == ' ' || !*ptr )
{
if( pts.size() > 1 )
PolyLine( img, &pts[0], (int)pts.size(), false, buf, thickness, line_type, XY_SHIFT );
PolyLine( img, &pts[0], (int)pts.size(), false, buf, thickness, line_type, XY_SHIFT );
if( !*ptr++ )
break;
pts.resize(0);
@@ -2030,7 +2030,7 @@ void cv::fillPoly(InputOutputArray _img, InputArrayOfArrays pts,
AutoBuffer<int> _npts(ncontours);
Point** ptsptr = _ptsptr;
int* npts = _npts;
for( i = 0; i < ncontours; i++ )
{
Mat p = pts.getMat(i);
@@ -2056,7 +2056,7 @@ void cv::polylines(InputOutputArray _img, InputArrayOfArrays pts,
AutoBuffer<int> _npts(ncontours);
Point** ptsptr = _ptsptr;
int* npts = _npts;
for( i = 0; i < ncontours; i++ )
{
Mat p = pts.getMat(manyContours ? i : -1);
@@ -2078,7 +2078,7 @@ static const int CodeDeltas[8][2] =
CV_IMPL void
cvDrawContours( void* _img, CvSeq* contour,
CvScalar _externalColor, CvScalar _holeColor,
CvScalar _externalColor, CvScalar _holeColor,
int maxLevel, int thickness,
int line_type, CvPoint _offset )
{
@@ -2104,7 +2104,7 @@ cvDrawContours( void* _img, CvSeq* contour,
maxLevel = MAX(maxLevel, INT_MIN+2);
maxLevel = MIN(maxLevel, INT_MAX-1);
if( maxLevel < 0 )
{
h_next = contour->h_next;
@@ -2148,7 +2148,7 @@ cvDrawContours( void* _img, CvSeq* contour,
pts.push_back(pt);
prev_pt = pt;
}
pt.x += CodeDeltas[(int)code][0];
pt.y += CodeDeltas[(int)code][1];
}
@@ -2166,7 +2166,7 @@ cvDrawContours( void* _img, CvSeq* contour,
CV_Assert( elem_type == CV_32SC2 );
cv::Point pt1, pt2;
int shift = 0;
count -= !CV_IS_SEQ_CLOSED(contour);
CV_READ_SEQ_ELEM( pt1, reader );
pt1 += offset;
@@ -2218,7 +2218,7 @@ CV_IMPL CvScalar
cvColorToScalar( double packed_color, int type )
{
CvScalar scalar;
if( CV_MAT_DEPTH( type ) == CV_8U )
{
int icolor = cvRound( packed_color );
+224 -224
View File
@@ -128,7 +128,7 @@ DFTFactorize( int n, int* factors )
factors[0] = n;
return 1;
}
f = (((n - 1)^n)+1) >> 1;
if( f > 1 )
{
@@ -176,7 +176,7 @@ DFTInit( int n0, int nf, int* factors, int* itab, int elem_size, void* _wave, in
{
itab[0] = 0;
itab[n0-1] = n0-1;
if( n0 != 4 )
{
for( i = 1; i < n0-1; i++ )
@@ -338,7 +338,7 @@ DFTInit( int n0, int nf, int* factors, int* itab, int elem_size, void* _wave, in
{
Complex<float>* wave = (Complex<float>*)_wave;
assert( elem_size == sizeof(Complex<float>) );
wave[0].re = 1.f;
wave[0].im = 0.f;
@@ -379,25 +379,25 @@ template<> struct DFT_VecR4<float>
Cv32suf t; t.i = 0x80000000;
__m128 neg0_mask = _mm_load_ss(&t.f);
__m128 neg3_mask = _mm_shuffle_ps(neg0_mask, neg0_mask, _MM_SHUFFLE(0,1,2,3));
for( ; n*4 <= N; )
{
nx = n;
n *= 4;
dw0 /= 4;
for( i = 0; i < n0; i += n )
{
Complexf *v0, *v1;
v0 = dst + i;
v1 = v0 + nx*2;
x02 = _mm_loadl_pi(x02, (const __m64*)&v0[0]);
x13 = _mm_loadl_pi(x13, (const __m64*)&v0[nx]);
x02 = _mm_loadh_pi(x02, (const __m64*)&v1[0]);
x13 = _mm_loadh_pi(x13, (const __m64*)&v1[nx]);
y01 = _mm_add_ps(x02, x13);
y23 = _mm_sub_ps(x02, x13);
t1 = _mm_xor_ps(_mm_shuffle_ps(y01, y23, _MM_SHUFFLE(2,3,3,2)), neg3_mask);
@@ -409,7 +409,7 @@ template<> struct DFT_VecR4<float>
_mm_storeh_pi((__m64*)&v0[nx], y01);
_mm_storel_pi((__m64*)&v1[0], y23);
_mm_storeh_pi((__m64*)&v1[nx], y23);
for( j = 1, dw = dw0; j < nx; j++, dw += dw0 )
{
v0 = dst + i + j;
@@ -419,7 +419,7 @@ template<> struct DFT_VecR4<float>
w23 = _mm_loadl_pi(w23, (const __m64*)&wave[dw*2]);
x13 = _mm_loadh_pi(x13, (const __m64*)&v1[nx]); // x1, x3 = r1 i1 r3 i3
w23 = _mm_loadh_pi(w23, (const __m64*)&wave[dw*3]); // w2, w3 = wr2 wi2 wr3 wi3
t0 = _mm_mul_ps(_mm_moveldup_ps(x13), w23);
t1 = _mm_mul_ps(_mm_movehdup_ps(x13), _mm_shuffle_ps(w23, w23, _MM_SHUFFLE(2,3,0,1)));
x13 = _mm_addsub_ps(t0, t1);
@@ -432,7 +432,7 @@ template<> struct DFT_VecR4<float>
x02 = _mm_addsub_ps(x02, _mm_movelh_ps(x02, x02));
// re(x0) im(x0) re(x2*w1), im(x2*w1)
x02 = _mm_loadl_pi(x02, (const __m64*)&v0[0]);
y01 = _mm_add_ps(x02, x13);
y23 = _mm_sub_ps(x02, x13);
t1 = _mm_xor_ps(_mm_shuffle_ps(y01, y23, _MM_SHUFFLE(2,3,3,2)), neg3_mask);
@@ -447,7 +447,7 @@ template<> struct DFT_VecR4<float>
}
}
}
_dw0 = dw0;
return n;
}
@@ -460,52 +460,52 @@ static void ippsDFTFwd_CToC( const Complex<float>* src, Complex<float>* dst,
const void* spec, uchar* buf)
{
ippsDFTFwd_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst,
(const IppsDFTSpec_C_32fc*)spec, buf);
(const IppsDFTSpec_C_32fc*)spec, buf);
}
static void ippsDFTFwd_CToC( const Complex<double>* src, Complex<double>* dst,
const void* spec, uchar* buf)
{
ippsDFTFwd_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst,
(const IppsDFTSpec_C_64fc*)spec, buf);
(const IppsDFTSpec_C_64fc*)spec, buf);
}
static void ippsDFTInv_CToC( const Complex<float>* src, Complex<float>* dst,
const void* spec, uchar* buf)
{
ippsDFTInv_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst,
(const IppsDFTSpec_C_32fc*)spec, buf);
(const IppsDFTSpec_C_32fc*)spec, buf);
}
static void ippsDFTInv_CToC( const Complex<double>* src, Complex<double>* dst,
const void* spec, uchar* buf)
{
ippsDFTInv_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst,
(const IppsDFTSpec_C_64fc*)spec, buf);
(const IppsDFTSpec_C_64fc*)spec, buf);
}
static void ippsDFTFwd_RToPack( const float* src, float* dst,
const void* spec, uchar* buf)
{
ippsDFTFwd_RToPack_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf);
ippsDFTFwd_RToPack_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf);
}
static void ippsDFTFwd_RToPack( const double* src, double* dst,
const void* spec, uchar* buf)
{
ippsDFTFwd_RToPack_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf);
ippsDFTFwd_RToPack_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf);
}
static void ippsDFTInv_PackToR( const float* src, float* dst,
const void* spec, uchar* buf)
{
ippsDFTInv_PackToR_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf);
ippsDFTInv_PackToR_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf);
}
static void ippsDFTInv_PackToR( const double* src, double* dst,
const void* spec, uchar* buf)
{
ippsDFTInv_PackToR_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf);
ippsDFTInv_PackToR_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf);
}
#endif
@@ -596,7 +596,7 @@ DFT( const Complex<T>* src, Complex<T>* dst, int n,
{
int n2 = n/2;
Complex<T>* dsth = dst + n2;
for( i = 0; i < n2; i += 2, itab += tab_step*2 )
{
j = itab[0];
@@ -647,7 +647,7 @@ DFT( const Complex<T>* src, Complex<T>* dst, int n,
DFT_VecR4<T> vr4;
n = vr4(dst, factors[0], n0, dw0, wave);
}
// radix-4 transform
for( ; n*4 <= factors[0]; )
{
@@ -671,7 +671,7 @@ DFT( const Complex<T>* src, Complex<T>* dst, int n,
r2 = v0[0].re; i2 = v0[0].im;
r4 = v0[nx].re; i4 = v0[nx].im;
r0 = r2 + r4; i0 = i2 + i4;
r2 -= r4; i2 -= i4;
@@ -772,7 +772,7 @@ DFT( const Complex<T>* src, Complex<T>* dst, int n,
i2 = v[nx*2].re*wave[dw*2].re - v[nx*2].im*wave[dw*2].im;
r2 = v[nx*2].re*wave[dw*2].im + v[nx*2].im*wave[dw*2].re;
r1 = r0 + i2; i1 = i0 + r2;
r2 = sin_120*(i0 - r2); i2 = sin_120*(i2 - r0);
r0 = v[0].re; i0 = v[0].im;
v[0].re = r0 + r1; v[0].im = i0 + i1;
@@ -825,7 +825,7 @@ DFT( const Complex<T>* src, Complex<T>* dst, int n,
r5 = r2 + i3; i5 = i2 + r3;
r2 -= i4; i2 -= r4;
r3 = r0 + r1; i3 = i0 + i1;
r0 -= r1; i0 -= i1;
@@ -879,7 +879,7 @@ DFT( const Complex<T>* src, Complex<T>* dst, int n,
T r1 = v[n-k].re*wave_[-d].re - v[n-k].im*wave_[-d].im;
T i1 = v[n-k].re*wave_[-d].im + v[n-k].im*wave_[-d].re;
T r0 = r2 + r1;
T i0 = i2 - i1;
r1 = r2 - r1;
@@ -904,7 +904,7 @@ DFT( const Complex<T>* src, Complex<T>* dst, int n,
T i0 = wave[d].im * a[q].im;
T r1 = wave[d].re * b[q].im;
T i1 = wave[d].im * b[q].re;
s1.re += r0 + i0; s0.re += r0 - i0;
s1.im += r1 - i1; s0.im += r1 + i1;
@@ -1416,7 +1416,7 @@ static void DFT_32f( const Complexf* src, Complexf* dst, int n,
int flags, double scale )
{
DFT(src, dst, n, nf, factors, itab, wave, tab_size, spec, buf, flags, scale);
}
}
static void DFT_64f( const Complexd* src, Complexd* dst, int n,
int nf, const int* factors, const int* itab,
@@ -1455,9 +1455,9 @@ static void CCSIDFT_64f( const double* src, double* dst, int n, int nf, int* fac
{
CCSIDFT( src, dst, n, nf, factors, itab, wave, tab_size, spec, buf, flags, scale);
}
}
void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
{
@@ -1473,7 +1473,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
AutoBuffer<uchar> buf;
void *spec = 0;
Mat src0 = _src0.getMat(), src = src0;
int prev_len = 0, stage = 0;
bool inv = (flags & DFT_INVERSE) != 0;
@@ -1495,7 +1495,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
_dst.create( src.size(), depth );
else
_dst.create( src.size(), type );
Mat dst = _dst.getMat();
if( !real_transform )
@@ -1546,7 +1546,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
if( len*count >= 64 ) // use IPP DFT if available
{
int ipp_sz = 0;
if( real_transform && stage == 0 )
{
if( depth == CV_32F )
@@ -1667,7 +1667,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
if( tmp_buf )
dptr = tmp_buf;
dft_func( sptr, dptr, len, nf, factors, itab, wave, len, spec, ptr, _flags, scale );
if( dptr != dptr0 )
memcpy( dptr0, dptr + dptr_offset, dst_full_len );
@@ -1694,7 +1694,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
buf1 = ptr;
ptr += len*complex_elem_size;
dbuf0 = buf0, dbuf1 = buf1;
if( use_buf )
{
dbuf1 = ptr;
@@ -1749,7 +1749,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
}
sptr0 += complex_elem_size;
}
if( even )
dft_func( buf1, dbuf1, len, nf, factors, itab,
wave, len, spec, ptr, inv, scale );
@@ -1832,7 +1832,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
{
float* p = p0 + dstep*i;
float* q = i == 0 || i*2 == len ? p : p0 + dstep*(len-i);
for( int j = 1; j < (n+1)/2; j++ )
{
p[(n-j)*2] = q[j*2];
@@ -1848,7 +1848,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
{
double* p = p0 + dstep*i;
double* q = i == 0 || i*2 == len ? p : p0 + dstep*(len-i);
for( int j = 1; j < (n+1)/2; j++ )
{
p[(n-j)*2] = q[j*2];
@@ -1901,7 +1901,7 @@ void cv::mulSpectrums( InputArray _srcA, InputArray _srcB,
_dst.create( srcA.rows, srcA.cols, type );
Mat dst = _dst.getMat();
bool is_1d = (flags & DFT_ROWS) || (rows == 1 || (cols == 1 &&
srcA.isContinuous() && srcB.isContinuous() && dst.isContinuous()));
@@ -2163,7 +2163,7 @@ DCTInit( int n, int elem_size, void* _wave, int inv )
int i;
Complex<double> w, w1;
double t, scale;
if( n == 1 )
return;
@@ -2186,7 +2186,7 @@ DCTInit( int n, int elem_size, void* _wave, int inv )
w1.re = std::sqrt(1. - w1.im*w1.im);
}
n >>= 1;
if( elem_size == sizeof(Complex<double>) )
{
Complex<double>* wave = (Complex<double>*)_wave;
@@ -2206,7 +2206,7 @@ DCTInit( int n, int elem_size, void* _wave, int inv )
{
Complex<float>* wave = (Complex<float>*)_wave;
assert( elem_size == sizeof(Complex<float>) );
w.re = (float)scale;
w.im = 0.f;
@@ -2257,10 +2257,10 @@ static void IDCT_64f(const double* src, int src_step, double* dft_src, double* d
{
IDCT(src, src_step, dft_src, dft_dst, dst, dst_step,
n, nf, factors, itab, dft_wave, dct_wave, spec, buf);
}
}
}
void cv::dct( InputArray _src0, OutputArray _dst, int flags )
{
static DCTFunc dct_tbl[4] =
@@ -2308,7 +2308,7 @@ void cv::dct( InputArray _src0, OutputArray _dst, int flags )
{
uchar *sptr = src.data, *dptr = dst.data;
size_t sstep0, sstep1, dstep0, dstep1;
if( stage == 0 )
{
len = src.cols;
@@ -2389,7 +2389,7 @@ void cv::dct( InputArray _src0, OutputArray _dst, int flags )
ptr = (uchar*)cvAlignPtr( ptr + len*sizeof(int), 16 );
DFTInit( len, nf, factors, itab, complex_elem_size, dft_wave, inv );
}
dct_wave = ptr;
ptr += (len/2 + 1)*complex_elem_size;
src_dft_buf = dst_dft_buf = ptr;
@@ -2425,188 +2425,188 @@ namespace cv
{
static const int optimalDFTSizeTab[] = {
1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, 32, 36, 40, 45, 48,
50, 54, 60, 64, 72, 75, 80, 81, 90, 96, 100, 108, 120, 125, 128, 135, 144, 150, 160,
162, 180, 192, 200, 216, 225, 240, 243, 250, 256, 270, 288, 300, 320, 324, 360, 375,
384, 400, 405, 432, 450, 480, 486, 500, 512, 540, 576, 600, 625, 640, 648, 675, 720,
729, 750, 768, 800, 810, 864, 900, 960, 972, 1000, 1024, 1080, 1125, 1152, 1200,
1215, 1250, 1280, 1296, 1350, 1440, 1458, 1500, 1536, 1600, 1620, 1728, 1800, 1875,
1920, 1944, 2000, 2025, 2048, 2160, 2187, 2250, 2304, 2400, 2430, 2500, 2560, 2592,
2700, 2880, 2916, 3000, 3072, 3125, 3200, 3240, 3375, 3456, 3600, 3645, 3750, 3840,
3888, 4000, 4050, 4096, 4320, 4374, 4500, 4608, 4800, 4860, 5000, 5120, 5184, 5400,
5625, 5760, 5832, 6000, 6075, 6144, 6250, 6400, 6480, 6561, 6750, 6912, 7200, 7290,
7500, 7680, 7776, 8000, 8100, 8192, 8640, 8748, 9000, 9216, 9375, 9600, 9720, 10000,
10125, 10240, 10368, 10800, 10935, 11250, 11520, 11664, 12000, 12150, 12288, 12500,
12800, 12960, 13122, 13500, 13824, 14400, 14580, 15000, 15360, 15552, 15625, 16000,
16200, 16384, 16875, 17280, 17496, 18000, 18225, 18432, 18750, 19200, 19440, 19683,
20000, 20250, 20480, 20736, 21600, 21870, 22500, 23040, 23328, 24000, 24300, 24576,
25000, 25600, 25920, 26244, 27000, 27648, 28125, 28800, 29160, 30000, 30375, 30720,
31104, 31250, 32000, 32400, 32768, 32805, 33750, 34560, 34992, 36000, 36450, 36864,
37500, 38400, 38880, 39366, 40000, 40500, 40960, 41472, 43200, 43740, 45000, 46080,
46656, 46875, 48000, 48600, 49152, 50000, 50625, 51200, 51840, 52488, 54000, 54675,
55296, 56250, 57600, 58320, 59049, 60000, 60750, 61440, 62208, 62500, 64000, 64800,
65536, 65610, 67500, 69120, 69984, 72000, 72900, 73728, 75000, 76800, 77760, 78125,
78732, 80000, 81000, 81920, 82944, 84375, 86400, 87480, 90000, 91125, 92160, 93312,
93750, 96000, 97200, 98304, 98415, 100000, 101250, 102400, 103680, 104976, 108000,
109350, 110592, 112500, 115200, 116640, 118098, 120000, 121500, 122880, 124416, 125000,
128000, 129600, 131072, 131220, 135000, 138240, 139968, 140625, 144000, 145800, 147456,
150000, 151875, 153600, 155520, 156250, 157464, 160000, 162000, 163840, 164025, 165888,
168750, 172800, 174960, 177147, 180000, 182250, 184320, 186624, 187500, 192000, 194400,
196608, 196830, 200000, 202500, 204800, 207360, 209952, 216000, 218700, 221184, 225000,
230400, 233280, 234375, 236196, 240000, 243000, 245760, 248832, 250000, 253125, 256000,
259200, 262144, 262440, 270000, 273375, 276480, 279936, 281250, 288000, 291600, 294912,
295245, 300000, 303750, 307200, 311040, 312500, 314928, 320000, 324000, 327680, 328050,
331776, 337500, 345600, 349920, 354294, 360000, 364500, 368640, 373248, 375000, 384000,
388800, 390625, 393216, 393660, 400000, 405000, 409600, 414720, 419904, 421875, 432000,
437400, 442368, 450000, 455625, 460800, 466560, 468750, 472392, 480000, 486000, 491520,
492075, 497664, 500000, 506250, 512000, 518400, 524288, 524880, 531441, 540000, 546750,
552960, 559872, 562500, 576000, 583200, 589824, 590490, 600000, 607500, 614400, 622080,
625000, 629856, 640000, 648000, 655360, 656100, 663552, 675000, 691200, 699840, 703125,
708588, 720000, 729000, 737280, 746496, 750000, 759375, 768000, 777600, 781250, 786432,
787320, 800000, 810000, 819200, 820125, 829440, 839808, 843750, 864000, 874800, 884736,
885735, 900000, 911250, 921600, 933120, 937500, 944784, 960000, 972000, 983040, 984150,
995328, 1000000, 1012500, 1024000, 1036800, 1048576, 1049760, 1062882, 1080000, 1093500,
1105920, 1119744, 1125000, 1152000, 1166400, 1171875, 1179648, 1180980, 1200000,
1215000, 1228800, 1244160, 1250000, 1259712, 1265625, 1280000, 1296000, 1310720,
1312200, 1327104, 1350000, 1366875, 1382400, 1399680, 1406250, 1417176, 1440000,
1458000, 1474560, 1476225, 1492992, 1500000, 1518750, 1536000, 1555200, 1562500,
1572864, 1574640, 1594323, 1600000, 1620000, 1638400, 1640250, 1658880, 1679616,
1687500, 1728000, 1749600, 1769472, 1771470, 1800000, 1822500, 1843200, 1866240,
1875000, 1889568, 1920000, 1944000, 1953125, 1966080, 1968300, 1990656, 2000000,
2025000, 2048000, 2073600, 2097152, 2099520, 2109375, 2125764, 2160000, 2187000,
2211840, 2239488, 2250000, 2278125, 2304000, 2332800, 2343750, 2359296, 2361960,
2400000, 2430000, 2457600, 2460375, 2488320, 2500000, 2519424, 2531250, 2560000,
2592000, 2621440, 2624400, 2654208, 2657205, 2700000, 2733750, 2764800, 2799360,
2812500, 2834352, 2880000, 2916000, 2949120, 2952450, 2985984, 3000000, 3037500,
3072000, 3110400, 3125000, 3145728, 3149280, 3188646, 3200000, 3240000, 3276800,
3280500, 3317760, 3359232, 3375000, 3456000, 3499200, 3515625, 3538944, 3542940,
3600000, 3645000, 3686400, 3732480, 3750000, 3779136, 3796875, 3840000, 3888000,
3906250, 3932160, 3936600, 3981312, 4000000, 4050000, 4096000, 4100625, 4147200,
4194304, 4199040, 4218750, 4251528, 4320000, 4374000, 4423680, 4428675, 4478976,
4500000, 4556250, 4608000, 4665600, 4687500, 4718592, 4723920, 4782969, 4800000,
4860000, 4915200, 4920750, 4976640, 5000000, 5038848, 5062500, 5120000, 5184000,
5242880, 5248800, 5308416, 5314410, 5400000, 5467500, 5529600, 5598720, 5625000,
5668704, 5760000, 5832000, 5859375, 5898240, 5904900, 5971968, 6000000, 6075000,
6144000, 6220800, 6250000, 6291456, 6298560, 6328125, 6377292, 6400000, 6480000,
6553600, 6561000, 6635520, 6718464, 6750000, 6834375, 6912000, 6998400, 7031250,
7077888, 7085880, 7200000, 7290000, 7372800, 7381125, 7464960, 7500000, 7558272,
7593750, 7680000, 7776000, 7812500, 7864320, 7873200, 7962624, 7971615, 8000000,
8100000, 8192000, 8201250, 8294400, 8388608, 8398080, 8437500, 8503056, 8640000,
8748000, 8847360, 8857350, 8957952, 9000000, 9112500, 9216000, 9331200, 9375000,
9437184, 9447840, 9565938, 9600000, 9720000, 9765625, 9830400, 9841500, 9953280,
10000000, 10077696, 10125000, 10240000, 10368000, 10485760, 10497600, 10546875, 10616832,
10628820, 10800000, 10935000, 11059200, 11197440, 11250000, 11337408, 11390625, 11520000,
11664000, 11718750, 11796480, 11809800, 11943936, 12000000, 12150000, 12288000, 12301875,
12441600, 12500000, 12582912, 12597120, 12656250, 12754584, 12800000, 12960000, 13107200,
13122000, 13271040, 13286025, 13436928, 13500000, 13668750, 13824000, 13996800, 14062500,
14155776, 14171760, 14400000, 14580000, 14745600, 14762250, 14929920, 15000000, 15116544,
15187500, 15360000, 15552000, 15625000, 15728640, 15746400, 15925248, 15943230, 16000000,
16200000, 16384000, 16402500, 16588800, 16777216, 16796160, 16875000, 17006112, 17280000,
17496000, 17578125, 17694720, 17714700, 17915904, 18000000, 18225000, 18432000, 18662400,
18750000, 18874368, 18895680, 18984375, 19131876, 19200000, 19440000, 19531250, 19660800,
19683000, 19906560, 20000000, 20155392, 20250000, 20480000, 20503125, 20736000, 20971520,
20995200, 21093750, 21233664, 21257640, 21600000, 21870000, 22118400, 22143375, 22394880,
22500000, 22674816, 22781250, 23040000, 23328000, 23437500, 23592960, 23619600, 23887872,
23914845, 24000000, 24300000, 24576000, 24603750, 24883200, 25000000, 25165824, 25194240,
25312500, 25509168, 25600000, 25920000, 26214400, 26244000, 26542080, 26572050, 26873856,
27000000, 27337500, 27648000, 27993600, 28125000, 28311552, 28343520, 28800000, 29160000,
29296875, 29491200, 29524500, 29859840, 30000000, 30233088, 30375000, 30720000, 31104000,
31250000, 31457280, 31492800, 31640625, 31850496, 31886460, 32000000, 32400000, 32768000,
32805000, 33177600, 33554432, 33592320, 33750000, 34012224, 34171875, 34560000, 34992000,
35156250, 35389440, 35429400, 35831808, 36000000, 36450000, 36864000, 36905625, 37324800,
37500000, 37748736, 37791360, 37968750, 38263752, 38400000, 38880000, 39062500, 39321600,
39366000, 39813120, 39858075, 40000000, 40310784, 40500000, 40960000, 41006250, 41472000,
41943040, 41990400, 42187500, 42467328, 42515280, 43200000, 43740000, 44236800, 44286750,
44789760, 45000000, 45349632, 45562500, 46080000, 46656000, 46875000, 47185920, 47239200,
47775744, 47829690, 48000000, 48600000, 48828125, 49152000, 49207500, 49766400, 50000000,
50331648, 50388480, 50625000, 51018336, 51200000, 51840000, 52428800, 52488000, 52734375,
53084160, 53144100, 53747712, 54000000, 54675000, 55296000, 55987200, 56250000, 56623104,
56687040, 56953125, 57600000, 58320000, 58593750, 58982400, 59049000, 59719680, 60000000,
60466176, 60750000, 61440000, 61509375, 62208000, 62500000, 62914560, 62985600, 63281250,
63700992, 63772920, 64000000, 64800000, 65536000, 65610000, 66355200, 66430125, 67108864,
67184640, 67500000, 68024448, 68343750, 69120000, 69984000, 70312500, 70778880, 70858800,
71663616, 72000000, 72900000, 73728000, 73811250, 74649600, 75000000, 75497472, 75582720,
75937500, 76527504, 76800000, 77760000, 78125000, 78643200, 78732000, 79626240, 79716150,
80000000, 80621568, 81000000, 81920000, 82012500, 82944000, 83886080, 83980800, 84375000,
84934656, 85030560, 86400000, 87480000, 87890625, 88473600, 88573500, 89579520, 90000000,
90699264, 91125000, 92160000, 93312000, 93750000, 94371840, 94478400, 94921875, 95551488,
95659380, 96000000, 97200000, 97656250, 98304000, 98415000, 99532800, 100000000,
100663296, 100776960, 101250000, 102036672, 102400000, 102515625, 103680000, 104857600,
104976000, 105468750, 106168320, 106288200, 107495424, 108000000, 109350000, 110592000,
110716875, 111974400, 112500000, 113246208, 113374080, 113906250, 115200000, 116640000,
117187500, 117964800, 118098000, 119439360, 119574225, 120000000, 120932352, 121500000,
122880000, 123018750, 124416000, 125000000, 125829120, 125971200, 126562500, 127401984,
127545840, 128000000, 129600000, 131072000, 131220000, 132710400, 132860250, 134217728,
134369280, 135000000, 136048896, 136687500, 138240000, 139968000, 140625000, 141557760,
141717600, 143327232, 144000000, 145800000, 146484375, 147456000, 147622500, 149299200,
150000000, 150994944, 151165440, 151875000, 153055008, 153600000, 155520000, 156250000,
157286400, 157464000, 158203125, 159252480, 159432300, 160000000, 161243136, 162000000,
163840000, 164025000, 165888000, 167772160, 167961600, 168750000, 169869312, 170061120,
170859375, 172800000, 174960000, 175781250, 176947200, 177147000, 179159040, 180000000,
181398528, 182250000, 184320000, 184528125, 186624000, 187500000, 188743680, 188956800,
189843750, 191102976, 191318760, 192000000, 194400000, 195312500, 196608000, 196830000,
199065600, 199290375, 200000000, 201326592, 201553920, 202500000, 204073344, 204800000,
205031250, 207360000, 209715200, 209952000, 210937500, 212336640, 212576400, 214990848,
216000000, 218700000, 221184000, 221433750, 223948800, 225000000, 226492416, 226748160,
227812500, 230400000, 233280000, 234375000, 235929600, 236196000, 238878720, 239148450,
240000000, 241864704, 243000000, 244140625, 245760000, 246037500, 248832000, 250000000,
251658240, 251942400, 253125000, 254803968, 255091680, 256000000, 259200000, 262144000,
262440000, 263671875, 265420800, 265720500, 268435456, 268738560, 270000000, 272097792,
273375000, 276480000, 279936000, 281250000, 283115520, 283435200, 284765625, 286654464,
288000000, 291600000, 292968750, 294912000, 295245000, 298598400, 300000000, 301989888,
302330880, 303750000, 306110016, 307200000, 307546875, 311040000, 312500000, 314572800,
314928000, 316406250, 318504960, 318864600, 320000000, 322486272, 324000000, 327680000,
328050000, 331776000, 332150625, 335544320, 335923200, 337500000, 339738624, 340122240,
341718750, 345600000, 349920000, 351562500, 353894400, 354294000, 358318080, 360000000,
362797056, 364500000, 368640000, 369056250, 373248000, 375000000, 377487360, 377913600,
379687500, 382205952, 382637520, 384000000, 388800000, 390625000, 393216000, 393660000,
398131200, 398580750, 400000000, 402653184, 403107840, 405000000, 408146688, 409600000,
410062500, 414720000, 419430400, 419904000, 421875000, 424673280, 425152800, 429981696,
432000000, 437400000, 439453125, 442368000, 442867500, 447897600, 450000000, 452984832,
453496320, 455625000, 460800000, 466560000, 468750000, 471859200, 472392000, 474609375,
477757440, 478296900, 480000000, 483729408, 486000000, 488281250, 491520000, 492075000,
497664000, 500000000, 503316480, 503884800, 506250000, 509607936, 510183360, 512000000,
512578125, 518400000, 524288000, 524880000, 527343750, 530841600, 531441000, 536870912,
537477120, 540000000, 544195584, 546750000, 552960000, 553584375, 559872000, 562500000,
566231040, 566870400, 569531250, 573308928, 576000000, 583200000, 585937500, 589824000,
590490000, 597196800, 597871125, 600000000, 603979776, 604661760, 607500000, 612220032,
614400000, 615093750, 622080000, 625000000, 629145600, 629856000, 632812500, 637009920,
637729200, 640000000, 644972544, 648000000, 655360000, 656100000, 663552000, 664301250,
671088640, 671846400, 675000000, 679477248, 680244480, 683437500, 691200000, 699840000,
703125000, 707788800, 708588000, 716636160, 720000000, 725594112, 729000000, 732421875,
737280000, 738112500, 746496000, 750000000, 754974720, 755827200, 759375000, 764411904,
765275040, 768000000, 777600000, 781250000, 786432000, 787320000, 791015625, 796262400,
797161500, 800000000, 805306368, 806215680, 810000000, 816293376, 819200000, 820125000,
829440000, 838860800, 839808000, 843750000, 849346560, 850305600, 854296875, 859963392,
864000000, 874800000, 878906250, 884736000, 885735000, 895795200, 900000000, 905969664,
906992640, 911250000, 921600000, 922640625, 933120000, 937500000, 943718400, 944784000,
949218750, 955514880, 956593800, 960000000, 967458816, 972000000, 976562500, 983040000,
984150000, 995328000, 996451875, 1000000000, 1006632960, 1007769600, 1012500000,
1019215872, 1020366720, 1024000000, 1025156250, 1036800000, 1048576000, 1049760000,
1054687500, 1061683200, 1062882000, 1073741824, 1074954240, 1080000000, 1088391168,
1093500000, 1105920000, 1107168750, 1119744000, 1125000000, 1132462080, 1133740800,
1139062500, 1146617856, 1152000000, 1166400000, 1171875000, 1179648000, 1180980000,
1194393600, 1195742250, 1200000000, 1207959552, 1209323520, 1215000000, 1220703125,
1224440064, 1228800000, 1230187500, 1244160000, 1250000000, 1258291200, 1259712000,
1265625000, 1274019840, 1275458400, 1280000000, 1289945088, 1296000000, 1310720000,
1312200000, 1318359375, 1327104000, 1328602500, 1342177280, 1343692800, 1350000000,
1358954496, 1360488960, 1366875000, 1382400000, 1399680000, 1406250000, 1415577600,
1417176000, 1423828125, 1433272320, 1440000000, 1451188224, 1458000000, 1464843750,
1474560000, 1476225000, 1492992000, 1500000000, 1509949440, 1511654400, 1518750000,
1528823808, 1530550080, 1536000000, 1537734375, 1555200000, 1562500000, 1572864000,
1574640000, 1582031250, 1592524800, 1594323000, 1600000000, 1610612736, 1612431360,
1620000000, 1632586752, 1638400000, 1640250000, 1658880000, 1660753125, 1677721600,
1679616000, 1687500000, 1698693120, 1700611200, 1708593750, 1719926784, 1728000000,
1749600000, 1757812500, 1769472000, 1771470000, 1791590400, 1800000000, 1811939328,
1813985280, 1822500000, 1843200000, 1845281250, 1866240000, 1875000000, 1887436800,
1889568000, 1898437500, 1911029760, 1913187600, 1920000000, 1934917632, 1944000000,
1953125000, 1966080000, 1968300000, 1990656000, 1992903750, 2000000000, 2013265920,
2015539200, 2025000000, 2038431744, 2040733440, 2048000000, 2050312500, 2073600000,
1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, 32, 36, 40, 45, 48,
50, 54, 60, 64, 72, 75, 80, 81, 90, 96, 100, 108, 120, 125, 128, 135, 144, 150, 160,
162, 180, 192, 200, 216, 225, 240, 243, 250, 256, 270, 288, 300, 320, 324, 360, 375,
384, 400, 405, 432, 450, 480, 486, 500, 512, 540, 576, 600, 625, 640, 648, 675, 720,
729, 750, 768, 800, 810, 864, 900, 960, 972, 1000, 1024, 1080, 1125, 1152, 1200,
1215, 1250, 1280, 1296, 1350, 1440, 1458, 1500, 1536, 1600, 1620, 1728, 1800, 1875,
1920, 1944, 2000, 2025, 2048, 2160, 2187, 2250, 2304, 2400, 2430, 2500, 2560, 2592,
2700, 2880, 2916, 3000, 3072, 3125, 3200, 3240, 3375, 3456, 3600, 3645, 3750, 3840,
3888, 4000, 4050, 4096, 4320, 4374, 4500, 4608, 4800, 4860, 5000, 5120, 5184, 5400,
5625, 5760, 5832, 6000, 6075, 6144, 6250, 6400, 6480, 6561, 6750, 6912, 7200, 7290,
7500, 7680, 7776, 8000, 8100, 8192, 8640, 8748, 9000, 9216, 9375, 9600, 9720, 10000,
10125, 10240, 10368, 10800, 10935, 11250, 11520, 11664, 12000, 12150, 12288, 12500,
12800, 12960, 13122, 13500, 13824, 14400, 14580, 15000, 15360, 15552, 15625, 16000,
16200, 16384, 16875, 17280, 17496, 18000, 18225, 18432, 18750, 19200, 19440, 19683,
20000, 20250, 20480, 20736, 21600, 21870, 22500, 23040, 23328, 24000, 24300, 24576,
25000, 25600, 25920, 26244, 27000, 27648, 28125, 28800, 29160, 30000, 30375, 30720,
31104, 31250, 32000, 32400, 32768, 32805, 33750, 34560, 34992, 36000, 36450, 36864,
37500, 38400, 38880, 39366, 40000, 40500, 40960, 41472, 43200, 43740, 45000, 46080,
46656, 46875, 48000, 48600, 49152, 50000, 50625, 51200, 51840, 52488, 54000, 54675,
55296, 56250, 57600, 58320, 59049, 60000, 60750, 61440, 62208, 62500, 64000, 64800,
65536, 65610, 67500, 69120, 69984, 72000, 72900, 73728, 75000, 76800, 77760, 78125,
78732, 80000, 81000, 81920, 82944, 84375, 86400, 87480, 90000, 91125, 92160, 93312,
93750, 96000, 97200, 98304, 98415, 100000, 101250, 102400, 103680, 104976, 108000,
109350, 110592, 112500, 115200, 116640, 118098, 120000, 121500, 122880, 124416, 125000,
128000, 129600, 131072, 131220, 135000, 138240, 139968, 140625, 144000, 145800, 147456,
150000, 151875, 153600, 155520, 156250, 157464, 160000, 162000, 163840, 164025, 165888,
168750, 172800, 174960, 177147, 180000, 182250, 184320, 186624, 187500, 192000, 194400,
196608, 196830, 200000, 202500, 204800, 207360, 209952, 216000, 218700, 221184, 225000,
230400, 233280, 234375, 236196, 240000, 243000, 245760, 248832, 250000, 253125, 256000,
259200, 262144, 262440, 270000, 273375, 276480, 279936, 281250, 288000, 291600, 294912,
295245, 300000, 303750, 307200, 311040, 312500, 314928, 320000, 324000, 327680, 328050,
331776, 337500, 345600, 349920, 354294, 360000, 364500, 368640, 373248, 375000, 384000,
388800, 390625, 393216, 393660, 400000, 405000, 409600, 414720, 419904, 421875, 432000,
437400, 442368, 450000, 455625, 460800, 466560, 468750, 472392, 480000, 486000, 491520,
492075, 497664, 500000, 506250, 512000, 518400, 524288, 524880, 531441, 540000, 546750,
552960, 559872, 562500, 576000, 583200, 589824, 590490, 600000, 607500, 614400, 622080,
625000, 629856, 640000, 648000, 655360, 656100, 663552, 675000, 691200, 699840, 703125,
708588, 720000, 729000, 737280, 746496, 750000, 759375, 768000, 777600, 781250, 786432,
787320, 800000, 810000, 819200, 820125, 829440, 839808, 843750, 864000, 874800, 884736,
885735, 900000, 911250, 921600, 933120, 937500, 944784, 960000, 972000, 983040, 984150,
995328, 1000000, 1012500, 1024000, 1036800, 1048576, 1049760, 1062882, 1080000, 1093500,
1105920, 1119744, 1125000, 1152000, 1166400, 1171875, 1179648, 1180980, 1200000,
1215000, 1228800, 1244160, 1250000, 1259712, 1265625, 1280000, 1296000, 1310720,
1312200, 1327104, 1350000, 1366875, 1382400, 1399680, 1406250, 1417176, 1440000,
1458000, 1474560, 1476225, 1492992, 1500000, 1518750, 1536000, 1555200, 1562500,
1572864, 1574640, 1594323, 1600000, 1620000, 1638400, 1640250, 1658880, 1679616,
1687500, 1728000, 1749600, 1769472, 1771470, 1800000, 1822500, 1843200, 1866240,
1875000, 1889568, 1920000, 1944000, 1953125, 1966080, 1968300, 1990656, 2000000,
2025000, 2048000, 2073600, 2097152, 2099520, 2109375, 2125764, 2160000, 2187000,
2211840, 2239488, 2250000, 2278125, 2304000, 2332800, 2343750, 2359296, 2361960,
2400000, 2430000, 2457600, 2460375, 2488320, 2500000, 2519424, 2531250, 2560000,
2592000, 2621440, 2624400, 2654208, 2657205, 2700000, 2733750, 2764800, 2799360,
2812500, 2834352, 2880000, 2916000, 2949120, 2952450, 2985984, 3000000, 3037500,
3072000, 3110400, 3125000, 3145728, 3149280, 3188646, 3200000, 3240000, 3276800,
3280500, 3317760, 3359232, 3375000, 3456000, 3499200, 3515625, 3538944, 3542940,
3600000, 3645000, 3686400, 3732480, 3750000, 3779136, 3796875, 3840000, 3888000,
3906250, 3932160, 3936600, 3981312, 4000000, 4050000, 4096000, 4100625, 4147200,
4194304, 4199040, 4218750, 4251528, 4320000, 4374000, 4423680, 4428675, 4478976,
4500000, 4556250, 4608000, 4665600, 4687500, 4718592, 4723920, 4782969, 4800000,
4860000, 4915200, 4920750, 4976640, 5000000, 5038848, 5062500, 5120000, 5184000,
5242880, 5248800, 5308416, 5314410, 5400000, 5467500, 5529600, 5598720, 5625000,
5668704, 5760000, 5832000, 5859375, 5898240, 5904900, 5971968, 6000000, 6075000,
6144000, 6220800, 6250000, 6291456, 6298560, 6328125, 6377292, 6400000, 6480000,
6553600, 6561000, 6635520, 6718464, 6750000, 6834375, 6912000, 6998400, 7031250,
7077888, 7085880, 7200000, 7290000, 7372800, 7381125, 7464960, 7500000, 7558272,
7593750, 7680000, 7776000, 7812500, 7864320, 7873200, 7962624, 7971615, 8000000,
8100000, 8192000, 8201250, 8294400, 8388608, 8398080, 8437500, 8503056, 8640000,
8748000, 8847360, 8857350, 8957952, 9000000, 9112500, 9216000, 9331200, 9375000,
9437184, 9447840, 9565938, 9600000, 9720000, 9765625, 9830400, 9841500, 9953280,
10000000, 10077696, 10125000, 10240000, 10368000, 10485760, 10497600, 10546875, 10616832,
10628820, 10800000, 10935000, 11059200, 11197440, 11250000, 11337408, 11390625, 11520000,
11664000, 11718750, 11796480, 11809800, 11943936, 12000000, 12150000, 12288000, 12301875,
12441600, 12500000, 12582912, 12597120, 12656250, 12754584, 12800000, 12960000, 13107200,
13122000, 13271040, 13286025, 13436928, 13500000, 13668750, 13824000, 13996800, 14062500,
14155776, 14171760, 14400000, 14580000, 14745600, 14762250, 14929920, 15000000, 15116544,
15187500, 15360000, 15552000, 15625000, 15728640, 15746400, 15925248, 15943230, 16000000,
16200000, 16384000, 16402500, 16588800, 16777216, 16796160, 16875000, 17006112, 17280000,
17496000, 17578125, 17694720, 17714700, 17915904, 18000000, 18225000, 18432000, 18662400,
18750000, 18874368, 18895680, 18984375, 19131876, 19200000, 19440000, 19531250, 19660800,
19683000, 19906560, 20000000, 20155392, 20250000, 20480000, 20503125, 20736000, 20971520,
20995200, 21093750, 21233664, 21257640, 21600000, 21870000, 22118400, 22143375, 22394880,
22500000, 22674816, 22781250, 23040000, 23328000, 23437500, 23592960, 23619600, 23887872,
23914845, 24000000, 24300000, 24576000, 24603750, 24883200, 25000000, 25165824, 25194240,
25312500, 25509168, 25600000, 25920000, 26214400, 26244000, 26542080, 26572050, 26873856,
27000000, 27337500, 27648000, 27993600, 28125000, 28311552, 28343520, 28800000, 29160000,
29296875, 29491200, 29524500, 29859840, 30000000, 30233088, 30375000, 30720000, 31104000,
31250000, 31457280, 31492800, 31640625, 31850496, 31886460, 32000000, 32400000, 32768000,
32805000, 33177600, 33554432, 33592320, 33750000, 34012224, 34171875, 34560000, 34992000,
35156250, 35389440, 35429400, 35831808, 36000000, 36450000, 36864000, 36905625, 37324800,
37500000, 37748736, 37791360, 37968750, 38263752, 38400000, 38880000, 39062500, 39321600,
39366000, 39813120, 39858075, 40000000, 40310784, 40500000, 40960000, 41006250, 41472000,
41943040, 41990400, 42187500, 42467328, 42515280, 43200000, 43740000, 44236800, 44286750,
44789760, 45000000, 45349632, 45562500, 46080000, 46656000, 46875000, 47185920, 47239200,
47775744, 47829690, 48000000, 48600000, 48828125, 49152000, 49207500, 49766400, 50000000,
50331648, 50388480, 50625000, 51018336, 51200000, 51840000, 52428800, 52488000, 52734375,
53084160, 53144100, 53747712, 54000000, 54675000, 55296000, 55987200, 56250000, 56623104,
56687040, 56953125, 57600000, 58320000, 58593750, 58982400, 59049000, 59719680, 60000000,
60466176, 60750000, 61440000, 61509375, 62208000, 62500000, 62914560, 62985600, 63281250,
63700992, 63772920, 64000000, 64800000, 65536000, 65610000, 66355200, 66430125, 67108864,
67184640, 67500000, 68024448, 68343750, 69120000, 69984000, 70312500, 70778880, 70858800,
71663616, 72000000, 72900000, 73728000, 73811250, 74649600, 75000000, 75497472, 75582720,
75937500, 76527504, 76800000, 77760000, 78125000, 78643200, 78732000, 79626240, 79716150,
80000000, 80621568, 81000000, 81920000, 82012500, 82944000, 83886080, 83980800, 84375000,
84934656, 85030560, 86400000, 87480000, 87890625, 88473600, 88573500, 89579520, 90000000,
90699264, 91125000, 92160000, 93312000, 93750000, 94371840, 94478400, 94921875, 95551488,
95659380, 96000000, 97200000, 97656250, 98304000, 98415000, 99532800, 100000000,
100663296, 100776960, 101250000, 102036672, 102400000, 102515625, 103680000, 104857600,
104976000, 105468750, 106168320, 106288200, 107495424, 108000000, 109350000, 110592000,
110716875, 111974400, 112500000, 113246208, 113374080, 113906250, 115200000, 116640000,
117187500, 117964800, 118098000, 119439360, 119574225, 120000000, 120932352, 121500000,
122880000, 123018750, 124416000, 125000000, 125829120, 125971200, 126562500, 127401984,
127545840, 128000000, 129600000, 131072000, 131220000, 132710400, 132860250, 134217728,
134369280, 135000000, 136048896, 136687500, 138240000, 139968000, 140625000, 141557760,
141717600, 143327232, 144000000, 145800000, 146484375, 147456000, 147622500, 149299200,
150000000, 150994944, 151165440, 151875000, 153055008, 153600000, 155520000, 156250000,
157286400, 157464000, 158203125, 159252480, 159432300, 160000000, 161243136, 162000000,
163840000, 164025000, 165888000, 167772160, 167961600, 168750000, 169869312, 170061120,
170859375, 172800000, 174960000, 175781250, 176947200, 177147000, 179159040, 180000000,
181398528, 182250000, 184320000, 184528125, 186624000, 187500000, 188743680, 188956800,
189843750, 191102976, 191318760, 192000000, 194400000, 195312500, 196608000, 196830000,
199065600, 199290375, 200000000, 201326592, 201553920, 202500000, 204073344, 204800000,
205031250, 207360000, 209715200, 209952000, 210937500, 212336640, 212576400, 214990848,
216000000, 218700000, 221184000, 221433750, 223948800, 225000000, 226492416, 226748160,
227812500, 230400000, 233280000, 234375000, 235929600, 236196000, 238878720, 239148450,
240000000, 241864704, 243000000, 244140625, 245760000, 246037500, 248832000, 250000000,
251658240, 251942400, 253125000, 254803968, 255091680, 256000000, 259200000, 262144000,
262440000, 263671875, 265420800, 265720500, 268435456, 268738560, 270000000, 272097792,
273375000, 276480000, 279936000, 281250000, 283115520, 283435200, 284765625, 286654464,
288000000, 291600000, 292968750, 294912000, 295245000, 298598400, 300000000, 301989888,
302330880, 303750000, 306110016, 307200000, 307546875, 311040000, 312500000, 314572800,
314928000, 316406250, 318504960, 318864600, 320000000, 322486272, 324000000, 327680000,
328050000, 331776000, 332150625, 335544320, 335923200, 337500000, 339738624, 340122240,
341718750, 345600000, 349920000, 351562500, 353894400, 354294000, 358318080, 360000000,
362797056, 364500000, 368640000, 369056250, 373248000, 375000000, 377487360, 377913600,
379687500, 382205952, 382637520, 384000000, 388800000, 390625000, 393216000, 393660000,
398131200, 398580750, 400000000, 402653184, 403107840, 405000000, 408146688, 409600000,
410062500, 414720000, 419430400, 419904000, 421875000, 424673280, 425152800, 429981696,
432000000, 437400000, 439453125, 442368000, 442867500, 447897600, 450000000, 452984832,
453496320, 455625000, 460800000, 466560000, 468750000, 471859200, 472392000, 474609375,
477757440, 478296900, 480000000, 483729408, 486000000, 488281250, 491520000, 492075000,
497664000, 500000000, 503316480, 503884800, 506250000, 509607936, 510183360, 512000000,
512578125, 518400000, 524288000, 524880000, 527343750, 530841600, 531441000, 536870912,
537477120, 540000000, 544195584, 546750000, 552960000, 553584375, 559872000, 562500000,
566231040, 566870400, 569531250, 573308928, 576000000, 583200000, 585937500, 589824000,
590490000, 597196800, 597871125, 600000000, 603979776, 604661760, 607500000, 612220032,
614400000, 615093750, 622080000, 625000000, 629145600, 629856000, 632812500, 637009920,
637729200, 640000000, 644972544, 648000000, 655360000, 656100000, 663552000, 664301250,
671088640, 671846400, 675000000, 679477248, 680244480, 683437500, 691200000, 699840000,
703125000, 707788800, 708588000, 716636160, 720000000, 725594112, 729000000, 732421875,
737280000, 738112500, 746496000, 750000000, 754974720, 755827200, 759375000, 764411904,
765275040, 768000000, 777600000, 781250000, 786432000, 787320000, 791015625, 796262400,
797161500, 800000000, 805306368, 806215680, 810000000, 816293376, 819200000, 820125000,
829440000, 838860800, 839808000, 843750000, 849346560, 850305600, 854296875, 859963392,
864000000, 874800000, 878906250, 884736000, 885735000, 895795200, 900000000, 905969664,
906992640, 911250000, 921600000, 922640625, 933120000, 937500000, 943718400, 944784000,
949218750, 955514880, 956593800, 960000000, 967458816, 972000000, 976562500, 983040000,
984150000, 995328000, 996451875, 1000000000, 1006632960, 1007769600, 1012500000,
1019215872, 1020366720, 1024000000, 1025156250, 1036800000, 1048576000, 1049760000,
1054687500, 1061683200, 1062882000, 1073741824, 1074954240, 1080000000, 1088391168,
1093500000, 1105920000, 1107168750, 1119744000, 1125000000, 1132462080, 1133740800,
1139062500, 1146617856, 1152000000, 1166400000, 1171875000, 1179648000, 1180980000,
1194393600, 1195742250, 1200000000, 1207959552, 1209323520, 1215000000, 1220703125,
1224440064, 1228800000, 1230187500, 1244160000, 1250000000, 1258291200, 1259712000,
1265625000, 1274019840, 1275458400, 1280000000, 1289945088, 1296000000, 1310720000,
1312200000, 1318359375, 1327104000, 1328602500, 1342177280, 1343692800, 1350000000,
1358954496, 1360488960, 1366875000, 1382400000, 1399680000, 1406250000, 1415577600,
1417176000, 1423828125, 1433272320, 1440000000, 1451188224, 1458000000, 1464843750,
1474560000, 1476225000, 1492992000, 1500000000, 1509949440, 1511654400, 1518750000,
1528823808, 1530550080, 1536000000, 1537734375, 1555200000, 1562500000, 1572864000,
1574640000, 1582031250, 1592524800, 1594323000, 1600000000, 1610612736, 1612431360,
1620000000, 1632586752, 1638400000, 1640250000, 1658880000, 1660753125, 1677721600,
1679616000, 1687500000, 1698693120, 1700611200, 1708593750, 1719926784, 1728000000,
1749600000, 1757812500, 1769472000, 1771470000, 1791590400, 1800000000, 1811939328,
1813985280, 1822500000, 1843200000, 1845281250, 1866240000, 1875000000, 1887436800,
1889568000, 1898437500, 1911029760, 1913187600, 1920000000, 1934917632, 1944000000,
1953125000, 1966080000, 1968300000, 1990656000, 1992903750, 2000000000, 2013265920,
2015539200, 2025000000, 2038431744, 2040733440, 2048000000, 2050312500, 2073600000,
2097152000, 2099520000, 2109375000, 2123366400, 2125764000
};
}
int cv::getOptimalDFTSize( int size0 )
{
int a = 0, b = sizeof(optimalDFTSizeTab)/sizeof(optimalDFTSizeTab[0]) - 1;
+1455 -1455
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+12 -12
View File
@@ -356,7 +356,7 @@ void magnitude( InputArray src1, InputArray src2, OutputArray dst )
{
Mat X = src1.getMat(), Y = src2.getMat();
int type = X.type(), depth = X.depth(), cn = X.channels();
CV_Assert( X.size == Y.size && type == Y.type() && (depth == CV_32F || depth == CV_64F));
CV_Assert( X.size == Y.size && type == Y.type() && (depth == CV_32F || depth == CV_64F));
dst.create(X.dims, X.size, X.type());
Mat Mag = dst.getMat();
@@ -430,7 +430,7 @@ void phase( InputArray src1, InputArray src2, OutputArray dst, bool angleInDegre
FastAtan2_32f( buf[1], buf[0], buf[0], len, angleInDegrees );
for( k = 0; k < len; k++ )
angle[k] = buf[0][k];
angle[k] = buf[0][k];
}
ptrs[0] += len*esz1;
ptrs[1] += len*esz1;
@@ -491,7 +491,7 @@ void cartToPolar( InputArray src1, InputArray src2,
FastAtan2_32f( buf[1], buf[0], buf[0], len, angleInDegrees );
for( k = 0; k < len; k++ )
angle[k] = buf[0][k];
angle[k] = buf[0][k];
}
ptrs[0] += len*esz1;
ptrs[1] += len*esz1;
@@ -2249,15 +2249,15 @@ cvCartToPolar( const CvArr* xarr, const CvArr* yarr,
Angle = cv::cvarrToMat(anglearr);
CV_Assert( Angle.size() == X.size() && Angle.type() == X.type() );
}
if( magarr )
{
if( anglearr )
cv::cartToPolar( X, Y, Mag, Angle, angle_in_degrees != 0 );
else
cv::magnitude( X, Y, Mag );
}
else
cv::phase( X, Y, Angle, angle_in_degrees != 0 );
if( magarr )
{
if( anglearr )
cv::cartToPolar( X, Y, Mag, Angle, angle_in_degrees != 0 );
else
cv::magnitude( X, Y, Mag );
}
else
cv::phase( X, Y, Angle, angle_in_degrees != 0 );
}
CV_IMPL void
+5 -5
View File
@@ -2986,21 +2986,21 @@ PCA& PCA::computeVar(InputArray _data, InputArray __mean, int flags, double reta
g.at<float>(ig,0) += eigenvalues.at<float>(im,0);
}
}
int L;
for(L = 0; L < eigenvalues.rows; L++)
{
double energy = g.at<float>(L, 0) / g.at<float>(g.rows - 1, 0);
if(energy > retainedVariance)
break;
if(energy > retainedVariance)
break;
}
L = std::max(2, L);
// use clone() to physically copy the data and thus deallocate the original matrices
eigenvalues = eigenvalues.rowRange(0,L).clone();
eigenvectors = eigenvectors.rowRange(0,L).clone();
return *this;
}
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -5202,11 +5202,11 @@ string FileStorage::releaseAndGetString()
string buf;
if( fs.obj && fs.obj->outbuf )
icvClose(fs.obj, &buf);
release();
return buf;
}
return buf;
}
FileNode FileStorage::root(int streamidx) const
{
return isOpened() ? FileNode(fs, cvGetRootFileNode(fs, streamidx)) : FileNode();
+1 -1
View File
@@ -170,7 +170,7 @@ struct NoVec
};
extern volatile bool USE_SSE2;
extern volatile bool USE_SSE4_2;
extern volatile bool USE_SSE4_2;
extern volatile bool USE_AVX;
enum { BLOCK_SIZE = 1024 };
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -243,7 +243,7 @@ static int countNonZero8u( const uchar* src, int len )
}
initialized = true;
}
for (; i<=len-16; i+=16)
{
__m128i r0 = _mm_loadu_si128((const __m128i*)(src+i));
@@ -1915,7 +1915,7 @@ void cv::findNonZero( InputArray _src, OutputArray _idx )
Mat idx = _idx.getMat();
CV_Assert(idx.isContinuous());
Point* idx_ptr = (Point*)idx.data;
for( int i = 0; i < src.rows; i++ )
{
const uchar* bin_ptr = src.ptr(i);
+1 -1
View File
@@ -805,7 +805,7 @@ struct Mutex::Impl
CRITICAL_SECTION cs;
int refcount;
};
int _interlockedExchangeAdd(int* addr, int delta)
{
#if defined _MSC_VER && _MSC_VER >= 1500
+2 -2
View File
@@ -104,7 +104,7 @@ const float g_8x32fTab[] =
};
/* [-255..255].^2 */
const ushort g_8x16uSqrTab[] =
const ushort g_8x16uSqrTab[] =
{
65025, 64516, 64009, 63504, 63001, 62500, 62001, 61504, 61009, 60516, 60025, 59536,
59049, 58564, 58081, 57600, 57121, 56644, 56169, 55696, 55225, 54756, 54289, 53824,
@@ -151,7 +151,7 @@ const ushort g_8x16uSqrTab[] =
62001, 62500, 63001, 63504, 64009, 64516, 65025
};
const uchar g_Saturate8u[] =
const uchar g_Saturate8u[] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,