shithub: aacenc

Download patch

ref: b2a0a947f7d2c612789a96b6cc1f3b2997adf059
parent: ee0337cceeeafef5c0195d1055c1e1d58c0d9b71
author: lenox <lenox>
date: Mon Feb 28 07:18:36 EST 2000

huge cleanup (for unused parameters and vars)

--- a/aac_qc.c
+++ b/aac_qc.c
@@ -235,7 +235,7 @@
 }
 
 int inner_loop(AACQuantInfo *quantInfo,
-			   double *p_spectrum,
+//			   double *p_spectrum,
 			   double *pow_spectrum,
 			   int quant[NUM_COEFF],
 			   int max_bits)
@@ -247,7 +247,8 @@
 	{
 		quantInfo->common_scalefac += 1;
 		quantize(quantInfo, pow_spectrum, quant);
-		bits = count_bits(quantInfo, quant, quantInfo->book_vector); 
+//		bits = count_bits(quantInfo, quant, quantInfo->book_vector);
+		bits = count_bits(quantInfo, quant);
 	} while ( bits > max_bits );
 
 	return bits;
@@ -254,7 +255,7 @@
 }
 
 int search_common_scalefac(AACQuantInfo *quantInfo,
-						   double *p_spectrum,
+//						   double *p_spectrum,
 						   double *pow_spectrum,
 						   int quant[NUM_COEFF],
 						   int desired_rate)
@@ -268,7 +269,8 @@
 	{
 		quantInfo->common_scalefac = StepSize;
 		quantize(quantInfo, pow_spectrum, quant);
-		nBits = count_bits(quantInfo, quant, quantInfo->book_vector);  
+//		nBits = count_bits(quantInfo, quant, quantInfo->book_vector);
+		nBits = count_bits(quantInfo, quant);
 
 		if (CurrentStep == 1 ) {
 			break; /* nothing to adjust anymore */
@@ -364,9 +366,11 @@
 	return over;
 }
 
-int quant_compare(int best_over, double best_tot_noise, double best_over_noise,
-				  double best_max_noise, int over, double tot_noise, double over_noise,
-				  double max_noise)
+//int quant_compare(int best_over, double best_tot_noise, double best_over_noise,
+//				  double best_max_noise, int over, double tot_noise, double over_noise,
+//				  double max_noise)
+int quant_compare(double best_tot_noise, double best_over_noise,
+		  double tot_noise, double over_noise)
 {
 	/*
 	noise is given in decibals (db) relative to masking thesholds.
@@ -373,10 +377,10 @@
 
 	over_noise:  sum of quantization noise > masking
 	tot_noise:   sum of all quantization noise
-	max_noise:   max quantization noise 
+	max_noise:   max quantization noise
 
 	*/
-	int better=0;
+	int better;
 
 #if 0
 	better = ((over < best_over) ||
@@ -409,7 +413,7 @@
 		||( (max_noise == best_max_noise)
 		&&(tot_noise <= best_tot_noise)
 		)
-		) 
+		)
 		);
 #endif
 #endif
@@ -424,8 +428,9 @@
 
 
 int count_bits(AACQuantInfo* quantInfo,
-			   int quant[NUM_COEFF],
-			   int output_book_vector[SFB_NUM_MAX*2])
+			   int quant[NUM_COEFF]
+//			   ,int output_book_vector[SFB_NUM_MAX*2]
+                        )
 {
 	int i, bits = 0;
 
@@ -449,7 +454,7 @@
 
 	/* calculate the amount of bits needed for encoding the huffman codebook numbers */
 	bits += sort_book_numbers(quantInfo,             /* Quantization information */
-		output_book_vector,    /* Output codebook vector, formatted for bitstream */
+//		output_book_vector,    /* Output codebook vector, formatted for bitstream */
 		NULL,          /* Bitstream */
 		0);                    /* Write flag: 0 count, 1 write */
 
@@ -483,28 +488,29 @@
 			   double      energy[MAX_TIME_CHANNELS][MAX_SCFAC_BANDS],
 			   enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS],
 			   int         sfb_width_table[MAX_TIME_CHANNELS][MAX_SCFAC_BANDS],
-			   int         nr_of_sfb[MAX_TIME_CHANNELS],
+//			   int         nr_of_sfb[MAX_TIME_CHANNELS],
 			   int         average_block_bits,
-			   int         available_bitreservoir_bits,
-			   int         padding_limit,
+//			   int         available_bitreservoir_bits,
+//			   int         padding_limit,
 			   BsBitStream *fixed_stream,
-			   BsBitStream *var_stream,
-			   int         nr_of_chan,
+//			   BsBitStream *var_stream,
+//			   int         nr_of_chan,
 			   double      *p_reconstructed_spectrum[MAX_TIME_CHANNELS],
-			   int         useShortWindows,
-			   int aacAllowScalefacs,
+//			   int         useShortWindows,
+//			   int aacAllowScalefacs,
 			   AACQuantInfo* quantInfo,      /* AAC quantization information */ 
