mirror of
https://gitlab.com/ecodis/exhale.git
synced 2025-06-05 21:59:32 +02:00
clean extra frames
This commit is contained in:
@@ -444,6 +444,8 @@ unsigned BasicWavReader::read (int32_t* const frameBuf, const uint16_t frameCoun
|
|||||||
if ((frameBuf == nullptr) || (m_fileHandle == -1) || (framesTotal == 0) || (m_byteBuffer == nullptr) ||
|
if ((frameBuf == nullptr) || (m_fileHandle == -1) || (framesTotal == 0) || (m_byteBuffer == nullptr) ||
|
||||||
(m_bytesRemaining <= 0)) // end of chunk reached
|
(m_bytesRemaining <= 0)) // end of chunk reached
|
||||||
{
|
{
|
||||||
|
if (frameBuf != nullptr) memset (frameBuf, 0, framesTotal * m_waveChannels * sizeof (int32_t));
|
||||||
|
|
||||||
return 0; // invalid args or class not initialized
|
return 0; // invalid args or class not initialized
|
||||||
}
|
}
|
||||||
framesRead = m_readDataFunc (m_fileHandle, frameBuf, framesTotal, m_waveChannels, m_byteBuffer);
|
framesRead = m_readDataFunc (m_fileHandle, frameBuf, framesTotal, m_waveChannels, m_byteBuffer);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LocalDebuggerCommandArguments># C:\ha2010.wav debug.m4a > ..\..\debug.txt</LocalDebuggerCommandArguments>
|
<LocalDebuggerCommandArguments># C:\ha2010.wav ..\..\debug.m4a > ..\..\debug.txt</LocalDebuggerCommandArguments>
|
||||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
@@ -128,12 +128,12 @@ static unsigned getLowRatePreRollAU (uint8_t* const byteBuffer, const CoreCoderD
|
|||||||
if (useSbr) // UsacSbrData()
|
if (useSbr) // UsacSbrData()
|
||||||
{
|
{
|
||||||
au.write (1, 7);// SbrInfo(), sbrUseDfltHeader
|
au.write (1, 7);// SbrInfo(), sbrUseDfltHeader
|
||||||
if (et) au.write (1, 1); // sbr_data(), couple
|
if (et) au.write (0, 1); // fix _coupling = 0
|
||||||
au.write (0, 7);
|
au.write (0, 8 << et);
|
||||||
au.write (0, et ? 31 : 17);
|
au.write (0, 16 << et);
|
||||||
#if ENABLE_INTERTES
|
# if ENABLE_INTERTES
|
||||||
au.write (0, et + 1);
|
au.write (0, et + 1);
|
||||||
#endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (au.heldBitCount > 0) au.stream.push_back (au.heldBitChunk);
|
if (au.heldBitCount > 0) au.stream.push_back (au.heldBitChunk);
|
||||||
@@ -814,8 +814,8 @@ unsigned BitStreamWriter::createAudioConfig (const char samplingFrequencyIndex,
|
|||||||
#endif
|
#endif
|
||||||
const uint8_t sbrRatioShiftValue, unsigned char* const audioConfig)
|
const uint8_t sbrRatioShiftValue, unsigned char* const audioConfig)
|
||||||
{
|
{
|
||||||
const uint8_t fli = (sbrRatioShiftValue == 0 ? 1 /*no SBR*/ : __min (2, sbrRatioShiftValue) + 2);
|
const uint8_t fli = (sbrRatioShiftValue == 0 ? 1 /*no SBR*/ : __min (2, sbrRatioShiftValue & 3) + 2);
|
||||||
const int8_t usfi = __max (0, samplingFrequencyIndex - 3 * sbrRatioShiftValue); // TODO: non-standard sampling rates
|
const int8_t usfi = __max (0, samplingFrequencyIndex - 3 * (sbrRatioShiftValue & 3)); // TODO: nonstandard rates
|
||||||
unsigned bitCount = 37, auLen;
|
unsigned bitCount = 37, auLen;
|
||||||
#ifndef NO_PREROLL_DATA
|
#ifndef NO_PREROLL_DATA
|
||||||
unsigned ucOffset = (samplingFrequencyIndex < AAC_NUM_SAMPLE_RATES ? 2 : 5);
|
unsigned ucOffset = (samplingFrequencyIndex < AAC_NUM_SAMPLE_RATES ? 2 : 5);
|
||||||
@@ -881,7 +881,7 @@ unsigned BitStreamWriter::createAudioConfig (const char samplingFrequencyIndex,
|
|||||||
m_auBitStream.write (0, 3); // fix harmonicSBR, bs_interTes, bs_pvc = 0
|
m_auBitStream.write (0, 3); // fix harmonicSBR, bs_interTes, bs_pvc = 0
|
||||||
#endif
|
#endif
|
||||||
bitCount += 13; // incl. SbrDfltHeader following hereafter
|
bitCount += 13; // incl. SbrDfltHeader following hereafter
|
||||||
m_auBitStream.write (15, 4); // 11025 @ 44.1, 11625 @ 48, 15000 @ 64 kHz
|
m_auBitStream.write (15 - (sbrRatioShiftValue / 4), 4); // bs_start_freq
|
||||||
m_auBitStream.write (sf, 4); // 16193 @ 44.1, 18375 @ 48, 22500 @ 64 kHz
|
m_auBitStream.write (sf, 4); // 16193 @ 44.1, 18375 @ 48, 22500 @ 64 kHz
|
||||||
m_auBitStream.write ( 0, 2); // fix dflt_header_extra* = 0
|
m_auBitStream.write ( 0, 2); // fix dflt_header_extra* = 0
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user