Commit 3def8436 authored by Marina Kolpakova's avatar Marina Kolpakova

merged the trunk r8719:8731 and 8807

parent 01570fa8
...@@ -43,6 +43,9 @@ typedef unsigned __int64 uint64_t; ...@@ -43,6 +43,9 @@ typedef unsigned __int64 uint64_t;
#include "defines.h" #include "defines.h"
#ifdef __ARM_NEON__
#include "arm_neon.h"
#endif
namespace cvflann namespace cvflann
{ {
...@@ -416,9 +419,9 @@ struct Hamming ...@@ -416,9 +419,9 @@ struct Hamming
ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
{ {
ResultType result = 0; ResultType result = 0;
#if __GNUC__ #ifdef __GNUC__
#if CV_NEON #ifdef __ARM_NEON__
if (CPU_HAS_NEON_FEATURE) { {
uint32x4_t bits = vmovq_n_u32(0); uint32x4_t bits = vmovq_n_u32(0);
for (size_t i = 0; i < size; i += 16) { for (size_t i = 0; i < size; i += 16) {
uint8x16_t A_vec = vld1q_u8 (a + i); uint8x16_t A_vec = vld1q_u8 (a + i);
...@@ -433,8 +436,7 @@ struct Hamming ...@@ -433,8 +436,7 @@ struct Hamming
result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0); result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0);
result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2); result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2);
} }
else #else
#endif
{ {
//for portability just use unsigned long -- and use the __builtin_popcountll (see docs for __builtin_popcountll) //for portability just use unsigned long -- and use the __builtin_popcountll (see docs for __builtin_popcountll)
typedef unsigned long long pop_t; typedef unsigned long long pop_t;
...@@ -454,6 +456,7 @@ struct Hamming ...@@ -454,6 +456,7 @@ struct Hamming
result += __builtin_popcountll(a_final ^ b_final); result += __builtin_popcountll(a_final ^ b_final);
} }
} }
#endif //NEON
#else #else
HammingLUT lut; HammingLUT lut;
result = lut(reinterpret_cast<const unsigned char*> (a), result = lut(reinterpret_cast<const unsigned char*> (a),
......
...@@ -274,7 +274,7 @@ void CvCapture_GStreamer::removeFilter(const char *filter) ...@@ -274,7 +274,7 @@ void CvCapture_GStreamer::removeFilter(const char *filter)
// //
// connect uridecodebin dynamically created source pads to colourconverter // connect uridecodebin dynamically created source pads to colourconverter
// //
void CvCapture_GStreamer::newPad(GstElement *uridecodebin, void CvCapture_GStreamer::newPad(GstElement * /*uridecodebin*/,
GstPad *pad, GstPad *pad,
gpointer data) gpointer data)
{ {
......
...@@ -678,6 +678,8 @@ double cvGetOpenGlProp_GTK(const char* name) ...@@ -678,6 +678,8 @@ double cvGetOpenGlProp_GTK(const char* name)
result = window->useGl; result = window->useGl;
__END__; __END__;
#else
(void)name;
#endif #endif
return result; return result;
...@@ -1004,6 +1006,8 @@ static gboolean cvImageWidget_expose(GtkWidget* widget, GdkEventExpose* event, g ...@@ -1004,6 +1006,8 @@ static gboolean cvImageWidget_expose(GtkWidget* widget, GdkEventExpose* event, g
drawGl(window); drawGl(window);
return TRUE; return TRUE;
} }
#else
(void)data;
#endif #endif
CvImageWidget *image_widget; CvImageWidget *image_widget;
......
...@@ -174,10 +174,12 @@ Compares two histograms. ...@@ -174,10 +174,12 @@ Compares two histograms.
* **CV_COMP_INTERSECT** Intersection * **CV_COMP_INTERSECT** Intersection
* **CV_COMP_BHATTACHARYYA** Bhattacharyya distance * **CV_COMP_BHATTACHARYYA** Bhattacharyya distance
* **CV_COMP_HELLINGER** Synonym for ``CV_COMP_BHATTACHARYYA``
The functions ``compareHist`` compare two dense or two sparse histograms using the specified method: The functions ``compareHist`` compare two dense or two sparse histograms using the specified method:
* Correlation (method=CV\_COMP\_CORREL) * Correlation (``method=CV_COMP_CORREL``)
.. math:: .. math::
...@@ -192,19 +194,19 @@ The functions ``compareHist`` compare two dense or two sparse histograms using t ...@@ -192,19 +194,19 @@ The functions ``compareHist`` compare two dense or two sparse histograms using t
and and
:math:`N` is a total number of histogram bins. :math:`N` is a total number of histogram bins.
* Chi-Square (method=CV\_COMP\_CHISQR) * Chi-Square (``method=CV_COMP_CHISQR``)
.. math:: .. math::
d(H_1,H_2) = \sum _I \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)} d(H_1,H_2) = \sum _I \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)}
* Intersection (method=CV\_COMP\_INTERSECT) * Intersection (``method=CV_COMP_INTERSECT``)
.. math:: .. math::
d(H_1,H_2) = \sum _I \min (H_1(I), H_2(I)) d(H_1,H_2) = \sum _I \min (H_1(I), H_2(I))
* Bhattacharyya distance (method=CV\_COMP\_BHATTACHARYYA) * Bhattacharyya distance (``method=CV_COMP_BHATTACHARYYA`` or ``method=CV_COMP_HELLINGER``). In fact, OpenCV computes Hellinger distance, which is related to Bhattacharyya coefficient.
.. math:: .. math::
......
...@@ -533,7 +533,8 @@ enum ...@@ -533,7 +533,8 @@ enum
CV_COMP_CORREL =0, CV_COMP_CORREL =0,
CV_COMP_CHISQR =1, CV_COMP_CHISQR =1,
CV_COMP_INTERSECT =2, CV_COMP_INTERSECT =2,
CV_COMP_BHATTACHARYYA =3 CV_COMP_BHATTACHARYYA =3,
CV_COMP_HELLINGER =CV_COMP_BHATTACHARYYA
}; };
/* Mask size for distance transform */ /* Mask size for distance transform */
......
...@@ -1129,26 +1129,26 @@ norm_(const _Tp* src, size_t total, int cn, int normType, double startval, const ...@@ -1129,26 +1129,26 @@ norm_(const _Tp* src, size_t total, int cn, int normType, double startval, const
{ {
if( !mask ) if( !mask )
for( i = 0; i < total; i++ ) for( i = 0; i < total; i++ )
result = std::max(result, (double)std::abs(int(src[i]))); result = std::max(result, (double)std::abs(0+src[i]));// trick with 0 used to quiet gcc warning
else else
for( int c = 0; c < cn; c++ ) for( int c = 0; c < cn; c++ )
{ {
for( i = 0; i < total; i++ ) for( i = 0; i < total; i++ )
if( mask[i] ) if( mask[i] )
result = std::max(result, (double)std::abs(int(src[i*cn + c]))); result = std::max(result, (double)std::abs(0+src[i*cn + c]));
} }
} }
else if( normType == NORM_L1 ) else if( normType == NORM_L1 )
{ {
if( !mask ) if( !mask )
for( i = 0; i < total; i++ ) for( i = 0; i < total; i++ )
result += std::abs(int(src[i])); result += std::abs(0+src[i]);
else else
for( int c = 0; c < cn; c++ ) for( int c = 0; c < cn; c++ )
{ {
for( i = 0; i < total; i++ ) for( i = 0; i < total; i++ )
if( mask[i] ) if( mask[i] )
result += std::abs(int(src[i*cn + c])); result += std::abs(0+src[i*cn + c]);
} }
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment