Wondercoll
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros | Typedefs | Functions
cvaccum.cpp File Reference
#include "_cv.h"

Macros

#define ICV_DEF_ACC_FUNC(name, srctype, dsttype, cvtmacro)
 
#define ICV_DEF_ACCPROD_FUNC(flavor, srctype, dsttype, cvtmacro)
 
#define ICV_DEF_ACCWEIGHT_FUNC(flavor, srctype, dsttype, cvtmacro)
 
#define ICV_DEF_ACCMASK_FUNC_C1(name, srctype, dsttype, cvtmacro)
 
#define ICV_DEF_ACCPRODUCTMASK_FUNC_C1(flavor, srctype, dsttype, cvtmacro)
 
#define ICV_DEF_ACCWEIGHTMASK_FUNC_C1(flavor, srctype, dsttype, cvtmacro)
 
#define ICV_DEF_ACCMASK_FUNC_C3(name, srctype, dsttype, cvtmacro)
 
#define ICV_DEF_ACCPRODUCTMASK_FUNC_C3(flavor, srctype, dsttype, cvtmacro)
 
#define ICV_DEF_ACCWEIGHTMASK_FUNC_C3(flavor, srctype, dsttype, cvtmacro)
 
#define ICV_DEF_INIT_ACC_TAB(FUNCNAME)
 

Typedefs

typedef CvStatus(CV_STDCALLCvAddWeightedFunc )(const void *src, int srcstep, void *dst, int dststep, CvSize size, float alpha)
 
typedef CvStatus(CV_STDCALLCvAddWeightedMaskFunc )(const void *src, int srcstep, void *dst, int dststep, const void *mask, int maskstep, CvSize size, float alpha)
 

Functions

CV_IMPL void cvAcc (const void *arr, void *sumarr, const void *maskarr)
 
CV_IMPL void cvSquareAcc (const void *arr, void *sq_sum, const void *maskarr)
 
CV_IMPL void cvMultiplyAcc (const void *arrA, const void *arrB, void *acc, const void *maskarr)
 
CV_IMPL void cvRunningAvg (const void *arrY, void *arrU, double alpha, const void *maskarr)
 

Macro Definition Documentation

