shithub: aacenc

Download patch

ref: 921fc834fa7d87e16b1be27fc7f808fc1ad50a69
parent: 83632f2bee3a7f657dee6661776ade6651239ec3
author: menno <menno>
date: Thu Dec 23 09:31:34 EST 1999

Fix in Mid/Side calculation

--- a/enc_tf.c
+++ b/enc_tf.c
@@ -16,8 +16,8 @@
 #include "aac_qc.h"
 #include "all.h"
 #include "aac_se_enc.h"
+#define SQRT2 sqrt(2)
 
-
 /* AAC tables */
 
 /* First attempt at supporting multiple sampling rates   *
@@ -243,11 +243,11 @@
 		for (chanNum=2;chanNum<4;chanNum++) {
 			if (chanNum == 2) {
 				for(i = 0; i < block_size_samples; i++){
-					DTimeSigLookAheadBuf[chanNum][i] = (DTimeSigLookAheadBuf[0][i]+DTimeSigLookAheadBuf[1][i])*0.5;
+					DTimeSigLookAheadBuf[chanNum][i] = (DTimeSigLookAheadBuf[0][i]+DTimeSigLookAheadBuf[1][i])/SQRT2;
 				}
 			} else {
 				for(i = 0; i < block_size_samples; i++){
-					DTimeSigLookAheadBuf[chanNum][i] = (DTimeSigLookAheadBuf[0][i]-DTimeSigLookAheadBuf[1][i])*0.5;
+					DTimeSigLookAheadBuf[chanNum][i] = (DTimeSigLookAheadBuf[0][i]-DTimeSigLookAheadBuf[1][i])/SQRT2;
 				}
 			}
 		}
@@ -298,7 +298,6 @@
 	{
 		int chanNum;
 		for (chanNum=0;chanNum<max_ch;chanNum++) {
-
 			/* A few definitions:                                                      */
 			/*   block_type:  Initially, the block_type used in the previous frame.    */
 			/*                Will be set to the block_type to use this frame.         */