-			   Ch_Info* ch_info,
-			   int varBitRate,
-			   int bitRate)
+			   Ch_Info* ch_info
+//			   ,int varBitRate
+//			   ,int bitRate
+                           )
 {
 	int quant[NUM_COEFF];
 	int s_quant[NUM_COEFF];
-	int i=0;
-	int j=0;
+	int i;
+//	int j=0;
 	int k;
 	double max_dct_line = 0;
-	int global_gain;
+//	int global_gain;
 	int store_common_scalefac;
 	int best_scale_factor[SFB_NUM_MAX];
 	double pow_spectrum[NUM_COEFF];
@@ -511,8 +517,8 @@
 	double requant[NUM_COEFF];
 	int sb;
 	int extra_bits;
-	int max_bits;
-	int output_book_vector[SFB_NUM_MAX*2];
+//	int max_bits;
+//	int output_book_vector[SFB_NUM_MAX*2];
 	double SigMaskRatio[SFB_NUM_MAX];
 	IS_Info *is_info;
 	MS_Info *ms_info;
@@ -524,17 +530,18 @@
 	int* common_scalefac = &(quantInfo -> common_scalefac);
 
 	int outer_loop_count, notdone;
-	int over = 0, best_over = 100, better;
-	int sfb_overflow;
+	int over, better;
+//      int best_over = 100;
+//	int sfb_overflow;
 	int best_common_scalefac;
 	double noise_thresh;
 	double sfQuantFac;
 	double over_noise, tot_noise, max_noise;
 	double noise[SFB_NUM_MAX];
-	double best_max_noise = 0;
+//	double best_max_noise = 0;
 	double best_over_noise = 0;
 	double best_tot_noise = 0;
-	static int init = -1;
+//	static int init = -1;
 
 	/* Set block type in quantization info */
 	quantInfo -> block_type = block_type[MONO_CHAN];
@@ -564,7 +571,7 @@
 	} else{
 		/* For long windows, band are not actually interleaved */
 		if ((quantInfo -> block_type == ONLY_LONG_WINDOW) ||  
-			(quantInfo -> block_type == LONG_SHORT_WINDOW) || 
+			(quantInfo -> block_type == LONG_SHORT_WINDOW) ||
 			(quantInfo -> block_type == SHORT_LONG_WINDOW)) {
 			quantInfo->nr_of_sfb = quantInfo->max_sfb;
 
@@ -648,7 +655,7 @@
 					if ((10*log10(energy[MONO_CHAN][sb]*sfb_width_table[0][sb]+1e-60)<70)||(SigMaskRatio[sb] > 1.0)) {
 						quantInfo->pns_sfb_flag[sb] = 1;
 						quantInfo->pns_sfb_nrg[sb] = (int) (2.0 * log(energy[0][sb]*sfb_width_table[0][sb]+1e-60) / log(2.0) + 0.5) + PNS_SF_OFFSET;
-						
+
 						/* Erase spectral lines */
 						for( i=sfb_offset[sb]; i<sfb_offset[sb+1]; i++ ) {
 							p_spectrum[0][i] = 0.0;
@@ -672,7 +679,7 @@
 	/** find the maximum spectral coefficient **/
 	/* Bug fix, 3/10/98 CL */
 	/* for(i=0; i<NUM_COEFF; i++){ */
-	for(i=0; i < sfb_offset[quantInfo->nr_of_sfb]; i++){ 
+	for(i=0; i < sfb_offset[quantInfo->nr_of_sfb]; i++){
 		pow_spectrum[i] = (pow(ABS(p_spectrum[0][i]), 0.75));
 		sign[i] = sgn(p_spectrum[0][i]);
 		if ((ABS(p_spectrum[0][i])) > max_dct_line){
@@ -698,18 +705,20 @@
 
 		outer_loop_count++;
 		over = 0;
-		sfb_overflow = 0;
+//		sfb_overflow = 0;
 
-		if (max_dct_line == 0.0)
-			sfb_overflow = 1;
+//		if (max_dct_line == 0.0)
+//			sfb_overflow = 1;
 
 		if (outer_loop_count == 1) {
-			max_bits = search_common_scalefac(quantInfo, p_spectrum[0], pow_spectrum,
-				quant, average_block_bits);
+//			max_bits = search_common_scalefac(quantInfo, p_spectrum[0], pow_spectrum,
+//				quant, average_block_bits);
+			search_common_scalefac(quantInfo, pow_spectrum, quant, average_block_bits);
 		}
 
-		max_bits = inner_loop(quantInfo, p_spectrum[0], pow_spectrum,
-			quant, average_block_bits) + extra_bits;
+//		max_bits = inner_loop(quantInfo, p_spectrum[0], pow_spectrum,
+//			quant, average_block_bits) + extra_bits;
+		inner_loop(quantInfo, pow_spectrum, quant, average_block_bits);
 
 		store_common_scalefac = quantInfo->common_scalefac;
 
@@ -717,12 +726,14 @@
 			over = calc_noise(quantInfo, p_spectrum[0], quant, requant, noise, allowed_dist[0],
 				&over_noise, &tot_noise, &max_noise);
 
-			better = quant_compare(best_over, best_tot_noise, best_over_noise,
-				best_max_noise, over, tot_noise, over_noise, max_noise);
+//			better = quant_compare(best_over, best_tot_noise, best_over_noise,
+//				best_max_noise, over, tot_noise, over_noise, max_noise);
+			better = quant_compare(best_tot_noise, best_over_noise,
+				               tot_noise, over_noise);
 
 			for (sb = 0; sb < quantInfo->nr_of_sfb; sb++) {
 				if (scale_factor[sb] > 59) {
-					sfb_overflow = 1;
+//					sfb_overflow = 1;
 					better = 0;
 				}
 			}
@@ -731,8 +742,8 @@
 				better = 1;
 
 			if (better) {
-				best_over = over;
-				best_max_noise = max_noise;
+//				best_over = over;
+//				best_max_noise = max_noise;
 				best_over_noise = over_noise;
 				best_tot_noise = tot_noise;
 				best_common_scalefac = store_common_scalefac;
@@ -798,7 +809,8 @@
 
 	calc_noise(quantInfo, p_spectrum[0], quant, requant, noise, allowed_dist[0],
 			&over_noise, &tot_noise, &max_noise);
-	count_bits(quantInfo, quant, output_book_vector);
+//	count_bits(quantInfo, quant, output_book_vector);
+	count_bits(quantInfo, quant);
 	if (quantInfo->block_type!=ONLY_SHORT_WINDOW)
 		PulseDecoder(quantInfo, quant);
 
@@ -813,19 +825,20 @@
 			scale_factor[i] = *common_scalefac - scale_factor[i] + SF_OFFSET;
 		}
 	}
-	*common_scalefac = global_gain = scale_factor[0];
+//	*common_scalefac = global_gain = scale_factor[0];
+	*common_scalefac = scale_factor[0];
 
 	/* place the codewords and their respective lengths in arrays data[] and len[] respectively */
 	/* there are 'counter' elements in each array, and these are variable length arrays depending on the input */
 
 	quantInfo -> spectralCount = 0;
-	for(k=0;k< quantInfo -> nr_of_sfb; k++) {  
+	for(k=0;k< quantInfo -> nr_of_sfb; k++) {
 		output_bits(
 			quantInfo,
 			quantInfo->book_vector[k],
 			quant,
 			quantInfo->sfb_offset[k],
-			quantInfo->sfb_offset[k+1]-quantInfo->sfb_offset[k], 
+			quantInfo->sfb_offset[k+1]-quantInfo->sfb_offset[k],
 			1);
 //		printf("%d\t%d\n",k,quantInfo->book_vector[k]);
 	}
@@ -840,7 +853,7 @@
 				}
 			} else {
 				for (i=sfb_offset[sb]; i<sfb_offset[sb+1]; i++){
-					p_reconstructed_spectrum[0][i] = sgn(p_spectrum[0][i]) * requant[i]; 
+					p_reconstructed_spectrum[0][i] = sgn(p_spectrum[0][i]) * requant[i];
 				}
 			}
 		}
@@ -856,12 +869,12 @@
 		      double *PsySigMaskRatio)
 {
 	int i,j,ii;
-	int index = 0;
+	int index;
 	double tmp[1024];
-	int book=1;
-	int group_offset=0;
+//	int book=1;
+	int group_offset;
 	int k=0;
-	int windowOffset = 0;
+	int windowOffset;
 
 	/* set up local variables for used quantInfo elements */
 	int* sfb_offset = quantInfo -> sfb_offset;
@@ -871,7 +884,7 @@
 	*nr_of_sfb = quantInfo->max_sfb;              /* Init to max_sfb */
 	window_group_length = quantInfo -> window_group_length;
 	num_window_groups = quantInfo -> num_window_groups;
-	
+
 	/* calc org sfb_offset just for shortblock */
 	sfb_offset[k]=0;
 	for (k=0; k < 1024; k++) {
@@ -891,7 +904,7 @@
 					tmp[index++] = p_spectrum[MONO_CHAN][ii+ sfb_offset[k] + 128*j +group_offset];
 			}
 		}
-		group_offset +=  128*window_group_length[i];     
+		group_offset +=  128*window_group_length[i];
 	}
 
 	for (k=0; k<1024; k++){
@@ -908,7 +921,7 @@
 			/* for this window group and this band, find worst case inverse sig-mask-ratio */
 			int bandNum=windowOffset*NSFB_SHORT + k;
 			double worstISMR = PsySigMaskRatio[bandNum];
-			int w=0;
+			int w;
 			for (w=1;w<window_group_length[i];w++) {
 				bandNum=(w+windowOffset)*NSFB_SHORT + k;
 				if (PsySigMaskRatio[bandNum]<worstISMR) {
@@ -929,7 +942,7 @@
 }
 
 sort_book_numbers(AACQuantInfo* quantInfo,     /* Quantization information */
-		  int output_book_vector[],    /* Output codebook vector, formatted for bitstream */
+//		  int output_book_vector[],    /* Output codebook vector, formatted for bitstream */
 		  BsBitStream* fixed_stream,   /* Bitstream */
 		  int write_flag)              /* Write flag: 0 count, 1 write */
 {
@@ -937,20 +950,20 @@
     This function inputs the vector, 'book_vector[]', which is of length SFB_NUM_MAX,
     and contains the optimal huffman tables of each sfb.  It returns the vector, 'output_book_vector[]', which
     has it's elements formatted for the encoded bit stream.  It's syntax is:
-   
+
     {sect_cb[0], length_segment[0], ... ,sect_cb[num_of_sections], length_segment[num_of_sections]}
 
     The above syntax is true, unless there is an escape sequence.  An
     escape sequence occurs when a section is longer than 2 ^ (bit_len)
     long in units of scalefactor bands.  Also, the integer returned from
-    this function is the number of bits written in the bitstream, 
-    'bit_count'.  
+    this function is the number of bits written in the bitstream,
+    'bit_count'.
 
     This function supports both long and short blocks.
     */
 
 	int i;
-	int repeat_counter = 1;
+	int repeat_counter;
 	int bit_count = 0;
 	int previous;
 	int max, bit_len/*,sfbs*/;
@@ -958,7 +971,7 @@
 
 	/* Set local pointers to quantInfo elements */
 	int* book_vector = quantInfo -> book_vector;
-	int nr_of_sfb = quantInfo -> nr_of_sfb;
+//	int nr_of_sfb = quantInfo -> nr_of_sfb;
 
 	if (quantInfo->block_type == ONLY_SHORT_WINDOW){
 		max = 7;
@@ -978,8 +991,8 @@
 		repeat_counter=1;
 
 		previous = book_vector[band];
-		if (write_flag) {   
-			BsPutBit(fixed_stream,book_vector[band],4);  
+		if (write_flag) {
+			BsPutBit(fixed_stream,book_vector[band],4);
 		}
 		bit_count += 4;
 
@@ -986,26 +999,26 @@
 		for (i=band+1;i<band+max_sfb;i++) {
 			if( (book_vector[i] != previous)) {
 				if (write_flag) {
-					BsPutBit(fixed_stream,repeat_counter,bit_len);  
+					BsPutBit(fixed_stream,repeat_counter,bit_len);
 				}
 				bit_count += bit_len;
 
 				if (repeat_counter == max){  /* in case you need to terminate an escape sequence */
-					if (write_flag) BsPutBit(fixed_stream,0,bit_len);  
+					if (write_flag) BsPutBit(fixed_stream,0,bit_len);
 					bit_count += bit_len;
 				}
-				
-				if (write_flag) BsPutBit(fixed_stream,book_vector[i],4);  
+
+				if (write_flag) BsPutBit(fixed_stream,book_vector[i],4);
 				bit_count += 4;
 				previous = book_vector[i];
 				repeat_counter=1;
-				
+
 			}
 			/* if the length of the section is longer than the amount of bits available in */
 			/* the bitsream, "max", then start up an escape sequence */
-			else if ((book_vector[i] == previous) && (repeat_counter == max)) { 
+			else if ((book_vector[i] == previous) && (repeat_counter == max)) {
 				if (write_flag) {
-					BsPutBit(fixed_stream,repeat_counter,bit_len);  
+					BsPutBit(fixed_stream,repeat_counter,bit_len);
 				}
 				bit_count += bit_len;
 				repeat_counter = 1;
@@ -1014,18 +1027,18 @@
 				repeat_counter++;
 			}
 		}
-		
+
 		if (write_flag) {
-			BsPutBit(fixed_stream,repeat_counter,bit_len);  
+			BsPutBit(fixed_stream,repeat_counter,bit_len);
 		}
 		bit_count += bit_len;
 		if (repeat_counter == max) {  /* special case if the last section length is an */
 			/* escape sequence */
-			if (write_flag) BsPutBit(fixed_stream,0,bit_len);  
+			if (write_flag) BsPutBit(fixed_stream,0,bit_len);
 			bit_count += bit_len;
 		}
-		
 
+
 	}  /* Bottom of group iteration */
 
 	return(bit_count);
@@ -1063,11 +1076,11 @@
 */
 
 {
-	int i,j,k,m,n;
+	int i,j,k,n;
 	int hop;
 	int min_book_choice[112][3];
 	int bit_stats[240][3];
-	int total_bits;
+//	int total_bits;
 	int total_bit_count;
 	int levels;
 	double fraction;
@@ -1076,7 +1089,7 @@
 	int* book_vector = quantInfo -> book_vector;
 
 	levels = (int) ((log((double)quantInfo->nr_of_sfb)/log((double)2.0))+1);
-	fraction = (pow(2,levels)+quantInfo->nr_of_sfb)/(double)(pow(2,levels)); 
+	fraction = (pow(2,levels)+quantInfo->nr_of_sfb)/(double)(pow(2,levels));
 
 //#define SLOW
 #ifdef SLOW
@@ -1086,14 +1099,12 @@
 		hop = 1;
 		i = 0;
 #endif
-		total_bits = noiseless_bit_count(quant,
-			hop,
-			min_book_choice,
-			quantInfo);         /* Quantization information */
+//		total_bits = noiseless_bit_count(quant, hop, min_book_choice, quantInfo);
+		noiseless_bit_count(quant, hop, min_book_choice, quantInfo);
 
 		/* load up the (not-full) binary search tree with the min_book_choice values */
 		k=0;
-		m=0;
+//		m=0;
 		total_bit_count = 0;
 
 		for (j=(int)(pow(2,levels-i)); j<(int)(fraction*pow(2,levels-i)); j++)
@@ -1120,7 +1131,7 @@
 			}
 			total_bit_count = total_bit_count +  bit_stats[j][0];
 			k=k+hop;
-			m++;
+//			m++;
 		}
 #ifdef SLOW
 	}
@@ -1138,19 +1149,19 @@
 {
   int i,j,k;
 
-  /* 
+  /*
      This function inputs:
      - the quantized spectral data, 'quant[][]';
      - all of the huffman codebooks, 'huff[][]';
      - the size of the sections, in scalefactor bands (SFB's), 'hop';
-     - an empty matrix, min_book_choice[][] passed to it; 
+     - an empty matrix, min_book_choice[][] passed to it;
 
      This function outputs:
      - the matrix, min_book_choice.  It is a two dimensional matrix, with its
-     rows corresponding to spectral sections.  The 0th column corresponds to 
-     the bits needed to code a section with 'hop' scalefactors bands wide, all using 
-     the same huffman codebook.  The 1st column contains the huffman codebook number 
-     that allows the minimum number of bits to be used.   
+     rows corresponding to spectral sections.  The 0th column corresponds to
+     the bits needed to code a section with 'hop' scalefactors bands wide, all using
+     the same huffman codebook.  The 1st column contains the huffman codebook number
+     that allows the minimum number of bits to be used.
 
      Other notes:
      - Initally, the dynamic range is calculated for each spectral section.  The section
@@ -1159,7 +1170,7 @@
      If the dynamic range is larger than 16, then an escape code is appended after the
      table 11 codeword which encodes the larger value explicity in a pseudo-non-uniform
      quantization method.
-     
+
      */
 
 	int max_sb_coeff;
@@ -1646,9 +1657,9 @@
 	int previous_scale_factor;
 	int previous_is_factor;       /* Intensity stereo */
 	int index = 0;
-	int count = 0;
-	int group_offset = 0;
-	int nr_of_sfb_per_group=0;
+//	int count = 0;
+//	int group_offset = 0;
+	int nr_of_sfb_per_group;
 
 	int pns_pcm_flag = 1;
 	int previous_noise_nrg = quantInfo->common_scalefac ;
@@ -1655,7 +1666,7 @@
 
 	/* set local pointer to quantInfo elements */
 	int* scale_factors = quantInfo->scale_factor;
-	
+
 	if (quantInfo->block_type == ONLY_SHORT_WINDOW) { /* short windows */
 		nr_of_sfb_per_group = quantInfo->nr_of_sfb/quantInfo->num_window_groups;
 	}
@@ -1695,7 +1706,7 @@
 						length = 0;
 						codeword = 0;
 					} else {
-						length = huff12[diff+60][FIRSTINTAB];    
+						length = huff12[diff+60][FIRSTINTAB];
 						codeword = huff12[diff+60][LASTINTAB];
 					}
 				}
--- a/aac_qc.h
+++ b/aac_qc.h
@@ -85,8 +85,9 @@
 				double error_energy[SFB_NUM_MAX]
 				);
 int count_bits(AACQuantInfo* quantInfo,
-			   int quant[NUM_COEFF],
-			   int output_book_vector[SFB_NUM_MAX*2]);
+			   int quant[NUM_COEFF]
+//			   ,int output_book_vector[SFB_NUM_MAX*2]
+                           );
 
 
 /*********************************************************/
@@ -105,20 +106,21 @@
 			   double      energy[MAX_TIME_CHANNELS][MAX_SCFAC_BANDS],
 			   enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS],
 			   int         sfb_width_table[MAX_TIME_CHANNELS][MAX_SCFAC_BANDS],
-			   int         nr_of_sfb[MAX_TIME_CHANNELS],
+//			   int         nr_of_sfb[MAX_TIME_CHANNELS],
 			   int         average_block_bits,
-			   int         available_bitreservoir_bits,
-			   int         padding_limit,
+//			   int         available_bitreservoir_bits,
+//			   int         padding_limit,
 			   BsBitStream *fixed_stream,
-			   BsBitStream *var_stream,
-			   int         nr_of_chan,
+//			   BsBitStream *var_stream,
+//			   int         nr_of_chan,
 			   double      *p_reconstructed_spectrum[MAX_TIME_CHANNELS],
-			   int         useShortWindows,
-			   int         aacAllowScalefacs,
-			   AACQuantInfo* quantInfo,      /* AAC quantization information */ 
-			   Ch_Info *ch_info,
-			   int varBitRate,
-			   int bitRate);
+//			   int         useShortWindows,
+//			   int         aacAllowScalefacs,
+			   AACQuantInfo* quantInfo,      /* AAC quantization information */
+			   Ch_Info *ch_info
+//			   ,int varBitRate
+//			   ,int bitRate
+                           );
 
 
 /*********************************************************/
