summaryrefslogtreecommitdiff
path: root/audio/toolame/patches/patch-aa
blob: a0eb97ab7dda15ed2c9a60bc0ee6b5aa6fd2e16e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$NetBSD: patch-aa,v 1.1.1.1 2003/06/23 07:07:26 mrg Exp $

these patches correct invalid C code that declares variables after statements.

--- psycho_3.c.orig	2003-03-01 20:35:14.000000000 +1100
+++ psycho_3.c	2003-06-20 17:07:31.000000000 +1000
@@ -133,8 +133,8 @@ void psycho_3_fft(FLOAT sample[BLKSIZE],
   static FLOAT *window;
 
   if (!init) { /* calculate window function for the Fourier transform */
-    window = (FLOAT *) mem_alloc (sizeof (DFFT), "window");
     register FLOAT sqrt_8_over_3 = pow (8.0 / 3.0, 0.5);
+    window = (FLOAT *) mem_alloc (sizeof (DFFT), "window");
     for (i = 0; i < BLKSIZE; i++) {
       window[i] = sqrt_8_over_3 * 0.5 * (1 - cos (2.0 * PI * i / (BLKSIZE))) / BLKSIZE;
     }
@@ -441,12 +441,14 @@ void psycho_3_init(options *glopts) {
   psycho_3_init_add_db();
   
   /* For each spectral line calculate the bark and the ATH (in dB) */
+  {
   FLOAT sfreq = (FLOAT) s_freq[header->version][header->sampling_frequency] * 1000;
   for (i=1;i<HBLKSIZE; i++) {
     FLOAT freq = i * sfreq/BLKSIZE;
     bark[i] = freq2bark(freq);
     ath[i] = ATH_dB(freq,glopts->athlevel);
   }
+  }
   
   { /* Work out the critical bands
        Starting from line 0, all lines within 1 bark of the starting