⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cxnorm.cpp

📁 opencv库在TI DM6437上的移植,目前包括两个库cv.lib和cxcore.lib的工程
💻 CPP
📖 第 1 页 / 共 5 页
字号:
            int limit = MIN( remaining, size.width - x );       \
            remaining -= limit;                                 \
            limit += x;                                         \
            ICV_NORM_MASK_CASE( _op_, _update_op_,              \
                                worktype, limit );              \
            if( remaining == 0 )                                \
            {                                                   \
                remaining = block_size;                         \
                total_norm += (normtype)norm;                   \
                norm = 0;                                       \
            }                                                   \
        }                                                       \
    }                                                           \
                                                                \
    total_norm += (normtype)norm;                               \
    *_norm = post_func((double)total_norm);                     \
    return CV_OK;                                               \
}


#define  ICV_DEF_NORM_MASK_NOHINT_FUNC_2D( name, _op_, _update_op_,\
    post_func, arrtype, normtype, worktype, block_size )        \
IPCVAPI_IMPL( CvStatus, name, ( const arrtype* src, int step,   \
    const uchar* mask, int maskstep, CvSize size, double* _norm ),\
    (src, step, mask, maskstep, size, _norm) )                  \
{                                                               \
    normtype norm = 0;                                          \
    step /= sizeof(src[0]);                                     \
                                                                \
    for( ; size.height--; src += step, mask += maskstep )       \
    {                                                           \
        int x = 0;                                              \
        ICV_NORM_MASK_CASE( _op_, _update_op_,                  \
                            worktype, size.width );             \
    }                                                           \
                                                                \
    *_norm = post_func((double)norm);                           \
    return CV_OK;                                               \
}


#define  ICV_DEF_NORM_MASK_NOHINT_BLOCK_FUNC_2D_COI( name, _op_,\
                _update_op_, post_func, arrtype,                \
                normtype, worktype, block_size )                \
static CvStatus CV_STDCALL name( const arrtype* src, int step,  \
    const uchar* mask, int maskstep, CvSize size,               \
    int cn, int coi, double* _norm )                            \
{                                                               \
    int remaining = block_size;                                 \
    normtype total_norm = 0;                                    \
    worktype norm = 0;                                          \
    step /= sizeof(src[0]);                                     \
    src += coi - 1;                                             \
                                                                \
    for( ; size.height--; src += step, mask += maskstep )       \
    {                                                           \
        int x = 0;                                              \
        while( x < size.width )                                 \
        {                                                       \
            int limit = MIN( remaining, size.width - x );       \
            remaining -= limit;                                 \
            limit += x;                                         \
            ICV_NORM_MASK_COI_CASE( _op_, _update_op_,          \
                                    worktype, limit, cn );      \
            if( remaining == 0 )                                \
            {                                                   \
                remaining = block_size;                         \
                total_norm += (normtype)norm;                   \
                norm = 0;                                       \
            }                                                   \
        }                                                       \
    }                                                           \
                                                                \
    total_norm += (normtype)norm;                               \
    *_norm = post_func((double)total_norm);                     \
    return CV_OK;                                               \
}


#define  ICV_DEF_NORM_MASK_NOHINT_FUNC_2D_COI( name, _op_,      \
    _update_op_, post_func,                                     \
    arrtype, normtype, worktype, block_size )                   \
static CvStatus CV_STDCALL name( const arrtype* src, int step,  \
    const uchar* mask, int maskstep, CvSize size,               \
    int cn, int coi, double* _norm )                            \
{                                                               \
    normtype norm = 0;                                          \
    step /= sizeof(src[0]);                                     \
    src += coi - 1;                                             \
                                                                \
    for( ; size.height--; src += step, mask += maskstep )       \
    {                                                           \
        int x = 0;                                              \
        ICV_NORM_MASK_COI_CASE( _op_, _update_op_,              \
                                worktype, size.width, cn );     \
    }                                                           \
                                                                \
    *_norm = post_func((double)norm);                           \
    return CV_OK;                                               \
}



#define  ICV_DEF_NORM_DIFF_MASK_NOHINT_BLOCK_FUNC_2D( name,     \
    _op_, _update_op_, post_func, arrtype,                      \
    normtype, worktype, block_size )                            \
IPCVAPI_IMPL( CvStatus, name,( const arrtype* src1, int step1,  \
    const arrtype* src2, int step2, const uchar* mask,          \
    int maskstep, CvSize size, double* _norm ),                 \
    (src1, step1, src2, step2, mask, maskstep, size, _norm ))   \
{                                                               \
    int remaining = block_size;                                 \
    normtype total_norm = 0;                                    \
    worktype norm = 0;                                          \
    step1 /= sizeof(src1[0]);                                   \
    step2 /= sizeof(src2[0]);                                   \
                                                                \
    for( ; size.height--; src1 += step1, src2 += step2,         \
                          mask += maskstep )                    \
    {                                                           \
        int x = 0;                                              \
        while( x < size.width )                                 \
        {                                                       \
            int limit = MIN( remaining, size.width - x );       \
            remaining -= limit;                                 \
            limit += x;                                         \
            ICV_NORM_DIFF_MASK_CASE( _op_, _update_op_,         \
                                     worktype, limit );         \
            if( remaining == 0 )                                \
            {                                                   \
                remaining = block_size;                         \
                total_norm += (normtype)norm;                   \
                norm = 0;                                       \
            }                                                   \
        }                                                       \
    }                                                           \
                                                                \
    total_norm += (normtype)norm;                               \
    *_norm = post_func((double)total_norm);                     \
    return CV_OK;                                               \
}


#define  ICV_DEF_NORM_DIFF_MASK_NOHINT_FUNC_2D( name, _op_,     \
    _update_op_, post_func,                                     \
    arrtype, normtype, worktype, block_size )                   \
IPCVAPI_IMPL( CvStatus, name,( const arrtype* src1, int step1,  \
    const arrtype* src2, int step2, const uchar* mask,          \
    int maskstep, CvSize size, double* _norm ),                 \
    (src1, step1, src2, step2, mask, maskstep, size, _norm ))   \
{                                                               \
    normtype norm = 0;                                          \
    step1 /= sizeof(src1[0]);                                   \
    step2 /= sizeof(src2[0]);                                   \
                                                                \
    for( ; size.height--; src1 += step1, src2 += step2,         \
                          mask += maskstep )                    \
    {                                                           \
        int x = 0;                                              \
        ICV_NORM_DIFF_MASK_CASE( _op_, _update_op_,             \
                                 worktype, size.width );        \
    }                                                           \
                                                                \
    *_norm = post_func((double)norm);                           \
    return CV_OK;                                               \
}


#define  ICV_DEF_NORM_DIFF_MASK_NOHINT_BLOCK_FUNC_2D_COI( name, \
    _op_, _update_op_, post_func, arrtype,                      \
    normtype, worktype, block_size )                            \
static CvStatus CV_STDCALL name( const arrtype* src1, int step1,\
    const arrtype* src2, int step2, const uchar* mask,          \
    int maskstep, CvSize size, int cn, int coi, double* _norm ) \
{                                                               \
    int remaining = block_size;                                 \
    normtype total_norm = 0;                                    \
    worktype norm = 0;                                          \
    step1 /= sizeof(src1[0]);                                   \
    step2 /= sizeof(src2[0]);                                   \
    src1 += coi - 1;                                            \
    src2 += coi - 1;                                            \
                                                                \
    for( ; size.height--; src1 += step1, src2 += step2,         \
                          mask += maskstep )                    \
    {                                                           \
        int x = 0;                                              \
        while( x < size.width )                                 \
        {                                                       \
            int limit = MIN( remaining, size.width - x );       \
            remaining -= limit;                                 \
            limit += x;                                         \
            ICV_NORM_DIFF_MASK_COI_CASE( _op_, _update_op_,     \
                                    worktype, limit, cn );      \
            if( remaining == 0 )                                \
            {                                                   \
                remaining = block_size;                         \
                total_norm += (normtype)norm;                   \
                norm = 0;                                       \
            }                                                   \
        }                                                       \
    }                                                           \
                                                                \
    total_norm += (normtype)norm;                               \
    *_norm = post_func((double)total_norm);                     \
    return CV_OK;                                               \
}


