shithub: aacenc

Download patch

ref: 997d4237dc989169ddbe9001b6531e139b4ccf83
parent: 5bc8ca83006b23643cbbe9aa26480079310c009e
author: menno <menno>
date: Thu Dec 16 14:39:15 EST 1999

Serious bugfix in psych.c and removed all global statics, they are just normal global variables now.

--- a/aac_back_pred.c
+++ b/aac_back_pred.c
@@ -61,13 +61,13 @@
 #include "aac_back_pred.h"
 
 
-static int psy_init_mc[MAX_TIME_CHANNELS];
-static double dr_mc[MAX_TIME_CHANNELS][LPC+1][FLEN_LONG/2],e_mc[MAX_TIME_CHANNELS][LPC+1+1][FLEN_LONG/2];
-static double K_mc[MAX_TIME_CHANNELS][LPC+1][FLEN_LONG/2], R_mc[MAX_TIME_CHANNELS][LPC+1][FLEN_LONG/2];
-static double VAR_mc[MAX_TIME_CHANNELS][LPC+1][FLEN_LONG/2], KOR_mc[MAX_TIME_CHANNELS][LPC+1][FLEN_LONG/2];
-static double sb_samples_pred_mc[MAX_TIME_CHANNELS][FLEN_LONG/2];
-static int thisLineNeedsResetting_mc[MAX_TIME_CHANNELS][FLEN_LONG/2];
-static int reset_count_mc[MAX_TIME_CHANNELS];
+int psy_init_mc[MAX_TIME_CHANNELS];
+double dr_mc[MAX_TIME_CHANNELS][LPC+1][FLEN_LONG/2],e_mc[MAX_TIME_CHANNELS][LPC+1+1][FLEN_LONG/2];
+double K_mc[MAX_TIME_CHANNELS][LPC+1][FLEN_LONG/2], R_mc[MAX_TIME_CHANNELS][LPC+1][FLEN_LONG/2];
+double VAR_mc[MAX_TIME_CHANNELS][LPC+1][FLEN_LONG/2], KOR_mc[MAX_TIME_CHANNELS][LPC+1][FLEN_LONG/2];
+double sb_samples_pred_mc[MAX_TIME_CHANNELS][FLEN_LONG/2];
+int thisLineNeedsResetting_mc[MAX_TIME_CHANNELS][FLEN_LONG/2];
+int reset_count_mc[MAX_TIME_CHANNELS];
 
 void PredInit()
 {
--- a/aac_qc.c
+++ b/aac_qc.c
@@ -48,9 +48,9 @@
 		end   = quantInfo->sfb_offset[sfb+1];
 		ATH[sfb]=1e99;
 		for (i=start ; i < end; i++) {
-//			if (quantInfo->block_type==ONLY_SHORT_WINDOW)
-//				ATH_f = ATHformula(samp_freq*i/(2*128)); /* freq in kHz */
-//			else
+			if (quantInfo->block_type==ONLY_SHORT_WINDOW)
+				ATH_f = ATHformula(samp_freq*i/(2*128)); /* freq in kHz */
+			else
 				ATH_f = ATHformula(samp_freq*i/(2*1024)); /* freq in kHz */
 			ATH[sfb]=min(ATH[sfb],ATH_f);
 		}
@@ -190,7 +190,9 @@
 			double fac  = pow(diff/max_sb_noise,4);
 			error_energy[sb] += diff*fac;
 		}
-		error_energy[sb] = 10*log10(max(0.001,error_energy[sb] / allowed_dist[sb]));
+		if (allowed_dist[sb] != 0.0)
+			error_energy[sb] = 10*log10(error_energy[sb] / allowed_dist[sb]);
+		else error_energy[sb] = 0;
 		if (error_energy[sb] > 0) {
 			over++;
 			*over_noise += error_energy[sb];
@@ -243,6 +245,15 @@
 #if 1
 	better =   (over_noise <  best_over_noise)
 		|| ((over_noise == best_over_noise)&&(tot_noise < best_tot_noise));
+#if 0
+	better = (over_noise < best_over_noise)
+		||( (over_noise == best_over_noise)
+		&&( (max_noise < best_max_noise)
+		||( (max_noise == best_max_noise)
+		&&(tot_noise <= best_tot_noise)
+		)
+		) 
+		);
 #endif
 #endif
 #endif
@@ -249,6 +260,7 @@
 #endif
 #endif
 #endif
+#endif
 
 	return better;
 }
