| OLD | NEW |
| 1 /* | 1 /* |
| 2 * SIPR / ACELP.NET decoder | 2 * SIPR / ACELP.NET decoder |
| 3 * | 3 * |
| 4 * Copyright (c) 2008 Vladimir Voroshilov | 4 * Copyright (c) 2008 Vladimir Voroshilov |
| 5 * Copyright (c) 2009 Vitor Sessak | 5 * Copyright (c) 2009 Vitor Sessak |
| 6 * | 6 * |
| 7 * This file is part of FFmpeg. | 7 * This file is part of FFmpeg. |
| 8 * | 8 * |
| 9 * FFmpeg is free software; you can redistribute it and/or | 9 * FFmpeg is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Lesser General Public | 10 * modify it under the terms of the GNU Lesser General Public |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 parms->pitch_delay[i] = get_bits(pgb, p->pitch_delay_bits[i]); | 202 parms->pitch_delay[i] = get_bits(pgb, p->pitch_delay_bits[i]); |
| 203 parms->gp_index[i] = get_bits(pgb, p->gp_index_bits); | 203 parms->gp_index[i] = get_bits(pgb, p->gp_index_bits); |
| 204 | 204 |
| 205 for (j = 0; j < p->number_of_fc_indexes; j++) | 205 for (j = 0; j < p->number_of_fc_indexes; j++) |
| 206 parms->fc_indexes[i][j] = get_bits(pgb, p->fc_index_bits[j]); | 206 parms->fc_indexes[i][j] = get_bits(pgb, p->fc_index_bits[j]); |
| 207 | 207 |
| 208 parms->gc_index[i] = get_bits(pgb, p->gc_index_bits); | 208 parms->gc_index[i] = get_bits(pgb, p->gc_index_bits); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 | 211 |
| 212 static void lsp2lpc_sipr(const double *lsp, float *Az) | |
| 213 { | |
| 214 int lp_half_order = LP_FILTER_ORDER >> 1; | |
| 215 double buf[(LP_FILTER_ORDER >> 1) + 1]; | |
| 216 double pa[(LP_FILTER_ORDER >> 1) + 1]; | |
| 217 double *qa = buf + 1; | |
| 218 int i,j; | |
| 219 | |
| 220 qa[-1] = 0.0; | |
| 221 | |
| 222 ff_lsp2polyf(lsp , pa, lp_half_order ); | |
| 223 ff_lsp2polyf(lsp + 1, qa, lp_half_order - 1); | |
| 224 | |
| 225 for (i = 1, j = LP_FILTER_ORDER - 1; i < lp_half_order; i++, j--) { | |
| 226 double paf = pa[i] * (1 + lsp[LP_FILTER_ORDER - 1]); | |
| 227 double qaf = (qa[i] - qa[i-2]) * (1 - lsp[LP_FILTER_ORDER - 1]); | |
| 228 Az[i-1] = (paf + qaf) * 0.5; | |
| 229 Az[j-1] = (paf - qaf) * 0.5; | |
| 230 } | |
| 231 | |
| 232 Az[lp_half_order - 1] = (1.0 + lsp[LP_FILTER_ORDER - 1]) * | |
| 233 pa[lp_half_order] * 0.5; | |
| 234 | |
| 235 Az[LP_FILTER_ORDER - 1] = lsp[LP_FILTER_ORDER - 1]; | |
| 236 } | |
| 237 | |
| 238 static void sipr_decode_lp(float *lsfnew, const float *lsfold, float *Az, | 212 static void sipr_decode_lp(float *lsfnew, const float *lsfold, float *Az, |
| 239 int num_subfr) | 213 int num_subfr) |
| 240 { | 214 { |
| 241 double lsfint[LP_FILTER_ORDER]; | 215 double lsfint[LP_FILTER_ORDER]; |
| 242 int i,j; | 216 int i,j; |
| 243 float t, t0 = 1.0 / num_subfr; | 217 float t, t0 = 1.0 / num_subfr; |
| 244 | 218 |
| 245 t = t0 * 0.5; | 219 t = t0 * 0.5; |
| 246 for (i = 0; i < num_subfr; i++) { | 220 for (i = 0; i < num_subfr; i++) { |
| 247 for (j = 0; j < LP_FILTER_ORDER; j++) | 221 for (j = 0; j < LP_FILTER_ORDER; j++) |
| 248 lsfint[j] = lsfold[j] * (1 - t) + t * lsfnew[j]; | 222 lsfint[j] = lsfold[j] * (1 - t) + t * lsfnew[j]; |
| 249 | 223 |
| 250 lsp2lpc_sipr(lsfint, Az); | 224 ff_amrwb_lsp2lpc(lsfint, Az, LP_FILTER_ORDER); |
| 251 Az += LP_FILTER_ORDER; | 225 Az += LP_FILTER_ORDER; |
| 252 t += t0; | 226 t += t0; |
| 253 } | 227 } |
| 254 } | 228 } |
| 255 | 229 |
| 256 /** | 230 /** |
| 257 * Evaluate the adaptive impulse response. | 231 * Evaluate the adaptive impulse response. |
| 258 */ | 232 */ |
| 259 static void eval_ir(const float *Az, int pitch_lag, float *freq, | 233 static void eval_ir(const float *Az, int pitch_lag, float *freq, |
| 260 float pitch_sharp_factor) | 234 float pitch_sharp_factor) |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 "sipr", | 553 "sipr", |
| 580 AVMEDIA_TYPE_AUDIO, | 554 AVMEDIA_TYPE_AUDIO, |
| 581 CODEC_ID_SIPR, | 555 CODEC_ID_SIPR, |
| 582 sizeof(SiprContext), | 556 sizeof(SiprContext), |
| 583 sipr_decoder_init, | 557 sipr_decoder_init, |
| 584 NULL, | 558 NULL, |
| 585 NULL, | 559 NULL, |
| 586 sipr_decode_frame, | 560 sipr_decode_frame, |
| 587 .long_name = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"), | 561 .long_name = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"), |
| 588 }; | 562 }; |
| OLD | NEW |