24
votes
Implementation of the trigonometric functions for real time application
Your implementation is going to be slow, and the excuse "I need it to take a fixed amount of time" does not justify this. Using plain tables smells like cargo culting as well.
So I'm not ...
21
votes
Accepted
Radix2 Fast Fourier Transform implemented in C++
Putting this through the built-in profiler reveals some hot spots. Perhaps surprisingly: ReverseBits. It's not the biggest thing in the list, but it is significant ...
14
votes
Accepted
OpenCL implementations of IQZZ and IDCT for MJPEG
Indent your loop bodies.
Actually check ret - you're uselessly assigning and discarding it every time.
Use better variable names: avoid single letters (...
12
votes
Implementing convolution using SymPy
Your code shouldn't work:
You are calculating:
$$\int_a^b f(t) \, g(t - \tau) \; d\tau$$
but convolution is defined as:
$$f(t) \, * \, g(t) \equiv \int_{-\infty}^{\infty} f(\tau) \, g(t - \tau) \; d\...
12
votes
12
votes
I implemented FFT in C
double complex sub_even[N/2];
double complex sub_odd[N/2];
These are VLAs and they have the usual problem: it's easy to cause a stack overflow this way. No big ...
11
votes
Image Processing Application in C
Size to the object, not type
Rather than sizeof(Pixel), use sizeof image->pixels[0]. It is easier to code right, review and ...
10
votes
Radix2 Fast Fourier Transform implemented in C++
These lines:
size_t N_stage = static_cast<size_t>(std::pow(2, stage));
size_t W_offset = static_cast<size_t>(std::pow(2, stages - stage));
should not ...
10
votes
Accepted
Image Processing Application in C
Let's talk about the API. I've worked with multiple imaging libraries over the past ~25 years, and have significant experience designing them too.
API:
Let's start with the image container, the core ...
9
votes
I implemented FFT in C
We assume that N at each level is exactly divisible by 2, but we never confirm this. That can lead to users wondering why up to half of their input is ignored.
...
8
votes
Accepted
Fourier Series of a given function
I like it.
This code hews closely to the underlying math,
using lovely identifiers, and is very clear.
For {a,b}_k, here's the only
part I'm not super happy with:
...
7
votes
Accepted
Performing a "mean blur"
Convolution Filter
In CG this type of processing is call a convolution filter and there are many strategies used to handle edges
As the previous answer points out for performance you are best to use ...
7
votes
Accepted
Bilinear image interpolation
I would like to share some observations about your main concerns given at the end of the question. Let's start from the back:
5. extend_col/...
7
votes
I implemented FFT in C
Memory
Seem strange to use VLAs and multiple malloc() allocations - and not checking for success - that is unsafe.
Consider instead 1 allocation and add a check:
<...
6
votes
Performing a "mean blur"
Since you not only need adjacent values but also the number of adjacent cells, I do not think that there's a way to work around conditions that cover the corner cases. However, you can make a case ...
6
votes
Accepted
Modulating an oscillator by gain, pitch, and offset
counting flops
Let's unpack the inner loop, where all the work is being done. I am repeating the whole thing here, wrapping to 80 columns and adding some indentation to make it easier to read.
...
6
votes
Accepted
How could I make FFTW Hilbert transform calculate faster?
Updated Code Review for 2020-12-30 Code
Some of the original code review items have been addressed. Good work! Here are some remaining ideas:
I assume your purpose here is to make the ...
6
votes
Accepted
Image Stitching using SIFT Keypoint Descriptor in C++
Congratulations on getting this far; doing image stitching is far from trivial! The next step to make it looking truly professional is a more sophisticated blending algorithm for the overlapping ...
5
votes
Modulating an oscillator by gain, pitch, and offset
Don't define pi and twopi yourself. They should be available from math.h as M_PI and M_2_PI if you're in the GNU stack.
Defining ...
5
votes
Accepted
DSP-Quantizer class in C++
I see a number of things that may help you improve your program.
Omit empty destructor
The compiler will automatically generate a destructor that would, in this case be identical to the empty one ...
5
votes
Accepted
Median Filter Implementation In Python
Code review
Peilonrays points out a mixup with the out-of-bounds testing that is valid. The statement if j ... must be within the loop ...
5
votes
Hurst Exponent calculator
A few observations:
s_t = np.zeros(n) and r_t = np.zeros(n) are more than you need. Since you don't actually use the array ...
5
votes
Radix2 Fast Fourier Transform implemented in C++
You should be able to work inplace by utilizing the fact that std::complex has a predefined layout. Therefore you can actually cast between an array of double and an array of (half as many) complex ...
5
votes
Peak valley detection in python
Putting aside the matter of optimization for now: I have concerns about the numerical approach here. If this is written with a specific application in mind, and you can make certain assumptions about ...
5
votes
Drift correction for sensor readings using a high-pass filter
Not a full review, just some design ideas:
For a realtime system, I'd probably make the sampler object guarantee to produce valid values, rather than forcing all ...
5
votes
Image Processing Application in C
The other contributors made an excellent review of your code. I just want to comment on the philosophy or rationale behind this library choices.
Let's talk about the aim of computing a Sobel's filter: ...
5
votes
Accepted
Determining Error Rate of Phase Shift Keying via Monte Carlo Simulation
Add a way to pass simulation parameters via the command line
You are hardcoding the test parameters in main(). That means you have to change that file and recompile ...
4
votes
Poor performance for signal processing
I only have a few minor things to offer
Having done some quick testing, np.linspace is significantly faster (about 60x) than np.arange
...
4
votes
FFT Convolution
A few detail remarks:
Complex[,] convolve = null;
This variable declaration should be moved further down, to the line where it is actually needed. Initializing ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
signal-processing × 104python × 33
performance × 32
c++ × 30
image × 18
numpy × 16
algorithm × 15
c × 15
matlab × 13
audio × 8
beginner × 6
c++23 × 6
reinventing-the-wheel × 5
numerical-methods × 5
python-3.x × 4
array × 4
time-limit-exceeded × 4
matrix × 4
mathematics × 4
scipy × 4
java × 3
c# × 3
haskell × 3
memory-management × 3
cython × 3