@@ -346,6 +358,7 @@
 	int over = 0, best_over = 100, better;
 	int sfb_overflow, amp_over;
 	int best_common_scalefac;
+	int prev_scfac, prev_is_scfac;
 	double noise_thresh;
 	double over_noise, tot_noise, max_noise;
 	double noise[SFB_NUM_MAX];
@@ -422,7 +435,8 @@
 					int bandNum = (w+windowOffset)*maxBand + b;
 					sum += energy[MONO_CHAN][bandNum];
 				}
-				energy[MONO_CHAN][sfb_index++]=sum;
+				energy[MONO_CHAN][sfb_index] = sum;
+				sfb_index++;
 			}
 			windowOffset += numWindowsThisGroup;
 		}
@@ -432,6 +446,8 @@
 	for(sb = 0; sb < quantInfo->nr_of_sfb; sb++) {
 		if (10*log10(energy[MONO_CHAN][sb]+1e-15)>70) {
 			allowed_dist[MONO_CHAN][sb] = energy[MONO_CHAN][sb] * SigMaskRatio[sb];
+//			if (allowed_dist[MONO_CHAN][sb] < ATH[sb])
+//				allowed_dist[MONO_CHAN][sb] = ATH[sb];
 //			printf("%d\t\t%.3f\n", sb, SigMaskRatio[sb]);
 		} else {
 			allowed_dist[MONO_CHAN][sb] = energy[MONO_CHAN][sb] * 1.1;
@@ -567,16 +583,24 @@
 					sfb_overflow = 0;
 			}
 		}
