FreeCalypso > hg > gsm-codec-lib
view libtwamr/lpc.c @ 477:4c9222d95647
libtwamr encoder: always emit frame->mode = mode;
In the original implementation of amr_encode_frame(), the 'mode' member
of the output struct was set to 0xFF if the output frame type is TX_NO_DATA.
This design was made to mimic the mode field (16-bit word) being set to
0xFFFF (or -1) in 3GPP test sequence format - but nothing actually depends
on this struct member being set in any way, and amr_frame_to_tseq()
generates the needed 0xFFFF on its own, based on frame->type being equal
to TX_NO_DATA.
It is simpler and more efficient to always set frame->mode to the actual
encoding mode in amr_encode_frame(), and this new behavior has already
been documented in doc/AMR-library-API description in anticipation of
the present change.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 18 May 2024 22:30:42 +0000 |
parents | 9adfe3863a41 |
children |
line wrap: on
line source
/* ******************************************************************************** * * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 * R99 Version 3.3.0 * REL-4 Version 4.1.0 * ******************************************************************************** * * File : lpc.c * ******************************************************************************** */ /* ******************************************************************************** * MODULE INCLUDE FILE AND VERSION ID ******************************************************************************** */ #include "namespace.h" #include "lpc.h" /* ******************************************************************************** * INCLUDE FILES ******************************************************************************** */ #include "tw_amr.h" #include "typedef.h" #include "basic_op.h" #include "oper_32b.h" #include "autocorr.h" #include "lag_wind.h" #include "levinson.h" #include "cnst.h" #include "no_count.h" #include "window.h" /* ******************************************************************************** * PUBLIC PROGRAM CODE ******************************************************************************** */ /************************************************************************* * * Function: lpc_reset * ************************************************************************** */ void lpc_reset (lpcState *state) { Levinson_reset(&state->levinsonSt); } int lpc( lpcState *st, /* i/o: State struct */ enum Mode mode, /* i : coder mode */ Word16 x[], /* i : Input signal Q15 */ Word16 x_12k2[], /* i : Input signal (EFR) Q15 */ Word16 a[] /* o : predictor coefficients Q12 */ ) { Word16 rc[4]; /* First 4 reflection coefficients Q15 */ Word16 rLow[MP1], rHigh[MP1]; /* Autocorrelations low and hi */ /* No fixed Q value but normalized */ /* so that overflow is avoided */ test (); if ( sub (mode, MR122) == 0) { /* Autocorrelations */ Autocorr(x_12k2, M, rHigh, rLow, window_160_80); /* Lag windowing */ Lag_window(M, rHigh, rLow); /* Levinson Durbin */ Levinson(&st->levinsonSt, rHigh, rLow, &a[MP1], rc); /* Autocorrelations */ Autocorr(x_12k2, M, rHigh, rLow, window_232_8); /* Lag windowing */ Lag_window(M, rHigh, rLow); /* Levinson Durbin */ Levinson(&st->levinsonSt, rHigh, rLow, &a[MP1 * 3], rc); } else { /* Autocorrelations */ Autocorr(x, M, rHigh, rLow, window_200_40); /* Lag windowing */ Lag_window(M, rHigh, rLow); /* Levinson Durbin */ Levinson(&st->levinsonSt, rHigh, rLow, &a[MP1 * 3], rc); } return 0; }