clean up new code

This commit is contained in:
Christian R. Helmrich 2021-03-12 22:00:00 +01:00
parent 0bde366c7f
commit 5bfcbaca3e
7 changed files with 26 additions and 49 deletions

View File

@ -16,7 +16,7 @@ if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
endif()
project(exhale VERSION 1.1.3 LANGUAGES CXX)
project(exhale VERSION 1.1.4 LANGUAGES CXX)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release

View File

@ -33,7 +33,7 @@ exhale is being made available under an open-source license which is
based on the 3-clause BSD license but modified to address particular
aspects dictated by the nature and the output of this application.
The license text and release notes for the current version 1.1.3 can
The license text and release notes for the current version 1.1.4 can
be found in the `include` subdirectory of the exhale distribution.

View File

@ -25,9 +25,14 @@
<td valign="top">
<h1><br><span class="pink">exhale</span> - <span class="pink">e</span>codis e<span class="pink">x</span>tended <span class="pink">h</span>igh-efficiency <span class="pink">a</span>nd <span class="pink">l</span>ow-complexity <span class="pink">e</span>ncoder<br><span class="gray"><sup><br>Software Release Notes, Version History, Known Issues, Upcoming Feature Roadmap</sup></span><br><br></h1>
<h3>&nbsp; &nbsp;The version of this distribution of the &laquo;exhale&raquo; software release is <b>1.1.3</b> (official pub&shy;lic minor release) from February 2021. Please check <a href="http://www.ecodis.de/audio.htm#mpeg">www.ecodis.de</a> regularly for new versions of this software. A summary of each version up to this release, a list of known issues with this release, and a roadmap of additional functionality are provided below.</h3>
<h3>&nbsp; &nbsp;The version of this distribution of the &laquo;exhale&raquo; software release is <b>1.1.4</b> (official pub&shy;lic minor release) from March 2021. Please check <a href="http://www.ecodis.de/audio.htm#mpeg">www.ecodis.de</a> regularly for new versions of this software. A summary of each version up to this release, a list of known issues with this release, and a roadmap of additional functionality are provided below.</h3>
<h3><br><b>Chronological Version History</b></h3>
<h3>&nbsp; &nbsp;Version <b>1.1.3 <span class="gray">&nbsp;Feb. 2021, this release</span></b></h3>
<h3>&nbsp; &nbsp;Version <b>1.1.4 <span class="gray">&nbsp;Mar. 2021, this release</span></b></h3>
<ul>
<li><h3>exhaleApp: removed LUFS/dBFS command arguments again, code now automatic</h3></li>
<li><h3>exhaleLib: very minor tuning of transient coding especially on male speech signals</h3></li>
</ul>
<h3>&nbsp; &nbsp;Version <b>1.1.3 <span class="gray">&nbsp;Feb. 2021</span></b></h3>
<ul>
<li><h3>exhaleApp: allow specifying loudness (LUFS) and peak sample (dBFS) after preset</h3></li>
<li><h3>exhaleLib: write UsacConfig in immediate playout frames (increases compatibility)</h3></li>
@ -133,7 +138,7 @@
<li><h3>exhaleLib: speed-ups and further quality tuning for difficult signals, as necessary.</h3></li>
</ul>
<h3><br></h3>
<h4><span class="gray">Written by C. R. Helmrich for exhale 1.1.3, Feb. 2021. Available at www.ecodis.de/exhale/release.htm.</span><br><br></h4>
<h4><span class="gray">Written by C. R. Helmrich for exhale 1.1.4, Mar. 2021. Available at www.ecodis.de/exhale/release.htm.</span><br><br></h4>
</td>
<td valign="top" colspan="2">

View File

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

View File

