Unified · Split
| @@ -38,13 +38,13 @@ typedef struct · 37 unmodified lines | |||
| 38 | double src_ratio, input_index ; | 38 | double src_ratio, input_index ; |
| 39 | 39 | ||
| 40 | float *input_buffer ; | 40 | float *input_buffer ; |
| 41 | int in_buf_len ; | 41 | int in_buf_len, in_start, in_end ; |
| 42 | 42 | ||
| 43 | float *fir_out ; | 43 | float *fir_out ; |
| 44 | int fir_out_len ; | 44 | int fir_out_len, fir_start, fir_end ; |
| 45 | 45 | ||
| 46 | float *iir_out ; | 46 | float *iir_out ; |
| 47 | int iir_out_len ; | 47 | int iir_out_len, iir_start, iir_end ; |
| 48 | 48 | ||
| 49 | float dummy [1] ; | 49 | float dummy [1] ; |
| 50 | } FIR_IIR_POLY ; | 50 | } FIR_IIR_POLY ; |
| @@ -52,7 +52,6 @@ typedef struct · 1 unmodified line | |||
| 52 | static void fip_reset (SRC_PRIVATE *psrc) ; | 52 | static void fip_reset (SRC_PRIVATE *psrc) ; |
| 53 | static int fip_process (SRC_PRIVATE *psrc, SRC_DATA *data) ; | 53 | static int fip_process (SRC_PRIVATE *psrc, SRC_DATA *data) ; |
| 54 | 54 | ||
| 55 | |||
| 56 | static float best_coeffs [250] ; | 55 | static float best_coeffs [250] ; |
| 57 | 56 | ||
| 58 | const char* | 57 | const char* |
| @@ -61,12 +60,13 @@ fip_get_name (int src_enum) · 2 unmodified lines | |||
| 61 | switch (src_enum) | 60 | switch (src_enum) |
| 62 | { case SRC_FIR_IIR_POLY_BEST : | 61 | { case SRC_FIR_IIR_POLY_BEST : |
| 63 | return "Best FIR/IIR/Polynomial Interpolator" ; | 62 | return "Best FIR/IIR/Polynomial Interpolator" ; |
| 64 | 63 | #if 0 | |
| 65 | case SRC_FIR_IIR_POLY_MEDIUM : | 64 | case SRC_FIR_IIR_POLY_MEDIUM : |
| 66 | return "Medium FIR/IIR/Polynomial Interpolator" ; | 65 | return "Medium FIR/IIR/Polynomial Interpolator" ; |
| 67 | 66 | ||
| 68 | case SRC_FIR_IIR_POLY_FASTEST : | 67 | case SRC_FIR_IIR_POLY_FASTEST : |
| 69 | return "Fastest FIR/IIR/Polynomial Interpolator" ; | 68 | return "Fastest FIR/IIR/Polynomial Interpolator" ; |
| 69 | #endif | ||
| 70 | } ; | 70 | } ; |
| 71 | 71 | ||
| 72 | return NULL ; | 72 | return NULL ; |
| @@ -78,12 +78,13 @@ fip_get_description (int src_enum) · 5 unmodified lines | |||
| 78 | switch (src_enum) | 78 | switch (src_enum) |
| 79 | { case SRC_FIR_IIR_POLY_BEST : | 79 | { case SRC_FIR_IIR_POLY_BEST : |
| 80 | return "Three stage FIR/IIR/Polynomial Interpolator, best quality, XXdb SNR, XX% BW." ; | 80 | return "Three stage FIR/IIR/Polynomial Interpolator, best quality, XXdb SNR, XX% BW." ; |
| 81 | 81 | #if 0 | |
| 82 | case SRC_FIR_IIR_POLY_MEDIUM : | 82 | case SRC_FIR_IIR_POLY_MEDIUM : |
| 83 | return "Three stage FIR/IIR/Polynomial Interpolator, medium quality, XXdb SNR, XX% BW." ; | 83 | return "Three stage FIR/IIR/Polynomial Interpolator, medium quality, XXdb SNR, XX% BW." ; |
| 84 | 84 | ||
| 85 | case SRC_FIR_IIR_POLY_FASTEST : | 85 | case SRC_FIR_IIR_POLY_FASTEST : |
| 86 | return "Three stage FIR/IIR/Polynomial Interpolator, fastest, XXdb SNR, XX% BW." ; | 86 | return "Three stage FIR/IIR/Polynomial Interpolator, fastest, XXdb SNR, XX% BW." ; |
| 87 | #endif | ||
| 87 | } ; | 88 | } ; |
| 88 | 89 | ||
| 89 | return NULL ; | 90 | return NULL ; |
| @@ -152,11 +153,23 @@ fip_reset (SRC_PRIVATE *psrc) · 62 unmodified lines | |||
| 152 | { FIR_IIR_POLY *fip ; | 153 | { FIR_IIR_POLY *fip ; |
| 153 | 154 | ||
| 154 | fip = (FIR_IIR_POLY *) psrc->private_data ; | 155 | fip = (FIR_IIR_POLY *) psrc->private_data ; |
| 156 | if (fip == NULL) | ||
| 157 | return ; | ||
| 155 | 158 | ||
| 159 | memset (fip->input_buffer, 0, fip->channels * fip->in_buf_len * sizeof (fip->dummy [0])) ; | ||
| 160 | memset (fip->fir_out, 0, fip->channels * fip->fir_out_len * sizeof (fip->dummy [0])) ; | ||
| 161 | memset (fip->iir_out, 0, fip->channels * fip->iir_out_len * sizeof (fip->dummy [0])) ; | ||
| 162 | |||
| 163 | fip->in_start = fip->in_end = ARRAY_LEN (best_coeffs) ; | ||
| 164 | fip->fir_start = fip->fir_end = 0 ; | ||
| 165 | fip->iir_start = fip->iir_end = 0 ; | ||
| 166 | |||
| 167 | fip->src_ratio = fip->input_index = 0.0 ; | ||
| 168 | |||
| 169 | return ; | ||
| 156 | } /* fip_reset */ | 170 | } /* fip_reset */ |
| 157 | 171 | ||
| 158 | /*======================================================================================== | 172 | /*======================================================================================== |
| 159 | ** Beware all ye who dare pass this point. There be dragons here. | ||
| 160 | */ | 173 | */ |
| 161 | 174 | ||
| 162 | static int | 175 | static int |
| @@ -172,6 +185,11 @@ fip_process (SRC_PRIVATE *psrc, SRC_DATA *data) · 9 unmodified lines | |||
| 172 | if (sizeof (fip->dummy [0]) != sizeof (data->data_in [0])) | 185 | if (sizeof (fip->dummy [0]) != sizeof (data->data_in [0])) |
| 173 | return SRC_ERR_SIZE_INCOMPATIBILITY ; | 186 | return SRC_ERR_SIZE_INCOMPATIBILITY ; |
| 174 | 187 | ||
| 188 | if (data->src_ratio < 1.0) | ||
| 189 | { printf ("Bad ratio %f\n", data->src_ratio) ; | ||
| 190 | exit (1) ; | ||
| 191 | } ; | ||
| 192 | |||
| 175 | 193 | ||
| 176 | return SRC_ERR_NO_ERROR ; | 194 | return SRC_ERR_NO_ERROR ; |
| 177 | } /* fip_process */ | 195 | } /* fip_process */ |
| @@ -184,9 +202,8 @@ fip_process (SRC_PRIVATE *psrc, SRC_DATA *data) · 6 unmodified lines | |||
| 184 | 202 | ||
| 185 | /* | 203 | /* |
| 186 | ** Do not edit or modify anything in this comment block. | 204 | ** Do not edit or modify anything in this comment block. |
| 187 | ** The arch-tag line is a file identity tag for the GNU Arch | 205 | ** The arch-tag line is a file identity tag for the GNU Arch |
| 188 | ** revision control system. | 206 | ** revision control system. |
| 189 | ** | 207 | ** |
| 190 | ** arch-tag: a6c8bad4-740c-4e4f-99f1-e274174ab540 | 208 | ** arch-tag: a6c8bad4-740c-4e4f-99f1-e274174ab540 |
| 191 | */ | 209 | */ |
| 192 | |||