1
0
mirror of https://github.com/mstorsjo/fdk-aac.git synced 2025-02-17 19:50:35 +01:00

Add support for Workgroup 4 (WG4) channel mapping

This is the channel ordering used in DVD Audio, and is the standard
used internally in the VLC media player.
This commit is contained in:
Sergio Ammirata 2012-10-04 15:51:05 -04:00 committed by Martin Storsjo
parent a4d6ca7b07
commit 661e20600f
5 changed files with 52 additions and 7 deletions

View File

@ -206,8 +206,9 @@ typedef enum {
CH_ORDER_MPEG =
0, /*!< MPEG channel ordering (e. g. 5.1: C, L, R, SL, SR, LFE) */
CH_ORDER_WAV /*!< WAV fileformat channel ordering (e. g. 5.1: L, R, C, LFE,
SL, SR) */
CH_ORDER_WAV, /*!< WAV fileformat channel ordering (e. g. 5.1: L, R, C, LFE,
SL, SR) */
CH_ORDER_WG4 /*!< WG4 fileformat channel ordering (e. g. 5.1: L, R, SL, SR, C, LFE) */
} CHANNEL_ORDER;

View File

@ -2191,7 +2191,7 @@ AACENC_ERROR aacEncoder_SetParam(const HANDLE_AACENCODER hAacEncoder,
break;
case AACENC_CHANNELORDER:
if (hAacEncoder->aacConfig.channelOrder != (CHANNEL_ORDER)value) {
if (!((value == 0) || (value == 1))) {
if (!((value == 0) || (value == 1) || (value == 2))) {
err = AACENC_INVALID_CONFIG;
break;
}

View File

@ -491,10 +491,17 @@ FDK_METADATA_ERROR FDK_MetadataEnc_Init(
FDK_channelMapDescr mapDescrPrev, mapDescr;
int c, src[2] = {-1, -1}, dst[2] = {-1, -1};
FDK_chMapDescr_init(&mapDescrPrev, NULL, 0,
(channelOrder == CH_ORDER_MPEG) ? 1 : 0);
FDK_chMapDescr_init(&mapDescr, NULL, 0,
(channelOrder == CH_ORDER_MPEG) ? 1 : 0);
if (channelOrder == CH_ORDER_WG4) {
FDK_chMapDescr_init(&mapDescrPrev, FDK_mapInfoTabWg4,
FDK_mapInfoTabLenWg4, 0);
FDK_chMapDescr_init(&mapDescr, FDK_mapInfoTabWg4,
FDK_mapInfoTabLenWg4, 0);
} else {
FDK_chMapDescr_init(&mapDescrPrev, NULL, 0,
(channelOrder == CH_ORDER_MPEG) ? 1 : 0);
FDK_chMapDescr_init(&mapDescr, NULL, 0,
(channelOrder == CH_ORDER_MPEG) ? 1 : 0);
}
switch (channelMode) {
case MODE_1:

View File

@ -189,6 +189,12 @@ UCHAR FDK_chMapDescr_getMapValue(const FDK_channelMapDescr* const pMapDescr,
*/
int FDK_chMapDescr_isValid(const FDK_channelMapDescr* const pMapDescr);
/**
* Extra variables for setting up Wg4 channel mapping.
*/
extern const CHANNEL_MAP_INFO FDK_mapInfoTabWg4[];
extern const UINT FDK_mapInfoTabLenWg4;
#ifdef __cplusplus
}
#endif

View File

@ -155,6 +155,37 @@ static const CHANNEL_MAP_INFO mapInfoTabDflt[DFLT_CH_MAP_TAB_LEN] =
/* 13 */ {mapCfg13, 24},
/* 14 */ {mapCfg14, 8}};
static const UCHAR mapWg4Cfg1[] = {0, 1};
static const UCHAR mapWg4Cfg2[] = {0, 1};
static const UCHAR mapWg4Cfg3[] = {2, 0, 1};
static const UCHAR mapWg4Cfg4[] = {3, 0, 1, 2};
static const UCHAR mapWg4Cfg5[] = {4, 0, 1, 2, 3};
static const UCHAR mapWg4Cfg6[] = {4, 0, 1, 2, 3, 5};
static const UCHAR mapWg4Cfg7[] = {6, 0, 1, 2, 3, 4, 5, 7};
static const UCHAR mapWg4Cfg14[] = {6, 0, 1, 2, 3, 4, 5, 7};
const CHANNEL_MAP_INFO FDK_mapInfoTabWg4[] =
{/* chCfg, map, numCh */
/* 0 */ {mapFallback, 24},
/* 1 */ {mapWg4Cfg1, 2},
/* 2 */ {mapWg4Cfg2, 2},
/* 3 */ {mapWg4Cfg3, 3},
/* 4 */ {mapWg4Cfg4, 4},
/* 5 */ {mapWg4Cfg5, 5},
/* 6 */ {mapWg4Cfg6, 6},
/* 7 */ {mapWg4Cfg7, 8},
/* 8 */ {mapFallback, 24},
/* 9 */ {mapFallback, 24},
/* 10 */ {mapFallback, 24},
/* 11 */ {mapFallback, 24}, // Unhandled for Wg4 yet
/* 12 */ {mapFallback, 24}, // Unhandled for Wg4 yet
/* 13 */ {mapFallback, 24}, // Unhandled for Wg4 yet
/* 14 */ {mapFallback, 24}}; // Unhandled for Wg4 yet
const UINT FDK_mapInfoTabLenWg4 = sizeof(FDK_mapInfoTabWg4)/sizeof(FDK_mapInfoTabWg4[0]);
/**
* Get the mapping value for a specific channel and map index.
*/