Commit 3aec97e3 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi

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
parent 7ad97579
This diff is collapsed.
......@@ -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
......
......@@ -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 */
......
This diff is collapsed.
......@@ -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);
......
......@@ -124,11 +124,6 @@ struct SBR_HEADER_DATA
INT alterScale;
INT freqScale;
/*
element of sbrdata
*/
SR_MODE sampleRateMode;
/*
element of channelpairelement
*/
......
......@@ -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++) {
......
......@@ -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) {
......
......@@ -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 (nNoiseBands > MAX_NUM_NOISE_COEFFS ) {
nNoiseBands = MAX_NUM_NOISE_COEFFS;
}
if( nNoiseBands == 0 ) {
nNoiseBands = 1;
}
if (h_sbrNoiseFloorEstimate->noNoiseBands > MAX_NUM_NOISE_COEFFS)
h_sbrNoiseFloorEstimate->noNoiseBands = MAX_NUM_NOISE_COEFFS;
h_sbrNoiseFloorEstimate->noNoiseBands = nNoiseBands;
if( h_sbrNoiseFloorEstimate->noNoiseBands==0)
h_sbrNoiseFloorEstimate->noNoiseBands=1;
}
......
......@@ -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,
......
......@@ -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 */
......@@ -268,13 +268,6 @@ typedef enum
}
INVF_MODE;
typedef enum
{
SINGLE_RATE,
DUAL_RATE
}
SR_MODE;
typedef enum
{
FREQ_RES_LOW = 0,
......
This diff is collapsed.
This diff is collapsed.
......@@ -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];
......
This diff is collapsed.
......@@ -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);
void FDKsbrEnc_UpdateLoRes(UCHAR * v_lores,
INT *num_lores,
UCHAR * v_hires,
INT num_hires);
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
);
INT
FDKsbrEnc_FindStartAndStopBand(const INT samplingFreq,
const INT noChannels,
const INT startFreq,
const INT stop_freq,
const SR_MODE sampleRateMode,
INT *k0,
INT *k2);
INT FDKsbrEnc_getSbrStartFreqRAW (INT startFreq, INT QMFbands, INT fs );
INT FDKsbrEnc_getSbrStopFreqRAW (INT stopFreq, INT QMFbands, INT fs);
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 fsCore);
INT FDKsbrEnc_getSbrStopFreqRAW (INT stopFreq, INT fsCore);
#endif
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment