/[pcsx2_0.9.7]/trunk/3rdparty/liba52/a52_internal.h
ViewVC logotype

Contents of /trunk/3rdparty/liba52/a52_internal.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15 - (show annotations) (download)
Mon Sep 6 13:44:19 2010 UTC (10 years, 2 months ago) by william
File MIME type: text/plain
File size: 4447 byte(s)
initial checkout of r3113 from upstream repository
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>
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 typedef struct {
25 uint8_t bai; /* fine SNR offset, fast gain */
26 uint8_t deltbae; /* delta bit allocation exists */
27 int8_t deltba[50]; /* per-band delta bit allocation */
28 } ba_t;
29
30 typedef struct {
31 uint8_t exp[256]; /* decoded channel exponents */
32 int8_t bap[256]; /* derived channel bit allocation */
33 } expbap_t;
34
35 struct a52_state_s {
36 uint8_t fscod; /* sample rate */
37 uint8_t halfrate; /* halfrate factor */
38 uint8_t acmod; /* coded channels */
39 uint8_t lfeon; /* coded lfe channel */
40 sample_t clev; /* centre channel mix level */
41 sample_t slev; /* surround channels mix level */
42
43 int output; /* type of output */
44 sample_t level; /* output level */
45 sample_t bias; /* output bias */
46
47 int dynrnge; /* apply dynamic range */
48 sample_t dynrng; /* dynamic range */
49 void * dynrngdata; /* dynamic range callback funtion and data */
50 sample_t (* dynrngcall) (sample_t range, void * dynrngdata);
51
52 uint8_t chincpl; /* channel coupled */
53 uint8_t phsflginu; /* phase flags in use (stereo only) */
54 uint8_t cplstrtmant; /* coupling channel start mantissa */
55 uint8_t cplendmant; /* coupling channel end mantissa */
56 uint32_t cplbndstrc; /* coupling band structure */
57 sample_t cplco[5][18]; /* coupling coordinates */
58
59 /* derived information */
60 uint8_t cplstrtbnd; /* coupling start band (for bit allocation) */
61 uint8_t ncplbnd; /* number of coupling bands */
62
63 uint8_t rematflg; /* stereo rematrixing */
64
65 uint8_t endmant[5]; /* channel end mantissa */
66
67 uint16_t bai; /* bit allocation information */
68
69 uint32_t * buffer_start;
70 uint16_t lfsr_state; /* dither state */
71 uint32_t bits_left;
72 uint32_t current_word;
73
74 uint8_t csnroffst; /* coarse SNR offset */
75 ba_t cplba; /* coupling bit allocation parameters */
76 ba_t ba[5]; /* channel bit allocation parameters */
77 ba_t lfeba; /* lfe bit allocation parameters */
78
79 uint8_t cplfleak; /* coupling fast leak init */
80 uint8_t cplsleak; /* coupling slow leak init */
81
82 expbap_t cpl_expbap;
83 expbap_t fbw_expbap[5];
84 expbap_t lfe_expbap;
85
86 sample_t * samples;
87 int downmixed;
88 };
89
90 // [Air]: Added sample_t casts here.
91 // Improves SSE2 optimization efficiency under Visual Studio 2008
92
93 #define LEVEL_PLUS6DB ((sample_t)2.0)
94 #define LEVEL_PLUS3DB ((sample_t)1.4142135623730951)
95 #define LEVEL_3DB ((sample_t)0.7071067811865476)
96 #define LEVEL_45DB ((sample_t)0.5946035575013605)
97 #define LEVEL_6DB ((sample_t)0.5)
98
99 #define EXP_REUSE (0)
100 #define EXP_D15 (1)
101 #define EXP_D25 (2)
102 #define EXP_D45 (3)
103
104 #define DELTA_BIT_REUSE (0)
105 #define DELTA_BIT_NEW (1)
106 #define DELTA_BIT_NONE (2)
107 #define DELTA_BIT_RESERVED (3)
108
109 void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart,
110 int start, int end, int fastleak, int slowleak,
111 expbap_t * expbap);
112
113 int a52_downmix_init (int input, int flags, sample_t * level,
114 sample_t clev, sample_t slev);
115 int a52_downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level,
116 sample_t clev, sample_t slev);
117 void a52_downmix (sample_t * samples, int acmod, int output, sample_t bias,
118 sample_t clev, sample_t slev);
119 void a52_upmix (sample_t * samples, int acmod, int output);
120
121 void a52_imdct_init (uint32_t mm_accel);
122 void a52_imdct_256 (sample_t * data, sample_t * delay, sample_t bias);
123 void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias);

  ViewVC Help
Powered by ViewVC 1.1.22