#define  ICV_DEF_NORM_DIFF_MASK_NOHINT_FUNC_2D_COI( name, _op_, \
    _update_op_, post_func,                                     \
    arrtype, normtype, worktype, block_size )                   \
static CvStatus CV_STDCALL name( const arrtype* src1, int step1,\
    const arrtype* src2, int step2, const uchar* mask,          \
    int maskstep, CvSize size, int cn, int coi, double* _norm ) \
{                                                               \
    normtype norm = 0;                                          \
    step1 /= sizeof(src1[0]);                                   \
    step2 /= sizeof(src2[0]);                                   \
    src1 += coi - 1;                                            \
    src2 += coi - 1;                                            \
                                                                \
    for( ; size.height--; src1 += step1, src2 += step2,         \
                          mask += maskstep )                    \
    {                                                           \
        int x = 0;                                              \
        ICV_NORM_DIFF_MASK_COI_CASE( _op_, _update_op_,         \
                                     worktype, size.width, cn );\
    }                                                           \
                                                                \
    *_norm = post_func((double)norm);                           \
    return CV_OK;                                               \
}


//////////////////////////////////// The macros expanded /////////////////////////////////


#define ICV_DEF_NORM_FUNC_ALL_C(flavor, _abs_, _abs_diff_, arrtype, worktype)\
                                                                            \
ICV_DEF_NORM_NOHINT_FUNC_2D( icvNorm_Inf_##flavor##_C1R,                    \
    _abs_, MAX, CV_NOP, arrtype, worktype, worktype, 0 )                    \
                                                                            \
ICV_DEF_NORM_NOHINT_FUNC_2D_COI( icvNorm_Inf_##flavor##_CnCR,               \
    _abs_, MAX, CV_NOP, arrtype, worktype, worktype, 0 )                    \
                                                                            \
ICV_DEF_NORM_DIFF_NOHINT_FUNC_2D( icvNormDiff_Inf_##flavor##_C1R,           \
    _abs_diff_, MAX, CV_NOP, arrtype, worktype, worktype, 0 )               \
                                                                            \
ICV_DEF_NORM_DIFF_NOHINT_FUNC_2D_COI( icvNormDiff_Inf_##flavor##_CnCR,      \
    _abs_diff_, MAX, CV_NOP, arrtype, worktype, worktype, 0 )               \
                                                                            \
ICV_DEF_NORM_MASK_NOHINT_FUNC_2D( icvNorm_Inf_##flavor##_C1MR,              \
    _abs_, MAX, CV_NOP, arrtype, worktype, worktype, 0 )                    \
                                                                            \
ICV_DEF_NORM_MASK_NOHINT_FUNC_2D_COI( icvNorm_Inf_##flavor##_CnCMR,         \
    _abs_, MAX, CV_NOP, arrtype, worktype, worktype, 0 )                    \
                                                                            \
ICV_DEF_NORM_DIFF_MASK_NOHINT_FUNC_2D( icvNormDiff_Inf_##flavor##_C1MR,     \
    _abs_diff_, MAX, CV_NOP, arrtype, worktype, worktype, 0 )               \
                                                                            \
ICV_DEF_NORM_DIFF_MASK_NOHINT_FUNC_2D_COI( icvNormDiff_Inf_##flavor##_CnCMR,\
    _abs_diff_, MAX, CV_NOP, arrtype, worktype, worktype, 0 )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -