mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
84d900cfda
Vectorize the per-sample squared-Euclidean distance in BruteForceImpl::findNearestCore with universal intrinsics (two independent v_fma accumulators + scalar tail). The scalar reduction accumulates in float in strict order, which the compiler cannot auto-vectorize without -ffast-math; independent SIMD accumulators break that serial-accumulation dependency. Accumulates in float exactly as before (only summation order changes, ~1e-7, below stored float precision); selected neighbors and distances matched scalar on all test data, ML_KNearest tests pass. Real findNearest A/B: 3.76x M4, 3.47x Threadripper, 3.73x Xeon, 4.10x A76, 2.82x A55 (in-order). Adds modules/ml/perf with a findNearest perf test.
16 lines
400 B
C++
16 lines
400 B
C++
// This file is part of OpenCV project.
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
// of this distribution and at http://opencv.org/license.html.
|
|
#ifndef __OPENCV_PERF_PRECOMP_HPP__
|
|
#define __OPENCV_PERF_PRECOMP_HPP__
|
|
|
|
#include <opencv2/ts.hpp>
|
|
#include <opencv2/ml.hpp>
|
|
|
|
namespace opencv_test {
|
|
using namespace perf;
|
|
using namespace cv::ml;
|
|
}
|
|
|
|
#endif
|