@@ -125,7 +127,7 @@
 /* sort_book_numbers                                     */
 /*********************************************************/
 int sort_book_numbers(AACQuantInfo* quantInfo,     /* Quantization information */
-		  int output_book_vector[],    /* Output codebook vector, formatted for bitstream */
+//		  int output_book_vector[],    /* Output codebook vector, formatted for bitstream */
 		  BsBitStream* fixed_stream,   /* Bitstream */
 		  int write_flag);             /* Write flag: 0 count, 1 write */
 
--- a/aac_se_enc.c
+++ b/aac_se_enc.c
@@ -238,7 +238,7 @@
 	/* this function writes out an individual_channel_stream to the bitstream and */
 	/* returns the number of bits written to the bitstream */
 	int bit_count = 0;
-	int output_book_vector[SFB_NUM_MAX*2];
+//	int output_book_vector[SFB_NUM_MAX*2];
 	writeFlag = ( writeFlag != 0 );
 
 	/* Write the 8-bit global_gain */
@@ -251,7 +251,8 @@
 	}
 
 	/* Write section_data() information to the bitstream */
-	bit_count += sort_book_numbers(quantInfo,output_book_vector,fixed_stream,writeFlag);
+//	bit_count += sort_book_numbers(quantInfo,output_book_vector,fixed_stream,writeFlag);
+	bit_count += sort_book_numbers(quantInfo,fixed_stream,writeFlag);
 
 	/* Write scale_factor_data() information */
 	bit_count += write_scalefactor_bitstream(fixed_stream,writeFlag,quantInfo);
