ref: cdd7675df63db06b9a9d3fa6dc7a8edf2e6166be
parent: c07b90a24af3b3ada12028cd29630a694a8060b3
author: Krzysztof Nikiel <knik@users.sourceforge.net>
date: Sun Oct 15 07:28:22 EDT 2017
set default mode to ABR@128
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+ * changed default mode to ABR 64kbps/channel
* implemented short windows grouping
* new huffman coder
* SSE quantizer
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -886,11 +886,14 @@
if (infile->channels >= 6)
myFormat->useLfe = 1;
myFormat->allowMidside = useMidSide;
+ if (quantqual > 0)
+ {
+ myFormat->quantqual = quantqual;
+ myFormat->bitRate = 0;
+ }
if (bitRate)
myFormat->bitRate = bitRate / infile->channels;
myFormat->bandWidth = cutOff;
- if (quantqual > 0)
- myFormat->quantqual = quantqual;
myFormat->outputFormat = stream;
myFormat->inputFormat = FAAC_INPUT_FLOAT;
if (!faacEncSetConfiguration(hEncoder, myFormat))
@@ -941,9 +944,13 @@
quantqual = myFormat->quantqual;
bitRate = myFormat->bitRate;
if (bitRate)
- fprintf(stderr, "Average bitrate: %d kbps\n",
- (bitRate + 500) / 1000 * infile->channels);
- fprintf(stderr, "Quantization quality: %ld\n", quantqual);
+ {
+ fprintf(stderr, "Initial quantization quality: %ld\n", quantqual);
+ fprintf(stderr, "Average bitrate: %d kbps/channel\n",
+ (bitRate + 500) / 1000);
+ }
+ else
+ fprintf(stderr, "Quantization quality: %ld\n", quantqual);
fprintf(stderr, "Bandwidth: %d Hz\n", cutOff);
fprintf(stderr, "Object type: ");
switch (objectType)
--- a/libfaac/frame.c
+++ b/libfaac/frame.c
@@ -52,7 +52,10 @@
static SR_INFO srInfo[12+1];
// default bandwidth/samplerate ratio
-static const double bwfac = 0.42;
+static const struct {
+ double fac;
+ double freq;
+} g_bw = {0.42, 18000};
int FAACAPI faacEncGetVersion( char **faac_id_string,
char **faac_copyright_string)
@@ -154,7 +157,10 @@
if (config->bitRate && !config->bandWidth)
{
- config->bandWidth = (double)config->bitRate * hEncoder->sampleRate * bwfac / 60000.0;
+ config->bandWidth = (double)config->bitRate * hEncoder->sampleRate * g_bw.fac / 60000.0;
+ if (config->bandWidth > g_bw.freq)
+ config->bandWidth = g_bw.freq;
+
if (!config->quantqual)
{
config->quantqual = (double)config->bitRate * hEncoder->numChannels / 1280;
@@ -170,7 +176,7 @@
if (!config->bandWidth)
{
- config->bandWidth = bwfac * hEncoder->sampleRate;
+ config->bandWidth = g_bw.fac * hEncoder->sampleRate;
}
hEncoder->config.bandWidth = config->bandWidth;
@@ -253,8 +259,8 @@
hEncoder->config.allowMidside = 1;
hEncoder->config.useLfe = 1;
hEncoder->config.useTns = 0;
- hEncoder->config.bitRate = 0; /* default bitrate / channel */
- hEncoder->config.bandWidth = bwfac * hEncoder->sampleRate;
+ hEncoder->config.bitRate = 64000;
+ hEncoder->config.bandWidth = g_bw.fac * hEncoder->sampleRate;
hEncoder->config.quantqual = 0;
hEncoder->config.psymodellist = (psymodellist_t *)psymodellist;
hEncoder->config.psymodelidx = 0;