#define ICV_DEF_ACC_FUNC (   name,
  srctype,
  dsttype,
  cvtmacro 
)
Value:
name,( const srctype *src, int srcstep, dsttype *dst, \
int dststep, CvSize size ), (src, srcstep, dst, dststep, size )) \
\
{ \
srcstep /= sizeof(src[0]); \
dststep /= sizeof(dst[0]); \
for( ; size.height--; src += srcstep, dst += dststep ) \
{ \
int x; \
for( x = 0; x <= size.width - 4; x += 4 ) \
{ \
dsttype t0 = dst[x] + cvtmacro(src[x]); \
dsttype t1 = dst[x + 1] + cvtmacro(src[x + 1]); \
dst[x] = t0; dst[x + 1] = t1; \
\
t0 = dst[x + 2] + cvtmacro(src[x + 2]); \
t1 = dst[x + 3] + cvtmacro(src[x + 3]); \
dst[x + 2] = t0; dst[x + 3] = t1; \
} \
for( ; x < size.width; x++ ) \
dst[x] += cvtmacro(src[x]); \
} \
\
return CV_OK; \
}
#define ICV_DEF_ACCMASK_FUNC_C1 (   name,
  srctype,
  dsttype,
  cvtmacro 
)
Value:
name,( const srctype *src, int srcstep, const uchar* mask, int maskstep,\
dsttype *dst, int dststep, CvSize size ), \
(src, srcstep, mask, maskstep, dst, dststep, size )) \
{ \
srcstep /= sizeof(src[0]); \
dststep /= sizeof(dst[0]); \
for( ; size.height--; src += srcstep, \
dst += dststep, mask += maskstep ) \
{ \
int x; \
for( x = 0; x <= size.width - 2; x += 2 ) \
{ \
if( mask[x] ) \
dst[x] += cvtmacro(src[x]); \
if( mask[x+1] ) \
dst[x+1] += cvtmacro(src[x+1]); \
} \
for( ; x < size.width; x++ ) \
if( mask[x] ) \
dst[x] += cvtmacro(src[x]); \
} \
\
return CV_OK; \
}
#define ICV_DEF_ACCMASK_FUNC_C3 (   name,
  srctype,
  dsttype,
  cvtmacro 
)
Value:
name,( const srctype *src, int srcstep, const uchar* mask, int maskstep,\
dsttype *dst, int dststep, CvSize size ), \
(src, srcstep, mask, maskstep, dst, dststep, size )) \
{ \
srcstep /= sizeof(src[0]); \
dststep /= sizeof(dst[0]); \
for( ; size.height--; src += srcstep, \
dst += dststep, mask += maskstep ) \
{ \
int x; \
for( x = 0; x < size.width; x++ ) \
if( mask[x] ) \
{ \
dsttype t0, t1, t2; \
t0 = dst[x*3] + cvtmacro(src[x*3]); \
t1 = dst[x*3+1] + cvtmacro(src[x*3+1]); \
t2 = dst[x*3+2] + cvtmacro(src[x*3+2]); \
dst[x*3] = t0; \
dst[x*3+1] = t1; \
dst[x*3+2] = t2; \
} \
} \
\
return CV_OK; \
}
#define ICV_DEF_ACCPROD_FUNC (   flavor,
  srctype,
  dsttype,
  cvtmacro 
)
Value:
IPCVAPI_IMPL( CvStatus, icvAddProduct_##flavor##_C1IR, \
( const srctype *src1, int step1, const srctype *src2, int step2, \
dsttype *dst, int dststep, CvSize size ), \
(src1, step1, src2, step2, dst, dststep, size) ) \
{ \
step1 /= sizeof(src1[0]); \
step2 /= sizeof(src2[0]); \
dststep /= sizeof(dst[0]); \
for( ; size.height--; src1 += step1, src2 += step2, dst += dststep ) \
{ \
int x; \
for( x = 0; x <= size.width - 4; x += 4 ) \
{ \
dsttype t0 = dst[x] + cvtmacro(src1[x])*cvtmacro(src2[x]); \
dsttype t1 = dst[x+1] + cvtmacro(src1[x+1])*cvtmacro(src2[x+1]);\
dst[x] = t0; dst[x + 1] = t1; \
\
t0 = dst[x + 2] + cvtmacro(src1[x + 2])*cvtmacro(src2[x + 2]); \
t1 = dst[x + 3] + cvtmacro(src1[x + 3])*cvtmacro(src2[x + 3]); \
dst[x + 2] = t0; dst[x + 3] = t1; \
} \
for( ; x < size.width; x++ ) \
dst[x] += cvtmacro(src1[x])*cvtmacro(src2[x]); \
} \
\
return CV_OK; \
}
#define ICV_DEF_ACCPRODUCTMASK_FUNC_C1 (   flavor,
  srctype,
  dsttype,
  cvtmacro 
)
Value:
IPCVAPI_IMPL( CvStatus, icvAddProduct_##flavor##_C1IMR, \
( const srctype *src1, int step1, const srctype* src2, int step2, \
const uchar* mask, int maskstep, dsttype *dst, int dststep, CvSize size ),\
(src1, step1, src2, step2, mask, maskstep, dst, dststep, size )) \
{ \
step1 /= sizeof(src1[0]); \
step2 /= sizeof(src2[0]); \
dststep /= sizeof(dst[0]); \
for( ; size.height--; src1 += step1, src2 += step2, \
dst += dststep, mask += maskstep ) \
{ \
int x; \
for( x = 0; x <= size.width - 2; x += 2 ) \
{ \
if( mask[x] ) \
dst[x] += cvtmacro(src1[x])*cvtmacro(src2[x]); \
if( mask[x+1] ) \
dst[x+1] += cvtmacro(src1[x+1])*cvtmacro(src2[x+1]); \
} \
for( ; x < size.width; x++ ) \
if( mask[x] ) \
dst[x] += cvtmacro(src1[x])*cvtmacro(src2[x]); \
} \
\
return CV_OK; \
}
#define ICV_DEF_ACCPRODUCTMASK_FUNC_C3 (   flavor,
  srctype,
  dsttype,
  cvtmacro 
)
Value:
IPCVAPI_IMPL( CvStatus, icvAddProduct_##flavor##_C3IMR, \
( const srctype *src1, int step1, const srctype* src2, int step2, \
const uchar* mask, int maskstep, dsttype *dst, int dststep, CvSize size ),\
(src1, step1, src2, step2, mask, maskstep, dst, dststep, size )) \
{ \
step1 /= sizeof(src1[0]); \
step2 /= sizeof(src2[0]); \
dststep /= sizeof(dst[0]); \
for( ; size.height--; src1 += step1, src2 += step2, \
dst += dststep, mask += maskstep ) \
{ \
int x; \
for( x = 0; x < size.width; x++ ) \
if( mask[x] ) \
{ \
dsttype t0, t1, t2; \
t0 = dst[x*3]+cvtmacro(src1[x*3])*cvtmacro(src2[x*3]); \
t1 = dst[x*3+1]+cvtmacro(src1[x*3+1])*cvtmacro(src2[x*3+1]);\
t2 = dst[x*3+2]+cvtmacro(src1[x*3+2])*cvtmacro(src2[x*3+2]);\
dst[x*3] = t0; \
dst[x*3+1] = t1; \
dst[x*3+2] = t2; \
} \
} \
\
return CV_OK; \
}
#define ICV_DEF_ACCWEIGHT_FUNC (   flavor,
  srctype,
  dsttype,
  cvtmacro 
)
Value:
IPCVAPI_IMPL( CvStatus, icvAddWeighted_##flavor##_C1IR, \
( const srctype *src, int srcstep, dsttype *dst, int dststep, \
CvSize size, dsttype alpha ), (src, srcstep, dst, dststep, size, alpha) )\
{ \
dsttype beta = (dsttype)(1 - alpha); \
srcstep /= sizeof(src[0]); \
dststep /= sizeof(dst[0]); \
for( ; size.height--; src += srcstep, dst += dststep ) \
{ \
int x; \
for( x = 0; x <= size.width - 4; x += 4 ) \
{ \
dsttype t0 = dst[x]*beta + cvtmacro(src[x])*alpha; \
dsttype t1 = dst[x+1]*beta + cvtmacro(src[x+1])*alpha; \
dst[x] = t0; dst[x + 1] = t1; \
\
t0 = dst[x + 2]*beta + cvtmacro(src[x + 2])*alpha; \
t1 = dst[x + 3]*beta + cvtmacro(src[x + 3])*alpha; \
dst[x + 2] = t0; dst[x + 3] = t1; \
} \
for( ; x < size.width; x++ ) \
dst[x] = dst[x]*beta + cvtmacro(src[x])*alpha; \
} \
\
return CV_OK; \
}
#define ICV_DEF_ACCWEIGHTMASK_FUNC_C1 (   flavor,
  srctype,
  dsttype,
  cvtmacro 
)
Value:
IPCVAPI_IMPL( CvStatus, icvAddWeighted_##flavor##_C1IMR, \
( const srctype *src, int srcstep, const uchar* mask, int maskstep, \
dsttype *dst, int dststep, CvSize size, dsttype alpha ), \
(src, srcstep, mask, maskstep, dst, dststep, size, alpha )) \
{ \
dsttype beta = (dsttype)(1 - alpha); \
srcstep /= sizeof(src[0]); \
dststep /= sizeof(dst[0]); \
for( ; size.height--; src += srcstep, \
dst += dststep, mask += maskstep ) \
{ \
int x; \
for( x = 0; x <= size.width - 2; x += 2 ) \
{ \
if( mask[x] ) \
dst[x] = dst[x]*beta + cvtmacro(src[x])*alpha; \
if( mask[x+1] ) \
dst[x+1] = dst[x+1]*beta + cvtmacro(src[x+1])*alpha; \
} \
for( ; x < size.width; x++ ) \
if( mask[x] ) \
dst[x] = dst[x]*beta + cvtmacro(src[x])*alpha; \
} \
\
return CV_OK; \
}
#define ICV_DEF_ACCWEIGHTMASK_FUNC_C3 (   flavor,
  srctype,
  dsttype,
  cvtmacro 
)
Value:
IPCVAPI_IMPL( CvStatus, icvAddWeighted_##flavor##_C3IMR, \
( const srctype *src, int srcstep, const uchar* mask, int maskstep, \
dsttype *dst, int dststep, CvSize size, dsttype alpha ), \
(src, srcstep, mask, maskstep, dst, dststep, size, alpha )) \
{ \
dsttype beta = (dsttype)(1 - alpha); \
srcstep /= sizeof(src[0]); \
dststep /= sizeof(dst[0]); \
for( ; size.height--; src += srcstep, \
dst += dststep, mask += maskstep ) \
{ \
int x; \
for( x = 0; x < size.width; x++ ) \
if( mask[x] ) \
{ \
dsttype t0, t1, t2; \
t0 = dst[x*3]*beta + cvtmacro(src[x*3])*alpha; \
t1 = dst[x*3+1]*beta + cvtmacro(src[x*3+1])*alpha; \
t2 = dst[x*3+2]*beta + cvtmacro(src[x*3+2])*alpha; \
dst[x*3] = t0; \
dst[x*3+1] = t1; \
dst[x*3+2] = t2; \
} \
} \
\
return CV_OK; \
}
#define ICV_DEF_INIT_ACC_TAB (   FUNCNAME)
Value:
static void icvInit##FUNCNAME##Table( CvFuncTable* tab, CvBigFuncTable* masktab ) \
{ \
tab->fn_2d[CV_8U] = (void*)icv##FUNCNAME##_8u32f_C1IR; \
tab->fn_2d[CV_32F] = (void*)icv##FUNCNAME##_32f_C1IR; \
\
masktab->fn_2d[CV_8UC1] = (void*)icv##FUNCNAME##_8u32f_C1IMR; \
masktab->fn_2d[CV_32FC1] = (void*)icv##FUNCNAME##_32f_C1IMR; \
\
masktab->fn_2d[CV_8UC3] = (void*)icv##FUNCNAME##_8u32f_C3IMR; \
masktab->fn_2d[CV_32FC3] = (void*)icv##FUNCNAME##_32f_C3IMR; \
}

Typedef Documentation

typedef CvStatus(CV_STDCALL * CvAddWeightedFunc)(const void *src, int srcstep, void *dst, int dststep, CvSize size, float alpha)
typedef CvStatus(CV_STDCALL * CvAddWeightedMaskFunc)(const void *src, int srcstep, void *dst, int dststep, const void *mask, int maskstep, CvSize size, float alpha)

Function Documentation

CV_IMPL void cvAcc ( const void *  arr,
void *  sumarr,
const void *  maskarr 
)
CV_IMPL void cvMultiplyAcc ( const void *  arrA,
const void *  arrB,
void *  acc,
const void *  maskarr 
)
CV_IMPL void cvRunningAvg ( const void *  arrY,
void *  arrU,
double  alpha,
const void *  maskarr 
)
CV_IMPL void cvSquareAcc ( const void *  arr,
void *  sq_sum,
const void *  maskarr 
)