vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
|
fidelity test More...
#include <iostream>
#include <random>
#include <vigra/accumulator.hxx>
#include <vigra/multi_math.hxx>
#include <vspline/vspline.h>
Go to the source code of this file.
Functions | |
int | main (int argc, char *argv[]) |
fidelity test
This is a test to see how much a signal degrades when it is submitted to a sequence of operations:
Finally, a last shift is performed which samples the penultimate version of the signal at points coinciding with coordinates 0...N-1 of the original signal. This last iteration should ideally recreate the original sequence.
The test is done with a periodic signal to avoid margin effects. The initial sequence is created by evaluating a periodic high-degree b-spline of half the size at steps n/2. This way we start out with a signal with low high-frequency content - a signal which can be approximated well with a b-spline. Optionally, the supersampling factor can be passed on the command line to experiment with different values than the default of 2. Supersampling factors should be whole numbers (halves also work, but less precise) - so that the knot points of the original signal coincide with knot points of the supersampled signal. This way, every interval contains a partial polynomial with no discontinuities, and the spline can faithfully represent the signal. Both this program and bls.cpp show that there is a significant threshold involved: if the initial signal contains no frequencies above half the Nyquist frequency, a b-spline of sufficiently large degree becomes immune to resampling. See also bls.cpp, which produces test signals using IFFT, which is a clearer way of excluding part of the frequency spectrum, because the signal generated by IFT can - by definition - only contain frequencies which have non-zero corresponding coefficients in the FT.
compile with: clang++ -pthread -O3 -std=c++11 n_shift.cc -o n_shift
invoke like: n_shift 17 500
Definition in file n_shift.cc.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 79 of file n_shift.cc.