@@ -263,7 +264,8 @@
 	bit_count += WriteTNSData(quantInfo,fixed_stream,writeFlag);
 	
 	/* Write gain control data */
-	bit_count += WriteGainControlData(quantInfo,fixed_stream,writeFlag);
+//	bit_count += WriteGainControlData(quantInfo,fixed_stream,writeFlag);
+        bit_count += WriteGainControlData(fixed_stream,writeFlag);
 
 	/* Write out spectral_data() */
 	bit_count += WriteSpectralData(quantInfo,fixed_stream,writeFlag);
@@ -381,10 +383,10 @@
 /*****************************************************************************/
 int WriteTNSData(AACQuantInfo* quantInfo,    /* AACQuantInfo structure */
 		 BsBitStream* fixed_stream,  /* Pointer to bitstream */
-		 int writeFlag)              /* 1 means write, 0 means count only */ 
+		 int writeFlag)              /* 1 means write, 0 means count only */
 {
   int bit_count = 0;
-  int numWindows = 1;
+  int numWindows;
   int len_tns_nfilt;
   int len_tns_length;
   int len_tns_order;
@@ -468,7 +470,8 @@
 /*****************************************************************************/
 /* WriteGainControlData(...), write gain control data.                       */
 /*****************************************************************************/
-int WriteGainControlData(AACQuantInfo* quantInfo,    /* AACQuantInfo structure */
+int WriteGainControlData(
+//                         AACQuantInfo* quantInfo,    /* AACQuantInfo structure */
 			 BsBitStream* fixed_stream,  /* Pointer to bitstream */
 			 int writeFlag)              /* 1 means write, 0 means count only */  
 {
--- a/aac_se_enc.h
+++ b/aac_se_enc.h
@@ -136,7 +136,8 @@
 /*****************************************************************************/
 /* WriteGainControlData(...), write gain control data.                       */
 /*****************************************************************************/
-int WriteGainControlData(AACQuantInfo* quantInfo,  /* Pointer to AACQuantInfo structure */
+int WriteGainControlData(
+//                         AACQuantInfo* quantInfo,  /* Pointer to AACQuantInfo structure */
 			 BsBitStream* fixedStream, /* Pointer to bitstream */
 			 int writeFlag);           /* 1 means write, 0 means count only */
 
--- a/enc_tf.c
+++ b/enc_tf.c
@@ -233,7 +233,7 @@
 	/* it is the job of this module to determine 
 	the no of bits to use in addition to average_block_bits
 	max. available: average_block_bits + available_bitreservoir_bits */
-	int max_bitreservoir_bits = 8184;
+//	int max_bitreservoir_bits = 8184;
 
 	/* max. allowed amount of bits in the reservoir  (used to avoid padding bits) */
 	long num_bits_available;
@@ -324,8 +324,8 @@
 				chanNum,
 				&DTimeSigLookAheadBuf[chanNum],
 				&next_desired_block_type[chanNum],
-				(int)qc_select,
-				block_size_samples,
+//				(int)qc_select,
+//				block_size_samples,
 				chpo_long,
 				chpo_short
 				);
@@ -423,8 +423,8 @@
 		for (chanNum=0;chanNum<max_ch;chanNum++) {
 
 			/* Count number of bits used for gain_control_data */
-			used_bits += WriteGainControlData(&quantInfo[chanNum],     /* quantInfo contains packed gain control data */
-				NULL,           /* NULL BsBitStream.  Only counting bits, no need to write yet */
+//			used_bits += WriteGainControlData(&quantInfo[chanNum],     /* quantInfo contains packed gain control data */
+			used_bits += WriteGainControlData(NULL,           /* NULL BsBitStream.  Only counting bits, no need to write yet */
 				0);             /* Zero write flag means don't write */
 		}
 	}
@@ -498,7 +498,8 @@
 		channelInfo, block_type, quantInfo, as->use_MS, as->use_IS, max_ch);
 
 	MSEnergy(spectral_line_vector, energy, chpo_long, chpo_short, sfb_width_table,
-		channelInfo, block_type, quantInfo, as->use_MS, max_ch);
+//		channelInfo, block_type, quantInfo, as->use_MS, max_ch);
+		block_type, quantInfo, as->use_MS, max_ch);
 
 	{
 		int chanNum;   
@@ -521,7 +522,7 @@
 	*
 	******************************************************************************************************************************/
 	{ 
-		int padding_limit = max_bitreservoir_bits;
+//		int padding_limit = max_bitreservoir_bits;
 		int maxNumBitsByteAligned;
 		int chanNum;   
 		int numFillBits;
@@ -638,9 +639,10 @@
 			MSEncodeSwitch(spectral_line_vector,
 				channelInfo,
 				sfb_offset_table,
-				block_type,
-				quantInfo,
-				max_ch);
+//				block_type,
+				quantInfo
+//				,max_ch
+                                );
 		}
 
 		/************************************************/
@@ -658,20 +660,21 @@
 				&energy[chanNum],
 				&block_type[chanNum],
 				&sfb_width_table[chanNum],
-				&nr_of_sfb[chanNum],
+//				&nr_of_sfb[chanNum],
 				bitsToUse,
-				available_bitreservoir_bits,
-				padding_limit,
+//				available_bitreservoir_bits,
+//				padding_limit,
 				fixed_stream,
-				NULL,
-				1,                        /* nr of audio channels */
+//				NULL,
+//				1,                        /* nr of audio channels */
 				&reconstructed_spectrum[chanNum],
-				useShortWindows,
-				aacAllowScalefacs,
+//				useShortWindows,
+//				aacAllowScalefacs,
 				&quantInfo[chanNum],
-				&(channelInfo[chanNum]),
-				0/*no vbr*/,
-				bit_rate);
+				&(channelInfo[chanNum])
+//				,0/*no vbr*/,
+//				,bit_rate
+                                );
 			if (error == FERROR)
 				return error;
 		}
@@ -683,7 +686,7 @@
 			MSReconstruct(reconstructed_spectrum,
 				channelInfo,
 				sfb_offset_table,
-				block_type,
+//				block_type,
 				quantInfo,
 				max_ch);
 		}
@@ -695,7 +698,7 @@
 			ISReconstruct(reconstructed_spectrum,
 				channelInfo,
 				sfb_offset_table,
-				block_type,
+//				block_type,
 				quantInfo,
 				max_ch);
 		}