-		for (sb = 0; sb < quantInfo->nr_of_sfb-1; sb++) {
-			if (scale_factor[sb] > (scale_factor[sb+1]+60))
-				sfb_overflow = 1;
-			if (scale_factor[sb] < (scale_factor[sb+1]-60))
-				sfb_overflow = 1;
+
+		prev_is_scfac = 0;
+		prev_scfac = store_common_scalefac;
+		for (sb = 0; sb < quantInfo->nr_of_sfb; sb++) {
+			if (ch_info->is_info.is_used[sb]) {
+				if (prev_is_scfac >= (scale_factor[sb]+60))
+					sfb_overflow = 1;
+				if (prev_is_scfac <= (scale_factor[sb]-60))
+					sfb_overflow = 1;
+				prev_is_scfac = scale_factor[sb];
+			} else {
+				if (prev_scfac >= (scale_factor[sb]+60))
+					sfb_overflow = 1;
+				if (prev_scfac <= (scale_factor[sb]-60))
+					sfb_overflow = 1;
+				prev_scfac = scale_factor[sb];
+			}
 		}
-		if (scale_factor[quantInfo->nr_of_sfb-1] > (scale_factor[quantInfo->nr_of_sfb-2]+60))
-			sfb_overflow = 1;
-		if (scale_factor[quantInfo->nr_of_sfb-1] < (scale_factor[quantInfo->nr_of_sfb-2]-60))
-			sfb_overflow = 1;
 
 		if ((amp_over == 0)||(over == 0)||(amp_over==quantInfo->nr_of_sfb)||(sfb_overflow))
 			break;
--- a/aac_se_enc.c
+++ b/aac_se_enc.c
@@ -340,7 +340,6 @@
 {
 	int i, bit_count = 0;
 
-	/* Currently write no pulse data present */
 	if (quantInfo->pulseInfo.pulse_data_present) {
 		if (writeFlag) {
 			BsPutBit(fixed_stream,1,LEN_PULSE_PRES);  /* no pulse_data_present */
--- a/enc_tf.c
+++ b/enc_tf.c
@@ -30,25 +30,25 @@
 int max_sfb_l[] = { 49, 49, 47, 48, 49, 51, 47, 47, 43, 43, 43, 40 };
 
 
-static int     block_size_samples = 1024;  /* nr of samples per block in one! audio channel */
-static int     short_win_in_long  = 8;
-static int     max_ch;    /* no of of audio channels */
-static double *spectral_line_vector[MAX_TIME_CHANNELS];
-static double *reconstructed_spectrum[MAX_TIME_CHANNELS];
-static double *overlap_buffer[MAX_TIME_CHANNELS];
-static double *DTimeSigBuf[MAX_TIME_CHANNELS];
-static double *DTimeSigLookAheadBuf[MAX_TIME_CHANNELS+2];
+int     block_size_samples = 1024;  /* nr of samples per block in one! audio channel */
+int     short_win_in_long  = 8;
+int     max_ch;    /* no of of audio channels */
+double *spectral_line_vector[MAX_TIME_CHANNELS];
+double *reconstructed_spectrum[MAX_TIME_CHANNELS];
+double *overlap_buffer[MAX_TIME_CHANNELS];
+double *DTimeSigBuf[MAX_TIME_CHANNELS];
+double *DTimeSigLookAheadBuf[MAX_TIME_CHANNELS+2];
 
 /* static variables used by the T/F mapping */
-static enum QC_MOD_SELECT qc_select = AAC_QC;                   /* later f(encPara) */
-static enum AAC_PROFILE profile = MAIN;
-static enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS];
-static enum WINDOW_TYPE desired_block_type[MAX_TIME_CHANNELS];
-static enum WINDOW_TYPE next_desired_block_type[MAX_TIME_CHANNELS+2];
+enum QC_MOD_SELECT qc_select = AAC_QC;                   /* later f(encPara) */
+enum AAC_PROFILE profile = MAIN;
+enum WINDOW_TYPE block_type[MAX_TIME_CHANNELS];
+enum WINDOW_TYPE desired_block_type[MAX_TIME_CHANNELS];
+enum WINDOW_TYPE next_desired_block_type[MAX_TIME_CHANNELS+2];
 
 /* Additional variables for AAC */
-static int aacAllowScalefacs = 1;              /* Allow AAC scalefactors to be nonconstant */
-static TNS_INFO tnsInfo[MAX_TIME_CHANNELS];
+int aacAllowScalefacs = 1;              /* Allow AAC scalefactors to be nonconstant */
+TNS_INFO tnsInfo[MAX_TIME_CHANNELS];
 
 AACQuantInfo quantInfo[MAX_TIME_CHANNELS];               /* Info structure for AAC quantization and coding */
 
@@ -56,7 +56,7 @@
 Ch_Info channelInfo[MAX_TIME_CHANNELS];
 
 /* AAC shorter windows 960-480-120 */
-static int useShortWindows=0;  /* don't use shorter windows */
+int useShortWindows=0;  /* don't use shorter windows */
 
 // TEMPORARY HACK
 
@@ -222,10 +222,10 @@
 	CH_PSYCH_OUTPUT_LONG chpo_long[MAX_TIME_CHANNELS+2];
 	CH_PSYCH_OUTPUT_SHORT chpo_short[MAX_TIME_CHANNELS+2][MAX_SHORT_WINDOWS];
 
-	memset(chpo_long,0,sizeof(CH_PSYCH_OUTPUT_LONG)*(MAX_TIME_CHANNELS+2));
-	memset(chpo_short,0,sizeof(CH_PSYCH_OUTPUT_SHORT)*(MAX_TIME_CHANNELS+2)*MAX_SHORT_WINDOWS);
-	memset(p_ratio_long,0,sizeof(double)*(MAX_TIME_CHANNELS)*MAX_SCFAC_BANDS);
-	memset(p_ratio_short,0,sizeof(double)*(MAX_TIME_CHANNELS)*MAX_SCFAC_BANDS);
+//	memset(chpo_long,0,sizeof(CH_PSYCH_OUTPUT_LONG)*(MAX_TIME_CHANNELS+2));
+//	memset(chpo_short,0,sizeof(CH_PSYCH_OUTPUT_SHORT)*(MAX_TIME_CHANNELS+2)*MAX_SHORT_WINDOWS);
+//	memset(p_ratio_long,0,sizeof(double)*(MAX_TIME_CHANNELS)*MAX_SCFAC_BANDS);
+//	memset(p_ratio_short,0,sizeof(double)*(MAX_TIME_CHANNELS)*MAX_SCFAC_BANDS);
 
 	{ /* convert float input to double, which is the internal format */
 		/* store input data in look ahead buffer which may be necessary for the window switching decision */
@@ -412,25 +412,6 @@
 	*
 	******************************************************************************************************************************/
 
-//	if (as->use_MS) {
-		MSPreprocess(p_ratio_long, p_ratio_short, chpo_long, chpo_short,
-			channelInfo, block_type, quantInfo,max_ch);
-//	} else {
-//		int chanNum;
-//		for (chanNum=0;chanNum<max_ch;chanNum++) {
-//
-//			/* Save p_ratio from psychoacoustic model for next frame.  */
-//			/* Psycho model is using a look-ahead window for block switching */
-//			if (as->use_MS) {
-//				memcpy( (char*)p_ratio_long[chanNum], (char*)chpo_long[chanNum+2].p_ratio, (NSFB_LONG)*sizeof(double) );
-//				memcpy( (char*)p_ratio_short[chanNum],(char*)chpo_short[chanNum+2][0].p_ratio,(MAX_SHORT_WINDOWS*NSFB_SHORT)*sizeof(double) );
-//			} else {
-//				memcpy( (char*)p_ratio_long[chanNum], (char*)chpo_long[chanNum].p_ratio, (NSFB_LONG)*sizeof(double) );
-//				memcpy( (char*)p_ratio_short[chanNum],(char*)chpo_short[chanNum][0].p_ratio,(MAX_SHORT_WINDOWS*NSFB_SHORT)*sizeof(double) );
-//			}
-//		}
-//	}
-
 	{
 		int chanNum;
 		for (chanNum=0;chanNum<max_ch;chanNum++) {
@@ -437,22 +418,22 @@
 			switch( block_type[chanNum] ) {
 			case ONLY_LONG_WINDOW:
 				memcpy( (char*)sfb_width_table[chanNum], (char*)chpo_long[chanNum].cb_width, (NSFB_LONG+1)*sizeof(int) );
-				nr_of_sfb[chanNum] = 49; //chpo_long[chanNum].no_of_cb;
+				nr_of_sfb[chanNum] = chpo_long[chanNum].no_of_cb;
 				p_ratio[chanNum]   = p_ratio_long[chanNum];
 				break;
 			case LONG_SHORT_WINDOW:
 				memcpy( (char*)sfb_width_table[chanNum], (char*)chpo_long[chanNum].cb_width, (NSFB_LONG+1)*sizeof(int) );
-				nr_of_sfb[chanNum] = 49; //chpo_long[chanNum].no_of_cb;
+				nr_of_sfb[chanNum] = chpo_long[chanNum].no_of_cb;
 				p_ratio[chanNum]   = p_ratio_long[chanNum];
 				break;
 			case ONLY_SHORT_WINDOW:
 				memcpy( (char*)sfb_width_table[chanNum], (char*)chpo_short[chanNum][0].cb_width, (NSFB_SHORT+1)*sizeof(int) );
-				nr_of_sfb[chanNum] = 14; //chpo_short[chanNum][0].no_of_cb;
+				nr_of_sfb[chanNum] = chpo_short[chanNum][0].no_of_cb;
 				p_ratio[chanNum]   = p_ratio_short[chanNum];
 				break;
 			case SHORT_LONG_WINDOW:
 				memcpy( (char*)sfb_width_table[chanNum], (char*)chpo_long[chanNum].cb_width, (NSFB_LONG+1)*sizeof(int) );
-				nr_of_sfb[chanNum] = 49; //chpo_long[chanNum].no_of_cb;
+				nr_of_sfb[chanNum] = chpo_long[chanNum].no_of_cb;
 				p_ratio[chanNum]   = p_ratio_long[chanNum];
 				break;
 			}
@@ -461,6 +442,25 @@
 
 		MSEnergy(spectral_line_vector, energy, chpo_long, chpo_short,
 			  sfb_width_table, channelInfo, block_type, quantInfo, max_ch);
+
+//	if (as->use_MS) {
+		MSPreprocess(p_ratio_long, p_ratio_short, chpo_long, chpo_short,
+			channelInfo, block_type, quantInfo,max_ch);
+//	} else {
+//		int chanNum;
+//		for (chanNum=0;chanNum<max_ch;chanNum++) {
+//
+//			/* Save p_ratio from psychoacoustic model for next frame.  */
+//			/* Psycho model is using a look-ahead window for block switching */
+//			if (as->use_MS) {
+//				memcpy( (char*)p_ratio_long[chanNum], (char*)chpo_long[chanNum+2].p_ratio, (NSFB_LONG)*sizeof(double) );
+//				memcpy( (char*)p_ratio_short[chanNum],(char*)chpo_short[chanNum+2][0].p_ratio,(MAX_SHORT_WINDOWS*NSFB_SHORT)*sizeof(double) );
+//			} else {
+//				memcpy( (char*)p_ratio_long[chanNum], (char*)chpo_long[chanNum].p_ratio, (NSFB_LONG)*sizeof(double) );
+//				memcpy( (char*)p_ratio_short[chanNum],(char*)chpo_short[chanNum][0].p_ratio,(MAX_SHORT_WINDOWS*NSFB_SHORT)*sizeof(double) );
+//			}
+//		}
+//	}
 
 	{
 		int chanNum;   
--- a/imdct.c
+++ b/imdct.c
@@ -9,7 +9,7 @@
 
 #define DPI	3.14159265358979323846264338327950288
 
-static double zero = 0;
+double zero = 0;
 
 void vcopy( double src[], double dest[], int inc_src, int inc_dest, int vlen )
 {
--- a/psych.c
+++ b/psych.c
@@ -52,9 +52,9 @@
 
 Source file: 
 
-$Id: psych.c,v 1.3 1999/12/16 17:20:55 menno Exp $
-$Id: psych.c,v 1.3 1999/12/16 17:20:55 menno Exp $
-$Id: psych.c,v 1.3 1999/12/16 17:20:55 menno Exp $
+$Id: psych.c,v 1.4 1999/12/16 19:39:15 menno Exp $
+$Id: psych.c,v 1.4 1999/12/16 19:39:15 menno Exp $
+$Id: psych.c,v 1.4 1999/12/16 19:39:15 menno Exp $
 
 **********************************************************************/
 
@@ -66,7 +66,7 @@
 #include "psych.h"
 
 
-static SR_INFO sr_info_aac[MAX_SAMPLING_RATES+1] =
+SR_INFO sr_info_aac[MAX_SAMPLING_RATES+1] =
 {
   { 8000  },
   { 11025 },
@@ -117,7 +117,7 @@
 };
 
 /* added by T. Araki (1997.07.10) */
-static PARTITION_TABLE_LONG  part_tbl_long_all[MAX_SAMPLING_RATES+1] =
+PARTITION_TABLE_LONG  part_tbl_long_all[MAX_SAMPLING_RATES+1] =
 {
   { 8000  },
   { 11025 },
@@ -199,7 +199,7 @@
   { -1 }
 };
 
-static PARTITION_TABLE_SHORT  part_tbl_short_all[MAX_SAMPLING_RATES+1] =
+PARTITION_TABLE_SHORT  part_tbl_short_all[MAX_SAMPLING_RATES+1] =
 {
   { 8000  },
   { 11025 },
@@ -265,18 +265,18 @@
 /* added by T. Araki (1997.07.10) end */
 
 /* added by T. Araki (1997.10.16) */
-static double          sample[MAX_TIME_CHANNELS+2][BLOCK_LEN_LONG*2];
+double          sample[MAX_TIME_CHANNELS+2][BLOCK_LEN_LONG*2];
                                /* sample value */
 
-static FFT_TABLE_LONG    fft_tbl_long;  /* table for long fft */
-static FFT_TABLE_SHORT    fft_tbl_short;  /* table for short fft */
-static PARTITION_TABLE_LONG    *part_tbl_long;  
+FFT_TABLE_LONG    fft_tbl_long;  /* table for long fft */
+FFT_TABLE_SHORT    fft_tbl_short;  /* table for short fft */
+PARTITION_TABLE_LONG    *part_tbl_long;  
                                /* partition table for long block */
-static PARTITION_TABLE_SHORT    *part_tbl_short;
+PARTITION_TABLE_SHORT    *part_tbl_short;
                                /* partition table for short block */
-static PSY_STATVARIABLE_LONG    psy_stvar_long[MAX_TIME_CHANNELS+2];
+PSY_STATVARIABLE_LONG    psy_stvar_long[MAX_TIME_CHANNELS+2];
                                /* static variables for long block */
-static PSY_STATVARIABLE_SHORT    psy_stvar_short[MAX_TIME_CHANNELS+2];
+PSY_STATVARIABLE_SHORT    psy_stvar_short[MAX_TIME_CHANNELS+2];
                                /* static variables for short block */
 /* added by T. Araki (1997.10.16) end */
 
@@ -656,7 +656,7 @@
 		p_chpo_long[no_of_chan].cb_width  = p_sri->cb_width_long;
 		p_chpo_long[no_of_chan].no_of_cb = p_sri->num_cb_long;
 		if (no_of_chan == 1)
-			memcpy(p_chpo_long[no_of_chan].use_ms, use_ms_l, NPART_LONG*sizeof(int));
+			memcpy(p_chpo_long[no_of_chan].use_ms, use_ms_l, NSFB_LONG*sizeof(int));
 
 		for( i=0; i<MAX_SHORT_WINDOWS; i++ ) {
 			p_chpo_short[no_of_chan][i].p_ratio  = psy_stvar_short[no_of_chan].ismr[i];
@@ -663,7 +663,7 @@
 			p_chpo_short[no_of_chan][i].cb_width = p_sri->cb_width_short;
 			p_chpo_short[no_of_chan][i].no_of_cb = p_sri->num_cb_short;
 			if (no_of_chan == 1)
-				memcpy(p_chpo_short[no_of_chan][i].use_ms, use_ms_s[i], NPART_SHORT*sizeof(int));
+				memcpy(p_chpo_short[no_of_chan][i].use_ms, use_ms_s[i], NSFB_SHORT*sizeof(int));
 		}
 
 	}
--- a/tns.c
+++ b/tns.c
@@ -7,7 +7,7 @@
 /***********************************************/
 /* TNS Profile/Frequency Dependent Parameters  */
 /***********************************************/
-static unsigned long tnsSupportedSamplingRates[13] = 
+unsigned long tnsSupportedSamplingRates[13] = 
   {8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,0};
 
 /* Limit bands to > 1.5 kHz */
@@ -17,35 +17,35 @@
   { 10, 9, 8, 8, 5, 4, 3, 3, 2, 2, 1, 1 }; */
        
 /* Limit bands to > 2.0 kHz */
-static unsigned short tnsMinBandNumberLong[12] = 
+unsigned short tnsMinBandNumberLong[12] = 
   { 31, 30, 28, 24, 26, 25, 20, 17, 16, 15, 12, 11 };
-static unsigned short tnsMinBandNumberShort[12] = 
+unsigned short tnsMinBandNumberShort[12] = 
   { 12, 10, 10, 8, 6, 6, 4, 3, 3, 2, 2, 2 };
        
 /**************************************/
 /* Main/Low Profile TNS Parameters    */
 /**************************************/
-static unsigned short tnsMaxBandsLongMainLow[12] = 
+unsigned short tnsMaxBandsLongMainLow[12] = 
   { 39, 42, 42, 42, 46, 46, 51, 42, 40, 34, 31, 31 };
 
-static unsigned short tnsMaxBandsShortMainLow[12] = 
+unsigned short tnsMaxBandsShortMainLow[12] = 
   { 14, 14, 14, 14, 14, 14, 14, 14, 14, 10, 9, 9 };
 
-static unsigned short tnsMaxOrderLongMain = 20;
-static unsigned short tnsMaxOrderLongLow = 12;
-static unsigned short tnsMaxOrderShortMainLow = 7;
+unsigned short tnsMaxOrderLongMain = 20;
+unsigned short tnsMaxOrderLongLow = 12;
+unsigned short tnsMaxOrderShortMainLow = 7;
 
 /**************************************/
 /* SSR Profile TNS Parameters         */
 /**************************************/
-static unsigned short tnsMaxBandsLongSSR[12] = 
+unsigned short tnsMaxBandsLongSSR[12] = 
   { 19, 23, 23, 23, 29, 29, 26, 26, 26, 27, 28, 28 };
 
-static unsigned short tnsMaxBandsShortSSR[12] = 
+unsigned short tnsMaxBandsShortSSR[12] = 
   { 7, 8, 8, 8, 7, 7, 6, 6, 6, 7, 7, 7 };
 
-static unsigned short tnsMaxOrderLongSSR = 12;
-static unsigned short tnsMaxOrderShortSSR = 7;
+unsigned short tnsMaxOrderLongSSR = 12;
+unsigned short tnsMaxOrderShortSSR = 7;
 
 
 /*****************************************************/