mirror of
https://gitlab.com/ecodis/exhale.git
synced 2025-06-05 21:59:32 +02:00
some code cleanup
This commit is contained in:
@ -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`
|
`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
|
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,
|
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
|
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
|
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)
|
SBR is disabled, or a...g when SBR is enabled)
|
||||||
- *Format is:* lossy
|
- *Format is:* lossy
|
||||||
- *Highest BPS mode supported:* 24 (or 32, doesn't matter much)
|
- *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)
|
- *Bitrate (kbps):* (depends on bit-rate mode, see Usage above)
|
||||||
- *Settings:* CVBR mode # (where # equals that in *Parameters*)
|
- *Settings:* CVBR mode # (where # equals that in *Parameters*)
|
||||||
|
|
||||||
|
@ -15,5 +15,5 @@
|
|||||||
# define EXHALELIB_VERSION_MINOR "1"
|
# define EXHALELIB_VERSION_MINOR "1"
|
||||||
#endif
|
#endif
|
||||||
#ifndef EXHALELIB_VERSION_BUGFIX
|
#ifndef EXHALELIB_VERSION_BUGFIX
|
||||||
# define EXHALELIB_VERSION_BUGFIX ".1" // "RC" or ".0", ".1", ...
|
# define EXHALELIB_VERSION_BUGFIX ".2" // "RC" or ".0", ".1", ...
|
||||||
#endif
|
#endif
|
||||||
|
@ -657,7 +657,7 @@ unsigned BitStreamWriter::writeStereoCoreToolInfo (const CoreCoderData& elData,
|
|||||||
#if !RESTRICT_TO_AAC
|
#if !RESTRICT_TO_AAC
|
||||||
if (timeWarping)
|
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++;
|
bitCount++;
|
||||||
} // tw_mdct
|
} // tw_mdct
|
||||||
#endif
|
#endif
|
||||||
@ -852,9 +852,9 @@ unsigned BitStreamWriter::createAudioFrame (CoreCoderData** const elementData,
|
|||||||
return 0; // invalid arguments error
|
return 0; // invalid arguments error
|
||||||
}
|
}
|
||||||
#ifndef NO_PREROLL_DATA
|
#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);
|
memcpy (tempBuffer, &m_auBitStream.stream.front (), bitCount);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -868,9 +868,9 @@ unsigned BitStreamWriter::createAudioFrame (CoreCoderData** const elementData,
|
|||||||
m_auBitStream.write (ipf ? 1 : 0, 1); // UsacExtElement, usacExtElementPresent
|
m_auBitStream.write (ipf ? 1 : 0, 1); // UsacExtElement, usacExtElementPresent
|
||||||
if (ipf)
|
if (ipf)
|
||||||
{
|
{
|
||||||
const uint16_t idxPreRollExt = (uint16_t) elementData[0]->elementType;
|
const uint16_t idxPreRollExt = elementData[0]->elementType & 1;
|
||||||
const bool lowRatePreRollExt = (ipf == 1 && numElements == 1 && idxPreRollExt < ID_USAC_LFE);
|
const bool lowRatePreRollExt = (ipf == 1 && numElements == 1 && noiseFilling[0]);
|
||||||
const unsigned payloadLength = (lowRatePreRollExt ? 8 + idxPreRollExt * 6 : bitCount) + 3; // in bytes!
|
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 (0, 1); // usacExtElementUseDefaultLength = 0 (variable)
|
||||||
m_auBitStream.write (CLIP_UCHAR (payloadLength), 8);
|
m_auBitStream.write (CLIP_UCHAR (payloadLength), 8);
|
||||||
@ -882,12 +882,17 @@ unsigned BitStreamWriter::createAudioFrame (CoreCoderData** const elementData,
|
|||||||
|
|
||||||
if (lowRatePreRollExt)
|
if (lowRatePreRollExt)
|
||||||
{
|
{
|
||||||
while (ci < payloadLength - 3) m_auBitStream.write (zeroAu[idxPreRollExt][ci++], 8);
|
bitCount = payloadLength - 3;
|
||||||
}
|
memcpy (tempBuffer, zeroAu[idxPreRollExt], bitCount);
|
||||||
else
|
if (elementData[0]->elementType < ID_USAC_LFE) // correct window_sequence
|
||||||
{
|
{
|
||||||
while (ci < bitCount) m_auBitStream.write (tempBuffer[ci++], 8); // write last AU
|
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;
|
ci = 0;
|
||||||
bitCount = (payloadLength > 254 ? 26 : 10) + (payloadLength << 3); // for ext. bits
|
bitCount = (payloadLength > 254 ? 26 : 10) + (payloadLength << 3); // for ext. bits
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* exhaleEnc.h - header file for class providing Extended HE-AAC encoding capability
|
/* 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
|
* 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-
|
* 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
|
CCFL_1024 = 1024 // LC
|
||||||
} USAC_CCFL;
|
} USAC_CCFL;
|
||||||
|
|
||||||
// overall xHE-AAC encoding class
|
// overall BL USAC encoding class
|
||||||
class ExhaleEncoder : public ExhaleEncAPI
|
class ExhaleEncoder : public ExhaleEncAPI
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#define SFB_QUANT_OFFSET 0.405396 // 1 - 0.5^(3/4)
|
#define SFB_QUANT_OFFSET 0.405396 // 1 - 0.5^(3/4)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// class for xHE-AAC quantization
|
// class for BL USAC quantization
|
||||||
class SfbQuantizer
|
class SfbQuantizer
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user