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 Libav.
8  *
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.
13  *
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.
18  *
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
22  */
23 
24 #ifndef AVCODEC_SIPR_H
25 #define AVCODEC_SIPR_H
26 
27 #include "avcodec.h"
28 #include "dsputil.h"
29 #include "acelp_pitch_delay.h"
30 #include "libavutil/mem.h"
31 
32 #define LP_FILTER_ORDER_16k 16
33 #define L_SUBFR_16k 80
34 #define PITCH_MIN 30
35 #define PITCH_MAX 281
36 
37 #define LSFQ_DIFF_MIN (0.0125 * M_PI)
38 
39 #define LP_FILTER_ORDER 10
40 
42 #define L_INTERPOL (LP_FILTER_ORDER + 1)
43 
45 #define SUBFR_SIZE 48
46 
47 #define SUBFRAME_COUNT_16k 2
48 
49 typedef enum {
55 } SiprMode;
56 
57 typedef struct SiprParameters {
59  int vq_indexes[5];
60  int pitch_delay[5];
61  int gp_index[5];
62  int16_t fc_indexes[5][10];
63  int gc_index[5];
65 
66 typedef struct SiprContext {
69 
71 
74 
76 
78 
80  float gain_mem;
81  float energy_history[4];
84 
85  /* 5k0 */
86  float tilt_mem;
90 
91  /* 16k */
95  float *filt_mem[2];
98  double lsp_history_16k[16];
99 
100  void (*decode_frame)(struct SiprContext *ctx, SiprParameters *params,
101  float *out_data);
102 } SiprContext;
103 
104 extern const float ff_pow_0_5[16];
105 
106 void ff_sipr_init_16k(SiprContext *ctx);
107 
109  float *out_data);
110 
111 #endif /* AVCODEC_SIPR_H */
struct SiprContext SiprContext
int gp_index[5]
adaptive-codebook gain indexes
Definition: sipr.h:61
int pitch_delay[5]
pitch delay
Definition: sipr.h:60
int vq_indexes[5]
Definition: sipr.h:59
This structure describes decoded (raw) audio or video data.
Definition: avcodec.h:989
Definition: sipr.h:51
int pitch_lag_prev
Definition: sipr.h:92
#define SUBFR_SIZE
Subframe size for all modes except 16k.
Definition: sipr.h:45
memory handling functions
double lsp_history_16k[16]
Definition: sipr.h:98
float iir_mem[LP_FILTER_ORDER_16k+1]
Definition: sipr.h:93
float synth_buf[LP_FILTER_ORDER+5 *SUBFR_SIZE+6]
Definition: sipr.h:77
float postfilter_syn5k0[LP_FILTER_ORDER+SUBFR_SIZE *5]
Definition: sipr.h:89
float mem_preemph[LP_FILTER_ORDER_16k]
Definition: sipr.h:96
float * filt_mem[2]
Definition: sipr.h:95
float lsf_history[LP_FILTER_ORDER_16k]
Definition: sipr.h:73
SiprMode
Definition: sipr.h:49
#define PITCH_DELAY_MAX
#define L_INTERPOL
Number of past samples needed for excitation interpolation.
Definition: sipr.h:42
Definition: sipr.h:50
float highpass_filt_mem[2]
Definition: sipr.h:82
float lsp_history[LP_FILTER_ORDER]
Definition: sipr.h:79
Definition: sipr.h:53
#define PITCH_MAX
Definition: sipr.h:35
AVCodecContext * avctx
Definition: sipr.h:67
Definition: sipr.h:52
#define LP_FILTER_ORDER
Definition: sipr.h:39
#define L_SUBFR_16k
Definition: sipr.h:33
int16_t fc_indexes[5][10]
fixed-codebook indexes
Definition: sipr.h:62
float synth[LP_FILTER_ORDER_16k]
Definition: sipr.h:97
float energy_history[4]
Definition: sipr.h:81
external API header
main external API structure.
Definition: avcodec.h:1339
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
void(* decode_frame)(struct SiprContext *ctx, SiprParameters *params, float *out_data)
Definition: sipr.h:100
float postfilter_mem5k0[PITCH_DELAY_MAX+LP_FILTER_ORDER]
Definition: sipr.h:88
float postfilter_mem[PITCH_DELAY_MAX+LP_FILTER_ORDER]
Definition: sipr.h:83
AVFrame frame
Definition: sipr.h:68
int gc_index[5]
fixed-codebook gain indexes
Definition: sipr.h:63
float gain_mem
Definition: sipr.h:80
float excitation[L_INTERPOL+PITCH_MAX+2 *L_SUBFR_16k]
Definition: sipr.h:75
void ff_sipr_decode_frame_16k(SiprContext *ctx, SiprParameters *params, float *out_data)
Definition: sipr16k.c:176
#define LP_FILTER_ORDER_16k
Definition: sipr.h:32
float postfilter_agc
Definition: sipr.h:87
DSP utils.
int ma_pred_switch
switched moving average predictor
Definition: sipr.h:58
float past_pitch_gain
Definition: sipr.h:72
SiprMode mode
Definition: sipr.h:70
const float ff_pow_0_5[16]
Definition: sipr.c:135
struct SiprParameters SiprParameters
float tilt_mem
Definition: sipr.h:86
void ff_sipr_init_16k(SiprContext *ctx)
Definition: sipr16k.c:271
float filt_buf[2][LP_FILTER_ORDER_16k+1]
Definition: sipr.h:94