MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / decode_frame

Function decode_frame

libavcodec/sipr.c:386–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384}
385
386static void decode_frame(SiprContext *ctx, SiprParameters *params,
387 float *out_data)
388{
389 int i, j;
390 int subframe_count = modes[ctx->mode].subframe_count;
391 int frame_size = subframe_count * SUBFR_SIZE;
392 float Az[LP_FILTER_ORDER * MAX_SUBFRAME_COUNT];
393 float *excitation;
394 float ir_buf[SUBFR_SIZE + LP_FILTER_ORDER];
395 float lsf_new[LP_FILTER_ORDER];
396 float *impulse_response = ir_buf + LP_FILTER_ORDER;
397 float *synth = ctx->synth_buf + 16; // 16 instead of LP_FILTER_ORDER for
398 // memory alignment
399 int t0_first = 0;
400 AMRFixed fixed_cb;
401
402 memset(ir_buf, 0, LP_FILTER_ORDER * sizeof(float));
403 lsf_decode_fp(lsf_new, ctx->lsf_history, params);
404
405 sipr_decode_lp(lsf_new, ctx->lsp_history, Az, subframe_count);
406
407 memcpy(ctx->lsp_history, lsf_new, LP_FILTER_ORDER * sizeof(float));
408
409 excitation = ctx->excitation + PITCH_DELAY_MAX + L_INTERPOL;
410
411 for (i = 0; i < subframe_count; i++) {
412 float *pAz = Az + i*LP_FILTER_ORDER;
413 float fixed_vector[SUBFR_SIZE];
414 int T0,T0_frac;
415 float pitch_gain, gain_code, avg_energy;
416
417 ff_decode_pitch_lag(&T0, &T0_frac, params->pitch_delay[i], t0_first, i,
418 ctx->mode == MODE_5k0, 6);
419
420 if (i == 0 || (i == 2 && ctx->mode == MODE_5k0))
421 t0_first = T0;
422
423 ff_acelp_interpolatef(excitation, excitation - T0 + (T0_frac <= 0),
424 ff_b60_sinc, 6,
425 2 * ((2 + T0_frac)%3 + 1), LP_FILTER_ORDER,
426 SUBFR_SIZE);
427
428 decode_fixed_sparse(&fixed_cb, params->fc_indexes[i], ctx->mode,
429 ctx->past_pitch_gain < 0.8);
430
431 eval_ir(pAz, T0, impulse_response, modes[ctx->mode].pitch_sharp_factor);
432
433 convolute_with_sparse(fixed_vector, &fixed_cb, impulse_response,
434 SUBFR_SIZE);
435
436 avg_energy =
437 (0.01 + ff_dot_productf(fixed_vector, fixed_vector, SUBFR_SIZE))/
438 SUBFR_SIZE;
439
440 ctx->past_pitch_gain = pitch_gain = gain_cb[params->gc_index[i]][0];
441
442 gain_code = ff_amr_set_fixed_gain(gain_cb[params->gc_index[i]][1],
443 avg_energy, ctx->energy_history,

Callers 1

sipr_decode_frameFunction · 0.70

Calls 14

lsf_decode_fpFunction · 0.85
sipr_decode_lpFunction · 0.85
ff_decode_pitch_lagFunction · 0.85
ff_acelp_interpolatefFunction · 0.85
eval_irFunction · 0.85
convolute_with_sparseFunction · 0.85
ff_dot_productfFunction · 0.85
ff_amr_set_fixed_gainFunction · 0.85
ff_weighted_vector_sumfFunction · 0.85
postfilter_5k0Function · 0.85
ff_adaptive_gain_controlFunction · 0.85

Tested by

no test coverage detected