--- a/is.c
+++ b/is.c
@@ -145,7 +145,7 @@
 void ISReconstruct(double *spectrum[MAX_TIME_CHANNELS],   /* array of pointers to spectral data */
 				   Ch_Info *channelInfo,                  /* Pointer to Ch_Info */
 				   int sfb_offset_table[][MAX_SCFAC_BANDS+1],
-				   enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
+//				   enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
 				   AACQuantInfo* quantInfo,
 				   int numberOfChannels)                 /* Number of channels */
 {
--- a/is.h
+++ b/is.h
@@ -30,7 +30,7 @@
 void ISReconstruct(double *spectrum[MAX_TIME_CHANNELS],   /* array of pointers to spectral data */
 		   Ch_Info *channelInfo,                  /* Pointer to Ch_Info */
 		   int sfb_offset_table[][MAX_SCFAC_BANDS+1],
-		   enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
+//		   enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
 		   AACQuantInfo* quantInfo,
 		   int numberOfChannels);                 /* Number of channels */
 
--- a/ms.c
+++ b/ms.c
@@ -50,7 +50,7 @@
 	int chanNum;
 	int sfbNum;
 
-	static int block = 0;
+//	static int block = 0;
 	int used = 0, notused = 0;
 	int realyused = 0;
 
@@ -150,7 +150,7 @@
 				} else if ((block_type[leftChan]==block_type[rightChan])&&(use_ms == 1)) {
 					int chan;
 					int numGroups;
-					int groupIndex = 0;
+					int groupIndex;
 					int maxSfb;
 					int g,b,j;
 					MS_Info *msInfo;
@@ -186,13 +186,13 @@
 									
 								}
 							}
-							groupIndex+=quantInfo[chan].window_group_length[g];
+//							groupIndex+=quantInfo[chan].window_group_length[g];
 						}
 					}
 				} else {
 					int chan;
 					int numGroups;
-					int groupIndex = 0;
+					int groupIndex;
 					int maxSfb;
 					int g,b,j;
 					MS_Info *msInfo;
@@ -225,7 +225,7 @@
 									
 								}
 							}
-							groupIndex+=quantInfo[chan].window_group_length[g];
+//							groupIndex+=quantInfo[chan].window_group_length[g];
 						}
 					}
 				}
@@ -241,7 +241,7 @@
 			  CH_PSYCH_OUTPUT_LONG p_chpo_long[],
 			  CH_PSYCH_OUTPUT_SHORT p_chpo_short[][MAX_SHORT_WINDOWS],
 			  int sfb_width_table[MAX_TIME_CHANNELS][MAX_SCFAC_BANDS],
-			  Ch_Info *channelInfo,                  /* Pointer to Ch_Info */
+//			  Ch_Info *channelInfo,                  /* Pointer to Ch_Info */
 			  enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
 			  AACQuantInfo* quantInfo,               /* Quant info */
 			  int use_ms,
@@ -318,7 +318,7 @@
 				channelInfo[leftChan].ms_info.is_present=0;
 
 				/* Perform MS if block_types are the same */
-				if (block_type[leftChan]==block_type[rightChan]) { 
+				if (block_type[leftChan]==block_type[rightChan]) {
 
 					int numGroups;
 					int maxSfb;
@@ -329,7 +329,7 @@
 
 					channelInfo[leftChan].common_window = 1;  /* Use common window */
 					channelInfo[leftChan].ms_info.is_present=1;
-                                        w = 0;
+//                                        w = 0;
 
 					numGroups = quantInfo[leftChan].num_window_groups;
 					maxSfb = quantInfo[leftChan].max_sfb;
@@ -344,10 +344,10 @@
 							msInfo->ms_used[b] = ( (!isInfo->is_used[b])||(!isInfo->is_present) );
 						}
 					}
-					
+
 					/* Perform sum and differencing on bands in which ms_used flag */
 					/* has been set. */
