shithub: aacenc

Download patch

ref: 8aecd0c07ff455eef781710576c9ca9614ba1000
parent: b4698b94324b28ccb80a5f50bdacda579c13f8d2
author: Krzysztof Nikiel <knik@users.sourceforge.net>
date: Tue Aug 22 12:40:54 EDT 2017

raised max framesize and max quality (5000) for mp4 files

--- a/frontend/main.c
+++ b/frontend/main.c
@@ -867,6 +867,7 @@
     {
         mpegVersion = MPEG4;
         stream = RAW_STREAM;
+        maxBytesOutput = 0x1000 * infile->channels;
     }
 
     frameSize = samplesInput / infile->channels;
--- a/libfaac/aacquant.h
+++ b/libfaac/aacquant.h
@@ -46,7 +46,7 @@
 
 #include "quantize.h"
 
-enum {DEFQUAL = 100, MAXQUAL = 2000, MINQUAL = 10};
+enum {DEFQUAL = 100, MAXQUAL = 5000, MAXQUALADTS = 500, MINQUAL = 10};
 
 void AACQuantizeInit(CoderInfo *coderInfo, unsigned int numChannels,
 		     AACQuantCfg *aacquantCfg);
--- a/libfaac/frame.c
+++ b/libfaac/frame.c
@@ -124,7 +124,8 @@
                                     faacEncConfigurationPtr config)
 {
     faacEncStruct* hEncoder = (faacEncStruct*)hpEncoder;
-	int i;
+    int i;
+    int maxqual = hEncoder->config.outputFormat ? MAXQUALADTS : MAXQUAL;
 
     hEncoder->config.allowMidside = config->allowMidside;
     hEncoder->config.useLfe = config->useLfe;
@@ -253,8 +254,8 @@
     if (hEncoder->config.bandWidth > (hEncoder->sampleRate / 2))
 		hEncoder->config.bandWidth = hEncoder->sampleRate / 2;
 
-    if (config->quantqual > MAXQUAL)
-        config->quantqual = MAXQUAL;
+    if (config->quantqual > maxqual)
+        config->quantqual = maxqual;
     if (config->quantqual < MINQUAL)
         config->quantqual = MINQUAL;
 
@@ -470,6 +471,7 @@
     unsigned int allowMidside = hEncoder->config.allowMidside;
     unsigned int bandWidth = hEncoder->config.bandWidth;
     unsigned int shortctl = hEncoder->config.shortctl;
+    int maxqual = hEncoder->config.outputFormat ? MAXQUALADTS : MAXQUAL;
 
     /* Increase frame number */
     hEncoder->frameNum++;
@@ -887,8 +889,8 @@
 		if (((diff > 0) && (fix > 0.0)) || ((diff < 0) && (fix < 0.0)))
 		{
 			hEncoder->aacquantCfg.quality *= (1.0 - fix);
-                        if (hEncoder->aacquantCfg.quality > MAXQUAL)
-                            hEncoder->aacquantCfg.quality = MAXQUAL;
+                        if (hEncoder->aacquantCfg.quality > maxqual)
+                            hEncoder->aacquantCfg.quality = maxqual;
             if (hEncoder->aacquantCfg.quality < 50)
                 hEncoder->aacquantCfg.quality = 50;
 		}