1 /********************************************************************
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
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. *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
12 ********************************************************************
14 function: window functions
16 ********************************************************************/
18 #include "config-tremor.h"
24 #include "window_lookup.h"
26 const void *_vorbis_window(int type
, int left
){
57 void _vorbis_apply_window(ogg_int32_t
*d
,const void *window_p
[2],
60 LOOKUP_T
*window
[2]={window_p
[0],window_p
[1]};
62 long ln
=blocksizes
[lW
];
63 long rn
=blocksizes
[nW
];
65 long leftbegin
=n
/4-ln
/4;
66 long leftend
=leftbegin
+ln
/2;
68 long rightbegin
=n
/2+n
/4-rn
/4;
69 long rightend
=rightbegin
+rn
/2;
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); */
76 vect_mult_fw(&d
[leftbegin
], &window
[lW
][0], leftend
-leftbegin
);
77 vect_mult_bw(&d
[rightbegin
], &window
[nW
][rn
/2-1], rightend
-rightbegin
);
79 /* Again - memset not needed
80 memset((void *)&d[rightend], 0, sizeof(ogg_int32_t)*(n-rightend)); */