Mercurial > libavcodec.hg
comparison amrnbdec.c @ 12464:2dd67ed2f947 libavcodec
Move AMRNB lsf2lsp() function to common code for using in future AMRWB decoder.
Patch by Marcelo Galvo Pvoa
author | vitor |
---|---|
date | Tue, 07 Sep 2010 20:44:41 +0000 |
parents | ceec2fb08b8e |
children | b42e02e9bf2b |
comparison
equal
deleted
inserted
replaced
12463:04e68eb1aab7 | 12464:2dd67ed2f947 |
---|---|
220 | 220 |
221 /// @defgroup amr_lpc_decoding AMR pitch LPC coefficient decoding functions | 221 /// @defgroup amr_lpc_decoding AMR pitch LPC coefficient decoding functions |
222 /// @{ | 222 /// @{ |
223 | 223 |
224 /** | 224 /** |
225 * Convert an lsf vector into an lsp vector. | |
226 * | |
227 * @param lsf input lsf vector | |
228 * @param lsp output lsp vector | |
229 */ | |
230 static void lsf2lsp(const float *lsf, double *lsp) | |
231 { | |
232 int i; | |
233 | |
234 for (i = 0; i < LP_FILTER_ORDER; i++) | |
235 lsp[i] = cos(2.0 * M_PI * lsf[i]); | |
236 } | |
237 | |
238 /** | |
239 * Interpolate the LSF vector (used for fixed gain smoothing). | 225 * Interpolate the LSF vector (used for fixed gain smoothing). |
240 * The interpolation is done over all four subframes even in MODE_12k2. | 226 * The interpolation is done over all four subframes even in MODE_12k2. |
241 * | 227 * |
242 * @param[in,out] lsf_q LSFs in [0,1] for each subframe | 228 * @param[in,out] lsf_q LSFs in [0,1] for each subframe |
243 * @param[in] lsf_new New LSFs in [0,1] for subframe 4 | 229 * @param[in] lsf_new New LSFs in [0,1] for subframe 4 |
291 ff_set_min_dist_lsf(lsf_q, MIN_LSF_SPACING, LP_FILTER_ORDER); | 277 ff_set_min_dist_lsf(lsf_q, MIN_LSF_SPACING, LP_FILTER_ORDER); |
292 | 278 |
293 if (update) | 279 if (update) |
294 interpolate_lsf(p->lsf_q, lsf_q); | 280 interpolate_lsf(p->lsf_q, lsf_q); |
295 | 281 |
296 lsf2lsp(lsf_q, lsp); | 282 ff_acelp_lsf2lspd(lsp, lsf_q, LP_FILTER_ORDER); |
297 } | 283 } |
298 | 284 |
299 /** | 285 /** |
300 * Decode a set of 5 split-matrix quantized lsf indexes into 2 lsp vectors. | 286 * Decode a set of 5 split-matrix quantized lsf indexes into 2 lsp vectors. |
301 * | 287 * |
355 | 341 |
356 // store data for computing the next frame's LSFs | 342 // store data for computing the next frame's LSFs |
357 interpolate_lsf(p->lsf_q, lsf_q); | 343 interpolate_lsf(p->lsf_q, lsf_q); |
358 memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(*lsf_r)); | 344 memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(*lsf_r)); |
359 | 345 |
360 lsf2lsp(lsf_q, p->lsp[3]); | 346 ff_acelp_lsf2lspd(p->lsp[3], lsf_q, LP_FILTER_ORDER); |
361 | 347 |
362 // interpolate LSP vectors at subframes 1, 2 and 3 | 348 // interpolate LSP vectors at subframes 1, 2 and 3 |
363 for (i = 1; i <= 3; i++) | 349 for (i = 1; i <= 3; i++) |
364 for(j = 0; j < LP_FILTER_ORDER; j++) | 350 for(j = 0; j < LP_FILTER_ORDER; j++) |
365 p->lsp[i-1][j] = p->prev_lsp_sub4[j] + | 351 p->lsp[i-1][j] = p->prev_lsp_sub4[j] + |