1 /* GStreamer 2 * Copyright (C) <2015> Wim Taymans <wim.taymans@gmail.com> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef __GST_AUDIO_RESAMPLER_PRIVATE_H__ 21 #define __GST_AUDIO_RESAMPLER_PRIVATE_H__ 22 23 #include "audio-resampler.h" 24 25 /* Contains a collection of all things found in other resamplers: 26 * speex (filter construction, optimizations), ffmpeg (fixed phase filter, blackman filter), 27 * SRC (linear interpolation, fixed precomputed tables),... 28 * 29 * Supports: 30 * - S16, S32, F32 and F64 formats 31 * - nearest, linear and cubic interpolation 32 * - sinc based interpolation with kaiser or blackman-nutall windows 33 * - fully configurable kaiser parameters 34 * - dynamic linear or cubic interpolation of filter table, this can 35 * use less memory but more CPU 36 * - full filter table, generated from optionally linear or cubic 37 * interpolation of filter table 38 * - fixed filter table size with nearest neighbour phase, optionally 39 * using a precomputed tables 40 * - dynamic samplerate changes 41 * - x86 and neon optimizations 42 */ 43 typedef void (*ConvertTapsFunc) (gdouble * tmp_taps, gpointer taps, 44 gdouble weight, gint n_taps); 45 typedef void (*InterpolateFunc) (gpointer o, const gpointer a, gint len, 46 const gpointer icoeff, gint astride); 47 typedef void (*ResampleFunc) (GstAudioResampler * resampler, gpointer in[], 48 gsize in_len, gpointer out[], gsize out_len, gsize * consumed); 49 typedef void (*DeinterleaveFunc) (GstAudioResampler * resampler, 50 gpointer * sbuf, gpointer in[], gsize in_frames); 51 52 struct _GstAudioResampler 53 { 54 GstAudioResamplerMethod method; 55 GstAudioResamplerFlags flags; 56 GstAudioFormat format; 57 GstStructure *options; 58 gint format_index; 59 gint channels; 60 gint in_rate; 61 gint out_rate; 62 63 gint bps; 64 gint ostride; 65 66 GstAudioResamplerFilterMode filter_mode; 67 guint filter_threshold; 68 GstAudioResamplerFilterInterpolation filter_interpolation; 69 70 gdouble cutoff; 71 gdouble kaiser_beta; 72 /* for cubic */ 73 gdouble b, c; 74 75 /* temp taps */ 76 gpointer tmp_taps; 77 78 /* oversampled main filter table */ 79 gint oversample; 80 gint n_taps; 81 gpointer taps; 82 gpointer taps_mem; 83 gsize taps_stride; 84 gint n_phases; 85 gint alloc_taps; 86 gint alloc_phases; 87 88 /* cached taps */ 89 gpointer *cached_phases; 90 gpointer cached_taps; 91 gpointer cached_taps_mem; 92 gsize cached_taps_stride; 93 94 ConvertTapsFunc convert_taps; 95 InterpolateFunc interpolate; 96 DeinterleaveFunc deinterleave; 97 ResampleFunc resample; 98 99 gint blocks; 100 gint inc; 101 gint samp_inc; 102 gint samp_frac; 103 gint samp_index; 104 gint samp_phase; 105 gint skip; 106 107 gpointer samples; 108 gsize samples_len; 109 gsize samples_avail; 110 gpointer *sbuf; 111 }; 112 113 #endif /* __GST_AUDIO_RESAMPLER_PRIVATE_H__ */ 114