annotate liba52/a52_internal.h @ 929:c35f06d95e64 libavcodec

mlib fix patch by (Juergen Keil <jk at tools dot de>)
author michaelni
date Sun, 15 Dec 2002 22:42:59 +0000
parents 207cc56d18f8
children 68d0a38bd802
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
1 /*
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
2 * a52_internal.h
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
3 * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
5 *
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
6 * This file is part of a52dec, a free ATSC A-52 stream decoder.
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
7 * See http://liba52.sourceforge.net/ for updates.
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
8 *
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
9 * a52dec is free software; you can redistribute it and/or modify
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
12 * (at your option) any later version.
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
13 *
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
14 * a52dec is distributed in the hope that it will be useful,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
17 * GNU General Public License for more details.
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
18 *
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
22 */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
23
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
24 typedef struct {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
25 uint8_t bai; /* fine SNR offset, fast gain */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
26 uint8_t deltbae; /* delta bit allocation exists */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
27 int8_t deltba[50]; /* per-band delta bit allocation */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
28 } ba_t;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
29
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
30 typedef struct {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
31 uint8_t exp[256]; /* decoded channel exponents */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
32 int8_t bap[256]; /* derived channel bit allocation */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
33 } expbap_t;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
34
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
35 struct a52_state_s {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
36 uint8_t fscod; /* sample rate */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
37 uint8_t halfrate; /* halfrate factor */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
38 uint8_t acmod; /* coded channels */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
39 uint8_t lfeon; /* coded lfe channel */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
40 sample_t clev; /* centre channel mix level */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
41 sample_t slev; /* surround channels mix level */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
42
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
43 int output; /* type of output */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
44 sample_t level; /* output level */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
45 sample_t bias; /* output bias */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
46
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
47 int dynrnge; /* apply dynamic range */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
48 sample_t dynrng; /* dynamic range */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
49 void * dynrngdata; /* dynamic range callback funtion and data */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
50 sample_t (* dynrngcall) (sample_t range, void * dynrngdata);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
51
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
52 uint8_t chincpl; /* channel coupled */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
53 uint8_t phsflginu; /* phase flags in use (stereo only) */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
54 uint8_t cplstrtmant; /* coupling channel start mantissa */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
55 uint8_t cplendmant; /* coupling channel end mantissa */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
56 uint32_t cplbndstrc; /* coupling band structure */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
57 sample_t cplco[5][18]; /* coupling coordinates */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
58
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
59 /* derived information */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
60 uint8_t cplstrtbnd; /* coupling start band (for bit allocation) */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
61 uint8_t ncplbnd; /* number of coupling bands */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
62
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
63 uint8_t rematflg; /* stereo rematrixing */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
64
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
65 uint8_t endmant[5]; /* channel end mantissa */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
66
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
67 uint16_t bai; /* bit allocation information */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
68
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
69 uint8_t csnroffst; /* coarse SNR offset */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
70 ba_t cplba; /* coupling bit allocation parameters */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
71 ba_t ba[5]; /* channel bit allocation parameters */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
72 ba_t lfeba; /* lfe bit allocation parameters */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
73
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
74 uint8_t cplfleak; /* coupling fast leak init */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
75 uint8_t cplsleak; /* coupling slow leak init */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
76
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
77 expbap_t cpl_expbap;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
78 expbap_t fbw_expbap[5];
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
79 expbap_t lfe_expbap;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
80
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
81 sample_t * samples;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
82 int downmixed;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
83 };
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
84
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
85 #define LEVEL_PLUS6DB 2.0
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
86 #define LEVEL_PLUS3DB 1.4142135623730951
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
87 #define LEVEL_3DB 0.7071067811865476
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
88 #define LEVEL_45DB 0.5946035575013605
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
89 #define LEVEL_6DB 0.5
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
90
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
91 #define EXP_REUSE (0)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
92 #define EXP_D15 (1)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
93 #define EXP_D25 (2)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
94 #define EXP_D45 (3)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
95
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
96 #define DELTA_BIT_REUSE (0)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
97 #define DELTA_BIT_NEW (1)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
98 #define DELTA_BIT_NONE (2)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
99 #define DELTA_BIT_RESERVED (3)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
100
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
101 void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
102 int start, int end, int fastleak, int slowleak,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
103 expbap_t * expbap);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
104
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
105 int a52_downmix_init (int input, int flags, sample_t * level,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
106 sample_t clev, sample_t slev);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
107 int a52_downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
108 sample_t clev, sample_t slev);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
109 void a52_downmix (sample_t * samples, int acmod, int output, sample_t bias,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
110 sample_t clev, sample_t slev);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
111 void a52_upmix (sample_t * samples, int acmod, int output);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
112
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
113 void a52_imdct_init (uint32_t mm_accel);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
114 void a52_imdct_256 (sample_t * data, sample_t * delay, sample_t bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
115 void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias);