Coder Social home page Coder Social logo

jniemann66 / resampler Goto Github PK

View Code? Open in Web Editor NEW
158.0 5.0 25.0 267.38 MB

High quality command-line audio sample rate converter

License: GNU Lesser General Public License v2.1

C++ 2.06% HTML 1.38% CSS 0.02% C 74.25% Makefile 9.91% Fortran 1.74% Shell 3.33% CMake 0.70% Perl 0.36% M4 0.92% TeX 2.04% OCaml 1.61% Roff 0.18% MATLAB 0.04% Python 0.27% C# 0.05% Smarty 1.13%
sample-rate conversion audio-applications sample-rate-conversion audio-conversion lowpass-filter fir-filter resample bit-depth frequency-response

resampler's People

Contributors

godsic avatar jniemann66 avatar mgood7123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

resampler's Issues

Sometimes audio is duplicated

This only happens on some tracks.
Audio for eximple.
Duration: 00:04:18.142

After:
ReSamplerLib -i './01 - Cloud 9.flac' -o './+resampled/01 - Cloud 9.flac' -r 44100 -b 16
Duration: 00:04:18.142

After:
ReSamplerLib -i './01 - Cloud 9.flac' -o './+resampled/01 - Cloud 9.flac' -r 44100 -b 16 --dither
Duration: 00:08:36.285
This is this track, but 2 times in a row.

ReSampler is built with:
g++ -pthread -std=gnu++11 main.cpp ReSampler.cpp conversioninfo.cpp -lfftw3 -lsndfile -o ReSampler -O3 -lquadmath -DUSE_QUADMATH
or this:
g++ -pthread -std=c++11 main.cpp ReSampler.cpp conversioninfo.cpp -lfftw3 -lsndfile -o ReSampler -O3 -DUSE_AVX -DUSE_FMA -mavx -mfma
result is the same

Very short sound clips do not convert correctly

I liked the iedea of you ReSampler software, I was searching for the best quality reasampler as I wanted to convert 16 bit Impulse responces from 44100 to 48000.
As they are to be used for convolver fileters I wanted best quality for the multi channel files.

I converted the
[hoast_o1_01-04ch.wav] (https://github.com/thomasdeppisch/hoast360/blob/master/irs/hoast_o1_01-04ch.wav)
and
[hoast_o3_01-04ch.wav] (https://github.com/thomasdeppisch/hoast360/blob/master/irs/hoast_o3_01-04ch.wav)

The results came out as files with longer or shorter times than the originals and the impulse miximums where not in the same time slots. I compared the originals with the resampled results in Reaper.

I solved my need with the use of the highest quality Render setting in the Reaper DAW with the use of extreme setting for resampling.
I do not know if this resulted in similar quality as a ReSampler would have produced if it was working correctly.

Segfault upon completion of conversion (gcc / minGW only)

Description: occasional crash at the end of the conversion
Affects: version 2.0.0+ when compiled with gcc or minGW

Suspect double-free or some other deallocation issue

2.0.0-pre-release 64-bit version                                                                                                                                                   
Input file: ./inputs/96khz_sweep-3dBFS_32f.wav                                                                                                                                     
Output file: ./outputs/96khz_sweep-3dBFS_32f-to44k-dp-steep.wav                                                                                                                    
Using double precision for calculations.                                                                                                                                           
input bit format: 32f (float)                                                                                                                                                      
source file channels: 1                                                                                                                                                            
input sample rate: 96000                                                                                                                                                           
output sample rate: 44100                                                                                                                                                          
Scanning input file for peaks ...Done                                                                                                                                              
Peak input sample: 0.707107 (-3.010297 dBFS) at 0:0:0.215438                                                                                                                       
LPF transition frequency: 21047.73 Hz (95.45 %)                                                                                                                                    
Conversion ratio: 0.459375 (147:320)                                                                                                                                               
Writing Metadata                                                                                                                                                                   
Converting ...Done                                                                                                                                                                 
Peak output sample: 0.707107 (-3.010297 dBFS)                                                                                                                                      
Time=329 ms [24.3x]                                                                                                                                                                

*** Error in `../ReSampler': double free or corruption (out): 0x0000000001a7edc0 ***              

Update 24/02/18:
fixed channel output buffer size out-by-one bug.
See attached valgrind output
valgrind-session-ReSampler-bug.txt

Update 17/02/18: crashing as soon as
std::vector<std::vector> outputChannelBuffers;
is destroyed. Still not exactly sure why.

Need help from CMake expert to improve CMake Code

CMake To-do list

  • build the guts of ReSampler as a library (static or shared) , whilst still being able to build the executable version as well

  • build on all platforms (or as many as possible)

  • build various configurations

  • GCC/Clang: need these configs: AVX

  • GCC/Clang: need these configs: AVX+FMA. Quadmath, NoSSE

  • MSVC: need these configs: 32/NoSSE, AVX+FMA

  • make library easily discoverable by other CMake Projects

  • download dependencies (libsndfile and co ) as necessary

  • consolidate ANDROID with the others

Sound duration

Windows 7 x64, ReSampler 2.1.0

Source: Swept_24.wav from http://src.infinitewave.ca/TestSignals.zip

$ mediainfo Swept_24.wav
Duration                                 : 8 s 0 ms

$ resampler -i Swept_24.wav -o out-res.wav -r 44100 --doubleprecision
2.1.0 64-bit version
Input file: Swept_24.wav
Output file: out-res.wav
Using double precision for calculations.
input bit format: 24
source file channels: 1
input sample rate: 96000
output sample rate: 44100
Scanning input file for peaks ...Done
Peak input sample: 0.500000 (-6.020598 dBFS) at 0:0:0.100000
LPF transition frequency: 20045.45 Hz (90.91 %)
Conversion ratio: 0.459375 (147:320)
Writing Metadata
Converting (multi-stage) ...
Writing to output file ...
Done
Peak output sample: 0.500000 (-6.020597 dBFS)
Time=333 ms [24.0x]

$ mediainfo out-res.wav
Duration                                 : 7 s 997 ms

If I add --singleStage, then Duration is still not 8 s, but 7 s 999 ms.

Other resamplers I know of keep the sound duration intact.

Slow and low quality output

Just tried command line tool. Trivial conversion from 44100 -> 48000 -> 44100. Produces huge differences. (Is it wrong synchronization I dunno.) and manages barely 3x real time processing.

memory buffer based file conversion

what are your thoughts about implementing memory based file conversion? (eg using memory buffers instead of physical/RAM-based filesystem files)

also perhaps a queue based conversion, based on memory buffers, something like this

// assume the user wants to convert then process the output file as it is being converted

char * waveFile;

extern size_t read__(char *file, char * *p); // reads an entire file

read__("someWaveFile.wav", &waveFile);

// Re->open_mem opens a memory file for processing as if it where a standard physical file

Re->open_mem(waveFile);

bool has_header = false;

// process header if output has one
// NOTE: if data is required in order for the header to be correctly written then do so first
// NOTE: the user implementation MUST be able to support this

// NOTE: if the user knows what data to expect in the header they could avoid reading it entirely

// in the event the user require the header and it is required in order for data to be processed

if (!Re->header_requires_all_data())
    if (Re->has_header()) {
        process_header(Re->get_header());
        has_header = true;
    }

// another way to obtain the header should it require data, could be to process all data before hand

// however this approach eliminates the real-time aspect since the data would be pre-converted
// and would produce lag/stuttering given sufficiently large data
// and converting the file twice would just waste time since it is already converted

// in the event the user require the header and it is required in order for data to be processed

if (Re->header_requires_all_data())
    // process all data before hand
    while (Re->has_samples()) Re->get_one_sample();
    // rewind memory file index back to start without erasing header information
    // and without erasing converted data
    Re->rewind_keep_header_keep_conversion();
    // obtain header
    if (Re->has_header()) {
        process_header(Re->get_header());
        has_header = true;
    }

// Re->has_samples returns true if there is data to convert, otherwise false for EOF or equivilant
while (Re->has_samples())
    // Re->get_one_sample converts and return one sample
    process_one_sample(Re->get_one_sample());

// in the event the user require the header and it is not required in order for data to be processed
if (!has_header)
    if (Re->has_header())
        process_header(Re->get_header());
/*    from http://www.mega-nerd.com/libsndfile/FAQ.html#Q017

Q17 : Can libsndfile read/write files from/to UNIX pipes?

Yes, libsndfile can read files from pipes. Unfortunately, the write case is much more complicated.

File formats like AIFF and WAV have information at the start of the file (the file header) which states the length of the file, the number of sample frames etc. This information must be filled in correctly when the file header is written, but this information is not reliably known until the file is closed. This means that libsndfile cannot write AIFF, WAV and many other file types to a pipe.

However, there is at least one file format (AU) which is specifically designed to be written to a pipe. Like AIFF and WAV, AU has a header with a sample frames field, but it is specifically allowable to set that frames field to 0x7FFFFFFF if the file length is not known when the header is written. The AU file format can also hold data in many of the standard formats (ie SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_FLOAT etc) as well as allowing data in both big and little endian format.

See also FAQ Q6. 

Q6 : What's the best format for storing temporary files?

When you want to store temporary data there are a number of requirements;

    A simple, easy to parse header.
    The format must provide the fastest possible read and write rates (ie avoid conversions and encoding/decoding).
    The file format must be reasonably common and playable by most players.
    Able to store data in either endian-ness. 

The format which best meets these requirements is AU, which allows data to be stored in any one of short, int, float and double (among others) formats.

For instance, if an application uses float data internally, its temporary files should use a format of (SF_ENDIAN_CPU | SF_FORMAT_AU | SF_FORMAT_FLOAT) which will store big endian float data in big endian CPUs and little endian float data on little endian CPUs. Reading and writing this format will not require any conversions or byte swapping regardless of the host CPU. 
*/

Gapless playback not perfect

I have resampled some tracks with your resampler from 88/24 to 44.1/16 and I noticed less than perfect gapless playback. A soft click happens between two consecutive tracks, where there should be none, since it is not in the original files.

So I resampled the tracks again with SOX and with SSRC to find out more about where the flaw could be. With these resamplers I heard no pop and upon inspection of the number of samples the latter showed the same amount of samples: 14 449 512 samples whereas ReSampler cut it short at 14 449 461 samples.

--noDelayTrim results in the amount of samples to be the same as SOX and SSRC, that happen to be aligned to the 588 samples boundary of the CD format. And yet, when one track transitions to another, I can still hear a soft click. It seems time is being shifted in the resulting file by 51 samples?

Microsoft m128_f32 not supported in gcc

When trying to enable SSE2 intrinsic code for GCC, get this:

In file included from ReSampler.cpp:28:0:
FIRFilter.h: In member function ‘FloatType FIRFilter<FloatType>::get()’:
FIRFilter.h:246:25: error: request for member ‘m128_f32’ in ‘accumulator’, which is of non-class type ‘__m128 {aka __vector(4) float}’
   output += accumulator.m128_f32[0] +
                         ^
FIRFilter.h:247:16: error: request for member ‘m128_f32’ in ‘accumulator’, which is of non-class type ‘__m128 {aka __vector(4) float}’
    accumulator.m128_f32[1] +
                ^
FIRFilter.h:248:16: error: request for member ‘m128_f32’ in ‘accumulator’, which is of non-class type ‘__m128 {aka __vector(4) float}’
    accumulator.m128_f32[2] +
                ^
FIRFilter.h:249:16: error: request for member ‘m128_f32’ in ‘accumulator’, which is of non-class type ‘__m128 {aka __vector(4) float}’
    accumulator.m128_f32[3];

May need to create a union.
relevant link on SO ?

potential bug with default subformat and 32-bit float input:

1.1.0 32-bit version, SSE2 build ... CPU supports SSE2 (ok)

Input file: C:\webprojects\WebSite1\uploads\f0f661bc7292305bcb54a3ca1d16547b
Output file: C:\webprojects\WebSite1\uploads\f0f661bc7292305bcb54a3ca1d16547b.wav
Output Bit Format not specified
Output file format wav and subformat 32f combination not valid ... defaulting to 16
Changing output file format to wav
source file channels: 1
input sample rate: 88200
output sample rate: 44100
input bit format: 32f (float)

Conversion ratio: 0.5 (1:2)
Scanning input file for peaks ...Done
Peak input sample: 0.000010 (-100.000267 dBFS)
Converting ...Done
Peak output sample: 0.000010 (-100.331604 dBFS)
Time=109 ms

</converter output>

ReSampler-2.1.1pre on ArchLinux: ‘numeric_limits’ is not a member of ‘std’

Trying to compile ReSampler-2.1.1pre on ArchLinux:

  1. Using libsndfile 1.2.2 of ArchLinux package repository
  2. Using fftw 3.3.10 of ArchLinux package repository
  3. Errors during compilation:
FIRFilter.h: In function »void ReSampler::dumpFilter(const FloatType*, int)«:
FIRFilter.h:898:53: error: »numeric_limits« is not a member of »std«
  898 |                 std::cout << std::setprecision(std::numeric_limits<double>::digits10 + 1);
      |                                                     ^~~~~~~~~~~~~~
FIRFilter.h:898:68: error: expected primary-expression before »double«
  898 |                 std::cout << std::setprecision(std::numeric_limits<double>::digits10 + 1);
      |                                                                    ^~~~~~

Remedy:
Add in FIRFilter.h:
#include <limits>

Segementation fault in flac to oga conversion

build from master
uname -a:
Linux zoo 5.16.0-5-amd64 #1 SMP PREEMPT Debian 5.16.14-1 (2022-03-15) x86_64 GNU/Linux
command line:
ReSampler -i SplendidGrandPiano/Samples/FF\ A0.flac --doubleprecision -o FF\ A0.oga -r 480000 --vorbisQuality 7 -b vorbis
source of sound file is from:
https://github.com/sfzinstruments/SplendidGrandPiano/blob/master/Samples/FF%20A0.flac
gdb backtrace:
`(gdb) run -i SplendidGrandPiano/Samples/FF\ A0.flac --doubleprecision -o FF\ A0.oga -r 480000 --vorbisQuality 7 -b vorbis
Starting program: ReSampler -i SplendidGrandPiano/Samples/FF\ A0.flac --doubleprecision -o FF\ A0.oga -r 480000 --vorbisQuality 7 -b vorbis
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
2.1.0 64-bit version AVX build ...
using FMA (Fused Multiply-Add) instruction ...
Input file: SplendidGrandPiano/Samples/FF A0.flac
Output file: FF A0.oga
Changing output bit format to vorbis
Changing output file format to oga
Using double precision for calculations.
input bit format: 16
source file channels: 2
input sample rate: 44100
output sample rate: 480000
Scanning input file for peaks ...Done
Peak input sample: 0.999939 (-0.000530 dBFS) at 0:0:0.107619
LPF transition frequency: 20045.45 Hz (90.91 %)
Conversion ratio: 10.884354 (1600:147)
Writing Metadata
setting vorbis quality level to 7.0
Converting (multi-stage) ...
[New Thread 0x7ffff5c94640 (LWP 135959)]
[New Thread 0x7ffff5493640 (LWP 135960)]
[Thread 0x7ffff5493640 (LWP 135960) exited]
[Thread 0x7ffff5c94640 (LWP 135959) exited]
[New Thread 0x7ffff5493640 (LWP 135961)]
[New Thread 0x7ffff5c94640 (LWP 135962)]
[Thread 0x7ffff5c94640 (LWP 135962) exited]
[Thread 0x7ffff5493640 (LWP 135961) exited]
[New Thread 0x7ffff5c94640 (LWP 135991)]
[New Thread 0x7ffff5493640 (LWP 135992)]
[Thread 0x7ffff5493640 (LWP 135992) exited]
[Thread 0x7ffff5c94640 (LWP 135991) exited]
[New Thread 0x7ffff5493640 (LWP 135999)]
[New Thread 0x7ffff5c94640 (LWP 136000)]
[Thread 0x7ffff5c94640 (LWP 136000) exited]
[Thread 0x7ffff5493640 (LWP 135999) exited]
[New Thread 0x7ffff5c94640 (LWP 136001)]
[New Thread 0x7ffff5493640 (LWP 136002)]
[Thread 0x7ffff5493640 (LWP 136002) exited]
[Thread 0x7ffff5c94640 (LWP 136001) exited]
[New Thread 0x7ffff5493640 (LWP 136003)]
[New Thread 0x7ffff5c94640 (LWP 136004)]
[Thread 0x7ffff5c94640 (LWP 136004) exited]
[Thread 0x7ffff5493640 (LWP 136003) exited]
[New Thread 0x7ffff5c94640 (LWP 136005)]
[New Thread 0x7ffff5493640 (LWP 136006)]
[Thread 0x7ffff5493640 (LWP 136006) exited]
[Thread 0x7ffff5c94640 (LWP 136005) exited]
[New Thread 0x7ffff5493640 (LWP 136007)]
[New Thread 0x7ffff5c94640 (LWP 136008)]
[Thread 0x7ffff5c94640 (LWP 136008) exited]
[Thread 0x7ffff5493640 (LWP 136007) exited]
[New Thread 0x7ffff5c94640 (LWP 136009)]
[New Thread 0x7ffff5493640 (LWP 136010)]
[Thread 0x7ffff5493640 (LWP 136010) exited]
[Thread 0x7ffff5c94640 (LWP 136009) exited]
[New Thread 0x7ffff5493640 (LWP 136011)]
[New Thread 0x7ffff5c94640 (LWP 136012)]
[Thread 0x7ffff5c94640 (LWP 136012) exited]
[Thread 0x7ffff5493640 (LWP 136011) exited]
[New Thread 0x7ffff5c94640 (LWP 136013)]
[New Thread 0x7ffff5493640 (LWP 136014)]
[Thread 0x7ffff5493640 (LWP 136014) exited]
[Thread 0x7ffff5c94640 (LWP 136013) exited]
[New Thread 0x7ffff5493640 (LWP 136015)]
[New Thread 0x7ffff5c94640 (LWP 136016)]
[Thread 0x7ffff5c94640 (LWP 136016) exited]
[Thread 0x7ffff5493640 (LWP 136015) exited]
[New Thread 0x7ffff5c94640 (LWP 136017)]
[New Thread 0x7ffff5493640 (LWP 136018)]
[Thread 0x7ffff5493640 (LWP 136018) exited]
[Thread 0x7ffff5c94640 (LWP 136017) exited]
[New Thread 0x7ffff5493640 (LWP 136019)]
[New Thread 0x7ffff5c94640 (LWP 136020)]
[Thread 0x7ffff5c94640 (LWP 136020) exited]
[Thread 0x7ffff5493640 (LWP 136019) exited]
[New Thread 0x7ffff5c94640 (LWP 136021)]
[New Thread 0x7ffff5493640 (LWP 136022)]
[Thread 0x7ffff5493640 (LWP 136022) exited]
[Thread 0x7ffff5c94640 (LWP 136021) exited]
[New Thread 0x7ffff5493640 (LWP 136023)]
[New Thread 0x7ffff5c94640 (LWP 136024)]
[Thread 0x7ffff5c94640 (LWP 136024) exited]
[Thread 0x7ffff5493640 (LWP 136023) exited]
[New Thread 0x7ffff5c94640 (LWP 136025)]
[New Thread 0x7ffff5493640 (LWP 136026)]
[Thread 0x7ffff5493640 (LWP 136026) exited]
[New Thread 0x7ffff5493640 (LWP 136027)]
[Thread 0x7ffff5c94640 (LWP 136025) exited]
[New Thread 0x7ffff5c94640 (LWP 136028)]

Clipping detected !
[Thread 0x7ffff5c94640 (LWP 136028) exited]
Adjusting gain by -0.000478 dB
[Thread 0x7ffff5493640 (LWP 136027) exited]
Writing to output file ...
Done
Peak output sample: 1.000000 (-0.000001 dBFS)
--Type for more, q to quit, c to continue without paging--c

Thread 1 "ReSampler" received signal SIGSEGV, Segmentation fault.
0x00007ffff7729bf7 in vorbis_analysis_wrote () from /lib/x86_64-linux-gnu/libvorbis.so.0
(gdb) bt
#0 0x00007ffff7729bf7 in vorbis_analysis_wrote () from /lib/x86_64-linux-gnu/libvorbis.so.0
#1 0x00007ffff7d360ee in ?? () from /lib/x86_64-linux-gnu/libsndfile.so.1
#2 0x00007ffff7d11b75 in ?? () from /lib/x86_64-linux-gnu/libsndfile.so.1
#3 0x000055555556c0a7 in SndfileHandle::SNDFILE_ref::~SNDFILE_ref (this=0x5555556abab0, __in_chrg=)
at /usr/include/sndfile.hh:169
#4 0x000055555556c30c in SndfileHandle::~SndfileHandle (this=0x5555556906f0, __in_chrg=) at /usr/include/sndfile.hh:265
#5 0x0000555555598c66 in std::default_delete::operator() (this=0x7fffffff8b90, __ptr=0x5555556906f0)
at /usr/include/c++/11/bits/unique_ptr.h:85
#6 0x0000555555576176 in std::unique_ptr<SndfileHandle, std::default_delete >::~unique_ptr (this=0x7fffffff8b90,
__in_chrg=) at /usr/include/c++/11/bits/unique_ptr.h:361
#7 0x000055555558f55d in ReSampler::convert<SndfileHandle, double> (ci=...) at ReSampler.cpp:979
#8 0x000055555556852b in ReSampler::convert_SndfileHandle_Double (ci=...) at ReSampler.cpp:311
#9 0x0000555555569dbe in ReSampler::runCommand (argc=12, argv=0x7fffffffe0d8) at ReSampler.cpp:1571
#10 0x0000555555560373 in main (argc=12, argv=0x7fffffffe0d8) at main.cpp:74
`

Dear @jniemann66, it seems I have found a sample that puts ReSampler to shame.

          Dear @jniemann66, it seems I have found a sample that puts ReSampler to shame.

54321.flac.zip

$ mediainfo 54321.flac
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
Duration                                 : 5 s 0 ms
Bit rate mode                            : Variable
Bit rate                                 : 308 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 54.3 kHz
Bit depth                                : 16 bits
Compression mode                         : Lossless
Stream size                              : 188 KiB (96%)
Writing library                          : libFLAC 1.4.3 (2023-06-23)
MD5 of the unencoded content             : 1151627D253AD4436776CEF9C21B84C8

$ resampler -i 54321.flac -o out.wav -r 44100 --doubleprecision --dither --autoblank
2.1.0 64-bit version
Input file: 54321.flac
Output file: out.wav
Output Bit Format not specified
Changing output file format to wav
Using double precision for calculations.
input bit format: 16
source file channels: 2
input sample rate: 54321
output sample rate: 44100
Scanning input file for peaks ...Done
Peak input sample: 0.251221 (-11.998891 dBFS) at 0:0:0.903315
LPF transition frequency: 20045.45 Hz (90.91 %)
Conversion ratio: 0.811841 (14700:18107)
Generating 1.00 bits of standard dither for 16-bit output format, with auto-blanking
Writing Metadata
Converting (multi-stage) ...
Writing to output file ...
Done
Peak output sample: 0.112339 (-18.989417 dBFS)
Time=88425 ms [0.1x]

Original
original

Expected more or less like
sox-v-ns-shibata-low

Fact
resampler

Originally posted by @sergeevabc in #34 (comment)

opening RAW audio files

what would the correct command line flags be to open a RAW audio file with a 16 bit Int PCM encoding and a sample rate of 44100 with stereo channel, as I cant seem to find any flags correcponding to those options, which are needed for libsnd to correctly open raw files

Static build

Hi,

Could you provide static build/single exe without any kind of extra dll's?

stdin/stdout option

Hi,

I try to use it in my processing chain where data is driven by standard input stdin to stdout, but option -i /dev/stdin and -o /dev/sdtout doesn't work like in other software eg sox, lame, etc..
Could you add this to your resampler?

ANDROID - Error: Couldn't Open Output File (System error.)

well we're close,

singleStage

I/ReSampler: 2.0.7 64-bit version
    Input file: /sdcard/ReSampler/00001313.wav
    Output file: /sdcard/ReSampler/00001313_48000.wav
    Changing output bit format to 16
I/ReSampler: input bit format: 16
I/ReSampler: source file channels: 2
    input sample rate: 44100
    output sample rate: 48000
I/ReSampler: Scanning input file for peaks ...Done
    Peak input sample: 0.999969 (-0.000265 dBFS) at 0:0:1.259297
    LPF transition frequency: 20045.45 Hz (90.91 %)
    Conversion ratio: 1.088435 (160:147)
I/ReSampler: Error: Couldn't Open Output File (System error.)

multiStage

I/ReSampler: 2.0.7 64-bit version
I/ReSampler: Input file: /sdcard/ReSampler/00001313.wav
    Output file: /sdcard/ReSampler/00001313_48000.wav
    Changing output bit format to 16
I/ReSampler: input bit format: 16
    source file channels: 2
    input sample rate: 44100
    output sample rate: 48000
I/ReSampler: Scanning input file for peaks ...Done
    Peak input sample: 0.999969 (-0.000265 dBFS) at 0:0:1.259297
    LPF transition frequency: 20045.45 Hz (90.91 %)
    Conversion ratio: 1.088435 (160:147)
I/ReSampler: Stage: 1
    inputRate: 44100
    outputRate: 63000
    ft: 20045.454545
    stopFreq: 22050.000000
    transition width: 3.181818 %
    guarantee: 22050.000000
    Generated Filter Size: 2943
    Output Buffer Size: 46812
I/ReSampler: Stage: 2
    inputRate: 63000
    outputRate: 48000
    ft: 20045.454545
    stopFreq: 25950.000000
    transition width: 9.090909 %
    guarantee: 25950.000000
    Generated Filter Size: 2163
    Output Buffer Size: 35666
    Command lines to do this conversion in discreet steps:
     -i /sdcard/ReSampler/00001313.wav -o /sdcard/ReSampler/00001313_48000-stage1.wav -r 63000 --lpf-cutoff 96.818182 --lpf-transition 3.181818 --maxStages 1
     -i /sdcard/ReSampler/00001313_48000-stage1.wav -o /sdcard/ReSampler/00001313_48000.wav -r 48000 --lpf-cutoff 90.909091 --lpf-transition 9.090909 --maxStages 1
I/ReSampler: Stage: 1
    inputRate: 44100
    outputRate: 63000
    ft: 20045.454545
    stopFreq: 22050.000000
    transition width: 3.181818 %
    guarantee: 22050.000000
    Generated Filter Size: 2943
    Output Buffer Size: 46812
I/ReSampler: Stage: 2
    inputRate: 63000
    outputRate: 48000
    ft: 20045.454545
    stopFreq: 25950.000000
    transition width: 9.090909 %
    guarantee: 25950.000000
    Generated Filter Size: 2163
    Output Buffer Size: 35666
    Command lines to do this conversion in discreet steps:
     -i /sdcard/ReSampler/00001313.wav -o /sdcard/ReSampler/00001313_48000-stage1.wav -r 63000 --lpf-cutoff 96.818182 --lpf-transition 3.181818 --maxStages 1
     -i /sdcard/ReSampler/00001313_48000-stage1.wav -o /sdcard/ReSampler/00001313_48000.wav -r 48000 --lpf-cutoff 90.909091 --lpf-transition 9.090909 --maxStages 1
    Error: Couldn't Open Output File (System error.)

Re: more elegant cleanup of androidbuf upon exit

Just doing a bit of cleanup.
Do we need to have those raw deletes of the androidbuf buffers before every exit point in main() ?

Can we just do an RAII version using a smart pointer ?
eg:
std::cout.rdbuf(std::unique_ptr(new androidbuf(ANDROID_LOG_INFO, "ReSampler")));
// and remove the deletes etc

Originally posted by @mgood7123 in #8 (comment)

Testing quad precision in resampling DSD to PCM

TL;DR
The experimental quad precision version of ReSampler is incredibly slow in resampling DSD64 to 24bit/96kHz.

Background and History (2017-2019)
My MPD based audio player is digitally connected via TOSLINK (i.e. no DAC in the signal path) to active loudspeakers (Genelec 8351A) accepting PCM only, no DSD. The input stage of the Genelecs is separating (and resampling) the signal to 24bit/96kHz for the tweeter and to 24bit/48kHz for the midrange and woofer. To playback my DSD collection I resampled DSD64 to PCM applying the "natural" (?) 24/88.2 format. Therefore the Genelecs had to perform the complex 88.2->96 resampling in real-time but I could hear audible artifacts in some pieces of classical music. So I decided to resample my DSD collection to 24/96 using the DSD-enhanced SoX by Måns Rullgård and XiSRC by xivero (now out of business). Redbook compliant material (16/44.1) is resampled to (24/48).

Testing ReSampler
Starting end of last year I'm using ReSampler for the (16/44.1) -> (24/48) conversion.
I'm compiling ReSampler from source on Ubuntu 20.04 in two "flavors", as AVX+FMA and as the (experimental) quad precision. Test input is a DSF of nearly 20 minutes of classical music.

Test 1: Single precision (flags: -r 96000 -b 24 --mt --multistage)
2.0.9 64-bit version AVX build ...
using FMA (Fused Multiply-Add) instruction ...
Input file: 1.dsf
Output file: 1.flac
Changing output bit format to 24
Changing output file format to flac
source file channels: 2
input sample rate: 2822400
output sample rate: 96000
LPF transition frequency: 43636.36 Hz (90.91 %)
Conversion ratio: 0.034014 (5:147)
Writing Metadata
Converting (multi-stage, multi-threaded) ...
Writing to output file ...
Done
Peak output sample: 0.560189 (-5.033305 dBFS)
Time=154000 ms [7.7x]

Test 2: Double precision (flags: -r 96000 -b 24 --doubleprecision --mt --multistage)
2.0.9 64-bit version AVX build ...
using FMA (Fused Multiply-Add) instruction ...
Input file: 1.dsf
Output file: 1.flac
Changing output bit format to 24
Changing output file format to flac
Using double precision for calculations.
source file channels: 2
input sample rate: 2822400
output sample rate: 96000
LPF transition frequency: 43636.36 Hz (90.91 %)
Conversion ratio: 0.034014 (5:147)
Writing Metadata
Converting (multi-stage, multi-threaded) ...
Writing to output file ...
Done
Peak output sample: 0.560190 (-5.033286 dBFS)
Time=189979 ms [6.3x]

Test 3: Quad precision (flags: -r 96000 -b 24 --mt --multistage)
2.0.9 64-bit version
Input file: 1.dsf
Output file: 1.flac
Changing output bit format to 24
Changing output file format to flac
Using quadruple-precision for calculations.
source file channels: 2
input sample rate: 2822400
output sample rate: 96000
LPF transition frequency: 43636.36 Hz (90.91 %)
Conversion ratio: 0.034014 (5:147)
Writing Metadata
Converting (multi-stage, multi-threaded) ...
Writing to output file ...
Done
Peak output sample: 0.560191 (-5.033284 dBFS)
Time=8970719 ms [0.1x]

Compiling with many errors on M1-Macs

I wanted to try ReSampler to compile on my new MacBook Pro with M1-Pro CPU. There are many errors while compiling it with

clang++ -pthread -std=c++11 main.cpp ReSampler.cpp conversioninfo.cpp -lfftw3 -lsndfile -o ReSampler-clang -O3 -L/usr/local/lib -I/usr/local/include

I got this errors:

In file included from main.cpp:62:
In file included from ./ReSampler.h:30:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:13:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/x86gprintrin.h:15:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/hresetintrin.h:42:27: error: invalid input constraint 'a' in asm
  __asm__ ("hreset $0" :: "a"(__eax));
                          ^
In file included from main.cpp:62:
In file included from ./ReSampler.h:30:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
    __builtin_ia32_emms();
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:649:12: note: '__builtin_isless' declared here
    return isless(__lcpp_x, __lcpp_y);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:545:22: note: expanded from macro 'isless'
#define isless(x, y) __builtin_isless((x),(y))
                     ^
In file included from main.cpp:62:
In file included from ./ReSampler.h:30:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:25: error: too few arguments to function call, expected 2, have 0
    __builtin_ia32_emms();
    ~~~~~~~~~~~~~~~~~~~~^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:67:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
           ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:129:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:159:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:189:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:216:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:239:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:260:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:287:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:310:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:331:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: use of undeclared identifier '__builtin_ia32_paddb'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: first argument of MTE builtin function must be a pointer ('__v8qi' (vector of 8 'char' values) invalid)
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^                    ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: use of undeclared identifier '__builtin_ia32_paddw'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: first argument of MTE builtin function must be a pointer ('__v4hi' (vector of 4 'short' values) invalid)
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^                    ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:394:19: error: use of undeclared identifier '__builtin_ia32_paddd'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
In file included from ReSampler.cpp:12:
In file included from ./ReSampler.h:30:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:13:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/x86gprintrin.h:15:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/hresetintrin.h:42:27: error: invalid input constraint 'a' in asm
  __asm__ ("hreset $0" :: "a"(__eax));
                          ^
In file included from ReSampler.cpp:12:
In file included from ./ReSampler.h:30:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
    __builtin_ia32_emms();
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:649:12: note: '__builtin_isless' declared here
    return isless(__lcpp_x, __lcpp_y);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:545:22: note: expanded from macro 'isless'
#define isless(x, y) __builtin_isless((x),(y))
                     ^
In file included from ReSampler.cpp:12:
In file included from ./ReSampler.h:30:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:25: error: too few arguments to function call, expected 2, have 0
    __builtin_ia32_emms();
    ~~~~~~~~~~~~~~~~~~~~^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:67:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
           ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:129:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:159:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:189:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:216:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:239:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:260:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:287:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:310:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:331:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: use of undeclared identifier '__builtin_ia32_paddb'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: first argument of MTE builtin function must be a pointer ('__v8qi' (vector of 8 'char' values) invalid)
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^                    ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: use of undeclared identifier '__builtin_ia32_paddw'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: first argument of MTE builtin function must be a pointer ('__v4hi' (vector of 4 'short' values) invalid)
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^                    ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:394:19: error: use of undeclared identifier '__builtin_ia32_paddd'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
In file included from conversioninfo.cpp:1:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:13:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/x86gprintrin.h:15:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/hresetintrin.h:42:27: error: invalid input constraint 'a' in asm
  __asm__ ("hreset $0" :: "a"(__eax));
                          ^
In file included from conversioninfo.cpp:1:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
    __builtin_ia32_emms();
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:649:12: note: '__builtin_isless' declared here
    return isless(__lcpp_x, __lcpp_y);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:545:22: note: expanded from macro 'isless'
#define isless(x, y) __builtin_isless((x),(y))
                     ^
In file included from conversioninfo.cpp:1:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:25: error: too few arguments to function call, expected 2, have 0
    __builtin_ia32_emms();
    ~~~~~~~~~~~~~~~~~~~~^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:67:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
           ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:129:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:159:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:189:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:216:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:239:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:260:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:287:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:310:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:331:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: use of undeclared identifier '__builtin_ia32_paddb'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: first argument of MTE builtin function must be a pointer ('__v8qi' (vector of 8 'char' values) invalid)
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^                    ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: use of undeclared identifier '__builtin_ia32_paddw'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: first argument of MTE builtin function must be a pointer ('__v4hi' (vector of 4 'short' values) invalid)
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^                    ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:394:19: error: use of undeclared identifier '__builtin_ia32_paddd'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Is it possible to patch to compile it on M1 too?

Android

how would I compile this for android so I can use this as a library in my application

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.