annotate tremor/window.c @ 27404:778fac8c186f

Add separate variables for CFLAGS that are specific to internal libraries and only add them to CFLAGS when compiling objects from those libraries.
author diego
date Thu, 07 Aug 2008 21:46:06 +0000
parents 8631a3803289
children e83eef58b30a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14280
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
1 /********************************************************************
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
2 * *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
4 * *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
8 * *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
11 * *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
12 ********************************************************************
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
13
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
14 function: window functions
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
15
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
16 ********************************************************************/
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
17
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
18 #include <stdlib.h>
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
19 #include <math.h>
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
20 #include "os.h"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
21 #include "misc.h"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
22 #include "window.h"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
23 #include "window_lookup.h"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
24
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
25 const void *_vorbis_window(int type, int left){
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
26
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
27 switch(type){
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
28 case 0:
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
29
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
30 switch(left){
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
31 case 32:
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
32 return vwin64;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
33 case 64:
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
34 return vwin128;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
35 case 128:
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
36 return vwin256;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
37 case 256:
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
38 return vwin512;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
39 case 512:
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
40 return vwin1024;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
41 case 1024:
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
42 return vwin2048;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
43 case 2048:
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
44 return vwin4096;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
45 case 4096:
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
46 return vwin8192;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
47 default:
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
48 return(0);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
49 }
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
50 break;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
51 default:
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
52 return(0);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
53 }
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
54 }
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
55
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
56 void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
57 long *blocksizes,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
58 int lW,int W,int nW){
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
59
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
60 LOOKUP_T *window[2]={window_p[0],window_p[1]};
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
61 long n=blocksizes[W];
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
62 long ln=blocksizes[lW];
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
63 long rn=blocksizes[nW];
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
64
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
65 long leftbegin=n/4-ln/4;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
66 long leftend=leftbegin+ln/2;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
67
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
68 long rightbegin=n/2+n/4-rn/4;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
69 long rightend=rightbegin+rn/2;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
70
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
71 int i,p;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
72
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
73 for(i=0;i<leftbegin;i++)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
74 d[i]=0;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
75
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
76 for(p=0;i<leftend;i++,p++)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
77 d[i]=MULT31(d[i],window[lW][p]);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
78
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
79 for(i=rightbegin,p=rn/2-1;i<rightend;i++,p--)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
80 d[i]=MULT31(d[i],window[nW][p]);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
81
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
82 for(;i<n;i++)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
83 d[i]=0;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
84 }