-					line_offset=0;
+//					line_offset=0;
 					startWindow = 0;
 					for (g=0;g<numGroups;g++) {
 						int numWindows = quantInfo[leftChan].window_group_length[g];
@@ -381,9 +381,10 @@
 void MSEncodeSwitch(double *spectrum[MAX_TIME_CHANNELS],   /* array of pointers to spectral data */
 	      Ch_Info *channelInfo,                  /* Pointer to Ch_Info */
 	      int sfb_offset_table[][MAX_SCFAC_BANDS+1],
-	      enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
-	      AACQuantInfo* quantInfo,               /* Quant info */
-	      int numberOfChannels)                  /* Number of channels */
+//	      enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
+	      AACQuantInfo* quantInfo               /* Quant info */
+//	      ,int numberOfChannels                 /* Number of channels */
+              )
 {
 	int chanNum;
 	int sfbNum;
@@ -410,7 +411,7 @@
 
 					numGroups = quantInfo[leftChan].num_window_groups;
 					maxSfb = quantInfo[leftChan].max_sfb;
-					w=0;
+//					w=0;
 
 					/* Determine which bands should be enabled */
 					/* Right now, simply enable bands which do not use intensity stereo */
@@ -426,7 +427,7 @@
 #endif
 					/* Perform sum and differencing on bands in which ms_used flag */
 					/* has been set. */
-					line_offset=0;
+//					line_offset=0;
 					startWindow = 0;
 					for (g=0;g<numGroups;g++) {
 						int numWindows = quantInfo[leftChan].window_group_length[g];
@@ -457,7 +458,7 @@
 void MSReconstruct(double *spectrum[MAX_TIME_CHANNELS],   /* array of pointers to spectral data */
 		   Ch_Info *channelInfo,                  /* Pointer to Ch_Info */
 		   int sfb_offset_table[][MAX_SCFAC_BANDS+1],
-		   enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
+//		   enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
 		   AACQuantInfo* quantInfo,               /* Quant info */
 		   int numberOfChannels)                 /* Number of channels */
 {
@@ -480,11 +481,11 @@
 					int maxSfb = quantInfo[leftChan].max_sfb;
 					int g,w,line_offset;
 					int startWindow,stopWindow;
-					w=0;
+//					w=0;
 
 					/* Perform sum and differencing on bands in which ms_used flag */
 					/* has been set. */
-					line_offset=0;
+//					line_offset=0;
 					startWindow = 0;
 					for (g=0;g<numGroups;g++) {
 						int numWindows = quantInfo[leftChan].window_group_length[g];
--- a/ms.h
+++ b/ms.h
@@ -56,7 +56,7 @@
 			  CH_PSYCH_OUTPUT_LONG p_chpo_long[],
 			  CH_PSYCH_OUTPUT_SHORT p_chpo_short[][MAX_SHORT_WINDOWS],
 			  int sfb_width_table[MAX_TIME_CHANNELS][MAX_SCFAC_BANDS],
-			  Ch_Info *channelInfo,                  /* Pointer to Ch_Info */
+//			  Ch_Info *channelInfo,                  /* Pointer to Ch_Info */
 			  enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
 			  AACQuantInfo* quantInfo,               /* Quant info */
 			  int use_ms,
@@ -66,9 +66,10 @@
 void MSEncodeSwitch(double *spectrum[MAX_TIME_CHANNELS],   /* array of pointers to spectral data */
 	      Ch_Info *channelInfo,                  /* Pointer to Ch_Info */
 	      int sfb_offset_table[][MAX_SCFAC_BANDS+1],
-	      enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
-	      AACQuantInfo* quantInfo,
-	      int numberOfChannels);                 /* Number of channels */
+//	      enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
+	      AACQuantInfo* quantInfo
+//	      ,int numberOfChannels
+              );                 /* Number of channels */
 
 void MSEncode(double *spectrum[MAX_TIME_CHANNELS],   /* array of pointers to spectral data */
 	      Ch_Info *channelInfo,                  /* Pointer to Ch_Info */
@@ -80,7 +81,7 @@
 void MSReconstruct(double *spectrum[MAX_TIME_CHANNELS],   /* array of pointers to spectral data */
 		   Ch_Info *channelInfo,                  /* Pointer to Ch_Info */
 		   int sfb_offset_table[][MAX_SCFAC_BANDS+1],
-		   enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
+//		   enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS], /* Block type */
 		   AACQuantInfo* quantInfo,               /* Quant info */
 		   int numberOfChannels);                 /* Number of channels */
 
--- a/nok_ltp_enc.c
+++ b/nok_ltp_enc.c
@@ -34,8 +34,8 @@
 /**************************************************************************
   Version Control Information			Method: CVS
   Identifiers:
-  $Revision: 1.9 $
-  $Date: 2000/02/28 08:19:03 $ (check in)
+  $Revision: 1.10 $
+  $Date: 2000/02/28 12:18:36 $ (check in)
   $Author: lenox $
   *************************************************************************/
 
@@ -198,7 +198,8 @@
 	case SHORT_LONG_WINDOW:
 		last_band = (num_of_sfb < NOK_MAX_LT_PRED_LONG_SFB) ? num_of_sfb : NOK_MAX_LT_PRED_LONG_SFB;
 
-		lt_status->delay[0] = estimate_delay (p_time_signal, lt_status->buffer, 2 * BLOCK_LEN_LONG);
+//		lt_status->delay[0] = estimate_delay (p_time_signal, lt_status->buffer, 2 * BLOCK_LEN_LONG);
+		lt_status->delay[0] = estimate_delay (p_time_signal, lt_status->buffer);
 
 //		fprintf(stderr, "(LTP) lag : %i ", lt_status->delay[0]);
 
--- a/nok_pitch.c
+++ b/nok_pitch.c
@@ -34,9 +34,9 @@
 /**************************************************************************
   Version Control Information			Method: CVS
   Identifiers:
-  $Revision: 1.6 $
-  $Date: 2000/02/08 07:47:59 $ (check in)
-  $Author: menno $
+  $Revision: 1.7 $
+  $Date: 2000/02/28 12:18:36 $ (check in)
+  $Author: lenox $
   *************************************************************************/
 
 
@@ -266,9 +266,9 @@
   *************************************************************************/
 
 int estimate_delay (double *sb_samples,
-					short *x_buffer,
-					int flen
-					)
+		    short *x_buffer
+//		    ,int flen
+		    )
 {
 	int i, j;
 	int delay;
@@ -304,7 +304,7 @@
 	for (i = 1; i < DELAY; i++)
 	{
 //NOK_LT_BLEN=4096
-		energy -= x_buffer[NOK_LT_BLEN - i] * x_buffer[NOK_LT_BLEN - i]; 
+		energy -= x_buffer[NOK_LT_BLEN - i] * x_buffer[NOK_LT_BLEN - i];
 		energy += x_buffer[NOK_LT_BLEN - i - 2048] * x_buffer[NOK_LT_BLEN - i - 2048]; //2048=j_max
 		corr[i] = corrtmp;
 		corr[i] -= x_buffer[NOK_LT_BLEN - i] * sb_samples[2047];
@@ -516,7 +516,7 @@
 	low = 1.0e+10;
 	for (i = 0; i < LPC; i++)
     {
-		dist = 0.0;
+//		dist = 0.0;
 		for (j = 0; j < CODESIZE; j++)
 		{
 			dist = (freq[i] - codebook[j]) * (freq[i] - codebook[j]);
--- a/nok_pitch.h
+++ b/nok_pitch.h
@@ -34,7 +34,8 @@
 extern void prediction (short *buffer, double *predicted_samples, double *weight,
                         int delay, int flen);
 
-extern int estimate_delay (double *sb_samples, short *x_buffer, int flen);
+//extern int estimate_delay (double *sb_samples, short *x_buffer, int flen);
+extern int estimate_delay (double *sb_samples, short *x_buffer);
 
 extern void pitch (double *sb_samples, double *sb_samples_pred, short *x_buffer,
                    int *ltp_coef, int delay, int flen);
--- a/psych.c
+++ b/psych.c
@@ -52,9 +52,9 @@
 
 Source file:
 
-$Id: psych.c,v 1.51 2000/02/24 18:53:15 menno Exp $
-$Id: psych.c,v 1.51 2000/02/24 18:53:15 menno Exp $
-$Id: psych.c,v 1.51 2000/02/24 18:53:15 menno Exp $
+$Id: psych.c,v 1.52 2000/02/28 12:18:36 lenox Exp $
+$Id: psych.c,v 1.52 2000/02/28 12:18:36 lenox Exp $
+$Id: psych.c,v 1.52 2000/02/28 12:18:36 lenox Exp $
 
 **********************************************************************/
 
@@ -82,7 +82,7 @@
 	}, { 11025, 43, 15,
 		{
 			8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 
-			12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24, 
+			12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24,
 			24, 28, 28, 32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64, 64
 		}, {
 			4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 20
@@ -132,7 +132,7 @@
 		{
 			4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  8,  8,  8,  8,  8,  8,  8, 
 			12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28, 32, 32, 32, 32, 32, 32,
-			32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 96 
+			32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 96
 		}, {
 			4,  4,  4,  4,  4,  8,  8,  8, 12, 12, 12, 16, 16, 16 
 		}
@@ -291,12 +291,12 @@
 	part_tbl_long->len = crit_bands+1;
 //	printf("%d %d\t",part_tbl_long->len, part_tbl_long->w_high[crit_bands]);
 
-	cbound /= 3;
+//	cbound /= 3;
 	part_tbl_short->sampling_rate = (int)sampling_rate;
 	part_tbl_short->w_low[0] = 0;
 	part_tbl_short->w_high[0] = 0;
 	part_tbl_short->width[0] = 1;
-    prev_cbound = 0;
+        prev_cbound = 0;
 	crit_bands = 0;
 	for(j = 1; j <= cbands; j++)
 	{
@@ -474,8 +474,8 @@
 			   int    no_of_chan,         /* no of audio channels */
 			   double *p_time_signal[],
 			   enum WINDOW_TYPE block_type[],
-			   int qcSelect,
-			   int frameLength,
+//			   int qcSelect,
+//			   int frameLength,
 			   /* output */
 			   CH_PSYCH_OUTPUT_LONG p_chpo_long[],
 			   CH_PSYCH_OUTPUT_SHORT p_chpo_short[][MAX_SHORT_WINDOWS]
@@ -515,8 +515,10 @@
 			psy_step1(p_time_signal,sample, no_of_chan);
 			psy_step2(&sample[no_of_chan], &psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan], &fft_tbl_long, 
 				&fft_tbl_short, ch);
-			psy_step3(&psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan], &psy_var_long, &psy_var_short, ch);
-			psy_step4(&psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan], &psy_var_long, &psy_var_short, ch);
+//			psy_step3(&psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan], &psy_var_long, &psy_var_short, ch);
+//			psy_step4(&psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan], &psy_var_long, &psy_var_short, ch);
+			psy_step3(&psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan], &psy_var_long, &psy_var_short);
+			psy_step4(&psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan], &psy_var_long, &psy_var_short);
 		} else if (no_of_chan == 2) {
 			int w, l;
 			psy_stvar_long[2].p_fft += BLOCK_LEN_LONG;
@@ -560,7 +562,8 @@
 		}
 
 		psy_step5(&part_tbl_long, &part_tbl_short, &psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan],
-			&psy_var_long, &psy_var_short, ch);
+//			&psy_var_long, &psy_var_short, ch);
+			&psy_var_long, &psy_var_short);
 		psy_step6(&part_tbl_long, &part_tbl_short, &psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan],
 			&psy_var_long, &psy_var_short);
 
@@ -582,16 +585,21 @@
 		psy_step8(&part_tbl_long, &part_tbl_short, &psy_var_long, &psy_var_short);
 		psy_step9(&part_tbl_long, &part_tbl_short, &psy_var_long, &psy_var_short);
 		psy_step10(&part_tbl_long, &part_tbl_short, &psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan], 
-			&psy_var_long, &psy_var_short, ch);
+//			&psy_var_long, &psy_var_short, ch);
+			&psy_var_long, &psy_var_short);
 		psy_step11andahalf(&part_tbl_long, &part_tbl_short, psy_stvar_long, psy_stvar_short, no_of_chan);
-		psy_step11(&part_tbl_long, &part_tbl_short, &psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan], ch);
-		psy_step12(&part_tbl_long, &part_tbl_short, &psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan], 
-			&psy_var_long, &psy_var_short, ch);
-		psy_step13(&psy_var_long, block_type, ch);
+//		psy_step11(&part_tbl_long, &part_tbl_short, &psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan], ch);
+		psy_step11(&part_tbl_long, &part_tbl_short, &psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan]);
+//		psy_step12(&part_tbl_long, &part_tbl_short, &psy_stvar_long[no_of_chan], &psy_stvar_short[no_of_chan],
+//			&psy_var_long, &psy_var_short, ch);
+		psy_step12(&part_tbl_long, &psy_stvar_long[no_of_chan], &psy_var_long);
+//		psy_step13(&psy_var_long, block_type, ch);
+		psy_step13(&psy_var_long, block_type);
 		psy_step14(p_sri, &part_tbl_long, &part_tbl_short, &psy_stvar_long[no_of_chan],
-			&psy_stvar_short[no_of_chan], &psy_var_long, &psy_var_short, ch);
+//			&psy_stvar_short[no_of_chan], &psy_var_long, &psy_var_short, ch);
+			&psy_stvar_short[no_of_chan], &psy_var_long, &psy_var_short);
 		psy_step15(psy_stvar_long[no_of_chan].use_ms, psy_stvar_short[no_of_chan].use_ms, p_sri, &psy_stvar_long[0], &psy_stvar_short[0], &psy_var_long, &psy_var_short, no_of_chan);
