summaryrefslogtreecommitdiffstats
path: root/libhb/downmix.h
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2010-04-05 18:50:29 +0000
committerjstebbins <[email protected]>2010-04-05 18:50:29 +0000
commitd7dc1c11f93fe701893899471a5d729869d8f5c6 (patch)
tree5d087d19b5092465f471e1ef76138b5f42396c97 /libhb/downmix.h
parent453a109aae42e4ce540b16977c4ffe3631b7dce3 (diff)
generalize audio channel map reordering
this allows remapping any channel order to any other channel order with the appropriate map definitions. channel maps currently supplied are smpte (used by ffmpeg), qt (our standard channel order), and ac3 (as delivered by a52dec). remapping can also be applied to the downmixer with the function hb_downmix_set_chan_map(hb_chan_map_t * map_in, hb_chan_map_t * map_out). this allows downmixing and channel reordering in a single step. there is no additional cost to reordering since the matrix multiply used to do the downmix simultaneously reorders. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3201 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/downmix.h')
-rw-r--r--libhb/downmix.h31
1 files changed, 28 insertions, 3 deletions
diff --git a/libhb/downmix.h b/libhb/downmix.h
index f9710488b..5a6ec0bf5 100644
--- a/libhb/downmix.h
+++ b/libhb/downmix.h
@@ -11,22 +11,38 @@ 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 int hb_smpte_chan_map[10][2][8];
-extern int hb_ac3_chan_map[10][2][8];
+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 );
@@ -34,8 +50,17 @@ 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( int (*layouts)[2][8], hb_sample_t * samples, int layout, 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 */