comparison liba52/a52.h @ 3394:35b18ed357c2

imported from liba52 CVS
author arpi
date Sun, 09 Dec 2001 15:28:44 +0000
parents
children e22ff7ebdc05
comparison
equal deleted inserted replaced
3393:3624cd351618 3394:35b18ed357c2
1 /*
2 * a52.h
3 * Copyright (C) 2000-2001 Michel Lespinasse <walken@zoy.org>
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
5 *
6 * This file is part of a52dec, a free ATSC A-52 stream decoder.
7 * See http://liba52.sourceforge.net/ for updates.
8 *
9 * a52dec is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * a52dec 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
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24 #ifndef A52_H
25 #define A52_H
26
27 #ifndef LIBA52_DOUBLE
28 typedef float sample_t;
29 #else
30 typedef double sample_t;
31 #endif
32
33 typedef struct a52_ba_s {
34 uint16_t fsnroffst; /* fine SNR offset */
35 uint16_t fgaincod; /* fast gain */
36 uint16_t deltbae; /* delta bit allocation exists */
37 int8_t deltba[50]; /* per-band delta bit allocation */
38 } a52_ba_t;
39
40 typedef struct a52_state_s {
41 uint8_t fscod; /* sample rate */
42 uint8_t halfrate; /* halfrate factor */
43 uint8_t acmod; /* coded channels */
44 sample_t clev; /* centre channel mix level */
45 sample_t slev; /* surround channels mix level */
46 uint8_t lfeon; /* coded lfe channel */
47
48 int output; /* type of output */
49 sample_t level; /* output level */
50 sample_t bias; /* output bias */
51
52 int dynrnge; /* apply dynamic range */
53 sample_t dynrng; /* dynamic range */
54 void * dynrngdata; /* dynamic range callback funtion and data */
55 sample_t (* dynrngcall) (sample_t range, void * dynrngdata);
56
57 uint16_t cplinu; /* coupling in use */
58 uint16_t chincpl[5]; /* channel coupled */
59 uint16_t phsflginu; /* phase flags in use (stereo only) */
60 uint16_t cplbndstrc[18]; /* coupling band structure */
61 uint16_t cplstrtmant; /* coupling channel start mantissa */
62 uint16_t cplendmant; /* coupling channel end mantissa */
63 sample_t cplco[5][18]; /* coupling coordinates */
64
65 /* derived information */
66 uint16_t cplstrtbnd; /* coupling start band (for bit allocation) */
67 uint16_t ncplbnd; /* number of coupling bands */
68
69 uint16_t rematflg[4]; /* stereo rematrixing */
70
71 uint16_t endmant[5]; /* channel end mantissa */
72
73 uint8_t cpl_exp[256]; /* decoded coupling channel exponents */
74 uint8_t fbw_exp[5][256]; /* decoded channel exponents */
75 uint8_t lfe_exp[7]; /* decoded lfe channel exponents */
76
77 uint16_t sdcycod; /* slow decay */
78 uint16_t fdcycod; /* fast decay */
79 uint16_t sgaincod; /* slow gain */
80 uint16_t dbpbcod; /* dB per bit - encodes the dbknee value */
81 uint16_t floorcod; /* masking floor */
82
83 uint16_t csnroffst; /* coarse SNR offset */
84 a52_ba_t cplba; /* coupling bit allocation parameters */
85 a52_ba_t ba[5]; /* channel bit allocation parameters */
86 a52_ba_t lfeba; /* lfe bit allocation parameters */
87
88 uint16_t cplfleak; /* coupling fast leak init */
89 uint16_t cplsleak; /* coupling slow leak init */
90
91 /* derived bit allocation information */
92 int8_t fbw_bap[5][256];
93 int8_t cpl_bap[256];
94 int8_t lfe_bap[7];
95 } a52_state_t;
96
97 #define A52_CHANNEL 0
98 #define A52_MONO 1
99 #define A52_STEREO 2
100 #define A52_3F 3
101 #define A52_2F1R 4
102 #define A52_3F1R 5
103 #define A52_2F2R 6
104 #define A52_3F2R 7
105 #define A52_CHANNEL1 8
106 #define A52_CHANNEL2 9
107 #define A52_DOLBY 10
108 #define A52_CHANNEL_MASK 15
109
110 #define A52_LFE 16
111 #define A52_ADJUST_LEVEL 32
112
113 sample_t * a52_init (uint32_t mm_accel);
114 int a52_syncinfo (uint8_t * buf, int * flags,
115 int * sample_rate, int * bit_rate);
116 int a52_frame (a52_state_t * state, uint8_t * buf, int * flags,
117 sample_t * level, sample_t bias);
118 void a52_dynrng (a52_state_t * state,
119 sample_t (* call) (sample_t, void *), void * data);
120 int a52_block (a52_state_t * state, sample_t * samples);
121
122 #endif /* A52_H */