History

More sketching out of fip_process().

Erik de Castro Lopo committed 22 years ago

Commit a28fd681 parent c4f4d141 file · +49 −4Browse files

Showing the changes to src (1 of 1 file). Show all

Unified · Split

src/src_fir_iir_poly.c+49−4
@@ -52,6 +52,12 @@ typedef struct · 51 unmodified lines
5252 static void fip_reset (SRC_PRIVATE *psrc) ;
5353 static int fip_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
5454
55+static int fip_process_var_down (FIR_IIR_POLY * fip, SRC_DATA * data) ;
56+static int fip_process_const_down (FIR_IIR_POLY * fip, SRC_DATA * data) ;
57+static int fip_process_var_up (FIR_IIR_POLY * fip, SRC_DATA * data) ;
58+static int fip_process_const_up (FIR_IIR_POLY * fip, SRC_DATA * data) ;
59+
60+
5561 static float best_coeffs [250] ;
5662
5763 const char*
@@ -185,19 +191,58 @@ fip_process (SRC_PRIVATE *psrc, SRC_DATA *data) · 127 unmodified lines
185191 if (sizeof (fip->dummy [0]) != sizeof (data->data_in [0]))
186192 return SRC_ERR_SIZE_INCOMPATIBILITY ;
187193
188− if (data->src_ratio < 1.0)
189− { printf ("Bad ratio %f\n", data->src_ratio) ;
190− exit (1) ;
194+ /* Just after an fip_reset(), the src_ratio field is invalid. */
195+ if (fip->src_ratio < 1.0 / SRC_MAX_RATIO)
196+ fip->src_ratio = data->src_ratio ;
197+
198+ if (fip->src_ratio < 1.0 || data->src_ratio < 1.0)
199+ { /* Special case code for constant and varying src_ratio downsampling. */
200+ if (fabs (fip->src_ratio - data->src_ratio) > 1e-20)
201+ return fip_process_var_down (fip, data) ;
202+
203+ return fip_process_const_down (fip, data) ;
191204 } ;
192205
206+ if (fabs (fip->src_ratio - data->src_ratio) > 1e-20)
207+ return fip_process_var_up (fip, data) ;
193208
194− return SRC_ERR_NO_ERROR ;
209+ return fip_process_const_up (fip, data) ;
195210 } /* fip_process */
196211
197212 /*----------------------------------------------------------------------------------------
198213 */
199214
215+static int
216+fip_process_var_down (FIR_IIR_POLY * fip, SRC_DATA * data)
217+{ fip = NULL ;
218+ data = NULL ;
219+ printf ("%s : not implemented yet.\n", __func__) ;
220+ return SRC_ERR_NO_ERROR ;
221+} /* fip_process_var_down */
200222
223+static int
224+fip_process_const_down (FIR_IIR_POLY * fip, SRC_DATA * data)
225+{ fip = NULL ;
226+ data = NULL ;
227+ printf ("%s : not implemented yet.\n", __func__) ;
228+ return SRC_ERR_NO_ERROR ;
229+} /* fip_process_const_down */
230+
231+static int
232+fip_process_var_up (FIR_IIR_POLY * fip, SRC_DATA * data)
233+{ fip = NULL ;
234+ data = NULL ;
235+ printf ("%s : not implemented yet.\n", __func__) ;
236+ return SRC_ERR_NO_ERROR ;
237+} /* fip_process_var_up */
238+
239+static int
240+fip_process_const_up (FIR_IIR_POLY * fip, SRC_DATA * data)
241+{ fip = NULL ;
242+ data = NULL ;
243+ printf ("%s : not implemented yet.\n", __func__) ;
244+ return SRC_ERR_NO_ERROR ;
245+} /* fip_process_const_up */
201246
202247
203248 /*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t