Revision 65323ed2

View differences:

libavcodec/sipr.c
37 37
#include "acelp_filters.h"
38 38
#include "celp_filters.h"
39 39

  
40
#define LSFQ_DIFF_MIN        (0.0125 * M_PI)
41

  
42
#define LP_FILTER_ORDER      10
43

  
44
/** Number of past samples needed for excitation interpolation */
45
#define L_INTERPOL           (LP_FILTER_ORDER + 1)
46

  
47
/**  Subframe size for all modes except 16k */
48
#define SUBFR_SIZE           48
49

  
50 40
#define MAX_SUBFRAME_COUNT   5
51 41

  
42
#include "sipr.h"
52 43
#include "siprdata.h"
53 44

  
54
typedef enum {
55
    MODE_16k,
56
    MODE_8k5,
57
    MODE_6k5,
58
    MODE_5k0,
59
    MODE_COUNT
60
} SiprMode;
61

  
62 45
typedef struct {
63 46
    const char *mode_name;
64 47
    uint16_t bits_per_frame;
......
127 110
    }
128 111
};
129 112

  
130
typedef struct {
131
    AVCodecContext *avctx;
132
    DSPContext dsp;
133

  
134
    SiprMode mode;
135

  
136
    float past_pitch_gain;
137
    float lsf_history[LP_FILTER_ORDER];
138

  
139
    float excitation[L_INTERPOL + PITCH_DELAY_MAX + 5*SUBFR_SIZE];
140

  
141
    DECLARE_ALIGNED_16(float, synth_buf[LP_FILTER_ORDER + 5*SUBFR_SIZE + 6]);
142

  
143
    float lsp_history[LP_FILTER_ORDER];
144
    float gain_mem;
145
    float energy_history[4];
146
    float highpass_filt_mem[2];
147
    float postfilter_mem[PITCH_DELAY_MAX + LP_FILTER_ORDER];
148

  
149
    /* 5k0 */
150
    float tilt_mem;
151
    float postfilter_agc;
152
    float postfilter_mem5k0[PITCH_DELAY_MAX + LP_FILTER_ORDER];
153
    float postfilter_syn5k0[LP_FILTER_ORDER + SUBFR_SIZE*5];
154
} SiprContext;
155

  
156
typedef struct {
157
    int vq_indexes[5];
158
    int pitch_delay[5];        ///< pitch delay
159
    int gp_index[5];           ///< adaptive-codebook gain indexes
160
    int16_t fc_indexes[5][10]; ///< fixed-codebook indexes
161
    int gc_index[5];           ///< fixed-codebook gain indexes
162
} SiprParameters;
163

  
164

  
165 113
static void dequant(float *out, const int *idx, const float *cbs[])
166 114
{
167 115
    int i;
libavcodec/sipr.h
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 "avcodec.h"
28
#include "dsputil.h"
29
#include "acelp_pitch_delay.h"
30

  
31
#define LSFQ_DIFF_MIN        (0.0125 * M_PI)
32

  
33
#define LP_FILTER_ORDER      10
34

  
35
/** Number of past samples needed for excitation interpolation */
36
#define L_INTERPOL           (LP_FILTER_ORDER + 1)
37

  
38
/**  Subframe size for all modes except 16k */
39
#define SUBFR_SIZE           48
40

  
41
typedef enum {
42
    MODE_16k,
43
    MODE_8k5,
44
    MODE_6k5,
45
    MODE_5k0,
46
    MODE_COUNT
47
} SiprMode;
48

  
49
typedef struct {
50
    AVCodecContext *avctx;
51
    DSPContext dsp;
52

  
53
    SiprMode mode;
54

  
55
    float past_pitch_gain;
56
    float lsf_history[LP_FILTER_ORDER];
57

  
58
    float excitation[L_INTERPOL + PITCH_DELAY_MAX + 5*SUBFR_SIZE];
59

  
60
    DECLARE_ALIGNED_16(float, synth_buf[LP_FILTER_ORDER + 5*SUBFR_SIZE + 6]);
61

  
62
    float lsp_history[LP_FILTER_ORDER];
63
    float gain_mem;
64
    float energy_history[4];
65
    float highpass_filt_mem[2];
66
    float postfilter_mem[PITCH_DELAY_MAX + LP_FILTER_ORDER];
67

  
68
    /* 5k0 */
69
    float tilt_mem;
70
    float postfilter_agc;
71
    float postfilter_mem5k0[PITCH_DELAY_MAX + LP_FILTER_ORDER];
72
    float postfilter_syn5k0[LP_FILTER_ORDER + SUBFR_SIZE*5];
73
} SiprContext;
74

  
75
typedef struct {
76
    int vq_indexes[5];
77
    int pitch_delay[5];        ///< pitch delay
78
    int gp_index[5];           ///< adaptive-codebook gain indexes
79
    int16_t fc_indexes[5][10]; ///< fixed-codebook indexes
80
    int gc_index[5];           ///< fixed-codebook gain indexes
81
} SiprParameters;
82

  
83
#endif /* AVCODEC_SIPR_H */

Also available in: Unified diff