1 /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved. 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 */ 5 6 #ifndef DSPUTIL_H_ 7 #define DSPUTIL_H_ 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 #include <stdint.h> 14 15 /* Converts from interleaved int16_t samples to non-interleaved float samples. 16 * The int16_t samples have range [-32768, 32767], and the float samples have 17 * range [-1.0, 1.0]. 18 * Args: 19 * input - The interleaved input buffer. Every "channels" samples is a frame. 20 * output - Pointers to output buffers. There are "channels" output buffers. 21 * channels - The number of samples per frame. 22 * frames - The number of frames to convert. 23 */ 24 void dsp_util_deinterleave(int16_t *input, float *const *output, int channels, 25 int frames); 26 27 /* Converts from non-interleaved float samples to interleaved int16_t samples. 28 * The int16_t samples have range [-32768, 32767], and the float samples have 29 * range [-1.0, 1.0]. This is the inverse of dsputil_deinterleave(). 30 * Args: 31 * input - Pointers to input buffers. There are "channels" input buffers. 32 * output - The interleaved output buffer. Every "channels" samples is a 33 * frame. 34 * channels - The number of samples per frame. 35 * frames - The number of frames to convert. 36 */ 37 void dsp_util_interleave(float *const *input, int16_t *output, int channels, 38 int frames); 39 40 /* Disables denormal numbers in floating point calculation. Denormal numbers 41 * happens often in IIR filters, and it can be very slow. 42 */ 43 void dsp_enable_flush_denormal_to_zero(); 44 45 #ifdef __cplusplus 46 } /* extern "C" */ 47 #endif 48 49 #endif /* DSPUTIL_H_ */ 50