@ -46,7 +46,7 @@
// constants, experimental macros
#if LE_ACCURATE_CALC
#define EA_LOUD_INIT 16384u // for methodDefinition = program loudness
#define EA_LOUD_INIT 16384u // bsSamplePeakLevel = 0 & methodValue = 0
#else
#define EA_LOUD_INIT 16399u // bsSamplePeakLevel = 0 & methodValue = 0
#endif
@ -230,33 +230,6 @@ static void eaApplyDownsampler (int32_t* const pcmBuffer, int32_t* const resampl
}
#endif // ENABLE_RESAMPLING
static uint32_t eaInitLoudnessInfo (const uint32_t defaultLoudStats, const bool loudnessInfoProvided,
#ifdef EXHALE_APP_WCHAR
const wchar_t* const strings[])
#else
const char* const strings[])
#endif
{
float loudnessInfo[2];
uint32_t qLoud, qPeak;
if (!loudnessInfoProvided) return defaultLoudStats;
for (int i = 0; i < 2; i++)
{
char cString[8];
for (int c = 0; c < 8; c++) cString[c] = char (strings[i][c]); // make sure string is of type char
cString[7] = '\0';
loudnessInfo[i] = (float) atof (cString);
}
qLoud = uint32_t (4.0f * __max (0.0f, __min (63.75f, 57.75f + loudnessInfo[0])) + 0.5f); // 8b LUFS
qPeak = uint32_t (32.f * __max (0.0f, __min (127.97f, 20.0f - loudnessInfo[1])) + 0.5f); // 12b dBFS
return EA_LOUD_INIT | (qPeak << 18) | (qLoud << 6) | 11u; // measurementSystem = 2, reliability = 3
}
// main routine
#ifdef EXHALE_APP_WCHAR
# ifdef __MINGW32__
@ -269,7 +242,7 @@ int main (const int argc, char* argv[])
{
if (argc <= 0) return argc; // for safety
const bool readStdin = (argc == 3 || argc == 5);
const bool readStdin = (argc == 3);
BasicWavReader wavReader;
int32_t* inPcmData = nullptr; // 24-bit WAVE audio input buffer
#if ENABLE_RESAMPLING
@ -387,7 +360,7 @@ int main (const int argc, char* argv[])
fprintf_s (stdout, " ---------------------------------------------------------------------\n\n");
// check arg. list, print usage if needed
if ((argc < 3) || (argc > 6) || (argc > 1 && argv[1][1] != 0))
if ((argc < 3) || (argc > 4) || (argc > 1 && argv[1][1] != 0))
{
fprintf_s (stdout, " Copyright 2018-2021 C.R.Helmrich, project ecodis. See License.htm for details.\n\n");
@ -401,9 +374,9 @@ int main (const int argc, char* argv[])
fprintf_s (stdout, EXHALE_TEXT_BLUE " Usage:\t" EXHALE_TEXT_INIT);
#endif
#ifdef EXHALE_APP_WCHAR
fwprintf_s (stdout, L"%s preset [LUFS dBFS] [inputWaveFile.wav] outputMP4File.m4a\n\n where\n\n", exeFileName);
fwprintf_s (stdout, L"%s preset [inputWaveFile.wav] outputMP4File.m4a\n\n where\n\n", exeFileName);
#else
fprintf_s (stdout, "%s preset [LUFS dBFS] [inputWaveFile.wav] outputMP4File.m4a\n\n where\n\n", exeFileName);
fprintf_s (stdout, "%s preset [inputWaveFile.wav] outputMP4File.m4a\n\n where\n\n", exeFileName);
#endif
#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64)
fprintf_s (stdout, " preset\t= # (0-9) low-complexity standard compliant xHE-AAC at 16ú#+48 kbit/s\n");
@ -420,8 +393,6 @@ int main (const int argc, char* argv[])
fprintf_s (stdout, " \t (a-g) low-complexity compliant xHE-AAC with SBR at 12*#+36 kbit/s\n");
# endif
#endif
fprintf_s (stdout, "\n LUFS BS.1770 program loudness level in range -57.75..6, optional\n");
fprintf_s (stdout, "\n dBFS sample (not true) peak level in range -107.97..20, optional\n");
fprintf_s (stdout, "\n inputWaveFile.wav lossless WAVE audio input, read from stdin if not specified\n\n");
fprintf_s (stdout, " outputMP4File.m4a encoded MPEG-4 bit-stream, extension should be .m4a or .mp4\n\n\n");
#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64)
@ -510,7 +481,7 @@ int main (const int argc, char* argv[])
inFileHandle = fileno (stdin);
#endif
}
else // argc = 4/6, open WAV file
else // argc = 4, open input file
{
#ifdef EXHALE_APP_WCHAR
const wchar_t* inFileName = argv[argc - 2];
@ -744,7 +715,7 @@ int main (const int argc, char* argv[])
#endif
const unsigned indepPeriod = (sampleRate < 48000 ? (sampleRate - 320) / frameLength : 45 /*for 50-Hz video, use 50 for 60-Hz video*/);
const unsigned mod3Percent = unsigned ((expectLength * (3 + (coreSbrFrameLengthIndex & 3))) >> 17);
uint32_t byteCount = 0, bw = (numChannels < 7 ? eaInitLoudnessInfo (loudStats, argc > 4, &argv[2]) : 0);
uint32_t byteCount = 0, bw = (numChannels < 7 ? loudStats : 0);
uint32_t br, bwMax = 0; // br will be used to hold bytes read and/or bit-rate
uint32_t headerRes = 0;
// initialize LoudnessEstimator object
@ -767,7 +738,6 @@ int main (const int argc, char* argv[])
// init encoder, generate UsacConfig()
memset (outAuData, 0, 108 * sizeof (uint8_t)); // max. allowed ASC + UC size
i = exhaleEnc.initEncoder (outAuData, &bw); // bw stores actual ASC + UC size
if ((i == 256) && (argc > 4)) i = 0; // clear LUFS warning
if ((i |= mp4Writer.open (outFileHandle, sampleRate, numChannels, inSampDepth, frameLength, startLength
#if ENABLE_SIMPLE_SBR
@ -1013,7 +983,7 @@ int main (const int argc, char* argv[])
const uint32_t qPeak = uint32_t (32.0f * (20.0f - 20.0f * log10 (__max (EA_PEAK_MIN, float (loudStats & USHRT_MAX))) - EA_PEAK_NORM) + 0.5f);
// recreate ASC + UC + loudness data
bw = EA_LOUD_INIT | (qPeak << 18) | (qLoud << 6) | 11u;
bw = EA_LOUD_INIT | (qPeak << 18) | (qLoud << 6) | 11; // measurementSystem
memset (outAuData, 0, 108 * sizeof (uint8_t)); // max allowed ASC + UC size
i = exhaleEnc.initEncoder (outAuData, &bw); // with finished loudnessInfo()
#ifndef NO_PREROLL_DATA
@ -1085,7 +1055,7 @@ mainFinish:
{
fprintf_s (stderr, " ERROR while trying to close stdin stream! Has it already been closed?\n\n");
}
else // argc = 4/6, WAV
else // argc = 4, file
{
#ifdef EXHALE_APP_WCHAR
fwprintf_s (stderr, L" ERROR while trying to close input file %s! Does it still exist?\n\n", argv[argc - 2]);

View File

@ -13,7 +13,7 @@
0 ICON "exhaleApp.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,1,3
FILEVERSION 1,1,4
BEGIN
BLOCK "StringFileInfo"
BEGIN

View File

@ -32,9 +32,8 @@ private:
uint8_t* m_uCharBuffer; // temporary buffer for ungrouping
#ifndef NO_PREROLL_DATA
uint8_t m_usacConfig[20]; // buffer for UsacConfig in IPF
uint16_t m_usacConfigLen; // length of UsacConfig in bytes
uint16_t m_usacConfigLen;
#endif
// helper functions
void writeByteAlignment (); // write 0s for byte alignment
unsigned writeChannelWiseIcsInfo (const IcsInfo& icsInfo); // ics_info()
@ -57,7 +56,10 @@ public:
// constructor
BitStreamWriter () { m_auBitStream.reset (); m_frameLength = 0; m_numSwbShort = 0; m_uCharBuffer = nullptr;
memset (m_usacConfig, 0, 20u); m_usacConfigLen = 0; }
#ifndef NO_PREROLL_DATA
memset (m_usacConfig, 0, 20); m_usacConfigLen = 0;
#endif
}
// destructor
~BitStreamWriter() { m_auBitStream.reset (); }
// public functions