21#ifndef mia_core_nccsum_hh
22#define mia_core_nccsum_hh
37 m_sumab_by_a2b2(0.0), m_sumab_by_suma2(0.0),
38 m_mean_a(0.0), m_mean_b(0.0)
42 NCCGradHelper(
double sumab_by_a2b2,
double sumab_by_suma2,
double mean_a,
double mean_b):
43 m_sumab_by_a2b2(2.0 * sumab_by_a2b2), m_sumab_by_suma2(sumab_by_suma2),
44 m_mean_a(mean_a), m_mean_b(mean_b)
50 return m_sumab_by_a2b2 * ( m_sumab_by_suma2 * ( a - m_mean_a ) - (b - m_mean_b));
55 double m_sumab_by_a2b2;
56 double m_sumab_by_suma2;
66 typedef double v2df __attribute__ ((vector_size (16)));
68 NCCSums(): m_sumab(0.0), m_n(0.0)
70 double zero[2] = {0.0, 0.0};
71 m_sum = _mm_loadu_pd(zero);
75 void add(
double a,
double b)
77 v2df val = {
static_cast<double>(a),
static_cast<double>(b)};
88 m_sum2 += other.m_sum2;
89 m_sumab += other.m_sumab;
94 bool has_samples()
const
101 std::pair<double, NCCGradHelper> get_grad_helper()
const;
117 m_suma2(0.0), m_sumb2(0.0),
118 m_sumab(0.0), m_n(0.0)
122 void add(
double a,
double b)
134 m_suma += other.m_suma;
135 m_sumb += other.m_sumb;
136 m_suma2 += other.m_suma2;
137 m_sumb2 += other.m_sumb2;
138 m_sumab += other.m_sumab;
EXPORT_2D C2DFVectorfield & operator+=(C2DFVectorfield &a, const C2DFVectorfield &b)
float get_gradient_scale(double a, double b) const
NCCGradHelper(double sumab_by_a2b2, double sumab_by_suma2, double mean_a, double mean_b)
void add(double a, double b)
std::pair< double, NCCGradHelper > get_grad_helper() const
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
#define NS_MIA_END
conveniance define to end the mia namespace
NCCSums operator+(const NCCSums &lhs, const NCCSums &rhs)