22 #include "ardour/utils.h"
31 #if defined (ARCH_X86) && defined (BUILD_SSE_OPTIMIZATIONS)
38 std::cerr <<
"compute_peak(): buffer unaligned!" << std::endl;
41 return x86_sse_compute_peak(buf, nsamples, current);
48 std::cerr <<
"apply_gain_to_buffer(): buffer unaligned!" << std::endl;
51 x86_sse_apply_gain_to_buffer(buf, nframes, gain);
58 std::cerr <<
"mix_buffers_with_gain(): dst unaligned!" << std::endl;
62 std::cerr <<
"mix_buffers_with_gain(): dst & src don't have the same alignment!" << std::endl;
65 x86_sse_mix_buffers_with_gain(dst, src, nframes, gain);
73 std::cerr <<
"mix_buffers_no_gain(): dst unaligned!" << std::endl;
77 std::cerr <<
"mix_buffers_no_gain(): dst & src don't have the same alignment!" << std::endl;
80 x86_sse_mix_buffers_no_gain(dst, src, nframes);
90 for (
pframes_t i = 0; i < nsamples; ++i) {
91 current =
f_max (current, fabsf (buf[i]));
106 for (i = 0; i < nframes; i++)
126 for (
pframes_t i = 0; i < nframes; i++) {
127 dst[i] += src[i] *
gain;
139 #if defined (__APPLE__) && defined (BUILD_VECLIB_OPTIMIZATIONS)
140 #include <Accelerate/Accelerate.h>
146 vDSP_maxmgv(buf, 1, &tmpmax, nsamples);
147 return f_max(current, tmpmax);
153 vDSP_maxv (const_cast<ARDOUR::Sample*>(buf), 1, max, nframes);
154 vDSP_minv (const_cast<ARDOUR::Sample*>(buf), 1, min, nframes);
160 vDSP_vsmul(buf, 1, &gain, buf, 1, nframes);
166 vDSP_vsma(src, 1, &gain, dst, 1, dst, 1, nframes);
174 vDSP_vsma(src, 1, &gain, dst, 1, dst, 1, nframes);
void default_find_peaks(const ARDOUR::Sample *buf, pframes_t nframes, float *minf, float *maxf)
LIBARDOUR_API PBD::PropertyDescriptor< bool > gain
void default_apply_gain_to_buffer(ARDOUR::Sample *buf, pframes_t nframes, float gain)
LIBARDOUR_API mix_buffers_with_gain_t mix_buffers_with_gain
void default_mix_buffers_no_gain(ARDOUR::Sample *dst, const ARDOUR::Sample *src, pframes_t nframes)
float default_compute_peak(const ARDOUR::Sample *buf, pframes_t nsamples, float current)
LIBARDOUR_API mix_buffers_no_gain_t mix_buffers_no_gain
void default_mix_buffers_with_gain(ARDOUR::Sample *dst, const ARDOUR::Sample *src, pframes_t nframes, float gain)
static float f_max(float x, float a)