Add signal module with signal resampling function#3613
Add signal module with signal resampling function#3613opencv-pushbot merged 1 commit intoopencv:4.xfrom
Conversation
529db0a to
ec7edb9
Compare
ec7edb9 to
c7602a8
Compare
68a4b7b to
e802999
Compare
opencv-alalek
left a comment
There was a problem hiding this comment.
Thank you for the contribution!
Please take a look on comments below.
modules/signal/test/test_signal.cpp
Outdated
|
|
||
| float MSE(const Mat1f &outSignal, const Mat1f &refSignal) | ||
| { | ||
| auto mse{0.f}; |
There was a problem hiding this comment.
Please use
float mse = 0.f;
here and below (instead of "auto" scalars).
To workaround old ARMv7 compiler.
| static float Bessel(float x) | ||
| { | ||
| int k = 12; // approximation parameter | ||
| float defmul = powf(x, 2) * 0.25f; |
There was a problem hiding this comment.
powf(x, 2)
x * x should be faster.
The same is below.
| { | ||
| tabs[i] = 2 * fc * (i - (ntabs - 1) / 2); | ||
| } | ||
| float *tmparr = new float[ntabs]; |
There was a problem hiding this comment.
Please use cv::AutoBuffer or std::vector instead. Avoid manual memory management.
| for (int i = 0; i < ntabs; ++i) | ||
| { | ||
| tabs[i] = std::sin(tmparr[i]) / tmparr[i]; | ||
| tabs[i] *= Bessel(beta * sqrtf((float)1 - powf((2 * i / (float)(ntabs - 1) - 1), 2))) / Bessel(beta); |
There was a problem hiding this comment.
/ (float)(ntabs - 1)
could be moved out of the loop as pre-computed 2.0f / (float)(ntabs - 1)
|
|
||
| /////////////// cubic Hermite spline (OpenCV's Universal Intrinsics) /////////////// | ||
| #if (CV_SIMD || CV_SIMD_SCALABLE) | ||
| static v_float32 simd_cubicHermite(v_float32 v_A, v_float32 v_B, v_float32 v_C, v_float32 v_D, v_float32 v_t) |
There was a problem hiding this comment.
v_float32
static inlineconst v_float32&to workaround alignment issues (see Win32 builder)
c82e7f5 to
71d52c8
Compare
|
Thank you for the updates! |
71d52c8 to
953024c
Compare
Found the issue in scalar code. Fixed |
| // of this distribution and at http://opencv.org/license.html | ||
| #ifndef OPENCV_SIGNAL_HPP | ||
| #define OPENCV_SIGNAL_HPP | ||
|
|
There was a problem hiding this comment.
Please add module declaration for documentation: http://pullrequest.opencv.org/buildbot/export/pr_contrib/3613/docs/
/**
@defgroup signal Signal Processing
This module includes signal processing algorithms.
@}
*/
There was a problem hiding this comment.
Added declaration
953024c to
ec96a9f
Compare
ec96a9f to
be00f49
Compare
|
Added fix for Windows10-x64 warnings check |
be00f49 to
105e514
Compare
Added signal module with resampling function implemented with cubic interpolation function and a filtering function based on Kaiser window and Bessel function, used to construct a FIR filter.
Detail: https://en.wikipedia.org/wiki/Sample-rate_conversion
There are provided:
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.