libavformat is now the default for mov, update extension.c to match this.
[mplayer/glamo.git] / liba52 / a52_internal.h
blob1f6d20593193327509c8d6733221c5b5a3087cca
1 /*
2 * a52_internal.h
3 * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
6 * This file is part of a52dec, a free ATSC A-52 stream decoder.
7 * See http://liba52.sourceforge.net/ for updates.
9 * Modified for use with MPlayer, changes contained in liba52_changes.diff.
10 * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
11 * $Id$
13 * a52dec is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * a52dec is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 typedef struct {
29 uint8_t bai; /* fine SNR offset, fast gain */
30 uint8_t deltbae; /* delta bit allocation exists */
31 int8_t deltba[50]; /* per-band delta bit allocation */
32 } ba_t;
34 typedef struct {
35 uint8_t exp[256]; /* decoded channel exponents */
36 int8_t bap[256]; /* derived channel bit allocation */
37 } expbap_t;
39 struct a52_state_s {
40 uint8_t fscod; /* sample rate */
41 uint8_t halfrate; /* halfrate factor */
42 uint8_t acmod; /* coded channels */
43 uint8_t lfeon; /* coded lfe channel */
44 sample_t clev; /* centre channel mix level */
45 sample_t slev; /* surround channels mix level */
47 int output; /* type of output */
48 sample_t level; /* output level */
49 sample_t bias; /* output bias */
51 int dynrnge; /* apply dynamic range */
52 sample_t dynrng; /* dynamic range */
53 void * dynrngdata; /* dynamic range callback funtion and data */
54 sample_t (* dynrngcall) (sample_t range, void * dynrngdata);
56 uint8_t chincpl; /* channel coupled */
57 uint8_t phsflginu; /* phase flags in use (stereo only) */
58 uint8_t cplstrtmant; /* coupling channel start mantissa */
59 uint8_t cplendmant; /* coupling channel end mantissa */
60 uint32_t cplbndstrc; /* coupling band structure */
61 sample_t cplco[5][18]; /* coupling coordinates */
63 /* derived information */
64 uint8_t cplstrtbnd; /* coupling start band (for bit allocation) */
65 uint8_t ncplbnd; /* number of coupling bands */
67 uint8_t rematflg; /* stereo rematrixing */
69 uint8_t endmant[5]; /* channel end mantissa */
71 uint16_t bai; /* bit allocation information */
73 uint32_t * buffer_start;
74 uint16_t lfsr_state; /* dither state */
75 uint32_t bits_left;
76 uint32_t current_word;
78 uint8_t csnroffst; /* coarse SNR offset */
79 ba_t cplba; /* coupling bit allocation parameters */
80 ba_t ba[5]; /* channel bit allocation parameters */
81 ba_t lfeba; /* lfe bit allocation parameters */
83 uint8_t cplfleak; /* coupling fast leak init */
84 uint8_t cplsleak; /* coupling slow leak init */
86 expbap_t cpl_expbap;
87 expbap_t fbw_expbap[5];
88 expbap_t lfe_expbap;
90 sample_t * samples;
91 int downmixed;
94 #define LEVEL_PLUS6DB 2.0
95 #define LEVEL_PLUS3DB 1.4142135623730951
96 #define LEVEL_3DB 0.7071067811865476
97 #define LEVEL_45DB 0.5946035575013605
98 #define LEVEL_6DB 0.5
100 #define EXP_REUSE (0)
101 #define EXP_D15 (1)
102 #define EXP_D25 (2)
103 #define EXP_D45 (3)
105 #define DELTA_BIT_REUSE (0)
106 #define DELTA_BIT_NEW (1)
107 #define DELTA_BIT_NONE (2)
108 #define DELTA_BIT_RESERVED (3)
110 #if ARCH_X86_64
111 # define REG_a "rax"
112 # define REG_d "rdx"
113 # define REG_S "rsi"
114 # define REG_D "rdi"
115 # define REG_BP "rbp"
116 #else
117 # define REG_a "eax"
118 # define REG_d "edx"
119 # define REG_S "esi"
120 # define REG_D "edi"
121 # define REG_BP "ebp"
122 #endif
124 void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart,
125 int start, int end, int fastleak, int slowleak,
126 expbap_t * expbap);
128 int a52_downmix_init (int input, int flags, sample_t * level,
129 sample_t clev, sample_t slev);
130 void downmix_accel_init(uint32_t mm_accel);
131 int a52_downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level,
132 sample_t clev, sample_t slev);
133 extern void (*a52_downmix) (sample_t * samples, int acmod, int output, sample_t bias,
134 sample_t clev, sample_t slev);
135 extern void (*a52_upmix) (sample_t * samples, int acmod, int output);
137 void a52_imdct_init (uint32_t mm_accel);
138 void a52_imdct_256 (sample_t * data, sample_t * delay, sample_t bias);
139 extern void (*a52_imdct_512) (sample_t * data, sample_t * delay, sample_t bias);
140 void imdct_do_512 (sample_t * data, sample_t * delay, sample_t bias);