kfrlib / kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
https://www.kfrlib.com
GNU General Public License v2.0
1.66k stars 253 forks source link

The resample example gets errors #178

Closed OUCyf closed 1 year ago

OUCyf commented 1 year ago

Hey, This is Fu, and when I run sample_rate_conversion.cpp, I got the following errors. Note I change the name of sample_rate_conversion.cpp to test.cpp.

I use m1-max, and when I run other examples, it's fine. In addition, I also have test sample_rate_conversion.cpp in Intel-mac, m2-pro, the same errors I got

Do you know the reasons, I do want to use KFR package and apply it to commerical purposes in the future.

clang++  -std=c++17 -I/usr/local/include  -L/usr/local/lib -l kfr_io test.cpp -o test
KFR 5.0.2 neon64 64-bit (clang-14.0.0/macos) +in +ve
libc++abi: terminating with uncaught exception of type kfr::logic_error: invalid or incompatible shapes: shape{2047} and shape{2048}
[1]    90436 abort      ./test
charlescao460 commented 1 year ago

Have the same issue. Seems like on v5.0.2 the input/output sizes of the SRC must be matched using output_size_for_input() or input_size_for_output() functions. Though the comments for the process() states that:

    /// @brief Writes output.size() samples to output reading at most input.size(), then consuming zeros as
    /// input.
    /// @returns Number of processed input samples (may be less than input.size()).
    template <univector_tag Tag>
    size_t process(univector<T, Tag>& output, univector_ref<const T> input)

As of 5.0.2, the automatic zero-padding seems to be no longer working.

dancazarin commented 1 year ago

Fixed in 5.0.3