Encoder downsampled SBR

* AAC-Encoder

   - Introduce optional AACENC_SBR_RATIO encoder API parameter to configure
     dualrate or downsampled SBR explicitely. ELD makes use of downsampled SBR
     in default configuration.
     Modified file(s):
        documentation\aacEncoder.pdf
        libAACenc\include\aacenc_lib.h
        libAACenc\src\aacenc.h
        libAACenc\src\aacenc_lib.cpp

* SBR-Encoder

   - Implement downsampled SBR feature.
   - Revise sbr tuning parameter selection.
     Modified file(s):
        libSBRenc\include\sbr_encoder.h
        libSBRenc\src\bit_sbr.h
        libSBRenc\src\env_est.cpp
        libSBRenc\src\mh_det.cpp
        libSBRenc\src\nf_est.cpp
        libSBRenc\src\ps_main.cpp
        libSBRenc\src\sbr.h
        libSBRenc\src\sbr_def.h
        libSBRenc\src\sbr_encoder.cpp
        libSBRenc\src\sbr_rom.cpp
        libSBRenc\src\sbr_rom.h
        libSBRenc\src\sbrenc_freq_sca.cpp
        libSBRenc\src\sbrenc_freq_sca.h
        libSBRenc\src\ton_corr.cpp

Bug 9428126

Change-Id: I731720a10829272acaaf70b84525df00a09ff3d2
This commit is contained in:
Jean-Michel Trivi 2013-08-29 12:24:04 -07:00
parent 7ad97579f8
commit 3aec97e388
18 changed files with 6556 additions and 6983 deletions

File diff suppressed because one or more lines are too long

View File

@ -316,7 +316,8 @@ if the parameter was not set from extern. The bitrate depends on the number of e
channels and sampling rate and is determined as follows.
\code
AAC-LC (AOT_AAC_LC): 1.5 bits per sample
HE-AAC (AOT_SBR): 0.625 bits per sample
HE-AAC (AOT_SBR): 0.625 bits per sample (dualrate sbr)
HE-AAC (AOT_SBR): 1.125 bits per sample (downsampled sbr)
HE-AAC v2 (AOT_PS): 0.5 bits per sample
\endcode
@ -416,8 +417,9 @@ determines the maximum allowed bitrate for AAC-LC. For HE-AAC and HE-AAC v2 a li
look-up table is used.
A good working point in terms of audio quality, sampling rate and bitrate, is at 1 to 1.5
bits/audio sample for AAC-LC, 0.625 bits/audio sample for HE-AAC and 0.5 bits/audio sample
for HE-AAC v2. For example for one channel with a sampling frequency of 48 kHz, the range from
bits/audio sample for AAC-LC, 0.625 bits/audio sample for dualrate HE-AAC, 1.125 bits/audio sample
for downsampled HE-AAC and 0.5 bits/audio sample for HE-AAC v2.
For example for one channel with a sampling frequency of 48 kHz, the range from
48 kbit/s to 72 kbit/s achieves reasonable audio quality for AAC-LC.
For HE-AAC and HE-AAC v2 the lowest possible audio input sampling frequency is 16 kHz because then the
@ -434,7 +436,7 @@ quality at that bitrate than HE-AAC or HE-AAC v2.
The following table provides an overview of recommended encoder configuration parameters
which we determined by virtue of numerous listening tests.
\subsection reommendedConfigLC AAC-LC, HE-AAC, HE-AACv2.
\subsection reommendedConfigLC AAC-LC, HE-AAC, HE-AACv2 in Dualrate SBR mode.
\verbatim
-----------------------------------------------------------------------------------
Audio Object Type | Bit Rate Range | Supported | Preferred | No. of
@ -457,8 +459,8 @@ AAC LC + SBR | 64000 - 128000 | 32.00, 44.10, 48.00 | 48.00 |
-------------------+------------------+-----------------------+------------+-------
AAC LC + SBR | 64000 - 69999 | 32.00, 44.10, 48.00 | 32.00 | 5, 5.1
AAC LC + SBR | 70000 - 159999 | 32.00, 44.10, 48.00 | 44.10 | 5, 5.1
AAC LC + SBR | 160000 - 319999 | 32.00, 44.10, 48.00 | 48.00 | 5, 5.1
AAC LC + SBR | 320000 - 640000 | 64.00, 88.20, 96.00 | 96.00 | 5, 5.1
AAC LC + SBR | 160000 - 245999 | 32.00, 44.10, 48.00 | 48.00 | 5
AAC LC + SBR | 160000 - 265999 | 32.00, 44.10, 48.00 | 48.00 | 5.1
-------------------+------------------+-----------------------+------------+-------
AAC LC | 8000 - 15999 | 11.025, 12.00, 16.00 | 12.00 | 1
AAC LC | 16000 - 23999 | 16.00 | 16.00 | 1
@ -481,7 +483,7 @@ AAC LC | 280000 - 800000 | 32.00, 44.10, 48.00 | 44.10 | 5,
-----------------------------------------------------------------------------------
\endverbatim \n
\subsection reommendedConfigLD AAC-LD, AAC-ELD, AAC-ELD with SBR.
\subsection reommendedConfigLD AAC-LD, AAC-ELD, AAC-ELD with SBR in Dualrate SBR mode.
\verbatim
-----------------------------------------------------------------------------------
Audio Object Type | Bit Rate Range | Supported | Preferred | No. of
@ -489,18 +491,20 @@ Audio Object Type | Bit Rate Range | Supported | Preferred | No.
| | [kHz] | Rate |
| | | [kHz] |
-------------------+------------------+-----------------------+------------+-------
ELD + SBR | 16000 - 24999 | 32.00 - 44.10 | 32.00 | 1
ELD + SBR | 18000 - 24999 | 32.00 - 44.10 | 32.00 | 1
ELD + SBR | 25000 - 31999 | 32.00 - 48.00 | 32.00 | 1
ELD + SBR | 32000 - 64000 | 32.00 - 48.00 | 48.00 | 1
-------------------+------------------+-----------------------+------------+-------
ELD + SBR | 32000 - 51999 | 32.00 - 48.00 | 44.10 | 2
ELD + SBR | 52000 - 128000 | 32.00 - 48.00 | 48.00 | 2
-------------------+------------------+-----------------------+------------+-------
ELD + SBR | 72000 - 192000 | 44.10 - 48.00 | 48.00 | 3
ELD + SBR | 72000 - 160000 | 44.10 - 48.00 | 48.00 | 3
-------------------+------------------+-----------------------+------------+-------
ELD + SBR | 96000 - 256000 | 44.10 - 48.00 | 48.00 | 4
ELD + SBR | 96000 - 212000 | 44.10 - 48.00 | 48.00 | 4
-------------------+------------------+-----------------------+------------+-------
ELD + SBR | 120000 - 320000 | 44.10 - 48.00 | 48.00 | 5
ELD + SBR | 120000 - 246000 | 44.10 - 48.00 | 48.00 | 5
-------------------+------------------+-----------------------+------------+-------
ELD + SBR | 120000 - 266000 | 44.10 - 48.00 | 48.00 | 5.1
-------------------+------------------+-----------------------+------------+-------
LD, ELD | 16000 - 19999 | 16.00 - 24.00 | 16.00 | 1
LD, ELD | 20000 - 39999 | 16.00 - 32.00 | 24.00 | 1
@ -531,13 +535,33 @@ LD, ELD | 340000 - 960000 | 44.10 - 48.00 | 48.00 |
-----------------------------------------------------------------------------------
\endverbatim \n
\subsection reommendedConfigELD AAC-ELD with SBR in Downsampled SBR mode.
\verbatim
-----------------------------------------------------------------------------------
Audio Object Type | Bit Rate Range | Supported | Preferred | No. of
| [bit/s] | Sampling Rates | Sampl. | Chan.
| | [kHz] | Rate |
| | | [kHz] |
-------------------+------------------+-----------------------+------------+-------
ELD + SBR | 18000 - 24999 | 16.00 - 22.05 | 22.05 | 1
(downsampled SBR) | 25000 - 35999 | 22.05 - 32.00 | 24.00 | 1
| 36000 - 64000 | 32.00 - 48.00 | 32.00 | 1
-----------------------------------------------------------------------------------
\endverbatim \n
\page ENCODERBEHAVIOUR Encoder Behaviour
\section BEHAVIOUR_BANDWIDTH Bandwidth
The FDK AAC encoder usually does not use the full frequency range of the input signal, but restricts the bandwidth
according to certain library-internal settings. They can be changed in the table "bandWidthTable" in the
file bandwidth.cpp (if available), or via command-line argument "-w" (see chapter \ref CommandLineUsage).
file bandwidth.cpp (if available).
The encoder API provides the ::AACENC_BANDWIDTH parameter to adjust the bandwidth explicitly.
\code
aacEncoder_SetParam(hAacEncoder, AACENC_BANDWIDTH, value);
\endcode
However it is not recommended to change these settings, because they are based on numerious listening
tests and careful tweaks to ensure the best overall encoding quality.
@ -638,7 +662,6 @@ an MPEG-2 AOT is choosen since PNS is an MPEG-4 AAC feature.
If SBR is activated, the encoder automatically deactivates PNS internally. If TNS is disabled but PNS is allowed,
the encoder deactivates PNS calculation internally.
*/
#ifndef _AAC_ENC_LIB_H_
@ -875,6 +898,15 @@ typedef enum
- 0: MPEG channel ordering (e. g. 5.1: C, L, R, SL, SR, LFE). (default)
- 1: WAVE file format channel ordering (e. g. 5.1: L, R, C, LFE, SL, SR). */
AACENC_SBR_RATIO = 0x0108, /*!< Controls activation of downsampled SBR. With downsampled SBR, the delay will be
shorter. On the other hand, for achieving the same quality level, downsampled SBR
needs more bits than dual-rate SBR.
With downsampled SBR, the AAC encoder will work at the same sampling rate as the
SBR encoder (single rate).
Downsampled SBR is supported for AAC-ELD and HE-AACv1.
- 1: Downsampled SBR (default for ELD).
- 2: Dual-rate SBR (default for HE-AAC). */
AACENC_AFTERBURNER = 0x0200, /*!< This parameter controls the use of the afterburner feature.
The afterburner is a type of analysis by synthesis algorithm which increases the
audio quality but also the required processing power. It is recommended to always

View File

@ -204,6 +204,8 @@ struct AACENC_CONFIG {
INT maxBitsPerFrame; /* maximum number of bits in AU */
INT bitreservoir; /* size of bitreservoir */
UINT sbrRatio; /* sbr sampling rate ratio: dual- or single-rate */
UCHAR useTns; /* flag: use temporal noise shaping */
UCHAR usePns; /* flag: use perceptual noise substitution */
UCHAR useIS; /* flag: use intensity coding */

View File

