Skip to main content
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 ...
Krupip's user avatar
  • 926
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 ...
user555045's user avatar
  • 12.4k
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 (...
OrangeDog's user avatar
  • 841
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\...
JakeI's user avatar
  • 121
12 votes

Image Processing Application in C

Enable more compiler warnings: ...
Madagascar's user avatar
  • 10.1k
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 ...
user555045's user avatar
  • 12.4k
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 ...
chux's user avatar
  • 36.4k
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 ...
Nayuki's user avatar
  • 1,369
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 ...
Cris Luengo's user avatar
  • 7,021
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. ...
Toby Speight's user avatar
  • 88.3k
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: ...
J_H's user avatar
  • 42.3k
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 ...
Blindman67's user avatar
  • 22.9k
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/...
AlexV's user avatar
  • 7,363
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: <...
chux's user avatar
  • 36.4k
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 ...
aventurin's user avatar
  • 520
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. ...
enigmaticPhysicist's user avatar
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 ...
Eric Backus's user avatar
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 ...
G. Sliepen's user avatar
  • 69.3k
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 ...
Reinderien's user avatar
  • 71.1k
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 ...
Edward's user avatar
  • 67.2k
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 ...
Cris Luengo's user avatar
  • 7,021
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 ...
AlexV's user avatar
  • 7,363
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 ...
miscco's user avatar
  • 4,371
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 ...
Reinderien's user avatar
  • 71.1k
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 ...
AShelly's user avatar
  • 1,062
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: ...
Costantino Grana's user avatar
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 ...
G. Sliepen's user avatar
  • 69.3k
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 ...
David L's user avatar
  • 41
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 ...
Roland Illig's user avatar
  • 21.9k

Only top scored, non community-wiki answers of a minimum length are eligible