summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libtremor/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libtremor/window.c')
-rw-r--r--lib/rbcodec/codecs/libtremor/window.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libtremor/window.c b/lib/rbcodec/codecs/libtremor/window.c
new file mode 100644
index 0000000000..3bc947f0e5
--- /dev/null
+++ b/lib/rbcodec/codecs/libtremor/window.c
@@ -0,0 +1,82 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: window functions
15
16 ********************************************************************/
17
18#include "config-tremor.h"
19#include <string.h>
20#include <math.h>
21#include "os.h"
22#include "misc.h"
23#include "window.h"
24#include "window_lookup.h"
25
26const void *_vorbis_window(int type, int left){
27
28 switch(type){
29 case 0:
30
31 switch(left){
32 case 32:
33 return vwin64;
34 case 64:
35 return vwin128;
36 case 128:
37 return vwin256;
38 case 256:
39 return vwin512;
40 case 512:
41 return vwin1024;
42 case 1024:
43 return vwin2048;
44 case 2048:
45 return vwin4096;
46 case 4096:
47 return vwin8192;
48 default:
49 return(0);
50 }
51 break;
52 default:
53 return(0);
54 }
55}
56#if 0
57void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
58 long *blocksizes,
59 int lW,int W,int nW){
60 LOOKUP_T *window[2]={window_p[0],window_p[1]};
61 long n=blocksizes[W];
62 long ln=blocksizes[lW];
63 long rn=blocksizes[nW];
64
65 long leftbegin=n/4-ln/4;
66 long leftend=leftbegin+ln/2;
67
68 long rightbegin=n/2+n/4-rn/4;
69 long rightend=rightbegin+rn/2;
70
71 /* Following memset is not required - we are careful to only overlap/add the
72 regions that geniunely overlap in the window region, and the portions
73 outside that region are not added (so don't need to be zerod). see block.c
74 memset((void *)&d[0], 0, sizeof(ogg_int32_t)*leftbegin); */
75
76 ogg_vect_mult_fw(&d[leftbegin], &window[lW][0], leftend-leftbegin);
77 ogg_vect_mult_bw(&d[rightbegin], &window[nW][rn/2-1], rightend-rightbegin);
78
79 /* Again - memset not needed
80 memset((void *)&d[rightend], 0, sizeof(ogg_int32_t)*(n-rightend)); */
81}
82#endif