-	}	
+	}
 
 	{
 		int i;
@@ -714,8 +722,8 @@
 void psy_step3(PSY_STATVARIABLE_LONG *psy_stvar_long,
                PSY_STATVARIABLE_SHORT *psy_stvar_short,
                PSY_VARIABLE_LONG *psy_var_long,
-               PSY_VARIABLE_SHORT *psy_var_short,
-               int ch
+               PSY_VARIABLE_SHORT *psy_var_short
+//               ,int ch
 	       )
 {
     int w,i;
@@ -760,8 +768,8 @@
 void psy_step4(PSY_STATVARIABLE_LONG *psy_stvar_long,
                PSY_STATVARIABLE_SHORT *psy_stvar_short,
 	       PSY_VARIABLE_LONG *psy_var_long,
-	       PSY_VARIABLE_SHORT *psy_var_short,
-	       int ch
+	       PSY_VARIABLE_SHORT *psy_var_short
+//	       ,int ch
 	       )
 {
     int w,i;
@@ -820,13 +828,13 @@
 	}
 }
 
-void psy_step5(PARTITION_TABLE_LONG *part_tbl_long, 
-			   PARTITION_TABLE_SHORT *part_tbl_short, 
+void psy_step5(PARTITION_TABLE_LONG *part_tbl_long,
+			   PARTITION_TABLE_SHORT *part_tbl_short,
 			   PSY_STATVARIABLE_LONG *psy_stvar_long,
-               PSY_STATVARIABLE_SHORT *psy_stvar_short,
-			   PSY_VARIABLE_LONG *psy_var_long, 
-			   PSY_VARIABLE_SHORT *psy_var_short,
-			   int ch
+                           PSY_STATVARIABLE_SHORT *psy_stvar_short,
+			   PSY_VARIABLE_LONG *psy_var_long,
+			   PSY_VARIABLE_SHORT *psy_var_short
+//			   ,int ch
 			   )
 {
     int b,w,i;
@@ -854,7 +862,7 @@
 
 			for(w = part_tbl_short->w_low[b]; w <= part_tbl_short->w_high[b]; w++){
 				psy_var_short->e[i][b] += psy_sqr(psy_stvar_short->fft_r[i][w]);
-				tmp_cb += psy_sqr(psy_stvar_short->fft_r[i][w]) * psy_var_short->c[i][w]; 
+				tmp_cb += psy_sqr(psy_stvar_short->fft_r[i][w]) * psy_var_short->c[i][w];
 			}
 
 			psy_var_short->c[i][b] = tmp_cb;
@@ -1005,15 +1013,15 @@
 
 void psy_step10(PARTITION_TABLE_LONG *part_tbl_long,
 		PARTITION_TABLE_SHORT *part_tbl_short,
-		PSY_STATVARIABLE_LONG *psy_stvar_long, 
-		PSY_STATVARIABLE_SHORT *psy_stvar_short, 
-		PSY_VARIABLE_LONG *psy_var_long, 
-		PSY_VARIABLE_SHORT *psy_var_short,
-		int ch
+		PSY_STATVARIABLE_LONG *psy_stvar_long,
+		PSY_STATVARIABLE_SHORT *psy_stvar_short,
+		PSY_VARIABLE_LONG *psy_var_long,
+		PSY_VARIABLE_SHORT *psy_var_short
+//		,int ch
 		)
 {
     int b,i;
-    
+
     psy_stvar_long->p_nb += NPART_LONG;
 
     if( psy_stvar_long->p_nb == NPART_LONG*2 ) psy_stvar_long->p_nb = 0;
@@ -1036,8 +1044,8 @@
 void psy_step11(PARTITION_TABLE_LONG *part_tbl_long, 
 		PARTITION_TABLE_SHORT *part_tbl_short, 
 		PSY_STATVARIABLE_LONG *psy_stvar_long, 
-		PSY_STATVARIABLE_SHORT *psy_stvar_short, 
-		int ch
+		PSY_STATVARIABLE_SHORT *psy_stvar_short
+//		,int ch
 		)
 {
     int b,i;
@@ -1168,14 +1176,15 @@
 }
 
 
-void psy_step12(PARTITION_TABLE_LONG *part_tbl_long, 
-				PARTITION_TABLE_SHORT *part_tbl_short, 
-				PSY_STATVARIABLE_LONG *psy_stvar_long, 
-				PSY_STATVARIABLE_SHORT *psy_stvar_short, 
-				PSY_VARIABLE_LONG *psy_var_long, 
-				PSY_VARIABLE_SHORT *psy_var_short,
-				int ch
-				)
+void psy_step12(
+                PARTITION_TABLE_LONG *part_tbl_long,
+//		PARTITION_TABLE_SHORT *part_tbl_short,
+		PSY_STATVARIABLE_LONG *psy_stvar_long,
+//		PSY_STATVARIABLE_SHORT *psy_stvar_short,
+		PSY_VARIABLE_LONG *psy_var_long
+//		,PSY_VARIABLE_SHORT *psy_var_short
+//		,int ch
+		)
 {
 #if 0
 	int b,i,shb;
@@ -1207,7 +1216,7 @@
 	shb = 0;
 
 	/* tuned for t1.wav.  doesnt effect most other samples */
-	if (psy_var_long->pe > 4000) shb = 1; 
+	if (psy_var_long->pe > 4000) shb = 1;
 
 	/* big surge of energy - always use short blocks */
 	if (  mx > 45*mn) shb = 1;
@@ -1234,9 +1243,9 @@
 #endif
 }
 
-void psy_step13(PSY_VARIABLE_LONG *psy_var_long, 
-				enum WINDOW_TYPE *block_type,
-				int ch
+void psy_step13(PSY_VARIABLE_LONG *psy_var_long,
+				enum WINDOW_TYPE *block_type
+//				,int ch
 				)
 {
 #if 1
@@ -1251,19 +1260,19 @@
 }
 
 void psy_step14(SR_INFO *p_sri,
-				PARTITION_TABLE_LONG *part_tbl_long, 
+				PARTITION_TABLE_LONG *part_tbl_long,
 				PARTITION_TABLE_SHORT *part_tbl_short,
 				PSY_STATVARIABLE_LONG *psy_stvar_long,
-				PSY_STATVARIABLE_SHORT *psy_stvar_short, 
-				PSY_VARIABLE_LONG *psy_var_long, 
-				PSY_VARIABLE_SHORT *psy_var_short,
-				int ch
+				PSY_STATVARIABLE_SHORT *psy_stvar_short,
+				PSY_VARIABLE_LONG *psy_var_long,
+				PSY_VARIABLE_SHORT *psy_var_short
+//				,int ch
 				)
 {
     int b, n, w, i;
     int w_low, w_high;
     double thr, minthr;
-    
+
     w_high = 0;
     for(n = 0; n < p_sri->num_cb_long; n++){
 		w_low = w_high;
--- a/psych.h
+++ b/psych.h
@@ -192,8 +192,8 @@
   int    no_of_chan,         /* no of audio channels */
   double *p_time_signal[],
   enum WINDOW_TYPE block_type[],
-  int qcSelect,
-  int frameLength,
+//  int qcSelect,
+//  int frameLength,
   /* output */
   CH_PSYCH_OUTPUT_LONG p_chpo_long[],
   CH_PSYCH_OUTPUT_SHORT p_chpo_short[][MAX_SHORT_WINDOWS]
@@ -238,107 +238,109 @@
 void psy_step3(PSY_STATVARIABLE_LONG *psy_stvar_long, 
                PSY_STATVARIABLE_SHORT *psy_stvar_short, 
                PSY_VARIABLE_LONG *psy_var_long, 
-               PSY_VARIABLE_SHORT *psy_var_short, 
-               int ch
+               PSY_VARIABLE_SHORT *psy_var_short
+//               ,int ch
 	       );
 
 void psy_step4(PSY_STATVARIABLE_LONG *psy_stvar_long,
                PSY_STATVARIABLE_SHORT *psy_stvar_short,
-	       PSY_VARIABLE_LONG *psy_var_long, 
-	       PSY_VARIABLE_SHORT *psy_var_short,
-	       int ch
+	       PSY_VARIABLE_LONG *psy_var_long,
+	       PSY_VARIABLE_SHORT *psy_var_short
+//	       ,int ch
 	       );
 
-void psy_step5(PARTITION_TABLE_LONG *part_tbl_long, 
-			   PARTITION_TABLE_SHORT *part_tbl_short, 
+void psy_step5(PARTITION_TABLE_LONG *part_tbl_long,
+			   PARTITION_TABLE_SHORT *part_tbl_short,
 			   PSY_STATVARIABLE_LONG *psy_stvar_long,
-               PSY_STATVARIABLE_SHORT *psy_stvar_short,
-			   PSY_VARIABLE_LONG *psy_var_long, 
-			   PSY_VARIABLE_SHORT *psy_var_short,
-			   int ch
+                           PSY_STATVARIABLE_SHORT *psy_stvar_short,
+			   PSY_VARIABLE_LONG *psy_var_long,
+			   PSY_VARIABLE_SHORT *psy_var_short
+//			   ,int ch
 			   );
 
-void psy_step6_step1(void *inData);
+//void psy_step6_step1(void *inData);
 
-void psy_step6_step1(void *inData);
+//void psy_step6_step1(void *inData);
 
-void psy_step6(PARTITION_TABLE_LONG *part_tbl_long, 
-			   PARTITION_TABLE_SHORT *part_tbl_short, 
+void psy_step6(PARTITION_TABLE_LONG *part_tbl_long,
+			   PARTITION_TABLE_SHORT *part_tbl_short,
 			   PSY_STATVARIABLE_LONG *psy_stvar_long,
-               PSY_STATVARIABLE_SHORT *psy_stvar_short,
-			   PSY_VARIABLE_LONG *psy_var_long, 
+                           PSY_STATVARIABLE_SHORT *psy_stvar_short,
+			   PSY_VARIABLE_LONG *psy_var_long,
 			   PSY_VARIABLE_SHORT *psy_var_short
 			   );
 
-void psy_step7(PARTITION_TABLE_LONG *part_tbl_long, 
-	       PARTITION_TABLE_SHORT *part_tbl_short, 
-	       PSY_VARIABLE_LONG *psy_var_long, 
+void psy_step7(PARTITION_TABLE_LONG *part_tbl_long,
+	       PARTITION_TABLE_SHORT *part_tbl_short,
+	       PSY_VARIABLE_LONG *psy_var_long,
 	       PSY_VARIABLE_SHORT *psy_var_short
 	       );
 
 void psy_step8(PARTITION_TABLE_LONG *part_tbl_long,
 	       PARTITION_TABLE_SHORT *part_tbl_short,
-	       PSY_VARIABLE_LONG *psy_var_long, 
+	       PSY_VARIABLE_LONG *psy_var_long,
 	       PSY_VARIABLE_SHORT *psy_var_short
 	       );
 
 void psy_step9(PARTITION_TABLE_LONG *part_tbl_long,
 	       PARTITION_TABLE_SHORT *part_tbl_short,
-	       PSY_VARIABLE_LONG *psy_var_long, 
+	       PSY_VARIABLE_LONG *psy_var_long,
 	       PSY_VARIABLE_SHORT *psy_var_short
 	       );
 
 void psy_step10(PARTITION_TABLE_LONG *part_tbl_long,
 		PARTITION_TABLE_SHORT *part_tbl_short,
-		PSY_STATVARIABLE_LONG *psy_stvar_long, 
-		PSY_STATVARIABLE_SHORT *psy_stvar_short, 
-		PSY_VARIABLE_LONG *psy_var_long, 
-		PSY_VARIABLE_SHORT *psy_var_short,
-		int ch /* ch */
+		PSY_STATVARIABLE_LONG *psy_stvar_long,
+		PSY_STATVARIABLE_SHORT *psy_stvar_short,
+		PSY_VARIABLE_LONG *psy_var_long,
+		PSY_VARIABLE_SHORT *psy_var_short
+//		,int ch
 		);
 
-void psy_step11(PARTITION_TABLE_LONG *part_tbl_long, 
-		PARTITION_TABLE_SHORT *part_tbl_short, 
-		PSY_STATVARIABLE_LONG *psy_stvar_long, 
-		PSY_STATVARIABLE_SHORT *psy_stvar_short, 
-		int ch
+void psy_step11(PARTITION_TABLE_LONG *part_tbl_long,
+		PARTITION_TABLE_SHORT *part_tbl_short,
+		PSY_STATVARIABLE_LONG *psy_stvar_long,
+		PSY_STATVARIABLE_SHORT *psy_stvar_short
+//		,int ch
 		);
 
-void psy_step11andahalf(PARTITION_TABLE_LONG *part_tbl_long, 
-						PARTITION_TABLE_SHORT *part_tbl_short, 
-						PSY_STATVARIABLE_LONG *psy_stvar_long, 
-						PSY_STATVARIABLE_SHORT *psy_stvar_short, 
+void psy_step11andahalf(PARTITION_TABLE_LONG *part_tbl_long,
+						PARTITION_TABLE_SHORT *part_tbl_short,
+						PSY_STATVARIABLE_LONG *psy_stvar_long,
+						PSY_STATVARIABLE_SHORT *psy_stvar_short,
 						int ch);
 
-void psy_step12(PARTITION_TABLE_LONG *part_tbl_long, 
-		PARTITION_TABLE_SHORT *part_tbl_short, 
-		PSY_STATVARIABLE_LONG *psy_stvar_long, 
-		PSY_STATVARIABLE_SHORT *psy_stvar_short, 
-		PSY_VARIABLE_LONG *psy_var_long, 
-		PSY_VARIABLE_SHORT *psy_var_short,
-		int ch
+void psy_step12(
+                PARTITION_TABLE_LONG *part_tbl_long,
+//		PARTITION_TABLE_SHORT *part_tbl_short,
+		PSY_STATVARIABLE_LONG *psy_stvar_long,
+//		PSY_STATVARIABLE_SHORT *psy_stvar_short,
+		PSY_VARIABLE_LONG *psy_var_long
+//		,PSY_VARIABLE_SHORT *psy_var_short
+//		,int ch
 		);
 
-void psy_step13(PSY_VARIABLE_LONG *psy_var_long, 
-		enum WINDOW_TYPE *block_type,
-		int ch
+void psy_step13(PSY_VARIABLE_LONG *psy_var_long,
+		enum WINDOW_TYPE *block_type
+//		,int ch
 		);
 
 void psy_step14(SR_INFO *p_sri,
-		PARTITION_TABLE_LONG *part_tbl_long, 
-		PARTITION_TABLE_SHORT *part_tbl_short, 
-		PSY_STATVARIABLE_LONG *psy_stvar_long, 
-		PSY_STATVARIABLE_SHORT *psy_stvar_short, 
-		PSY_VARIABLE_LONG *psy_var_long, 
-		PSY_VARIABLE_SHORT *psy_var_short,
-		int ch);
+		PARTITION_TABLE_LONG *part_tbl_long,
+		PARTITION_TABLE_SHORT *part_tbl_short,
+		PSY_STATVARIABLE_LONG *psy_stvar_long,
+		PSY_STATVARIABLE_SHORT *psy_stvar_short,
+		PSY_VARIABLE_LONG *psy_var_long,
+		PSY_VARIABLE_SHORT *psy_var_short
+//		,int ch
+                );
 
 void psy_step15(int use_ms_l[NSFB_LONG],
 				int use_ms_s[MAX_SHORT_WINDOWS][NSFB_SHORT],
 				SR_INFO *p_sri,
-				PSY_STATVARIABLE_LONG *psy_stvar_long, 
-				PSY_STATVARIABLE_SHORT *psy_stvar_short, 
-				PSY_VARIABLE_LONG *psy_var_long, 
+				PSY_STATVARIABLE_LONG *psy_stvar_long,
+				PSY_STATVARIABLE_SHORT *psy_stvar_short,
+				PSY_VARIABLE_LONG *psy_var_long,
 				PSY_VARIABLE_SHORT *psy_var_short,
 				int ch
 				);
--- a/tns.c
+++ b/tns.c
@@ -383,8 +383,8 @@
 
 	/* Set up pointers to current and last iteration */ 
 	/* predictor coefficients.						 */
-	aPtr = aArray1;
-	aLastPtr = aArray2;
+//	aPtr = aArray1;
+//	aLastPtr = aArray2;
 	/* If there is no signal energy, return */
 	if (!signal) {
 		kArray[0]=1.0;