annotate sipr.h @ 10889:de32bff741ea libavcodec

Split some SIPR structs to a header file for the upcoming SIPR16k commit
author vitor
date Sat, 16 Jan 2010 03:40:25 +0000
parents
children ff7c1c90b6f5
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
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
31 #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
32
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
33 #define LP_FILTER_ORDER 10
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
34
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
35 /** 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
36 #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
37
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
38 /** 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
39 #define SUBFR_SIZE 48
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
40
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
41 typedef enum {
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
42 MODE_16k,
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
43 MODE_8k5,
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
44 MODE_6k5,
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
45 MODE_5k0,
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
46 MODE_COUNT
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
47 } SiprMode;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
48
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
49 typedef struct {
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
50 AVCodecContext *avctx;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
51 DSPContext dsp;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
52
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
53 SiprMode mode;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
54
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
55 float past_pitch_gain;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
56 float lsf_history[LP_FILTER_ORDER];
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
57
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
58 float excitation[L_INTERPOL + PITCH_DELAY_MAX + 5*SUBFR_SIZE];
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 DECLARE_ALIGNED_16(float, synth_buf[LP_FILTER_ORDER + 5*SUBFR_SIZE + 6]);
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 lsp_history[LP_FILTER_ORDER];
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
63 float gain_mem;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
64 float energy_history[4];
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
65 float highpass_filt_mem[2];
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
66 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
67
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
68 /* 5k0 */
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
69 float tilt_mem;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
70 float postfilter_agc;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
71 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
72 float postfilter_syn5k0[LP_FILTER_ORDER + SUBFR_SIZE*5];
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
73 } SiprContext;
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 typedef struct {
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
76 int vq_indexes[5];
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
77 int pitch_delay[5]; ///< pitch delay
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
78 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
79 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
80 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
81 } SiprParameters;
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
82
de32bff741ea Split some SIPR structs to a header file for the upcoming SIPR16k commit
vitor
parents:
diff changeset
83 #endif /* AVCODEC_SIPR_H */