1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* downmix.h
Copyright (c) 2003-2012 HandBrake Team
This file is part of the HandBrake source code
Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License v2.
For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
*/
#ifndef DOWNMIX_H
#define DOWNMIX_H
typedef float hb_sample_t;
typedef struct
{
int chan_map[10][2][8];
int inv_chan_map[10][2][8];
} hb_chan_map_t;
typedef struct
{
int mode_in;
int mode_out;
int nchans_in;
int nchans_out;
hb_sample_t matrix[8][8];
int matrix_initialized;
hb_sample_t clev;
hb_sample_t slev;
hb_sample_t level;
hb_sample_t bias;
hb_chan_map_t map_in;
hb_chan_map_t map_out;
int center;
int left_surround;
int right_surround;
int rear_left_surround;
int rear_right_surround;
} hb_downmix_t;
// For convenience, a map to convert smpte channel layout
// to QuickTime channel layout.
// Map Indicies are mode, lfe, channel respectively
extern hb_chan_map_t hb_smpte_chan_map;
extern hb_chan_map_t hb_ac3_chan_map;
extern hb_chan_map_t hb_qt_chan_map;
hb_downmix_t * hb_downmix_init(int layout, int mixdown);
void hb_downmix_close( hb_downmix_t **downmix );
int hb_downmix_set_mode( hb_downmix_t * downmix, int layout, int mixdown );
void hb_downmix_set_level( hb_downmix_t * downmix, hb_sample_t clev, hb_sample_t slev, hb_sample_t level );
void hb_downmix_adjust_level( hb_downmix_t * downmix );
void hb_downmix_set_bias( hb_downmix_t * downmix, hb_sample_t bias );
void hb_downmix_set_chan_map(
hb_downmix_t * downmix,
hb_chan_map_t * map_in,
hb_chan_map_t * map_out );
void hb_downmix( hb_downmix_t * downmix, hb_sample_t * dst, hb_sample_t * src, int nsamples);
void hb_layout_remap(
hb_chan_map_t * map_in,
hb_chan_map_t * map_out,
int layout,
hb_sample_t * samples,
int nsamples );
int hb_need_downmix( int layout, int mixdown );
#endif /* DOWNMIX_H */
|