Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: source/patched-ffmpeg-mt/libavcodec/amrnbdec.c

Issue 3384002: ffmpeg source update for sep 09 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * AMR narrowband decoder 2 * AMR narrowband decoder
3 * Copyright (c) 2006-2007 Robert Swain 3 * Copyright (c) 2006-2007 Robert Swain
4 * Copyright (c) 2009 Colin McQuillan 4 * Copyright (c) 2009 Colin McQuillan
5 * 5 *
6 * This file is part of FFmpeg. 6 * This file is part of FFmpeg.
7 * 7 *
8 * FFmpeg is free software; you can redistribute it and/or 8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 215 }
216 216
217 return mode; 217 return mode;
218 } 218 }
219 219
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
244 */ 230 */
245 static void interpolate_lsf(float lsf_q[4][LP_FILTER_ORDER], float *lsf_new) 231 static void interpolate_lsf(float lsf_q[4][LP_FILTER_ORDER], float *lsf_new)
246 { 232 {
247 int i; 233 int i;
248 234
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(float)); 272 memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(float));
287 273
288 for (i = 0; i < LP_FILTER_ORDER; i++) 274 for (i = 0; i < LP_FILTER_ORDER; i++)
289 lsf_q[i] = lsf_r[i] * (LSF_R_FAC / 8000.0) + lsf_no_r[i] * (1.0 / 8000.0 ); 275 lsf_q[i] = lsf_r[i] * (LSF_R_FAC / 8000.0) + lsf_no_r[i] * (1.0 / 8000.0 );
290 276
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 *
302 * @param p pointer to the AMRContext 288 * @param p pointer to the AMRContext
303 */ 289 */
304 static void lsf2lsp_5(AMRContext *p) 290 static void lsf2lsp_5(AMRContext *p)
305 { 291 {
306 const uint16_t *lsf_param = p->frame.lsf; 292 const uint16_t *lsf_param = p->frame.lsf;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // calculate mean-removed LSF vector and add mean 336 // calculate mean-removed LSF vector and add mean
351 for (i = 0; i < LP_FILTER_ORDER; i++) 337 for (i = 0; i < LP_FILTER_ORDER; i++)
352 lsf_q[i] = (lsf_r[i] + p->prev_lsf_r[i] * pred_fac[i]) * (LSF_R_FAC / 80 00.0) + lsf_3_mean[i] * (1.0 / 8000.0); 338 lsf_q[i] = (lsf_r[i] + p->prev_lsf_r[i] * pred_fac[i]) * (LSF_R_FAC / 80 00.0) + lsf_3_mean[i] * (1.0 / 8000.0);
353 339
354 ff_set_min_dist_lsf(lsf_q, MIN_LSF_SPACING, LP_FILTER_ORDER); 340 ff_set_min_dist_lsf(lsf_q, MIN_LSF_SPACING, LP_FILTER_ORDER);
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] +
366 (p->lsp[3][j] - p->prev_lsp_sub4[j]) * 0.25 * i; 352 (p->lsp[3][j] - p->prev_lsp_sub4[j]) * 0.25 * i;
367 } 353 }
368 354
369 /// @} 355 /// @}
370 356
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 AVCodec amrnb_decoder = { 1053 AVCodec amrnb_decoder = {
1068 .name = "amrnb", 1054 .name = "amrnb",
1069 .type = AVMEDIA_TYPE_AUDIO, 1055 .type = AVMEDIA_TYPE_AUDIO,
1070 .id = CODEC_ID_AMR_NB, 1056 .id = CODEC_ID_AMR_NB,
1071 .priv_data_size = sizeof(AMRContext), 1057 .priv_data_size = sizeof(AMRContext),
1072 .init = amrnb_decode_init, 1058 .init = amrnb_decode_init,
1073 .decode = amrnb_decode_frame, 1059 .decode = amrnb_decode_frame,
1074 .long_name = NULL_IF_CONFIG_SMALL("Adaptive Multi-Rate NarrowBand"), 1060 .long_name = NULL_IF_CONFIG_SMALL("Adaptive Multi-Rate NarrowBand"),
1075 .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_FLT,SAMPLE_FMT_NONE}, 1061 .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_FLT,SAMPLE_FMT_NONE},
1076 }; 1062 };
OLDNEW
« no previous file with comments | « source/patched-ffmpeg-mt/libavcodec/allcodecs.c ('k') | source/patched-ffmpeg-mt/libavcodec/ansi.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698