Re: [MP3 ENCODER] Speeding up window_subband

2000-04-29 Thread Takehiro Tominaga

Hi, Naoki,

Your new code looks like very similar to my snapshot(but is not on the
net yet :p). It was mentioned in the first mail of
"the road to the next(v4.00?)" thread.

 "T" == Takehiro Tominaga [EMAIL PROTECTED] writes:

 3 new window subband code
   little bit faster

Uum, there's many people who optimize the same thing with the same way.

 "N" == Naoki Shibata [EMAIL PROTECTED] writes:

N Someone, please explain it.

Maybe I should explain it because that was written by me,
but I'm poor at English and have no time to ducumentation.

Wait till GW :)

% for not Japanese : GW is not Gateway, but Golden Week.
% in Japan, there are many national holidays in the first week of May,
% and it is called "golden week"
% so I will have a much time to hack.
--- 
Takehiro TOMINAGA // may the source be with you!
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )



[MP3 ENCODER] Speeding up window_subband

2000-04-28 Thread Naoki Shibata


  Hi all,

  The patch included in this mail speeds up old filter_subband(), and It
seems that same speed-up can be applied to current window_subband(). I
tried to understand how current window_subband() works, but I couldn't.
  Someone, please explain it.

  Naoki


*** filterbank.c~   Mon Nov  8 10:58:50 1999
--- filterbank.cSat Apr 29 13:23:56 2000
***
*** 208,213 
--- 208,305 
  /
  
  
+ void idct32(double a[])
+ {
+   /* returns sum_j=0^31 a[j]*cos(PI*j*(k+1/2)/32), 0=k32 */
+ 
+   static double costab[] = {
+ 0.5006029982351962726 ,0.74453627100229857749,0.553103896035421 
+,1.4841646163141661852,
+ 
+0.51544730992262455249,0.97256823786196078263,0.62250412303566482475,3.4076084184687189804,
+ 
+0.50547095989754364798,0.83934964541552681272,0.58293496820613388554,2.0577810099534108446,
+ 0.53104259108978413284,1.1694399334328846596 ,0.674808341455005678  
+,10.19000812354803287 ,
+ 0.5024192861881556782 
+,0.78815462345125020249,0.56694403481635768927,1.7224470982383341955,
+ 0.52249861493968885462,1.0606776859903470633 
+,0.64682178335999007679,5.1011486186891552563,
+ 
+0.50979557910415917998,0.89997622313641556513,0.60134488693504528634,2.5629154477415054814,
+ 0.54119610014619701222,1.3065629648763763537 ,0.70710678118654746172,
+   };
+ 
+   static unsigned char addtab[] = {
+ 1,29,31, 2,  1,25,27, 2,  1,21,23, 2,  1,17,19, 2,  
+ 1,13,15, 2,  1, 9,11, 2,  1, 5, 7, 2,  0, 3, 1, 
+ 1,27,31, 4,  1,26,30, 4,  1,19,23, 4,  1,18,22, 4,  
+ 1,11,15, 4,  1,10,14, 4,  0, 7, 3, 0, 6, 2, 
+ 1,23,31, 8,  1,22,30, 8,  1,21,29, 8,  1,20,28, 8,  
+ 0,15, 7, 0,14, 6, 0,13, 5, 0,12, 4, 
+ 0,31,15, 0,30,14, 0,29,13, 0,28,12, 
+ 0,27,11, 0,26,10, 0,25, 9, 0,24, 8, 
+   };
+ 
+   static unsigned char buttab[] = {
+ 15,31,30, 14,30,30, 13,29,30, 12,28,30, 
+ 11,27,30, 10,26,30,  9,25,30,  8,24,30, 
+  7,23,30,  6,22,30,  5,21,30,  4,20,30, 
+  3,19,30,  2,18,30,  1,17,30,  0,16,30, 
+ 23,15,29, 22,14,29, 21,13,29, 20,12,29, 
+ 19,11,29, 18,10,29, 17, 9,29, 16, 8,29, 
+  7,31,28,  6,30,28,  5,29,28,  4,28,28, 
+  3,27,28,  2,26,28,  1,25,28,  0,24,28, 
+ 27, 7,27, 26, 6,27, 25, 5,27, 24, 4,27, 
+ 19,15,26, 18,14,26, 17,13,26, 16,12,26, 
+ 11,23,25, 10,22,25,  9,21,25,  8,20,25, 
+  3,31,24,  2,30,24,  1,29,24,  0,28,24, 
+ 29, 3,23, 28, 2,23, 25, 7,22, 24, 6,22, 
+ 21,11,21, 20,10,21, 17,15,20, 16,14,20, 
+ 13,19,19, 12,18,19,  9,23,18,  8,22,18, 
+  5,27,17,  4,26,17,  1,31,16,  0,30,16, 
+ 30, 1,15, 28, 3,14, 26, 5,13, 24, 7,12, 
+ 22, 9,11, 20,11,10, 18,13, 9, 16,15, 8, 
+ 14,17, 7, 12,19, 6, 10,21, 5,  8,23, 4, 
+  6,25, 3,  4,27, 2,  2,29, 1,  0,31, 0, 
+   };
+ 
+   static unsigned char swaptab[] = {
+  1,16,  2, 8,  3,24,  5,20,
+  6,12,  7,28,  9,18, 11,26,
+ 13,22, 15,30, 19,25, 23,29,
+   };
+ 
+   int i;
+   unsigned char *p;
+ 
+   p = addtab;
+   for(i=0;i32;i++)
+ {
+   if (p[0]) {
+   a[p[2]] = -a[p[2]] - a[p[1]];
+   a[p[1]] += a[p[1] - p[3]];
+   p += 4;
+   } else {
+   a[p[1]] = -a[p[1]] - a[p[2]];
+   p += 3;
+   }
+ }
+ 
+   p = buttab;
+   for(i=0;i80;i++)
+ {
+   double xr;
+   xr = a[p[1]]*costab[p[2]];
+   a[p[1]] = (a[p[0]] - xr);
+   a[p[0]] = (a[p[0]] + xr);
+   p += 3;
+ }
+ 
+   p = swaptab;
+   for(i=0;i12;i++)
+ {
+   double xr;
+   xr = a[p[0]];
+   a[p[0]] = a[p[1]];
+   a[p[1]] = xr;
+   p += 2;
+ }
+ }
+ 
  void filter_subband(double z[64], double s[SBLIMIT]) {
  
 double yprime[32];
***
*** 217,222 
--- 309,315 
 
 double s0,s1;
  
+ #if 0
 if(!init) {
init=1;
for (i=0; i16; i++)  for (j=0; j32; j++)
***
*** 240,245 
--- 333,349 
   s[31-i] = s0-s1;
  
   }
+ #else
+   s[0] = z[16];
+ 
+   for(i=1;i=16;i++)
+ s[i] = z[i+16]+z[16-i];
+ 
+   for(i=17;i=31;i++)
+ s[i] = z[i+16]-z[80-i];
+ 
+   idct32(s);
+ #endif
  
 }
  


--
Naoki Shibata   e-mail: [EMAIL PROTECTED]

--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )