some code cleanup

This commit is contained in:
Christian R. Helmrich 2021-01-23 18:00:00 +01:00
parent 193dc26823
commit 9ed76efe87
5 changed files with 22 additions and 17 deletions

View File

@ -100,7 +100,7 @@ to print out usage information. As an example, the following command
`exhale.exe 5 C:\Music\Input.wav C:\Music\Output.m4a`
converts file Input.wav to file Output.m4a at roughly 128 kbit/s (if
the input signal is two-channel stereo) and in xHE-AAC audio format.
the input signal is 2-channel stereo) and in Extended HE-AAC format.
Note that, when calling the exhale application with a path (such as,
e.g., `bin/exhale` or `bin\exhale.exe`), but specifying the input or
output file without a file path (e.g., `Input.wav`), those files are
@ -124,7 +124,7 @@ the window content changed, on `Add New`. Then select `Custom` under
SBR is disabled, or a...g when SBR is enabled)
- *Format is:* lossy
- *Highest BPS mode supported:* 24 (or 32, doesn't matter much)
- *Encoder name:* xHE-AAC (exhale)
- *Encoder name:* Extended HE-AAC (exhale)
- *Bitrate (kbps):* (depends on bit-rate mode, see Usage above)
- *Settings:* CVBR mode # (where # equals that in *Parameters*)

View File

@ -15,5 +15,5 @@
# define EXHALELIB_VERSION_MINOR "1"
#endif
#ifndef EXHALELIB_VERSION_BUGFIX
# define EXHALELIB_VERSION_BUGFIX ".1" // "RC" or ".0", ".1", ...
# define EXHALELIB_VERSION_BUGFIX ".2" // "RC" or ".0", ".1", ...
#endif

View File

@ -657,7 +657,7 @@ unsigned BitStreamWriter::writeStereoCoreToolInfo (const CoreCoderData& elData,
#if !RESTRICT_TO_AAC
if (timeWarping)
{
m_auBitStream.write (0, 1); // common_tw not needed in xHE-AAC
m_auBitStream.write (0, 1); // common_tw not needed in BL USAC
bitCount++;
} // tw_mdct
#endif
@ -852,9 +852,9 @@ unsigned BitStreamWriter::createAudioFrame (CoreCoderData** const elementData,
return 0; // invalid arguments error
}
#ifndef NO_PREROLL_DATA
if (ipf) // save last AU for ext. data
if ((ipf == 2) || (ipf == 1 && (numElements > 1 || !noiseFilling[0]))) // previous AU
{
bitCount = __min (65532, (uint32_t) m_auBitStream.stream.size ());
bitCount = __min (nSamplesInFrame << 2, (uint32_t) m_auBitStream.stream.size ());
memcpy (tempBuffer, &m_auBitStream.stream.front (), bitCount);
}
#endif
@ -868,9 +868,9 @@ unsigned BitStreamWriter::createAudioFrame (CoreCoderData** const elementData,
m_auBitStream.write (ipf ? 1 : 0, 1); // UsacExtElement, usacExtElementPresent
if (ipf)
{
const uint16_t idxPreRollExt = (uint16_t) elementData[0]->elementType;
const bool lowRatePreRollExt = (ipf == 1 && numElements == 1 && idxPreRollExt < ID_USAC_LFE);
const unsigned payloadLength = (lowRatePreRollExt ? 8 + idxPreRollExt * 6 : bitCount) + 3; // in bytes!
const uint16_t idxPreRollExt = elementData[0]->elementType & 1;
const bool lowRatePreRollExt = (ipf == 1 && numElements == 1 && noiseFilling[0]);
const unsigned payloadLength = (lowRatePreRollExt ? (8 + idxPreRollExt * 6) >> (sbrRatioShiftValue > 0 ? 0 : 1) : bitCount) + 3; // in bytes!
m_auBitStream.write (0, 1); // usacExtElementUseDefaultLength = 0 (variable)
m_auBitStream.write (CLIP_UCHAR (payloadLength), 8);
@ -882,12 +882,17 @@ unsigned BitStreamWriter::createAudioFrame (CoreCoderData** const elementData,
if (lowRatePreRollExt)
{
while (ci < payloadLength - 3) m_auBitStream.write (zeroAu[idxPreRollExt][ci++], 8);
}
else
{
while (ci < bitCount) m_auBitStream.write (tempBuffer[ci++], 8); // write last AU
bitCount = payloadLength - 3;
memcpy (tempBuffer, zeroAu[idxPreRollExt], bitCount);
if (elementData[0]->elementType < ID_USAC_LFE) // correct window_sequence
{
const USAC_WSEQ wsPrev0 = elementData[0]->icsInfoPrev[0].windowSequence;
const uint8_t wsPreRoll = uint8_t (wsPrev0 == EIGHT_SHORT || wsPrev0 == STOP_START ? LONG_START : wsPrev0);
// SCE/CPE: window_sequence at byte index 2/0, left-shifted by value 2/0
tempBuffer[2 - 2 * idxPreRollExt] |= wsPreRoll << (2 - 2 * idxPreRollExt);
}
}
while (ci < bitCount) m_auBitStream.write (tempBuffer[ci++], 8); // write AU
ci = 0;
bitCount = (payloadLength > 254 ? 26 : 10) + (payloadLength << 3); // for ext. bits
}

View File

@ -1,5 +1,5 @@
/* exhaleEnc.h - header file for class providing Extended HE-AAC encoding capability
* 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-
@ -56,7 +56,7 @@ typedef enum USAC_CCFL : short
CCFL_1024 = 1024 // LC
} USAC_CCFL;
// overall xHE-AAC encoding class
// overall BL USAC encoding class
class ExhaleEncoder : public ExhaleEncAPI
{
private:

View File

@ -27,7 +27,7 @@
#define SFB_QUANT_OFFSET 0.405396 // 1 - 0.5^(3/4)
#endif
// class for xHE-AAC quantization
// class for BL USAC quantization
class SfbQuantizer
{
private: