2 * SIPR / ACELP.NET decoder
4 * Copyright (c) 2008 Vladimir Voroshilov
5 * Copyright (c) 2009 Vitor Sessak
7 * This file is part of Libav.
9 * Libav is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * Libav is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with Libav; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #ifndef AVCODEC_SIPR_H
25 #define AVCODEC_SIPR_H
29 #include "acelp_pitch_delay.h"
30 #include "libavutil/mem.h"
32 #define LP_FILTER_ORDER_16k 16
33 #define L_SUBFR_16k 80
37 #define LSFQ_DIFF_MIN (0.0125 * M_PI)
39 #define LP_FILTER_ORDER 10
41 /** Number of past samples needed for excitation interpolation */
42 #define L_INTERPOL (LP_FILTER_ORDER + 1)
44 /** Subframe size for all modes except 16k */
47 #define SUBFRAME_COUNT_16k 2
57 typedef struct SiprParameters {
58 int ma_pred_switch; ///< switched moving average predictor
60 int pitch_delay[5]; ///< pitch delay
61 int gp_index[5]; ///< adaptive-codebook gain indexes
62 int16_t fc_indexes[5][10]; ///< fixed-codebook indexes
63 int gc_index[5]; ///< fixed-codebook gain indexes
66 typedef struct SiprContext {
67 AVCodecContext *avctx;
72 float past_pitch_gain;
73 float lsf_history[LP_FILTER_ORDER_16k];
75 float excitation[L_INTERPOL + PITCH_MAX + 2 * L_SUBFR_16k];
77 DECLARE_ALIGNED(16, float, synth_buf)[LP_FILTER_ORDER + 5*SUBFR_SIZE + 6];
79 float lsp_history[LP_FILTER_ORDER];
81 float energy_history[4];
82 float highpass_filt_mem[2];
83 float postfilter_mem[PITCH_DELAY_MAX + LP_FILTER_ORDER];
88 float postfilter_mem5k0[PITCH_DELAY_MAX + LP_FILTER_ORDER];
89 float postfilter_syn5k0[LP_FILTER_ORDER + SUBFR_SIZE*5];
93 float iir_mem[LP_FILTER_ORDER_16k+1];
94 float filt_buf[2][LP_FILTER_ORDER_16k+1];
96 float mem_preemph[LP_FILTER_ORDER_16k];
97 float synth[LP_FILTER_ORDER_16k];
98 double lsp_history_16k[16];
100 void (*decode_frame)(struct SiprContext *ctx, SiprParameters *params,
104 extern const float ff_pow_0_5[16];
106 void ff_sipr_init_16k(SiprContext *ctx);
108 void ff_sipr_decode_frame_16k(SiprContext *ctx, SiprParameters *params,
111 #endif /* AVCODEC_SIPR_H */