shithub: aacenc

Download patch

ref: c5480959ed3948dbfbeaad0fe14787faa1fc3fc5
parent: 677a24b69e6c7c4984c3e252a0fe35184efb68b7
author: Krzysztof Nikiel <knik@users.sourceforge.net>
date: Sat Sep 2 10:53:24 EDT 2017

increased frame buffer sixe to 8k for all stream types and allow higher ADTS bitrates

--- a/frontend/main.c
+++ b/frontend/main.c
@@ -821,7 +821,7 @@
 
     /* open the encoder library */
     hEncoder = faacEncOpen(infile->samplerate, infile->channels,
-                           &samplesInput, &maxBytesOutput, container == MP4_CONTAINER);
+                           &samplesInput, &maxBytesOutput);
 
     if (hEncoder == NULL)
     {
--- a/include/faac.h
+++ b/include/faac.h
@@ -76,8 +76,7 @@
 faacEncHandle FAACAPI faacEncOpen(unsigned long sampleRate,
 				  unsigned int numChannels,
 				  unsigned long *inputSamples,
-                                  unsigned long *maxOutputBytes,
-                                  int mp4file
+                                  unsigned long *maxOutputBytes
                                  );
 
 int FAACAPI faacEncGetDecoderSpecificInfo(faacEncHandle hEncoder, unsigned char **ppBuffer,
--- a/libfaac/aacquant.h
+++ b/libfaac/aacquant.h
@@ -46,7 +46,7 @@
 
 #include "quantize.h"
 
-enum {DEFQUAL = 100, MAXQUAL = 5000, MAXQUALADTS = 500, MINQUAL = 10};
+enum {DEFQUAL = 100, MAXQUAL = 5000, MAXQUALADTS = MAXQUAL, MINQUAL = 10};
 
 void AACQuantizeInit(CoderInfo *coderInfo, unsigned int numChannels,
 		     AACQuantCfg *aacquantCfg);
--- a/libfaac/frame.c
+++ b/libfaac/frame.c
@@ -275,9 +275,7 @@
 faacEncHandle FAACAPI faacEncOpen(unsigned long sampleRate,
                                   unsigned int numChannels,
                                   unsigned long *inputSamples,
-                                  unsigned long *maxOutputBytes,
-                                  int mp4file
-                                 )
+                                  unsigned long *maxOutputBytes)
 {
     unsigned int channel;
     faacEncStruct* hEncoder;
@@ -286,10 +284,7 @@
 	return NULL;
 
     *inputSamples = FRAME_LEN*numChannels;
-    if (mp4file)
-        *maxOutputBytes = 0x1000 * numChannels;
-    else
-        *maxOutputBytes = (6144/8)*numChannels;
+    *maxOutputBytes = 0x2000;
 
 #ifdef DRM
     *maxOutputBytes += 1; /* for CRC */
@@ -327,11 +322,8 @@
 	/* default channel map is straight-through */
 	for( channel = 0; channel < MAX_CHANNELS; channel++ )
 		hEncoder->config.channel_map[channel] = channel;
-	
-    if (mp4file)
-        hEncoder->config.outputFormat = RAW_STREAM;
-    else
-        hEncoder->config.outputFormat = ADTS_STREAM;
+
+    hEncoder->config.outputFormat = ADTS_STREAM;
 
     /*
         be compatible with software which assumes 24bit in 32bit PCM