some fine-tuning

This commit is contained in:
Christian R. Helmrich 2021-03-06 13:00:00 +01:00
parent 8cdc188bb6
commit 2d0fa2f10d
5 changed files with 20 additions and 9 deletions

View File

@ -677,8 +677,7 @@ int main (const int argc, char* argv[])
// enforce executable specific constraints
i = __min (USHRT_MAX, wavReader.getSampleRate ());
if ((wavReader.getNumChannels () > 3 || coreSbrFrameLengthIndex >= 3) && (i == 57600 || i == 51200 || i == 40000 || i == 38400 ||
i == 34150 || i == 28800 || i == 25600 || i == 20000 || i == 19200 || i == 17075 || i == 14400 || i == 12800 || i == 9600))
if ((wavReader.getNumChannels () > 3 || coreSbrFrameLengthIndex >= 3) && (i == 57600 || i == 38400 || i == 19200)) // BL USAC
{
fprintf_s (stderr, " ERROR: exhale does not support %d-channel coding with %d Hz sampling rate.\n\n", wavReader.getNumChannels (), i);

View File

@ -821,7 +821,7 @@ unsigned BitStreamWriter::createAudioConfig (const char samplingFrequencyIndex,
writeByteAlignment (); // flush bytes
auLen = __min (18u + fli, bitCount >> 3);
#ifndef NO_PREROLL_DATA
m_usacConfigLen = uint16_t (__max (9, auLen - ucOffset)); // excl. ASC payload
m_usacConfigLen = uint16_t (__max (15, auLen - ucOffset)); // excl ASC payload
memcpy (m_usacConfig, &m_auBitStream.stream.at (ucOffset), auLen - ucOffset);
#endif
memcpy (audioConfig, &m_auBitStream.stream.front (), auLen);

View File

@ -1686,7 +1686,7 @@ unsigned ExhaleEncoder::temporalProcessing () // determine time-domain aspects o
const unsigned plNext = abs (m_tranLocNext[ci]) & ((1024 << m_shiftValSBR) - 1);
const unsigned sfNext = (m_tempAnaNext[ci] >> 24) & UCHAR_MAX;
const unsigned tfNext = (m_tempAnaNext[ci] >> 16) & UCHAR_MAX;
const unsigned tThresh = UCHAR_MAX * (__max (plCurr, plNext) < 614 /*0.6 * 1024*/ ? 16 : 15 - (m_bitRateMode >> 2));
const unsigned tThresh = UCHAR_MAX * (__max (plCurr, plNext) < 614 /*0.6 * 1024*/ ? 16 : 15 - (m_bitRateMode >> 3));
tsCurr[ch] = (m_tempAnaCurr[ci] /*R*/) & UCHAR_MAX;
tsNext[ch] = (m_tempAnaNext[ci] >> 8) & UCHAR_MAX;

View File

@ -5,7 +5,7 @@
* and comes with ABSOLUTELY NO WARRANTY. This software may be subject to other third-
* party rights, including patent rights. No such rights are granted under this License.
*
* Copyright (c) 2018-2020 Christian R. Helmrich, project ecodis. All rights reserved.
* Copyright (c) 2018-2021 Christian R. Helmrich, project ecodis. All rights reserved.
*/
#ifndef _EXHALE_ENC_H_

View File

@ -1,11 +1,11 @@
/* tempAnalysis.cpp - source file for class providing temporal analysis of PCM signals
* written by C. R. Helmrich, last modified in 2020 - see License.htm for legal notices
* written by C. R. Helmrich, last modified in 2021 - see License.htm for legal notices
*
* The copyright in this software is being made available under the exhale Copyright License
* and comes with ABSOLUTELY NO WARRANTY. This software may be subject to other third-
* party rights, including patent rights. No such rights are granted under this License.
*
* Copyright (c) 2018-2020 Christian R. Helmrich, project ecodis. All rights reserved.
* Copyright (c) 2018-2021 Christian R. Helmrich, project ecodis. All rights reserved.
*/
#include "exhaleLibPch.h"
@ -154,6 +154,7 @@ unsigned TempAnalyzer::temporalAnalysis (const int32_t* const timeSignals[USAC_M
int splitPtL = 0;
int splitPtC = halfFrameOffset;
int splitPtR = nSamplesInFrame;
uint64_t ue[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; // sub-fr. unit energies
unsigned uL0 = abs (chSig[splitPtL ] - chSigM1[splitPtL ]);
unsigned uL1 = abs (chSig[splitPtC - 1] - chSigM1[splitPtC - 1]);
unsigned uR0 = abs (chSig[splitPtC ] - chSigM1[splitPtC ]);
@ -164,7 +165,6 @@ unsigned TempAnalyzer::temporalAnalysis (const int32_t* const timeSignals[USAC_M
{
/*LF*/int32_t* lrSig = &lrCoreTimeSignals[ch][resamplerOffset >> sbrShift];
const int32_t* hrSig = &timeSignals[ch][resamplerOffset];
/*MF*/uint64_t ue[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; // unit energies
int64_t* const rPrev = m_filtSampPrev[ch];
uint64_t subSumL = 0, subSumM = 0, subSumH = 0;
@ -366,6 +366,18 @@ unsigned TempAnalyzer::temporalAnalysis (const int32_t* const timeSignals[USAC_M
maxAbsValR = maxHfrLevR;
m_maxAbsHpPrev[ch] = m_maxHfLevPrev[ch];
}
else
{
memset (ue, 0, 8 * sizeof (uint64_t));
for (u = nSamplesInFrame - 1; u > 0; u--) ue[u >> 8] += abs (chSig[u] - chSigM1[u]);
sumAbsValL = ue[0];
sumAbsValR = (uint64_t) maxAbsValL + (uint64_t) maxAbsValR;
for (u = (nSamplesInFrame >> 8) - 1; u > 0; u--) sumAbsValL = __min (sumAbsValL, ue[u]);
u = maxAbsValR;
if (sumAbsValL < sumAbsValR * (1u + (nSamplesInFrame >> 10)) && m_maxAbsHpPrev[ch] > TA_EPS) m_maxAbsHpPrev[ch] = TA_EPS;
}
m_transientLoc[ch] = packTransLocWithPitchLag (maxAbsValL, maxAbsValR, m_maxAbsHpPrev[ch],
maxAbsIdxL, maxAbsIdxR, __max (1, pLagBestR));
// update stats history for this channel
@ -376,7 +388,7 @@ unsigned TempAnalyzer::temporalAnalysis (const int32_t* const timeSignals[USAC_M
} // if sumAbsValL == 0 && sumAbsValR == 0
if (applyResampler) m_maxHfLevPrev[ch] = maxHfrLevR;
} // for ch
} // ch
return 0; // no error
}