annotate sipr.h @ 12047:c80c7a717156 libavcodec

Remove vestiges of radix-2 FFT Patch (mostly) by Loren Merritt
author mru
date Thu, 01 Jul 2010 23:21:42 +0000
parents 98970e51365a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10889
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
1 /*
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
2 * SIPR / ACELP.NET decoder
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
3 *
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
4 * Copyright (c) 2008 Vladimir Voroshilov
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
5 * Copyright (c) 2009 Vitor Sessak
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
6 *
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
7 * This file is part of FFmpeg.
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
8 *
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
9 * FFmpeg is free software; you can redistribute it and/or
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
10 * modify it under the terms of the GNU Lesser General Public
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
11 * License as published by the Free Software Foundation; either
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
12 * version 2.1 of the License, or (at your option) any later version.
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
13 *
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
14 * FFmpeg is distributed in the hope that it will be useful,
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
17 * Lesser General Public License for more details.
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
18 *
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
20 * License along with FFmpeg; if not, write to the Free Software
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
22 */
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
23
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
24 #ifndef AVCODEC_SIPR_H
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
25 #define AVCODEC_SIPR_H
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
26
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
27 #include "avcodec.h"
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
28 #include "dsputil.h"
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
29 #include "acelp_pitch_delay.h"
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
30
10891
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
31 #define LP_FILTER_ORDER_16k 16
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
32 #define L_SUBFR_16k 80
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
33 #define PITCH_MIN 30
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
34 #define PITCH_MAX 281
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
35
10889
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
36 #define LSFQ_DIFF_MIN (0.0125 * M_PI)
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
37
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
38 #define LP_FILTER_ORDER 10
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
39
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
40 /** Number of past samples needed for excitation interpolation */
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
41 #define L_INTERPOL (LP_FILTER_ORDER + 1)
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
42
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
43 /** Subframe size for all modes except 16k */
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
44 #define SUBFR_SIZE 48
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
45
10891
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
46 #define SUBFRAME_COUNT_16k 2
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
47
10889
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
48 typedef enum {
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
49 MODE_16k,
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
50 MODE_8k5,
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
51 MODE_6k5,
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
52 MODE_5k0,
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
53 MODE_COUNT
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
54 } SiprMode;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
55
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
56 typedef struct {
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
57 AVCodecContext *avctx;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
58 DSPContext dsp;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
59
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
60 SiprMode mode;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
61
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
62 float past_pitch_gain;
10891
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
63 float lsf_history[LP_FILTER_ORDER_16k];
10889
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
64
10891
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
65 float excitation[L_INTERPOL + PITCH_MAX + 2 * L_SUBFR_16k];
10889
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
66
11369
98970e51365a Remove DECLARE_ALIGNED_{8,16} macros
mru
parents: 10961
diff changeset
67 DECLARE_ALIGNED(16, float, synth_buf)[LP_FILTER_ORDER + 5*SUBFR_SIZE + 6];
10889
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
68
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
69 float lsp_history[LP_FILTER_ORDER];
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
70 float gain_mem;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
71 float energy_history[4];
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
72 float highpass_filt_mem[2];
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
73 float postfilter_mem[PITCH_DELAY_MAX + LP_FILTER_ORDER];
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
74
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
75 /* 5k0 */
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
76 float tilt_mem;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
77 float postfilter_agc;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
78 float postfilter_mem5k0[PITCH_DELAY_MAX + LP_FILTER_ORDER];
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
79 float postfilter_syn5k0[LP_FILTER_ORDER + SUBFR_SIZE*5];
10891
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
80
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
81 /* 16k */
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
82 int pitch_lag_prev;
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
83 float iir_mem[LP_FILTER_ORDER_16k+1];
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
84 float filt_buf[2][LP_FILTER_ORDER_16k+1];
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
85 float *filt_mem[2];
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
86 float mem_preemph[LP_FILTER_ORDER_16k];
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
87 float synth[LP_FILTER_ORDER_16k];
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
88 double lsp_history_16k[16];
10889
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
89 } SiprContext;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
90
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
91 typedef struct {
10891
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
92 int ma_pred_switch; ///< switched moving average predictor
10889
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
93 int vq_indexes[5];
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
94 int pitch_delay[5]; ///< pitch delay
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
95 int gp_index[5]; ///< adaptive-codebook gain indexes
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
96 int16_t fc_indexes[5][10]; ///< fixed-codebook indexes
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
97 int gc_index[5]; ///< fixed-codebook gain indexes
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
98 } SiprParameters;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
99
10891
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
100 extern const float ff_pow_0_5[16];
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
101
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
102 void ff_sipr_init_16k(SiprContext *ctx);
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
103
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
104 void ff_sipr_decode_frame_16k(SiprContext *ctx, SiprParameters *params,
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
105 float *out_data);
ff7c1c90b6f5 SIPR16k decoder
vitor
parents: 10889
diff changeset
106
10889
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
107 #endif /* AVCODEC_SIPR_H */