shithub: aacenc

Download patch

ref: 992431f0cbbf52e26e14e52f9a23fee1fa17c69d
parent: ec1fcac0122d5faaea5bef7a6930f1d3d82c98fb
author: knik <knik>
date: Thu Aug 7 04:17:00 EDT 2003

Better LFE support (reduced bandwidth)

--- a/libfaac/frame.c
+++ b/libfaac/frame.c
@@ -16,7 +16,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: frame.c,v 1.39 2003/08/02 11:32:10 stux Exp $
+ * $Id: frame.c,v 1.40 2003/08/07 08:17:00 knik Exp $
  */
 
 /*
@@ -485,9 +485,13 @@
         }
 
         /* Psychoacoustics */
-        /* Update buffers and run FFT on new samples */
-	hEncoder->psymodel->PsyBufferUpdate(&hEncoder->gpsyInfo, &hEncoder->psyInfo[channel],
-				  hEncoder->next3SampleBuff[channel], bandWidth);
+	/* Update buffers and run FFT on new samples */
+	/* LFE psychoacoustic can run without it */
+	if (!channelInfo[channel].lfe || channelInfo[channel].cpe)
+	{
+	  hEncoder->psymodel->PsyBufferUpdate(&hEncoder->gpsyInfo, &hEncoder->psyInfo[channel],
+					      hEncoder->next3SampleBuff[channel], bandWidth);
+	}
     }
 
     if (hEncoder->frameNum <= 3) /* Still filling up the buffers */
@@ -626,6 +630,12 @@
 			hEncoder->freqBuff[channel]);
       }
       CalcAvgEnrg(&coderInfo[channel], hEncoder->freqBuff[channel]);
+
+      // reduce LFE bandwidth
+      if (!channelInfo[channel].cpe && channelInfo[channel].lfe)
+      {
+	coderInfo[channel].nr_of_sfb = coderInfo[channel].max_sfb = 3;
+      }
     }
 
     MSEncode(coderInfo, channelInfo, hEncoder->freqBuff, numChannels, allowMidside);
@@ -828,6 +838,9 @@
 
 /*
 $Log: frame.c,v $
+Revision 1.40  2003/08/07 08:17:00  knik
+Better LFE support (reduced bandwidth)
+
 Revision 1.39  2003/08/02 11:32:10  stux
 added config.inputFormat, and associated defines and code, faac now handles native endian 16bit, 24bit and float input. Added faacEncGetDecoderSpecificInfo to the dll exports, needed for MP4. Updated DLL .dsp to compile without error. Updated CFG_VERSION to 102. Version number might need to be updated as the API has technically changed. Did not update libfaac.pdf
 
--- a/libfaac/psychkni.c
+++ b/libfaac/psychkni.c
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: psychkni.c,v 1.10 2003/07/07 16:31:46 knik Exp $
+ * $Id: psychkni.c,v 1.11 2003/08/07 08:17:00 knik Exp $
  */
 #include <stdio.h>
 #include <stdlib.h>
@@ -333,9 +333,8 @@
       else if (!channelInfo[channel].cpe &&
 	       channelInfo[channel].lfe)
       {				/* LFE */
-
-	/* NOT FINISHED */
-
+        // Only set block type and it should be OK
+	psyInfo[channel].block_type = ONLY_LONG_WINDOW;
       }
       else if (!channelInfo[channel].cpe)
       {				/* SCE */