@ -98,7 +98,7 @@ amm-info@iis.fraunhofer.de
/* Encoder library info */
#define AACENCODER_LIB_VL0 3
#define AACENCODER_LIB_VL1 4
#define AACENCODER_LIB_VL2 8
#define AACENCODER_LIB_VL2 9
#define AACENCODER_LIB_TITLE "AAC Encoder"
#define AACENCODER_LIB_BUILD_DATE __DATE__
#define AACENCODER_LIB_BUILD_TIME __TIME__
@ -118,7 +118,7 @@ amm-info@iis.fraunhofer.de
#define SBL(fl) (fl/8) /*!< Short block length (hardcoded to 8 short blocks per long block) */
#define BSLA(fl) (4*SBL(fl)+SBL(fl)/2) /*!< AAC block switching look-ahead */
#define DELAY_AAC(fl) (fl+BSLA(fl)) /*!< MDCT + blockswitching */
#define DELAY_AACELD(fl) ( (fl) + ((fl)/2) ) /*!< ELD FB delay */
#define DELAY_AACELD(fl) ((fl)/2) /*!< ELD FB delay (no framing delay included) */
#define INPUTBUFFER_SIZE (1537+100+2048)
@ -166,7 +166,8 @@ typedef struct {
UCHAR userMetaDataMode; /*!< Meta data library configuration. */
UCHAR userSbrEnabled;
UCHAR userSbrEnabled; /*!< Enable SBR for ELD. */
UINT userSbrRatio; /*!< SBR sampling rate ratio. Dual- or single-rate. */
} USER_PARAM;
@ -229,7 +230,7 @@ struct AACENCODER
UINT encoder_modis;
/* Capabity flags */
/* Capability flags */
UINT CAPF_tpEnc;
} ;
@ -255,6 +256,20 @@ static inline INT isSbrActive(const HANDLE_AACENC_CONFIG hAacConfig)
return ( sbrUsed );
}
static inline INT isPsActive(const AUDIO_OBJECT_TYPE audioObjectType)
{
INT psUsed = 0;
if ( (audioObjectType==AOT_PS)
|| (audioObjectType==AOT_MP2_PS)
|| (audioObjectType==AOT_DABPLUS_PS)
|| (audioObjectType==AOT_DRM_MPEG_PS) )
{
psUsed = 1;
}
return ( psUsed );
}
/****************************************************************************
Allocate Encoder
****************************************************************************/
@ -449,6 +464,14 @@ AAC_ENCODER_ERROR aacEncDefaultConfig(HANDLE_AACENC_CONFIG hAacConfig,
config->userAncDataRate = 0;
/* SBR rate is set to 0 here, which means it should be set automatically
in FDKaacEnc_AdjustEncSettings() if the user did not set a rate
expilicitely. */
config->userSbrRatio = 0;
/* SBR enable set to -1 means to inquire ELD audio configurator for reasonable configuration. */
config->userSbrEnabled = -1;
return AAC_ENC_OK;
}
@ -483,6 +506,7 @@ INT aacEncoder_LimitBitrate(
INT bitRate,
const INT nSubFrames,
const INT sbrActive,
const INT sbrDownSampleRate,
const AUDIO_OBJECT_TYPE aot
)
{
@ -492,8 +516,7 @@ INT aacEncoder_LimitBitrate(
FDKaacEnc_InitChannelMapping(channelMode, CH_ORDER_MPEG, &cm);
if (sbrActive) {
/* Assume SBR rate ratio of 2:1 */
coreSamplingRate = samplingRate / 2;
coreSamplingRate = samplingRate >> (sbrEncoder_IsSingleRatePossible(aot) ? (sbrDownSampleRate-1):1);
} else {
coreSamplingRate = samplingRate;
}
@ -669,19 +692,6 @@ AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
break;
}
/* We need the frame length to call aacEncoder_LimitBitrate() */
hAacConfig->bitRate = aacEncoder_LimitBitrate(
NULL,
hAacConfig->sampleRate,
hAacConfig->framelength,
hAacConfig->nChannels,
hAacConfig->channelMode,
config->userBitrate,
hAacConfig->nSubFrames,
isSbrActive(hAacConfig),
hAacConfig->audioObjectType
);
switch ( hAacConfig->audioObjectType ) {
case AOT_ER_AAC_LD:
case AOT_ER_AAC_ELD:
@ -699,6 +709,70 @@ AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
break;
}
hAacConfig->bitRate = config->userBitrate;
/* get bitrate in VBR configuration */
if ( (hAacConfig->bitrateMode>=1) && (hAacConfig->bitrateMode<=5) ) {
/* In VBR mode; SBR-modul depends on bitrate, core encoder on bitrateMode. */
hAacConfig->bitRate = FDKaacEnc_GetVBRBitrate(hAacConfig->bitrateMode, hAacConfig->channelMode);
}
/* Set default bitrate if no external bitrate declared. */
if ( (hAacConfig->bitrateMode==0) && (config->userBitrate==(UINT)-1) ) {
INT bitrate = FDKaacEnc_GetChannelModeConfiguration(hAacConfig->channelMode)->nChannelsEff * hAacConfig->sampleRate;
if ( isPsActive(hAacConfig->audioObjectType) ) {
hAacConfig->bitRate = (bitrate>>1); /* 0.5 bit per sample */
}
else if ( isSbrActive(hAacConfig) )
{
if ( (config->userSbrRatio==2) || ((config->userSbrRatio==0)&&(hAacConfig->audioObjectType!=AOT_ER_AAC_ELD)) ) {
hAacConfig->bitRate = (bitrate + (bitrate>>2))>>1; /* 0.625 bits per sample */
}
if ( (config->userSbrRatio==1) || ((config->userSbrRatio==0)&&(hAacConfig->audioObjectType==AOT_ER_AAC_ELD)) ) {
hAacConfig->bitRate = (bitrate + (bitrate>>3)); /* 1.125 bits per sample */
}
} else
{
hAacConfig->bitRate = bitrate + (bitrate>>1); /* 1.5 bits per sample */
}
}
/* Initialize SBR parameters */
if ( (config->userSbrRatio==0) && (isSbrActive(hAacConfig)) ) {
/* Automatic SBR ratio configuration
* - downsampled SBR for ELD
* - otherwise always dualrate SBR
*/
hAacConfig->sbrRatio = (hAacConfig->audioObjectType==AOT_ER_AAC_ELD) ? 1 : 2;
}
else {
/* SBR ratio has been set by the user, so use it. */
hAacConfig->sbrRatio = config->userSbrRatio;
}
/* We need the frame length to call aacEncoder_LimitBitrate() */
hAacConfig->bitRate = aacEncoder_LimitBitrate(
NULL,
hAacConfig->sampleRate,
hAacConfig->framelength,
hAacConfig->nChannels,
hAacConfig->channelMode,
hAacConfig->bitRate,
hAacConfig->nSubFrames,
isSbrActive(hAacConfig),
hAacConfig->sbrRatio,
hAacConfig->audioObjectType
);
/* Configure PNS */
if ( ((hAacConfig->bitrateMode>=1) && (hAacConfig->bitrateMode<=5)) /* VBR without PNS. */
|| (hAacConfig->useTns == 0) ) /* TNS required. */
{
hAacConfig->usePns = 0;
}
if (hAacConfig->epConfig >= 0) {
hAacConfig->syntaxFlags |= AC_ER;
if (((INT)hAacConfig->channelMode < 1) || ((INT)hAacConfig->channelMode > 7)) {
@ -718,41 +792,6 @@ AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
return AACENC_INVALID_CONFIG; /* not enough channels allocated */
}
/* get bitrate in VBR configuration */
if ( (hAacConfig->bitrateMode>=1) && (hAacConfig->bitrateMode<=5) ) {
/* In VBR mode; SBR-modul depends on bitrate, core encoder on bitrateMode. */
hAacConfig->bitRate = FDKaacEnc_GetVBRBitrate(hAacConfig->bitrateMode, hAacConfig->channelMode);
}
/* Set default bitrate if no external bitrate declared. */
if (hAacConfig->bitRate==-1) {
INT bitrate = FDKaacEnc_GetChannelModeConfiguration(hAacConfig->channelMode)->nChannelsEff * hAacConfig->sampleRate;
switch (hAacConfig->audioObjectType)
{
case AOT_AAC_LC:
hAacConfig->bitRate = bitrate + (bitrate>>1); /* 1.5 bits per sample */
break;
case AOT_SBR:
hAacConfig->bitRate = (bitrate + (bitrate>>2))>>1; /* 0.625 bits per sample */
break;
case AOT_PS:
hAacConfig->bitRate = (bitrate>>1); /* 0.5 bit per sample */
break;
default:
hAacConfig->bitRate = bitrate;
break;
}
}
/* Configure PNS */
if ( ((hAacConfig->bitrateMode>=1) && (hAacConfig->bitrateMode<=5)) /* VBR without PNS. */
|| (hAacConfig->useTns == 0) ) /* TNS required. */
{
hAacConfig->usePns = 0;
}
/* Meta data restriction. */
switch (hAacConfig->audioObjectType)
{
@ -846,8 +885,6 @@ static AACENC_ERROR aacEncInit(HANDLE_AACENCODER hAacEncoder,
SBR_ELEMENT_INFO sbrElInfo[(6)];
CHANNEL_MAPPING channelMapping;
AUDIO_OBJECT_TYPE aot = hAacConfig->audioObjectType;
if ( FDKaacEnc_InitChannelMapping(hAacConfig->channelMode,
hAacConfig->channelOrder,
&channelMapping) != AAC_ENC_OK )
@ -875,8 +912,9 @@ static AACENC_ERROR aacEncInit(HANDLE_AACENCODER hAacEncoder,
&aacBufferOffset,
&hAacConfig->nChannels,
&hAacConfig->sampleRate,
&hAacConfig->sbrRatio,
&frameLength,
&hAacConfig->audioObjectType,
hAacConfig->audioObjectType,
&hAacEncoder->nDelay,
(hAacConfig->audioObjectType == AOT_ER_AAC_ELD) ? 1 : TRANS_FAC,
(config->userTpHeaderPeriod!=0xFF) ? config->userTpHeaderPeriod : DEFAULT_HEADER_PERIOD_REPETITION_RATE,
@ -884,7 +922,7 @@ static AACENC_ERROR aacEncInit(HANDLE_AACENCODER hAacEncoder,
);
/* Suppress AOT reconfiguration and check error status. */
if ( sbrError || (hAacConfig->audioObjectType!=aot) ) {
if (sbrError) {
return AACENC_INIT_SBR_ERROR;
}
@ -953,7 +991,7 @@ static AACENC_ERROR aacEncInit(HANDLE_AACENCODER hAacEncoder,
INT inputDataDelay = DELAY_AAC(hAacConfig->framelength);
if ( isSbrActive(hAacConfig) && hSbrEncoder!=NULL) {
inputDataDelay = 2*inputDataDelay + sbrEncoder_GetInputDataDelay(*hSbrEncoder);
inputDataDelay = hAacConfig->sbrRatio*inputDataDelay + sbrEncoder_GetInputDataDelay(*hSbrEncoder);
}
if ( FDK_MetadataEnc_Init(hAacEncoder->hMetadataEnc,
@ -1684,6 +1722,16 @@ AACENC_ERROR aacEncoder_SetParam(
}
}
break;
case AACENC_SBR_RATIO:
if (settings->userSbrRatio != value) {
if (! ((value==0) || (value==1) || (value==2)) ) {
err = AACENC_INVALID_CONFIG;
break;
}
settings->userSbrRatio = value;
hAacEncoder->InitFlags |= AACENC_INIT_CONFIG | AACENC_INIT_STATES | AACENC_INIT_TRANSPORT;
}
break;
case AACENC_SBR_MODE:
if (settings->userSbrEnabled != value) {
settings->userSbrEnabled = value;
@ -1805,7 +1853,7 @@ UINT aacEncoder_GetParam(
value = (UINT)hAacEncoder->aacConfig.bitrateMode;
break;
case AACENC_SAMPLERATE:
value = (UINT)settings->userSamplerate;
value = (UINT)hAacEncoder->coderConfig.extSamplingRate;
break;
case AACENC_CHANNELMODE:
value = (UINT)hAacEncoder->aacConfig.channelMode;
@ -1822,6 +1870,9 @@ UINT aacEncoder_GetParam(
case AACENC_GRANULE_LENGTH:
value = (UINT)hAacEncoder->aacConfig.framelength;
break;
case AACENC_SBR_RATIO:
value = isSbrActive(&hAacEncoder->aacConfig) ? hAacEncoder->aacConfig.sbrRatio : 0;
break;
case AACENC_SBR_MODE:
value = (UINT) (hAacEncoder->aacConfig.syntaxFlags & AC_SBR_PRESENT) ? 1 : 0;
break;

View File

@ -101,6 +101,14 @@ amm-info@iis.fraunhofer.de
#define MAX_CODEC_FRAME_RATIO 2
#define MAX_PAYLOAD_SIZE 256
typedef enum codecType
{
CODEC_AAC=0,
CODEC_AACLD=1,
CODEC_UNSPECIFIED=99
} CODEC_TYPE;
typedef struct
{
INT bitRate;
@ -129,10 +137,11 @@ enum
typedef struct
{
CODEC_TYPE coreCoder; /*!< LC or ELD */
UINT bitrateFrom; /*!< inclusive */
UINT bitrateTo; /*!< exclusive */
USHORT sampleRate; /*!< */
UINT sampleRate; /*!< */
UCHAR numChannels; /*!< */
UCHAR startFreq; /*!< bs_start_freq */
@ -158,6 +167,7 @@ typedef struct sbrConfiguration
INT crcSbr; /*!< Flag: usage of SBR-CRC. */
INT dynBwSupported; /*!< Flag: support for dynamic bandwidth in this combination. */
INT parametricCoding; /*!< Flag: usage of parametric coding tool. */
INT downSampleFactor; /*!< Sampling rate relation between the SBR and the core encoder. */
int freq_res_fixfix[3]; /*!< Frequency resolution of envelopes in frame class FIXFIX
0=1 Env; 1=2 Env; 2=4 Env; */
/*
@ -194,7 +204,6 @@ typedef struct sbrConfiguration
INT useSaPan; /*!< Flag: usage of SAPAN stereo. */
INT dynBwEnabled; /*!< Flag: usage of dynamic bandwidth. */
INT bParametricStereo; /*!< Flag: usage of parametric stereo coding tool. */
INT bDownSampledSbr; /*!< Signal downsampled SBR is used. */
/*
header_extra1 configuration
@ -214,7 +223,7 @@ typedef struct sbrConfiguration
UCHAR init_amp_res_FF;
} sbrConfiguration, *sbrConfigurationPtr ;
typedef struct
typedef struct SBR_CONFIG_DATA
{
UINT sbrSyntaxFlags; /**< SBR syntax flags derived from AOT. */
INT nChannels; /**< Number of channels. */
@ -240,9 +249,7 @@ typedef struct
INT xposCtrlSwitch; /**< Flag indicates whether to switch xpos ctrl on the fly. */
INT switchTransposers; /**< Flag indicates whether to switch xpos on the fly . */
UCHAR initAmpResFF;
} SBR_CONFIG_DATA;
typedef SBR_CONFIG_DATA *HANDLE_SBR_CONFIG_DATA;
} SBR_CONFIG_DATA, *HANDLE_SBR_CONFIG_DATA;
typedef struct {
MP4_ELEMENT_ID elType;
@ -275,15 +282,26 @@ INT sbrEncoder_Open(
);
/**
* \brief get closest working bit rate to specified desired bit rate for a single SBR element
* \param bitRate the desired target bit rate
* \param numChannels the amount of audio channels
* \param coreSampleRate the sample rate of the core coder
* \param the current Audio Object Type
* \return closest working bit rate to bitRate value
* \brief Get closest working bitrate to specified desired
* bitrate for a single SBR element.
* \param bitRate The desired target bit rate
* \param numChannels The amount of audio channels
* \param coreSampleRate The sample rate of the core coder
* \param aot The current Audio Object Type
* \return Closest working bit rate to bitRate value
*/
UINT sbrEncoder_LimitBitRate(UINT bitRate, UINT numChannels, UINT coreSampleRate, AUDIO_OBJECT_TYPE aot);
/**
* \brief Check whether downsampled SBR single rate is possible
* with given audio object type.
* \param aot The Audio object type.
* \return 0 when downsampled SBR is not possible,
* 1 when downsampled SBR is possible.
*/
UINT sbrEncoder_IsSingleRatePossible(AUDIO_OBJECT_TYPE aot);
/**
* \brief Initialize SBR Encoder instance.
* \param phSbrEncoder Pointer to a SBR Encoder instance.
@ -294,6 +312,7 @@ UINT sbrEncoder_LimitBitRate(UINT bitRate, UINT numChannels, UINT coreSampleRate
* \param bufferOffset Returns the offset for the audio input data in order to do delay balancing.
* \param numChannels Input: Encoder input channels. output: core encoder channels.
* \param sampleRate Input: Encoder samplerate. output core encoder samplerate.
* \param downSampleFactor Input: Relation between SBR and core coder sampling rate;
* \param frameLength Input: Encoder frameLength. output core encoder frameLength.
* \param aot Input: Desired AOT. output AOT to be used after parameter checking.
* \param delay Input: core encoder delay. Output: total delay because of SBR.
@ -303,21 +322,23 @@ UINT sbrEncoder_LimitBitRate(UINT bitRate, UINT numChannels, UINT coreSampleRate
* - (1-10) corresponds to header repetition rate in frames.
* \return 0 on success, and non-zero if failed.
*/
INT sbrEncoder_Init( HANDLE_SBR_ENCODER hSbrEncoder,
SBR_ELEMENT_INFO elInfo[(6)],
int noElements,
INT_PCM *inputBuffer,
INT *bandwidth,
INT *bufferOffset,
INT *numChannels,
INT *sampleRate,
INT *frameLength,
AUDIO_OBJECT_TYPE *aot,
int *delay,
int transformFactor,
const int headerPeriod,
ULONG statesInitFlag
);
INT sbrEncoder_Init(
HANDLE_SBR_ENCODER hSbrEncoder,
SBR_ELEMENT_INFO elInfo[(6)],
int noElements,
INT_PCM *inputBuffer,
INT *coreBandwidth,
INT *inputBufferOffset,
INT *numChannels,
INT *sampleRate,
UINT *downSampleFactor,
INT *frameLength,
AUDIO_OBJECT_TYPE aot,
int *delay,
int transformFactor,
const int headerPeriod,
ULONG statesInitFlag
);
/**
* \brief Do delay line buffers housekeeping. To be called after each encoded audio frame.
@ -360,7 +381,7 @@ INT sbrEncoder_EncodeFrame(HANDLE_SBR_ENCODER hEnvEncoder,
* \param fSendHeaders Flag indicating that the SBR encoder should send more headers in the SBR payload or not.
* \return void
*/
void sbrEncoder_GetHeader(SBR_ENCODER *sbrEncoder,
void sbrEncoder_GetHeader(HANDLE_SBR_ENCODER sbrEncoder,
HANDLE_FDK_BITSTREAM hBs,
INT element_index,
int fSendHeaders);

View File

@ -124,11 +124,6 @@ struct SBR_HEADER_DATA
INT alterScale;
INT freqScale;
/*
element of sbrdata
*/
SR_MODE sampleRateMode;
/*
element of channelpairelement
*/

View File

@ -129,9 +129,6 @@ FDKsbrEnc_getEnergyFromCplxQmfData(FIXP_DBL **RESTRICT energyValues,/*!< the res
/* Get Scratch buffer */
C_ALLOC_SCRATCH_START(tmpNrg, FIXP_DBL, QMF_CHANNELS*QMF_MAX_TIME_SLOTS/2);
FDK_ASSERT(numberBands <= QMF_CHANNELS);
FDK_ASSERT(numberCols <= QMF_MAX_TIME_SLOTS);
/* Get max possible scaling of QMF data */
scale = DFRACT_BITS;
for (k=0; k<numberCols; k++) {

View File

@ -1244,25 +1244,38 @@ FDKsbrEnc_InitSbrMissingHarmonicsDetector (
FDK_ASSERT(totNoEst <= MAX_NO_OF_ESTIMATES);
switch(frameSize){
case 2048:
hs->transientPosOffset = FRAME_MIDDLE_SLOT_2048;
hs->timeSlots = NUMBER_TIME_SLOTS_2048;
break;
case 1920:
hs->transientPosOffset = FRAME_MIDDLE_SLOT_1920;
hs->timeSlots = NUMBER_TIME_SLOTS_1920;
break;
case 1024:
hs->transientPosOffset = FRAME_MIDDLE_SLOT_512LD;
hs->timeSlots = 16;
break;
case 960:
hs->transientPosOffset = FRAME_MIDDLE_SLOT_512LD;
hs->timeSlots = 15;
break;
default:
return -1;
if (sbrSyntaxFlags & SBR_SYNTAX_LOW_DELAY)
{
switch(frameSize){
case 1024:
case 512:
hs->transientPosOffset = FRAME_MIDDLE_SLOT_512LD;
hs->timeSlots = 16;
break;
case 960:
case 480:
hs->transientPosOffset = FRAME_MIDDLE_SLOT_512LD;
hs->timeSlots = 15;
break;
default:
return -1;
}
} else
{
switch(frameSize){
case 2048:
case 1024:
hs->transientPosOffset = FRAME_MIDDLE_SLOT_2048;
hs->timeSlots = NUMBER_TIME_SLOTS_2048;
break;
case 1920:
case 960:
hs->transientPosOffset = FRAME_MIDDLE_SLOT_1920;
hs->timeSlots = NUMBER_TIME_SLOTS_1920;
break;
default:
return -1;
}
}
if (sbrSyntaxFlags & SBR_SYNTAX_LOW_DELAY) {

View File

@ -102,7 +102,7 @@ static const FIXP_DBL QuantOffset = (INT)0xfc000000; /* ld64(0.25) */
#define max(a,b) ( a > b ? a:b)
#endif
#define NOISE_FLOOR_OFFSET_SCALING (3)
#define NOISE_FLOOR_OFFSET_SCALING (4)
@ -484,11 +484,13 @@ FDKsbrEnc_InitSbrNoiseFloorEstimate (HANDLE_SBR_NOISE_FLOOR_ESTIMATE h_sbrNoise
tmp = ((FIXP_DBL)MAXVAL_DBL)>>NOISE_FLOOR_OFFSET_SCALING;
}
else {
FDK_ASSERT(noiseFloorOffset<=8); /* because of NOISE_FLOOR_OFFSET_SCALING */
/* noiseFloorOffset has to be smaller than 12, because
the result of the calculation below must be smaller than 1:
(2^(noiseFloorOffset/3))*2^4<1 */
FDK_ASSERT(noiseFloorOffset<12);
/* Assumes the noise floor offset in tuning table are in q31 */
/* Currently the table contains only 0 for noise floor offset */
/* Change the qformat here when non-zero values would be filled */
/* Assumes the noise floor offset in tuning table are in q31 */
/* Change the qformat here when non-zero values would be filled */
exp = fDivNorm((FIXP_DBL)noiseFloorOffset, 3, &qexp);
tmp = fPow(2, DFRACT_BITS-1, exp, qexp, &qtmp);
tmp = scaleValue(tmp, qtmp-NOISE_FLOOR_OFFSET_SCALING);
@ -527,24 +529,30 @@ FDKsbrEnc_resetSbrNoiseFloorEstimate (HANDLE_SBR_NOISE_FLOOR_ESTIMATE h_sbrNoise
h_sbrNoiseFloorEstimate->noNoiseBands = 1;
}
else{
/*
* Calculate number of noise bands 1,2 or 3 bands/octave
/*
* Calculate number of noise bands 1,2 or 3 bands/octave
********************************************************/
FIXP_DBL tmp, ratio, lg2;
INT ratio_e, qlg2;
INT ratio_e, qlg2, nNoiseBands;
ratio = fDivNorm(k2, kx, &ratio_e);
lg2 = fLog2(ratio, ratio_e, &qlg2);
tmp = fMult((FIXP_DBL)(h_sbrNoiseFloorEstimate->noiseBands<<24), lg2);
tmp = scaleValue(tmp, qlg2-23);
h_sbrNoiseFloorEstimate->noNoiseBands = (INT)((tmp + (FIXP_DBL)1) >> 1);
nNoiseBands = (INT)((tmp + (FIXP_DBL)1) >> 1);
if (h_sbrNoiseFloorEstimate->noNoiseBands > MAX_NUM_NOISE_COEFFS)
h_sbrNoiseFloorEstimate->noNoiseBands = MAX_NUM_NOISE_COEFFS;
if( h_sbrNoiseFloorEstimate->noNoiseBands==0)
h_sbrNoiseFloorEstimate->noNoiseBands=1;
if (nNoiseBands > MAX_NUM_NOISE_COEFFS ) {
nNoiseBands = MAX_NUM_NOISE_COEFFS;
}
if( nNoiseBands == 0 ) {
nNoiseBands = 1;
}
h_sbrNoiseFloorEstimate->noNoiseBands = nNoiseBands;
}

View File

@ -315,7 +315,7 @@ static FDK_PSENC_ERROR DownmixPSQmfData(
}
else {
int n, k;
C_ALLOC_SCRATCH_START(pWorkBuffer, FIXP_QMF, QMF_CHANNELS*2);
C_AALLOC_SCRATCH_START(pWorkBuffer, FIXP_QMF, 2*QMF_CHANNELS)
/* define scalings */
int dynQmfScale = fixMax(0, hParametricStereo->dmxScale-1); /* scale one bit more for addition of left and right */
@ -400,8 +400,7 @@ static FDK_PSENC_ERROR DownmixPSQmfData(
*qmfScale = -downmixScale + 7;
C_ALLOC_SCRATCH_END(pWorkBuffer, FIXP_QMF, QMF_CHANNELS*2);
C_AALLOC_SCRATCH_END(pWorkBuffer, FIXP_QMF, 2*QMF_CHANNELS)
{
const INT noQmfSlots2 = hParametricStereo->noQmfSlots>>1;
@ -475,10 +474,9 @@ FDK_PSENC_ERROR FDKsbrEnc_PSEnc_ParametricStereoProcessing(
)
{
FDK_PSENC_ERROR error = PSENC_OK;
INT noQmfBands = hParametricStereo->noQmfBands;
INT psQmfScale[MAX_PS_CHANNELS] = {0};
int psCh, i;
C_ALLOC_SCRATCH_START(pWorkBuffer, FIXP_DBL, QMF_CHANNELS*4);
C_AALLOC_SCRATCH_START(pWorkBuffer, FIXP_QMF, 4*QMF_CHANNELS)
for (psCh = 0; psCh<MAX_PS_CHANNELS; psCh ++) {
@ -507,7 +505,7 @@ FDK_PSENC_ERROR FDKsbrEnc_PSEnc_ParametricStereoProcessing(
} /* for psCh */
C_ALLOC_SCRATCH_END(pWorkBuffer, FIXP_DBL, QMF_CHANNELS*4);
C_AALLOC_SCRATCH_END(pWorkBuffer, FIXP_QMF, 4*QMF_CHANNELS)
/* find best scaling in new QMF and Hybrid data */
psFindBestScaling( hParametricStereo,

View File

@ -105,7 +105,8 @@ amm-info@iis.fraunhofer.de
/* SBR bitstream delay */
#define DELAY_FRAMES 2
typedef struct {
typedef struct SBR_CHANNEL {
struct ENV_CHANNEL hEnvChannel;
//INT_PCM *pDSOutBuffer; /**< Pointer to downsampled audio output of SBR encoder */
DOWNSAMPLER downSampler;
@ -113,7 +114,7 @@ typedef struct {
} SBR_CHANNEL;
typedef SBR_CHANNEL* HANDLE_SBR_CHANNEL;
typedef struct {
typedef struct SBR_ELEMENT {
HANDLE_SBR_CHANNEL sbrChannel[2];
QMF_FILTER_BANK *hQmfAnalysis[2];
SBR_CONFIG_DATA sbrConfigData;
@ -126,10 +127,9 @@ typedef struct {
UCHAR payloadDelayLine[1+DELAY_FRAMES][MAX_PAYLOAD_SIZE];
UINT payloadDelayLineSize[1+DELAY_FRAMES]; /* Sizes in bits */
} SBR_ELEMENT;
typedef SBR_ELEMENT* HANDLE_SBR_ELEMENT;
} SBR_ELEMENT, *HANDLE_SBR_ELEMENT;
struct SBR_ENCODER
typedef struct SBR_ENCODER
{
HANDLE_SBR_ELEMENT sbrElement[(6)];
HANDLE_SBR_CHANNEL pSbrChannel[(6)];
@ -142,6 +142,7 @@ struct SBR_ENCODER
int bufferOffset; /* Offset for SBR parameter extraction in time domain input buffer. */
int downsampledOffset; /* Offset of downsampled/mixed output for core encoder. */
int downmixSize; /* Size in samples of downsampled/mixed output for core encoder. */
INT downSampleFactor; /* Sampling rate relation between the SBR and the core encoder. */
int fTimeDomainDownsampling; /* Flag signalling time domain downsampling instead of QMF downsampling. */
int nBitstrDelay; /* Amount of SBR frames to be delayed in bitstream domain. */
INT estimateBitrate; /* estimate bitrate of SBR encoder */
@ -158,7 +159,8 @@ struct SBR_ENCODER
INT maxChannels;
INT supportPS;
} ;
} SBR_ENCODER;
#endif /* __SBR_H */

View File

@ -268,13 +268,6 @@ typedef enum
}
INVF_MODE;
typedef enum
{
SINGLE_RATE,
DUAL_RATE
}
SR_MODE;
typedef enum
{
FREQ_RES_LOW = 0,

File diff suppressed because it is too large Load Diff

View File

@ -506,216 +506,277 @@ const UCHAR bookSbrNoiseBalanceL11T[25] =
/*
tuningTable
*/
const sbrTuningTable_t sbrTuningTable[SBRENC_TUNING_SIZE] =
const sbrTuningTable_t sbrTuningTable[] =
{
/* Some of the low bitrates are commented out here, this is because the
encoder could lose frames at those bitrates and throw an error because
it has insufficient bits to encode for some test items.
*/
/*** AAC ***/
/*** HE-AAC section ***/
/* sf,sfsp,sf,sfsp,nnb,nfo,saml,SM,FS*/
/*** mono ***/
/* 8/16 kHz dual rate */
{ 8000, 10000, 8000, 1, 7, 6, 11,10, 1, 0, 6, SBR_MONO, 3 },
{ 10000, 12000, 8000, 1, 11, 7, 13,12, 1, 0, 6, SBR_MONO, 3 },
{ 12000, 16001, 8000, 1, 14,10, 13,13, 1, 0, 6, SBR_MONO, 3 },
{ 16000, 24000, 8000, 1, 14,10, 14,14, 2, 0, 3, SBR_MONO, 2 }, /* placebo */
{ 24000, 32000, 8000, 1, 14,10, 14,14, 2, 0, 3, SBR_MONO, 2 }, /* placebo */
{ 32000, 48001, 8000, 1, 14,11, 15,15, 2, 0, 3, SBR_MONO, 2 }, /* placebo */ /* bitrates higher than 48000 not supported by AAC core */
{ CODEC_AAC, 8000, 10000, 8000, 1, 7, 6, 11,10, 1, 0, 6, SBR_MONO, 3 },
{ CODEC_AAC, 10000, 12000, 8000, 1, 11, 7, 13,12, 1, 0, 6, SBR_MONO, 3 },
{ CODEC_AAC, 12000, 16001, 8000, 1, 14,10, 13,13, 1, 0, 6, SBR_MONO, 3 },
{ CODEC_AAC, 16000, 24000, 8000, 1, 14,10, 14,14, 2, 0, 3, SBR_MONO, 2 }, /* placebo */
{ CODEC_AAC, 24000, 32000, 8000, 1, 14,10, 14,14, 2, 0, 3, SBR_MONO, 2 }, /* placebo */
{ CODEC_AAC, 32000, 48001, 8000, 1, 14,11, 15,15, 2, 0, 3, SBR_MONO, 2 }, /* placebo */ /* bitrates higher than 48000 not supported by AAC core */
/* 11/22 kHz dual rate */
{ 8000, 10000, 11025, 1, 5, 4, 6, 6, 1, 0, 6, SBR_MONO, 3 },
{ 10000, 12000, 11025, 1, 8, 5, 12, 9, 1, 0, 6, SBR_MONO, 3 },
{ 12000, 16000, 11025, 1, 12, 8, 13, 8, 1, 0, 6, SBR_MONO, 3 },
{ 16000, 20000, 11025, 1, 12, 8, 13, 8, 1, 0, 6, SBR_MONO, 3 }, /* at such "high" bitrates it's better to upsample the input */
{ 20000, 24001, 11025, 1, 13, 9, 13, 8, 1, 0, 6, SBR_MONO, 3 }, /* signal by a factor of 2 before sending it into the encoder */
{ 24000, 32000, 11025, 1, 14,10, 14, 9, 2, 0, 3, SBR_MONO, 2 }, /* placebo */
{ 32000, 48000, 11025, 1, 15,11, 15,10, 2, 0, 3, SBR_MONO, 2 }, /* placebo */
{ 48000, 64001, 11025, 1, 15,11, 15,10, 2, 0, 3, SBR_MONO, 1 }, /* placebo */
{ CODEC_AAC, 8000, 10000, 11025, 1, 5, 4, 6, 6, 1, 0, 6, SBR_MONO, 3 },
{ CODEC_AAC, 10000, 12000, 11025, 1, 8, 5, 12, 9, 1, 0, 6, SBR_MONO, 3 },
{ CODEC_AAC, 12000, 16000, 11025, 1, 12, 8, 13, 8, 1, 0, 6, SBR_MONO, 3 },
{ CODEC_AAC, 16000, 20000, 11025, 1, 12, 8, 13, 8, 1, 0, 6, SBR_MONO, 3 }, /* at such "high" bitrates it's better to upsample the input */
{ CODEC_AAC, 20000, 24001, 11025, 1, 13, 9, 13, 8, 1, 0, 6, SBR_MONO, 3 }, /* signal by a factor of 2 before sending it into the encoder */
{ CODEC_AAC, 24000, 32000, 11025, 1, 14,10, 14, 9, 2, 0, 3, SBR_MONO, 2 }, /* placebo */
{ CODEC_AAC, 32000, 48000, 11025, 1, 15,11, 15,10, 2, 0, 3, SBR_MONO, 2 }, /* placebo */
{ CODEC_AAC, 48000, 64001, 11025, 1, 15,11, 15,10, 2, 0, 3, SBR_MONO, 1 }, /* placebo */
/* 12/24 kHz dual rate */
{ 8000, 10000, 12000, 1, 4, 3, 6, 6, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 8 kbit/s */
{ 10000, 12000, 12000, 1, 7, 4, 11, 8, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 10 kbit/s */
{ 12000, 16000, 12000, 1, 11, 7, 12, 8, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 12 kbit/s */
{ 16000, 20000, 12000, 1, 11, 7, 12, 8, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 16 kbit/s */ /* at such "high" bitrates it's better to upsample the input */
{ 20000, 24001, 12000, 1, 12, 8, 12, 8, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 20 kbit/s */ /* signal by a factor of 2 before sending it into the encoder */
{ 24000, 32000, 12000, 1, 13, 9, 13, 9, 2, 0, 3, SBR_MONO, 2 }, /* placebo */
{ 32000, 48000, 12000, 1, 14,10, 14,10, 2, 0, 3, SBR_MONO, 2 }, /* placebo */
{ 48000, 64001, 12000, 1, 15,11, 15,11, 2, 0, 3, SBR_MONO, 1 }, /* placebo */
{ CODEC_AAC, 8000, 10000, 12000, 1, 4, 3, 6, 6, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 8 kbit/s */
{ CODEC_AAC, 10000, 12000, 12000, 1, 7, 4, 11, 8, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 10 kbit/s */
{ CODEC_AAC, 12000, 16000, 12000, 1, 11, 7, 12, 8, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 12 kbit/s */
{ CODEC_AAC, 16000, 20000, 12000, 1, 11, 7, 12, 8, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 16 kbit/s */ /* at such "high" bitrates it's better to upsample the input */
{ CODEC_AAC, 20000, 24001, 12000, 1, 12, 8, 12, 8, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 20 kbit/s */ /* signal by a factor of 2 before sending it into the encoder */
{ CODEC_AAC, 24000, 32000, 12000, 1, 13, 9, 13, 9, 2, 0, 3, SBR_MONO, 2 }, /* placebo */
{ CODEC_AAC, 32000, 48000, 12000, 1, 14,10, 14,10, 2, 0, 3, SBR_MONO, 2 }, /* placebo */
{ CODEC_AAC, 48000, 64001, 12000, 1, 14,11, 15,11, 2, 0, 3, SBR_MONO, 1 }, /* placebo */
/* 16/32 kHz dual rate */
{ 8000, 10000, 16000, 1, 1, 1, 0, 0, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 8 kbit/s */
{ 10000, 12000, 16000, 1, 2, 1, 6, 0, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 10 kbit/s */
{ 12000, 16000, 16000, 1, 4, 2, 6, 0, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 12 kbit/s */
{ 16000, 18000, 16000, 1, 4, 2, 8, 3, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 16 kbit/s */
{ 18000, 22000, 16000, 1, 6, 5,11, 7, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 20 kbit/s */
{ 22000, 28000, 16000, 1, 10, 9,12, 8, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 24 kbit/s */
{ 28000, 36000, 16000, 1, 12,12,13,13, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 32 kbit/s */
{ 36000, 44000, 16000, 1, 14,14,13,13, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 40 kbit/s */
{ 44000, 64001, 16000, 1, 15,15,13,13, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 48 kbit/s */
{ CODEC_AAC, 8000, 10000, 16000, 1, 1, 1, 0, 0, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 8 kbit/s */
{ CODEC_AAC, 10000, 12000, 16000, 1, 2, 1, 6, 0, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 10 kbit/s */
{ CODEC_AAC, 12000, 16000, 16000, 1, 4, 2, 6, 0, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 12 kbit/s */
{ CODEC_AAC, 16000, 18000, 16000, 1, 4, 2, 8, 3, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 16 kbit/s */
{ CODEC_AAC, 18000, 22000, 16000, 1, 6, 5,11, 7, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 20 kbit/s */
{ CODEC_AAC, 22000, 28000, 16000, 1, 10, 9,12, 8, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 24 kbit/s */
{ CODEC_AAC, 28000, 36000, 16000, 1, 12,12,13,13, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AAC, 36000, 44000, 16000, 1, 14,14,13,13, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 40 kbit/s */
{ CODEC_AAC, 44000, 64001, 16000, 1, 14,14,13,13, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 48 kbit/s */
/* 22.05/44.1 kHz dual rate */
/* { 8000, 11369, 22050, 1, 1, 1, 1, 1, 1, 0, 6, SBR_MONO, 3 }, */ /* nominal: 8 kbit/s */ /* encoder can not work stable at this extremely low bitrate */
{ 11369, 16000, 22050, 1, 3, 1, 4, 4, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 12 kbit/s */
{ 16000, 18000, 22050, 1, 3, 1, 5, 4, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 16 kbit/s */
{ 18000, 22000, 22050, 1, 4, 4, 8, 5, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 20 kbit/s */
{ 22000, 28000, 22050, 1, 7, 6, 8, 6, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 24 kbit/s */
{ 28000, 36000, 22050, 1, 10,10, 9, 9, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 32 kbit/s */
{ 36000, 44000, 22050, 1, 11,11,10,10, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 40 kbit/s */
{ 44000, 64001, 22050, 1, 13,13,12,12, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 48 kbit/s */
/* { CODEC_AAC, 8000, 11369, 22050, 1, 1, 1, 1, 1, 1, 0, 6, SBR_MONO, 3 }, */ /* nominal: 8 kbit/s */ /* encoder can not work stable at this extremely low bitrate */
{ CODEC_AAC, 11369, 16000, 22050, 1, 3, 1, 4, 4, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 12 kbit/s */
{ CODEC_AAC, 16000, 18000, 22050, 1, 3, 1, 5, 4, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 16 kbit/s */
{ CODEC_AAC, 18000, 22000, 22050, 1, 4, 4, 8, 5, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 20 kbit/s */
{ CODEC_AAC, 22000, 28000, 22050, 1, 7, 6, 8, 6, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 24 kbit/s */
{ CODEC_AAC, 28000, 36000, 22050, 1, 10,10, 9, 9, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AAC, 36000, 44000, 22050, 1, 11,11,10,10, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 40 kbit/s */
{ CODEC_AAC, 44000, 64001, 22050, 1, 13,13,12,12, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 48 kbit/s */
/* 24/48 kHz dual rate */
/* { 8000, 12000, 24000, 1, 1, 1, 1, 1, 1, 0, 6, SBR_MONO, 3 }, */ /* nominal: 8 kbit/s */ /* encoder can not work stable at this extremely low bitrate */
{ 12000, 16000, 24000, 1, 3, 1, 4, 4, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 12 kbit/s */
{ 16000, 18000, 24000, 1, 3, 1, 5, 4, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 16 kbit/s */
{ 18000, 22000, 24000, 1, 4, 3, 8, 5, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 20 kbit/s */
{ 22000, 28000, 24000, 1, 7, 6, 8, 6, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 24 kbit/s */
{ 28000, 36000, 24000, 1, 10,10, 9, 9, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 32 kbit/s */
{ 36000, 44000, 24000, 1, 11,11,10,10, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 40 kbit/s */
{ 44000, 64001, 24000, 1, 13,13,11,11, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 48 kbit/s */
/* { CODEC_AAC, 8000, 12000, 24000, 1, 1, 1, 1, 1, 1, 0, 6, SBR_MONO, 3 }, */ /* nominal: 8 kbit/s */ /* encoder can not work stable at this extremely low bitrate */
{ CODEC_AAC, 12000, 16000, 24000, 1, 3, 1, 4, 4, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 12 kbit/s */
{ CODEC_AAC, 16000, 18000, 24000, 1, 3, 1, 5, 4, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 16 kbit/s */
{ CODEC_AAC, 18000, 22000, 24000, 1, 4, 3, 8, 5, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 20 kbit/s */
{ CODEC_AAC, 22000, 28000, 24000, 1, 7, 6, 8, 6, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 24 kbit/s */
{ CODEC_AAC, 28000, 36000, 24000, 1, 10,10, 9, 9, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AAC, 36000, 44000, 24000, 1, 11,11,10,10, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 40 kbit/s */
{ CODEC_AAC, 44000, 64001, 24000, 1, 13,13,11,11, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 48 kbit/s */
/* 32/64 kHz dual rate */ /* placebo settings */
{ 24000, 36000, 32000, 1, 4, 4, 4, 4, 2, 0, 3, SBR_MONO, 3 }, /* lowest range */
{ 36000, 60000, 32000, 1, 7, 7, 6, 6, 2, 0, 3, SBR_MONO, 2 }, /* lowest range */
{ 60000, 72000, 32000, 1, 9, 9, 8, 8, 2, 0, 3, SBR_MONO, 1 }, /* low range */
{ 72000,100000, 32000, 1, 11,11,10,10, 2, 0, 3, SBR_MONO, 1 }, /* SBR sweet spot */
{ 100000,160001, 32000, 1, 13,13,11,11, 2, 0, 3, SBR_MONO, 1 }, /* backwards compatible */
{ CODEC_AAC, 24000, 36000, 32000, 1, 4, 4, 4, 4, 2, 0, 3, SBR_MONO, 3 }, /* lowest range */
{ CODEC_AAC, 36000, 60000, 32000, 1, 7, 7, 6, 6, 2, 0, 3, SBR_MONO, 2 }, /* lowest range */
{ CODEC_AAC, 60000, 72000, 32000, 1, 9, 9, 8, 8, 2, 0, 3, SBR_MONO, 1 }, /* low range */
{ CODEC_AAC, 72000,100000, 32000, 1, 11,11,10,10, 2, 0, 3, SBR_MONO, 1 }, /* SBR sweet spot */
{ CODEC_AAC, 100000,160001, 32000, 1, 13,13,11,11, 2, 0, 3, SBR_MONO, 1 }, /* backwards compatible */
/* 44.1/88.2 kHz dual rate */ /* placebo settings */
{ 24000, 36000, 44100, 1, 4, 4, 4, 4, 2, 0, 3, SBR_MONO, 3 }, /* lowest range (multichannel rear) */
{ 36000, 60000, 44100, 1, 7, 7, 6, 6, 2, 0, 3, SBR_MONO, 2 }, /* lowest range (multichannel rear) */
{ 60000, 72000, 44100, 1, 9, 9, 8, 8, 2, 0, 3, SBR_MONO, 1 }, /* low range */
{ 72000,100000, 44100, 1, 11,11,10,10, 2, 0, 3, SBR_MONO, 1 }, /* SBR sweet spot */
{ 100000,160001, 44100, 1, 13,13,11,11, 2, 0, 3, SBR_MONO, 1 }, /* backwards compatible */
{ CODEC_AAC, 24000, 36000, 44100, 1, 4, 4, 4, 4, 2, 0, 3, SBR_MONO, 3 }, /* lowest range (multichannel rear) */
{ CODEC_AAC, 36000, 60000, 44100, 1, 7, 7, 6, 6, 2, 0, 3, SBR_MONO, 2 }, /* lowest range (multichannel rear) */
{ CODEC_AAC, 60000, 72000, 44100, 1, 9, 9, 8, 8, 2, 0, 3, SBR_MONO, 1 }, /* low range */
{ CODEC_AAC, 72000,100000, 44100, 1, 11,11,10,10, 2, 0, 3, SBR_MONO, 1 }, /* SBR sweet spot */
{ CODEC_AAC, 100000,160001, 44100, 1, 13,13,11,11, 2, 0, 3, SBR_MONO, 1 }, /* backwards compatible */
/* 48/96 kHz dual rate */ /* not yet finally tuned */
{ 32000, 36000, 48000, 1, 4, 4, 9, 9, 2, 0, 3, SBR_MONO, 3 }, /* lowest range (multichannel rear) */
{ 36000, 60000, 48000, 1, 7, 7,10,10, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 40 */
{ 60000, 72000, 48000, 1, 9, 9,10,10, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 64 */
{ 72000,100000, 48000, 1, 11,11,11,11, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 80 */
{ 100000,160001, 48000, 1, 13,13,11,11, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 128 */
{ CODEC_AAC, 32000, 36000, 48000, 1, 4, 4, 9, 9, 2, 0, 3, SBR_MONO, 3 }, /* lowest range (multichannel rear) */
{ CODEC_AAC, 36000, 60000, 48000, 1, 7, 7,10,10, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 40 */
{ CODEC_AAC, 60000, 72000, 48000, 1, 9, 9,10,10, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 64 */
{ CODEC_AAC, 72000,100000, 48000, 1, 11,11,11,11, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 80 */
{ CODEC_AAC, 100000,160001, 48000, 1, 13,13,11,11, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 128 */
/*** stereo ***/
/* 08/16 kHz dual rate */
{ 16000, 24000, 8000, 2, 6, 6, 9, 7, 1, 0,-3, SBR_SWITCH_LRC, 3 }, /* nominal: 20 kbit/s */ /* placebo */
{ 24000, 28000, 8000, 2, 9, 9, 11, 9, 1, 0,-3, SBR_SWITCH_LRC, 3 }, /* nominal: 24 kbit/s */
{ 28000, 36000, 8000, 2, 11, 9, 11, 9, 2, 0,-3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ 36000, 44000, 8000, 2, 13,11, 13,11, 2, 0,-3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ 44000, 52000, 8000, 2, 14,12, 13,12, 2, 0,-3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ 52000, 60000, 8000, 2, 15,15, 13,13, 3, 0,-3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ 60000, 76000, 8000, 2, 15,15, 13,13, 3, 0,-3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ 76000,128001, 8000, 2, 15,15, 13,13, 3, 0,-3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
{ CODEC_AAC, 16000, 24000, 8000, 2, 6, 6, 9, 7, 1, 0,-3, SBR_SWITCH_LRC, 3 }, /* nominal: 20 kbit/s */ /* placebo */
{ CODEC_AAC, 24000, 28000, 8000, 2, 9, 9, 11, 9, 1, 0,-3, SBR_SWITCH_LRC, 3 }, /* nominal: 24 kbit/s */
{ CODEC_AAC, 28000, 36000, 8000, 2, 11, 9, 11, 9, 2, 0,-3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AAC, 36000, 44000, 8000, 2, 13,11, 13,11, 2, 0,-3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ CODEC_AAC, 44000, 52000, 8000, 2, 14,12, 13,12, 2, 0,-3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ CODEC_AAC, 52000, 60000, 8000, 2, 14,14, 13,13, 3, 0,-3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ CODEC_AAC, 60000, 76000, 8000, 2, 14,14, 13,13, 3, 0,-3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ CODEC_AAC, 76000,128001, 8000, 2, 14,14, 13,13, 3, 0,-3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
/* 11/22 kHz dual rate */
{ 16000, 24000, 11025, 2, 7, 5, 9, 7, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 20 kbit/s */ /* placebo */
{ 24000, 28000, 11025, 2, 10, 8,10, 8, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 24 kbit/s */
{ 28000, 36000, 11025, 2, 12, 8,12, 8, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ 36000, 44000, 11025, 2, 13, 9,13, 9, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ 44000, 52000, 11025, 2, 14,11,13,11, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ 52000, 60000, 11025, 2, 15,15,13,13, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ 60000, 76000, 11025, 2, 15,15,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ 76000,128001, 11025, 2, 15,15,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
{ CODEC_AAC, 16000, 24000, 11025, 2, 7, 5, 9, 7, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 20 kbit/s */ /* placebo */
{ CODEC_AAC, 24000, 28000, 11025, 2, 10, 8,10, 8, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 24 kbit/s */
{ CODEC_AAC, 28000, 36000, 11025, 2, 12, 8,12, 8, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AAC, 36000, 44000, 11025, 2, 13, 9,13, 9, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ CODEC_AAC, 44000, 52000, 11025, 2, 14,11,13,11, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ CODEC_AAC, 52000, 60000, 11025, 2, 15,15,13,13, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ CODEC_AAC, 60000, 76000, 11025, 2, 15,15,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ CODEC_AAC, 76000,128001, 11025, 2, 15,15,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
/* 12/24 kHz dual rate */
{ 16000, 24000, 12000, 2, 6, 4, 9, 7, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 20 kbit/s */ /* placebo */
{ 24000, 28000, 12000, 2, 9, 7,10, 8, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 24 kbit/s */
{ 28000, 36000, 12000, 2, 11, 7,12, 8, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ 36000, 44000, 12000, 2, 12, 9,12, 9, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ 44000, 52000, 12000, 2, 13,12,13,12, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ 52000, 60000, 12000, 2, 14,14,13,13, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ 60000, 76000, 12000, 2, 15,15,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ 76000,128001, 12000, 2, 15,15,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
{ CODEC_AAC, 16000, 24000, 12000, 2, 6, 4, 9, 7, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 20 kbit/s */ /* placebo */
{ CODEC_AAC, 24000, 28000, 12000, 2, 9, 7,10, 8, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 24 kbit/s */
{ CODEC_AAC, 28000, 36000, 12000, 2, 11, 7,12, 8, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AAC, 36000, 44000, 12000, 2, 12, 9,12, 9, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ CODEC_AAC, 44000, 52000, 12000, 2, 13,12,13,12, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ CODEC_AAC, 52000, 60000, 12000, 2, 14,14,13,13, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ CODEC_AAC, 60000, 76000, 12000, 2, 14,14,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ CODEC_AAC, 76000,128001, 12000, 2, 14,14,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
/* 16/32 kHz dual rate */
{ 16000, 24000, 16000, 2, 4, 2, 1, 0, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 20 kbit/s */
{ 24000, 28000, 16000, 2, 8, 7,10, 8, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 24 kbit/s */
{ 28000, 36000, 16000, 2, 10, 9,12,11, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ 36000, 44000, 16000, 2, 13,13,13,13, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ 44000, 52000, 16000, 2, 15,15,13,13, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ 52000, 60000, 16000, 2, 15,15,13,13, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ 60000, 76000, 16000, 2, 15,15,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ 76000,128001, 16000, 2, 15,15,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
{ CODEC_AAC, 16000, 24000, 16000, 2, 4, 2, 1, 0, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 20 kbit/s */
{ CODEC_AAC, 24000, 28000, 16000, 2, 8, 7,10, 8, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 24 kbit/s */
{ CODEC_AAC, 28000, 36000, 16000, 2, 10, 9,12,11, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AAC, 36000, 44000, 16000, 2, 13,13,13,13, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ CODEC_AAC, 44000, 52000, 16000, 2, 14,14,13,13, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ CODEC_AAC, 52000, 60000, 16000, 2, 14,14,13,13, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ CODEC_AAC, 60000, 76000, 16000, 2, 14,14,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ CODEC_AAC, 76000,128001, 16000, 2, 14,14,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
/* 22.05/44.1 kHz dual rate */
{ 16000, 24000, 22050, 2, 2, 1, 1, 0, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 20 kbit/s */
{ 24000, 28000, 22050, 2, 5, 4, 6, 5, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 24 kbit/s */
{ 28000, 32000, 22050, 2, 5, 4, 8, 7, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 28 kbit/s */
{ 32000, 36000, 22050, 2, 7, 6, 8, 7, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ 36000, 44000, 22050, 2, 10,10, 9, 9, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ 44000, 52000, 22050, 2, 12,12, 9, 9, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ 52000, 60000, 22050, 2, 13,13,10,10, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ 60000, 76000, 22050, 2, 14,14,12,12, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ 76000,128001, 22050, 2, 14,14,12,12, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
{ CODEC_AAC, 16000, 24000, 22050, 2, 2, 1, 1, 0, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 20 kbit/s */
{ CODEC_AAC, 24000, 28000, 22050, 2, 5, 4, 6, 5, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 24 kbit/s */
{ CODEC_AAC, 28000, 32000, 22050, 2, 5, 4, 8, 7, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 28 kbit/s */
{ CODEC_AAC, 32000, 36000, 22050, 2, 7, 6, 8, 7, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AAC, 36000, 44000, 22050, 2, 10,10, 9, 9, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ CODEC_AAC, 44000, 52000, 22050, 2, 12,12, 9, 9, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ CODEC_AAC, 52000, 60000, 22050, 2, 13,13,10,10, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ CODEC_AAC, 60000, 76000, 22050, 2, 14,14,12,12, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ CODEC_AAC, 76000,128001, 22050, 2, 14,14,12,12, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
/* 24/48 kHz dual rate */
{ 16000, 24000, 24000, 2, 2, 1, 1, 0, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 20 kbit/s */
{ 24000, 28000, 24000, 2, 5, 5, 6, 6, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 24 kbit/s */
{ 28000, 36000, 24000, 2, 7, 6, 8, 7, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ 36000, 44000, 24000, 2, 10,10, 9, 9, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ 44000, 52000, 24000, 2, 12,12, 9, 9, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ 52000, 60000, 24000, 2, 13,13,10,10, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ 60000, 76000, 24000, 2, 14,14,12,12, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ 76000,128001, 24000, 2, 15,15,12,12, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
{ CODEC_AAC, 16000, 24000, 24000, 2, 2, 1, 1, 0, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 20 kbit/s */
{ CODEC_AAC, 24000, 28000, 24000, 2, 5, 5, 6, 6, 1, 0, -3, SBR_SWITCH_LRC, 3 }, /* nominal: 24 kbit/s */
{ CODEC_AAC, 28000, 36000, 24000, 2, 7, 6, 8, 7, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AAC, 36000, 44000, 24000, 2, 10,10, 9, 9, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ CODEC_AAC, 44000, 52000, 24000, 2, 12,12, 9, 9, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ CODEC_AAC, 52000, 60000, 24000, 2, 13,13,10,10, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ CODEC_AAC, 60000, 76000, 24000, 2, 14,14,12,12, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ CODEC_AAC, 76000,128001, 24000, 2, 14,14,12,12, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
/* 32/64 kHz dual rate */ /* placebo settings */
{ 32000, 60000, 32000, 2, 4, 4, 4, 4, 2, 0, -3, SBR_SWITCH_LRC, 3 }, /* lowest range (multichannel rear) */
{ 60000, 80000, 32000, 2, 7, 7, 6, 6, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* lowest range (multichannel rear) */
{ 80000,112000, 32000, 2, 9, 9, 8, 8, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* low range */
{ 112000,144000, 32000, 2, 11,11,10,10, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* SBR sweet spot */
{ 144000,256001, 32000, 2, 13,13,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* backwards compatible */
{ CODEC_AAC, 32000, 60000, 32000, 2, 4, 4, 4, 4, 2, 0, -3, SBR_SWITCH_LRC, 3 }, /* lowest range (multichannel rear) */
{ CODEC_AAC, 60000, 80000, 32000, 2, 7, 7, 6, 6, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* lowest range (multichannel rear) */
{ CODEC_AAC, 80000,112000, 32000, 2, 9, 9, 8, 8, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* low range */
{ CODEC_AAC, 112000,144000, 32000, 2, 11,11,10,10, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* SBR sweet spot */
{ CODEC_AAC, 144000,256001, 32000, 2, 13,13,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* backwards compatible */
/* 44.1/88.2 kHz dual rate */ /* placebo settings */
{ 32000, 60000, 44100, 2, 4, 4, 4, 4, 2, 0, -3, SBR_SWITCH_LRC, 3 }, /* lowest range (multichannel rear) */
{ 60000, 80000, 44100, 2, 7, 7, 6, 6, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* lowest range (multichannel rear) */
{ 80000,112000, 44100, 2, 9, 9, 8, 8, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* low range */
{ 112000,144000, 44100, 2, 11,11,10,10, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* SBR sweet spot */
{ 144000,256001, 44100, 2, 13,13,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* backwards compatible */
{ CODEC_AAC, 32000, 60000, 44100, 2, 4, 4, 4, 4, 2, 0, -3, SBR_SWITCH_LRC, 3 }, /* lowest range (multichannel rear) */
{ CODEC_AAC, 60000, 80000, 44100, 2, 7, 7, 6, 6, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* lowest range (multichannel rear) */
{ CODEC_AAC, 80000,112000, 44100, 2, 9, 9, 8, 8, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* low range */
{ CODEC_AAC, 112000,144000, 44100, 2, 11,11,10,10, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* SBR sweet spot */
{ CODEC_AAC, 144000,256001, 44100, 2, 13,13,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* backwards compatible */
/* 48/96 kHz dual rate */ /* not yet finally tuned */
{ 36000, 60000, 48000, 2, 4, 4, 9, 9, 2, 0, -3, SBR_SWITCH_LRC, 3 }, /* lowest range (multichannel rear) */
{ 60000, 80000, 48000, 2, 7, 7, 9, 9, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 64 */
{ 80000,112000, 48000, 2, 9, 9,10,10, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 96 */
{ 112000,144000, 48000, 2, 11,11,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 128 */
{ 144000,256001, 48000, 2, 13,13,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 192 */
{ CODEC_AAC, 36000, 60000, 48000, 2, 4, 4, 9, 9, 2, 0, -3, SBR_SWITCH_LRC, 3 }, /* lowest range (multichannel rear) */
{ CODEC_AAC, 60000, 80000, 48000, 2, 7, 7, 9, 9, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 64 */
{ CODEC_AAC, 80000,112000, 48000, 2, 9, 9,10,10, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 96 */
{ CODEC_AAC, 112000,144000, 48000, 2, 11,11,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 128 */
{ CODEC_AAC, 144000,256001, 48000, 2, 13,13,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 192 */
/** AAC LOW DELAY SECTION **/
/* 22.05/44.1 kHz dual rate */
{ 18000, 22000, 22050, 1, 4, 4, 5, 5, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 20 kbit/s */
{ 22000, 28000, 22050, 1, 4, 4, 6, 5, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 24 kbit/s */
{ 28000, 36000, 22050, 1, 7, 8, 8, 8, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 32 kbit/s */
{ 36000, 44000, 22050, 1, 9, 9, 9, 9, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 40 kbit/s */
{ 44000, 52000, 22050, 1, 11,11,11,11, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 48 kbit/s */
{ 52000, 64001, 22050, 1, 12,11,11,11, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 56 kbit/s */
/* 24/48 kHz dual rate */
{ 20000, 22000, 24000, 1, 4, 4, 5, 5, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 20 kbit/s */
{ 22000, 28000, 24000, 1, 4, 4, 6, 5, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 24 kbit/s */
{ 28000, 36000, 24000, 1, 6, 8, 8, 8, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 32 kbit/s */
{ 36000, 44000, 24000, 1, 8, 9, 9, 9, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 40 kbit/s */
{ 44000, 52000, 24000, 1, 12,11,11,10, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 48 kbit/s */
{ 52000, 64001, 24000, 1, 13,11,11,10, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 48 kbit/s */
/*** mono ***/
/* 16/32 kHz dual rate not yet tuned ->alb copied from non LD tables*/
{ CODEC_AACLD, 16000, 18000, 16000, 1, 4, 5, 9, 7, 1, 0, 6, SBR_MONO, 3 }, /* nominal: 16 kbit/s wrr: tuned */
{ CODEC_AACLD, 18000, 22000, 16000, 1, 7, 7,12,12, 1, 6, 9, SBR_MONO, 3 }, /* nominal: 20 kbit/s wrr: tuned */
{ CODEC_AACLD, 22000, 28000, 16000, 1, 6, 6, 9, 9, 2, 3, 6, SBR_MONO, 3 }, /* nominal: 24 kbit/s wrr: tuned */
{ CODEC_AACLD, 28000, 36000, 16000, 1, 8, 8,12, 7, 2, 9,12, SBR_MONO, 3 }, /* jgr: special */ /* wrr: tuned */
{ CODEC_AACLD, 36000, 44000, 16000, 1, 10,14,12,13, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 40 kbit/s */
{ CODEC_AACLD, 44000, 64001, 16000, 1, 11,14,13,13, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 48 kbit/s */
/* 22.05/44.1 kHz dual rate */
{ 32000, 36000, 22050, 2, 5, 4, 7, 6, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ 36000, 44000, 22050, 2, 5, 8, 8, 8, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ 44000, 52000, 22050, 2, 7,10, 8, 8, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ 52000, 60000, 22050, 2, 9,11, 9, 9, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ 60000, 76000, 22050, 2, 10,12,10,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ 76000, 82000, 22050, 2, 12,12,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
{ 82000,128001, 22050, 2, 13,12,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
{ CODEC_AACLD, 18000, 22000, 22050, 1, 4, 4, 5, 5, 2, 0, 6, SBR_MONO, 3 }, /* nominal: 20 kbit/s */
{ CODEC_AACLD, 22000, 28000, 22050, 1, 5, 5, 6, 6, 2, 0, 6, SBR_MONO, 2 }, /* nominal: 24 kbit/s */
{ CODEC_AACLD, 28000, 36000, 22050, 1, 7, 8, 8, 8, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AACLD, 36000, 44000, 22050, 1, 9, 9, 9, 9, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 40 kbit/s */
{ CODEC_AACLD, 44000, 52000, 22050, 1, 12,11,11,11, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 48 kbit/s */
{ CODEC_AACLD, 52000, 64001, 22050, 1, 13,11,11,10, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 56 kbit/s */
/* 24/48 kHz dual rate */
{ 32000, 36000, 24000, 2, 5, 4, 7, 6, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ 36000, 44000, 24000, 2, 4, 8, 8, 8, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ 44000, 52000, 24000, 2, 6,10, 8, 8, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ 52000, 60000, 24000, 2, 9,11, 9, 9, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ 60000, 76000, 24000, 2, 11,12,10,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ 76000, 88000, 24000, 2, 12,13,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
{ 88000,128001, 24000, 2, 13,13,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 92 kbit/s */
{ CODEC_AACLD, 20000, 22000, 24000, 1, 4, 1, 8, 4, 2, 3, 6, SBR_MONO, 2 }, /* nominal: 20 kbit/s */
{ CODEC_AACLD, 22000, 28000, 24000, 1, 3, 8, 8, 7, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 24 kbit/s */
{ CODEC_AACLD, 28000, 36000, 24000, 1, 4, 8, 8, 7, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AACLD, 36000, 56000, 24000, 1, 8, 9, 9, 9, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 40 kbit/s */
{ CODEC_AACLD, 56000, 64001, 24000, 1, 13,11,11,10, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 64 kbit/s */
/* 32/64 kHz dual rate */ /* placebo settings */ /*jgr: new, copy from CODEC_AAC */
{ CODEC_AACLD, 24000, 36000, 32000, 1, 4, 4, 4, 4, 2, 0, 3, SBR_MONO, 3 }, /* lowest range */
{ CODEC_AACLD, 36000, 60000, 32000, 1, 7, 7, 6, 6, 2, 0, 3, SBR_MONO, 2 }, /* lowest range */
{ CODEC_AACLD, 60000, 72000, 32000, 1, 9, 9, 8, 8, 2, 0, 3, SBR_MONO, 1 }, /* low range */
{ CODEC_AACLD, 72000,100000, 32000, 1, 11,11,10,10, 2, 0, 3, SBR_MONO, 1 }, /* SBR sweet spot */
{ CODEC_AACLD, 100000,160001, 32000, 1, 13,13,11,11, 2, 0, 3, SBR_MONO, 1 }, /* backwards compatible */
/* 44/88 kHz dual rate */ /* not yet finally tuned */
{ CODEC_AACLD, 36000, 60000, 44100, 1, 8, 7, 6, 9, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 40 */
{ CODEC_AACLD, 60000, 72000, 44100, 1, 9, 9,10,10, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 64 */
{ CODEC_AACLD, 72000,100000, 44100, 1, 11,11,11,11, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 80 */
{ CODEC_AACLD, 100000,160001, 44100, 1, 13,13,11,11, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 128 */
/* 48/96 kHz dual rate */ /* 32 and 40kbps line tuned for dual-rate SBR */
{ CODEC_AACLD, 36000, 60000, 48000, 1, 8, 7, 6, 9, 2, 0, 3, SBR_MONO, 2 }, /* nominal: 40 */
{ CODEC_AACLD, 60000, 72000, 48000, 1, 9, 9,10,10, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 64 */
{ CODEC_AACLD, 72000,100000, 48000, 1, 11,11,11,11, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 80 */
{ CODEC_AACLD, 100000,160001, 48000, 1, 13,13,11,11, 2, 0, 3, SBR_MONO, 1 }, /* nominal: 128 */
/*** stereo ***/
/* 16/32 kHz dual rate not yet tuned ->alb copied from non LD tables*/
{ CODEC_AACLD, 32000, 36000, 16000, 2, 10, 9,12,11, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AACLD, 36000, 44000, 16000, 2, 13,13,13,13, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ CODEC_AACLD, 44000, 52000, 16000, 2, 10, 9,11, 9, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* tune12 nominal: 48 kbit/s */
{ CODEC_AACLD, 52000, 60000, 16000, 2, 14,14,13,13, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ CODEC_AACLD, 60000, 76000, 16000, 2, 14,14,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ CODEC_AACLD, 76000,128001, 16000, 2, 14,14,13,13, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
/* 22.05/44.1 kHz dual rate */
{ CODEC_AACLD, 32000, 36000, 22050, 2, 5, 4, 7, 6, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AACLD, 36000, 44000, 22050, 2, 5, 8, 8, 8, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ CODEC_AACLD, 44000, 52000, 22050, 2, 7,10, 8, 8, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ CODEC_AACLD, 52000, 60000, 22050, 2, 9,11, 9, 9, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ CODEC_AACLD, 60000, 76000, 22050, 2, 10,12,10,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ CODEC_AACLD, 76000, 82000, 22050, 2, 12,12,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
{ CODEC_AACLD, 82000,128001, 22050, 2, 13,12,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
/* 24/48 kHz dual rate */
{ CODEC_AACLD, 32000, 36000, 24000, 2, 5, 4, 7, 6, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 32 kbit/s */
{ CODEC_AACLD, 36000, 44000, 24000, 2, 4, 8, 8, 8, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 40 kbit/s */
{ CODEC_AACLD, 44000, 52000, 24000, 2, 6,10, 8, 8, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 48 kbit/s */
{ CODEC_AACLD, 52000, 60000, 24000, 2, 9,11, 9, 9, 3, 0, -3, SBR_SWITCH_LRC, 1 }, /* nominal: 56 kbit/s */
{ CODEC_AACLD, 60000, 76000, 24000, 2, 11,12,10,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 64 kbit/s */
{ CODEC_AACLD, 76000, 88000, 24000, 2, 12,13,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 80 kbit/s */
{ CODEC_AACLD, 88000,128001, 24000, 2, 13,13,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 92 kbit/s */
/* 32/64 kHz dual rate */ /* placebo settings */ /*jgr: new, copy from CODEC_AAC */
{ CODEC_AACLD, 60000, 80000, 32000, 2, 7, 7, 6, 6, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* lowest range (multichannel rear) */
{ CODEC_AACLD, 80000,112000, 32000, 2, 9, 9, 8, 8, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* low range */
{ CODEC_AACLD, 112000,144000, 32000, 2, 11,11,10,10, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* SBR sweet spot */
{ CODEC_AACLD, 144000,256001, 32000, 2, 13,13,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* backwards compatible */
/* 44.1/88.2 kHz dual rate */ /* placebo settings */ /*wrr: new, copy from CODEC_AAC */
{ CODEC_AACLD, 60000, 80000, 44100, 2, 7, 7, 6, 6, 3, 0, -3, SBR_SWITCH_LRC, 2 }, /* lowest range (multichannel rear) */
{ CODEC_AACLD, 80000,112000, 44100, 2, 10,10, 8, 8, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* hlm 11-08-29 */
{ CODEC_AACLD, 112000,144000, 44100, 2, 12,12,10,10, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* hlm 11-08-29 */
{ CODEC_AACLD, 144000,256001, 44100, 2, 13,13,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* backwards compatible */
/* 48/96 kHz dual rate */ /* not yet finally tuned */ /*wrr: new, copy from CODEC_AAC */
{ CODEC_AACLD, 60000, 80000, 48000, 2, 7, 7,10,10, 2, 0, -3, SBR_SWITCH_LRC, 2 }, /* nominal: 64 */
{ CODEC_AACLD, 80000,112000, 48000, 2, 9, 9,10,10, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 96 */
{ CODEC_AACLD, 112000,144000, 48000, 2, 11,11,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* nominal: 128 */
{ CODEC_AACLD, 144000,176000, 48000, 2, 12,12,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* hlm 09-10-19 */
{ CODEC_AACLD, 176000,256001, 48000, 2, 13,13,11,11, 3, 0, -3, SBR_LEFT_RIGHT, 1 }, /* hlm 09-10-19 */
};
const int sbrTuningTableSize = sizeof(sbrTuningTable)/sizeof(sbrTuningTable[0]);
const psTuningTable_t psTuningTable[4] =
{
{ 8000, 22000, PSENC_STEREO_BANDS_10, PSENC_NENV_1, FL2FXCONST_DBL(3.0f/4.0f) },

View File

@ -118,13 +118,8 @@ extern const UCHAR v_Huff_NoiseLevelL11T[63];
extern const INT bookSbrNoiseBalanceC11T[25];
extern const UCHAR bookSbrNoiseBalanceL11T[25];
#define SBRENC_AACLC_TUNING_SIZE 124
#define SBRENC_AACELD_TUNING_SIZE (26)
#define SBRENC_AACELD2_TUNING_SIZE (26)
#define SBRENC_TUNING_SIZE (SBRENC_AACLC_TUNING_SIZE + SBRENC_AACELD_TUNING_SIZE)
extern const sbrTuningTable_t sbrTuningTable[SBRENC_TUNING_SIZE];
extern const sbrTuningTable_t sbrTuningTable[];
extern const int sbrTuningTableSize;
extern const psTuningTable_t psTuningTable[4];

View File

@ -84,6 +84,7 @@ amm-info@iis.fraunhofer.de
/*!
\file
\brief frequency scale
\author Tobias Chalupka
*/
#include "sbrenc_freq_sca.h"
@ -92,10 +93,10 @@ amm-info@iis.fraunhofer.de
#include "genericStds.h"
/* StartFreq */
static INT getStartFreq(INT fs, const INT start_freq);
static INT getStartFreq(INT fsCore, const INT start_freq);
/* StopFreq */
static INT getStopFreq(INT fs, const INT stop_freq, const INT noChannels);
static INT getStopFreq(INT fsCore, const INT stop_freq);
static INT numberOfBands(INT b_p_o, INT start, INT stop, FIXP_DBL warp_factor);
static void CalcBands(INT * diff, INT start , INT stop , INT num_bands);
@ -115,7 +116,7 @@ static void cumSum(INT start_value, INT* diff, INT length, UCHAR *start_adress)
*******************************************************************************/
INT
FDKsbrEnc_getSbrStartFreqRAW (INT startFreq, INT QMFbands, INT fs)
FDKsbrEnc_getSbrStartFreqRAW (INT startFreq, INT fsCore)
{
INT result;
@ -123,9 +124,9 @@ FDKsbrEnc_getSbrStartFreqRAW (INT startFreq, INT QMFbands, INT fs)
return -1;
}
/* Update startFreq struct */
result = getStartFreq(fs, startFreq);
result = getStartFreq(fsCore, startFreq);
result = (result*fs/QMFbands+1)>>1;
result = (result*(fsCore>>5)+1)>>1; /* (result*fsSBR/QMFbands+1)>>1; */
return (result);
@ -141,17 +142,16 @@ FDKsbrEnc_getSbrStartFreqRAW (INT startFreq, INT QMFbands, INT fs)
Return:
*******************************************************************************/
INT FDKsbrEnc_getSbrStopFreqRAW (INT stopFreq, INT QMFbands, INT fs)
INT FDKsbrEnc_getSbrStopFreqRAW (INT stopFreq, INT fsCore)
{
INT result;
if ( stopFreq < 0 || stopFreq > 13)
return -1;
/* Uppdate stopFreq struct */
result = getStopFreq( fs, stopFreq, QMFbands);
result = (result*fs/QMFbands+1)>>1;
result = getStopFreq(fsCore, stopFreq);
result = (result*(fsCore>>5)+1)>>1; /* (result*fsSBR/QMFbands+1)>>1; */
return (result);
} /* End getSbrStopFreq */
@ -162,69 +162,73 @@ INT FDKsbrEnc_getSbrStopFreqRAW (INT stopFreq, INT QMFbands, INT fs)
*******************************************************************************
Description:
Arguments:
Arguments: fsCore - core sampling rate
Return:
*******************************************************************************/
static INT
getStartFreq(INT fs, const INT start_freq)
getStartFreq(INT fsCore, const INT start_freq)
{
INT k0_min;
switch(fs){
case 16000: k0_min = 24;
switch(fsCore){
case 8000: k0_min = 24; /* (3000 * nQmfChannels / fsSBR ) + 0.5 */
break;
case 22050: k0_min = 17;
case 11025: k0_min = 17; /* (3000 * nQmfChannels / fsSBR ) + 0.5 */
break;
case 24000: k0_min = 16;
case 12000: k0_min = 16; /* (3000 * nQmfChannels / fsSBR ) + 0.5 */
break;
case 32000: k0_min = 16;
case 16000: k0_min = 16; /* (4000 * nQmfChannels / fsSBR ) + 0.5 */
break;
case 44100: k0_min = 12;
case 22050: k0_min = 12; /* (4000 * nQmfChannels / fsSBR ) + 0.5 */
break;
case 48000: k0_min = 11;
case 24000: k0_min = 11; /* (4000 * nQmfChannels / fsSBR ) + 0.5 */
break;
case 64000: k0_min = 10;
case 32000: k0_min = 10; /* (5000 * nQmfChannels / fsSBR ) + 0.5 */
break;
case 88200: k0_min = 7;
case 44100: k0_min = 7; /* (5000 * nQmfChannels / fsSBR ) + 0.5 */
break;
case 96000: k0_min = 7;
case 48000: k0_min = 7; /* (5000 * nQmfChannels / fsSBR ) + 0.5 */
break;
case 96000: k0_min = 3; /* (5000 * nQmfChannels / fsSBR ) + 0.5 */
break;
default:
k0_min=11; /* illegal fs */
}
switch (fs) {
switch (fsCore) {
case 16000:
case 8000:
{
INT v_offset[]= {-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7};
return (k0_min + v_offset[start_freq]);
}
case 22050:
case 11025:
{
INT v_offset[]= {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13};
return (k0_min + v_offset[start_freq]);
}
case 24000:
case 12000:
{
INT v_offset[]= {-5, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16};
return (k0_min + v_offset[start_freq]);
}
case 32000:
case 16000:
{
INT v_offset[]= {-6, -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16};
return (k0_min + v_offset[start_freq]);
}
case 44100:
case 48000:
case 64000:
case 22050:
case 24000:
case 32000:
{
INT v_offset[]= {-4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20};
return (k0_min + v_offset[start_freq]);
}
case 88200:
case 44100:
case 48000:
case 96000:
{
INT v_offset[]= {-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24};
@ -249,13 +253,12 @@ getStartFreq(INT fs, const INT start_freq)
Return:
*******************************************************************************/
static INT
getStopFreq(INT fs, const INT stop_freq, const INT noChannels)
getStopFreq(INT fsCore, const INT stop_freq)
{
INT result,i;
INT k1_min;
INT v_dstop[13];
INT *v_stop_freq = NULL;
INT v_stop_freq_16[14] = {48,49,50,51,52,54,55,56,57,59,60,61,63,64};
INT v_stop_freq_22[14] = {35,37,38,40,42,44,46,48,51,53,56,58,61,64};
@ -266,40 +269,45 @@ getStopFreq(INT fs, const INT stop_freq, const INT noChannels)
INT v_stop_freq_64[14] = {20,22,24,26,29,31,34,37,41,45,49,54,59,64};
INT v_stop_freq_88[14] = {15,17,19,21,23,26,29,33,37,41,46,51,57,64};
INT v_stop_freq_96[14] = {13,15,17,19,21,24,27,31,35,39,44,50,57,64};
INT v_stop_freq_192[14] = {7, 8,10,12,14,16,19,23,27,32,38,46,54,64};
switch(fs){
case 16000: k1_min = 48;
switch(fsCore){
case 8000: k1_min = 48;
v_stop_freq =v_stop_freq_16;
break;
case 22050: k1_min = 35;
case 11025: k1_min = 35;
v_stop_freq =v_stop_freq_22;
break;
case 24000: k1_min = 32;
case 12000: k1_min = 32;
v_stop_freq =v_stop_freq_24;
break;
case 32000: k1_min = 32;
case 16000: k1_min = 32;
v_stop_freq =v_stop_freq_32;
break;
case 44100: k1_min = 23;
case 22050: k1_min = 23;
v_stop_freq =v_stop_freq_44;
break;
case 48000: k1_min = 21;
case 24000: k1_min = 21;
v_stop_freq =v_stop_freq_48;
break;
case 64000: k1_min = 20;
case 32000: k1_min = 20;
v_stop_freq =v_stop_freq_64;
break;
case 88200: k1_min = 15;
case 44100: k1_min = 15;
v_stop_freq =v_stop_freq_88;
break;
case 96000: k1_min = 13;
case 48000: k1_min = 13;
v_stop_freq =v_stop_freq_96;
break;
case 96000: k1_min = 7;
v_stop_freq =v_stop_freq_192;
break;
default:
k1_min = 21; /* illegal fs */
}
/* if no valid core samplingrate is used this loop produces
a segfault, because v_stop_freq is not initialized */
/* Ensure increasing bandwidth */
for(i = 0; i <= 12; i++) {
v_dstop[i] = v_stop_freq[i+1] - v_stop_freq[i];
@ -322,34 +330,41 @@ getStopFreq(INT fs, const INT stop_freq, const INT noChannels)
*******************************************************************************
Description:
Arguments:
Arguments: srSbr SBR sampling freqency
srCore AAC core sampling freqency
noChannels Number of QMF channels
startFreq SBR start frequency in QMF bands
stopFreq SBR start frequency in QMF bands
Return:
*k0 Output parameter
*k2 Output parameter
Return: Error code (0 is OK)
*******************************************************************************/
INT
FDKsbrEnc_FindStartAndStopBand(const INT samplingFreq,
const INT noChannels,
const INT startFreq,
const INT stopFreq,
const SR_MODE sampleRateMode,
INT *k0,
INT *k2)
FDKsbrEnc_FindStartAndStopBand(
const INT srSbr,
const INT srCore,
const INT noChannels,
const INT startFreq,
const INT stopFreq,
INT *k0,
INT *k2
)
{
/* Update startFreq struct */
*k0 = getStartFreq(samplingFreq, startFreq);
*k0 = getStartFreq(srCore, startFreq);
/* Test if start freq is outside corecoder range */
if( ( sampleRateMode == 1 ) &&
( samplingFreq*noChannels <
2**k0 * samplingFreq) ) {
if( srSbr*noChannels < *k0 * srCore ) {
return (1); /* raise the cross-over frequency and/or lower the number
of target bands per octave (or lower the sampling frequency) */
}
/*Update stopFreq struct */
if ( stopFreq < 14 ) {
*k2 = getStopFreq(samplingFreq, stopFreq, noChannels);
*k2 = getStopFreq(srCore, stopFreq);
} else if( stopFreq == 14 ) {
*k2 = 2 * *k0;
} else {
@ -364,10 +379,10 @@ FDKsbrEnc_FindStartAndStopBand(const INT samplingFreq,
/* Test for invalid k0 k2 combinations */
if ( (samplingFreq == 44100) && ( (*k2 - *k0) > MAX_FREQ_COEFFS_FS44100 ) )
if ( (srCore == 22050) && ( (*k2 - *k0) > MAX_FREQ_COEFFS_FS44100 ) )
return (1); /* Number of bands exceeds valid range of MAX_FREQ_COEFFS for fs=44.1kHz */
if ( (samplingFreq >= 48000) && ( (*k2 - *k0) > MAX_FREQ_COEFFS_FS48000 ) )
if ( (srCore >= 24000) && ( (*k2 - *k0) > MAX_FREQ_COEFFS_FS48000 ) )
return (1); /* Number of bands exceeds valid range of MAX_FREQ_COEFFS for fs>=48kHz */
if ((*k2 - *k0) > MAX_FREQ_COEFFS)
@ -390,15 +405,19 @@ FDKsbrEnc_FindStartAndStopBand(const INT samplingFreq,
Return:
*******************************************************************************/
INT
FDKsbrEnc_UpdateFreqScale(UCHAR *v_k_master, INT *h_num_bands,
const INT k0, const INT k2,
const INT freqScale,
const INT alterScale)
FDKsbrEnc_UpdateFreqScale(
UCHAR *v_k_master,
INT *h_num_bands,
const INT k0,
const INT k2,
const INT freqScale,
const INT alterScale
)
{
INT b_p_o = 0; /* bands_per_octave */
FIXP_DBL warp = FL2FXCONST_DBL(0.0f);
FIXP_DBL warp = FL2FXCONST_DBL(0.0f);
INT dk = 0;
/* Internal variables */
@ -426,7 +445,7 @@ FDKsbrEnc_UpdateFreqScale(UCHAR *v_k_master, INT *h_num_bands,
warp = FL2FXCONST_DBL(1.0f/2.6f); /* 1.0/(1.3*2.0); */
if(4*k2 >= 9*k0) /*two or more regions*/
if(4*k2 >= 9*k0) /*two or more regions (how many times the basis band is copied)*/
{
k1=2*k0;
@ -592,30 +611,31 @@ modifyBands(INT max_band_previous, INT * diff, INT length)
*******************************************************************************
Description:
Arguments:
Return:
*******************************************************************************/
INT
FDKsbrEnc_UpdateHiRes(UCHAR *h_hires, INT *num_hires,UCHAR * v_k_master,
INT num_master , INT *xover_band, SR_MODE drOrSr,
INT noQMFChannels)
FDKsbrEnc_UpdateHiRes(
UCHAR *h_hires,
INT *num_hires,
UCHAR *v_k_master,
INT num_master,
INT *xover_band
)
{
INT i;
INT divider;
INT max1,max2;
/* Check if we use a Dual rate => diver=2 else 1 */
divider = (drOrSr == DUAL_RATE) ? 2 : 1;
if( (v_k_master[*xover_band] > (noQMFChannels/divider) ) ||
if( (v_k_master[*xover_band] > 32 ) || /* v_k_master[*xover_band] > noQMFChannels(dualRate)/divider */
( *xover_band > num_master ) ) {
/* xover_band error, too big for this startFreq. Will be clipped */
/* Calculate maximum value for xover_band */
max1=0;
max2=num_master;
while( (v_k_master[max1+1] < (noQMFChannels/divider)) &&
while( (v_k_master[max1+1] < 32 ) && /* noQMFChannels(dualRate)/divider */
( (max1+1) < max2) )
{
max1++;

View File

@ -96,34 +96,42 @@ amm-info@iis.fraunhofer.de
INT
FDKsbrEnc_UpdateFreqScale(UCHAR *v_k_master, INT *h_num_bands,
const INT k0, const INT k2,
const INT freq_scale,
const INT alter_scale);
FDKsbrEnc_UpdateFreqScale(
UCHAR *v_k_master,
INT *h_num_bands,
const INT k0,
const INT k2,
const INT freq_scale,
const INT alter_scale
);
INT
FDKsbrEnc_UpdateHiRes(UCHAR *h_hires,
INT *num_hires,
UCHAR *v_k_master,
INT num_master ,
INT *xover_band,
SR_MODE drOrSr,
INT noQMFChannels);
FDKsbrEnc_UpdateHiRes(
UCHAR *h_hires,
INT *num_hires,
UCHAR *v_k_master,
INT num_master,
INT *xover_band
);
void FDKsbrEnc_UpdateLoRes(UCHAR * v_lores,
INT *num_lores,
UCHAR * v_hires,
INT num_hires);
void FDKsbrEnc_UpdateLoRes(
UCHAR *v_lores,
INT *num_lores,
UCHAR *v_hires,
INT num_hires
);
INT
FDKsbrEnc_FindStartAndStopBand(const INT samplingFreq,
const INT noChannels,
const INT startFreq,
const INT stop_freq,
const SR_MODE sampleRateMode,
INT *k0,
INT *k2);
FDKsbrEnc_FindStartAndStopBand(
const INT srSbr,
const INT srCore,
const INT noChannels,
const INT startFreq,
const INT stop_freq,
INT *k0,
INT *k2
);
INT FDKsbrEnc_getSbrStartFreqRAW (INT startFreq, INT QMFbands, INT fs );
INT FDKsbrEnc_getSbrStopFreqRAW (INT stopFreq, INT QMFbands, INT fs);
INT FDKsbrEnc_getSbrStartFreqRAW (INT startFreq, INT fsCore);
INT FDKsbrEnc_getSbrStopFreqRAW (INT stopFreq, INT fsCore);
#endif

View File

@ -303,8 +303,6 @@ FDKsbrEnc_CalculateTonalityQuotas( HANDLE_SBR_TON_CORR_EST hTonCorr, /*!< H
}
}
FDK_ASSERT(noEstPerFrame == 2);
C_ALLOC_SCRATCH_END(realBuf, FIXP_DBL, 2*BAND_V_SIZE*NUM_V_COMBINE);
C_ALLOC_SCRATCH_END(ac, ACORR_COEFS, 1);