FFmpeg
sipr.h
Go to the documentation of this file.
1 /*
2  * SIPR / ACELP.NET decoder
3  *
4  * Copyright (c) 2008 Vladimir Voroshilov
5  * Copyright (c) 2009 Vitor Sessak
6  *
7  * This file is part of FFmpeg.
8  *
9  * FFmpeg 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.
13  *
14  * FFmpeg 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.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with FFmpeg; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23 
24 #ifndef AVCODEC_SIPR_H
25 #define AVCODEC_SIPR_H
26 
27 #include "acelp_pitch_delay.h"
28 #include "libavutil/mem_internal.h"
29 
30 #define LP_FILTER_ORDER_16k 16
31 #define L_SUBFR_16k 80
32 #define PITCH_MIN 30
33 #define PITCH_MAX 281
34 
35 #define LSFQ_DIFF_MIN (0.0125 * M_PI)
36 
37 #define LP_FILTER_ORDER 10
38 
39 /** Number of past samples needed for excitation interpolation */
40 #define L_INTERPOL (LP_FILTER_ORDER + 1)
41 
42 /** Subframe size for all modes except 16k */
43 #define SUBFR_SIZE 48
44 
45 #define SUBFRAME_COUNT_16k 2
46 
47 typedef enum {
53 } SiprMode;
54 
55 typedef struct SiprParameters {
56  int ma_pred_switch; ///< switched moving average predictor
57  int vq_indexes[5];
58  int pitch_delay[5]; ///< pitch delay
59  int gp_index[5]; ///< adaptive-codebook gain indexes
60  int16_t fc_indexes[5][10]; ///< fixed-codebook indexes
61  int gc_index[5]; ///< fixed-codebook gain indexes
63 
64 typedef struct SiprContext {
66 
69 
71 
73 
75  float gain_mem;
76  float energy_history[4];
79 
80  /* 5k0 */
81  float tilt_mem;
85 
86  /* 16k */
90  float *filt_mem[2];
93  double lsp_history_16k[16];
94 
95  void (*decode_frame)(struct SiprContext *ctx, SiprParameters *params,
96  float *out_data);
97 } SiprContext;
98 
99 extern const float ff_pow_0_5[16];
100 
102 
104  float *out_data);
105 
106 #endif /* AVCODEC_SIPR_H */
SiprContext::iir_mem
float iir_mem[LP_FILTER_ORDER_16k+1]
Definition: sipr.h:88
mem_internal.h
SiprContext::lsp_history
float lsp_history[LP_FILTER_ORDER]
Definition: sipr.h:74
ff_pow_0_5
const float ff_pow_0_5[16]
Definition: sipr.c:136
SiprContext::postfilter_syn5k0
float postfilter_syn5k0[LP_FILTER_ORDER+SUBFR_SIZE *5]
Definition: sipr.h:84
MODE_5k0
@ MODE_5k0
Definition: sipr.h:51
ff_sipr_decode_frame_16k
void ff_sipr_decode_frame_16k(SiprContext *ctx, SiprParameters *params, float *out_data)
Definition: sipr16k.c:176
SiprContext::lsf_history
float lsf_history[LP_FILTER_ORDER_16k]
Definition: sipr.h:68
MODE_8k5
@ MODE_8k5
Definition: sipr.h:49
SUBFR_SIZE
#define SUBFR_SIZE
Subframe size for all modes except 16k.
Definition: sipr.h:43
PITCH_DELAY_MAX
#define PITCH_DELAY_MAX
Definition: acelp_pitch_delay.h:31
LP_FILTER_ORDER_16k
#define LP_FILTER_ORDER_16k
Definition: sipr.h:30
SiprParameters
Definition: sipr.h:55
SiprParameters::gc_index
int gc_index[5]
fixed-codebook gain indexes
Definition: sipr.h:61
SiprContext::gain_mem
float gain_mem
Definition: sipr.h:75
ctx
AVFormatContext * ctx
Definition: movenc.c:48
SiprContext::synth
float synth[LP_FILTER_ORDER_16k]
Definition: sipr.h:92
SiprMode
SiprMode
Definition: sipr.h:47
SiprParameters::ma_pred_switch
int ma_pred_switch
switched moving average predictor
Definition: sipr.h:56
L_INTERPOL
#define L_INTERPOL
Number of past samples needed for excitation interpolation.
Definition: sipr.h:40
SiprContext::lsp_history_16k
double lsp_history_16k[16]
Definition: sipr.h:93
MODE_16k
@ MODE_16k
Definition: sipr.h:48
SiprParameters::fc_indexes
int16_t fc_indexes[5][10]
fixed-codebook indexes
Definition: sipr.h:60
SiprContext::mem_preemph
float mem_preemph[LP_FILTER_ORDER_16k]
Definition: sipr.h:91
SiprParameters::pitch_delay
int pitch_delay[5]
pitch delay
Definition: sipr.h:58
SiprContext::postfilter_mem
float postfilter_mem[PITCH_DELAY_MAX+LP_FILTER_ORDER]
Definition: sipr.h:78
PITCH_MAX
#define PITCH_MAX
Definition: sipr.h:33
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:109
SiprContext::postfilter_agc
float postfilter_agc
Definition: sipr.h:82
SiprContext::pitch_lag_prev
int pitch_lag_prev
Definition: sipr.h:87
SiprContext::decode_frame
void(* decode_frame)(struct SiprContext *ctx, SiprParameters *params, float *out_data)
Definition: sipr.h:95
MODE_COUNT
@ MODE_COUNT
Definition: sipr.h:52
SiprContext::excitation
float excitation[L_INTERPOL+PITCH_MAX+2 *L_SUBFR_16k]
Definition: sipr.h:70
SiprContext::filt_buf
float filt_buf[2][LP_FILTER_ORDER_16k+1]
Definition: sipr.h:89
SiprParameters::vq_indexes
int vq_indexes[5]
Definition: sipr.h:57
SiprContext
Definition: sipr.h:64
ff_sipr_init_16k
void ff_sipr_init_16k(SiprContext *ctx)
Definition: sipr16k.c:271
SiprContext::energy_history
float energy_history[4]
Definition: sipr.h:76
MODE_6k5
@ MODE_6k5
Definition: sipr.h:50
SiprContext::filt_mem
float * filt_mem[2]
Definition: sipr.h:90
SiprContext::tilt_mem
float tilt_mem
Definition: sipr.h:81
SiprContext::synth_buf
float synth_buf[LP_FILTER_ORDER+5 *SUBFR_SIZE+6]
Definition: sipr.h:72
SiprContext::postfilter_mem5k0
float postfilter_mem5k0[PITCH_DELAY_MAX+LP_FILTER_ORDER]
Definition: sipr.h:83
SiprContext::highpass_filt_mem
float highpass_filt_mem[2]
Definition: sipr.h:77
L_SUBFR_16k
#define L_SUBFR_16k
Definition: sipr.h:31
SiprContext::mode
SiprMode mode
Definition: sipr.h:65
LP_FILTER_ORDER
#define LP_FILTER_ORDER
Definition: sipr.h:37
SiprContext::past_pitch_gain
float past_pitch_gain
Definition: sipr.h:67
SiprParameters::gp_index
int gp_index[5]
adaptive-codebook gain indexes
Definition: sipr.h:59
acelp_pitch_delay.h