new preecho was switching back to long blocks too soon
[platform/upstream/libvorbis.git] / lib / envelope.h
1 /********************************************************************
2  *                                                                  *
3  * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
4  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
5  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
7  *                                                                  *
8  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
9  * by the XIPHOPHORUS Company http://www.xiph.org/                  *
10  *                                                                  *
11  ********************************************************************
12
13  function: PCM data envelope analysis and manipulation
14  last mod: $Id: envelope.h,v 1.20 2002/03/23 03:17:34 xiphmont Exp $
15
16  ********************************************************************/
17
18 #ifndef _V_ENVELOPE_
19 #define _V_ENVELOPE_
20
21 #include "mdct.h"
22
23 #define VE_DIV    4
24 #define VE_CONV   3
25 #define VE_BANDS  4
26
27 typedef struct {
28   float ampbuf[VE_DIV];
29   int   ampptr;
30   float delbuf[VE_CONV-1];
31   float convbuf[2];
32   
33   float markers[1024];
34 } envelope_filter_state;
35
36 typedef struct {
37   int begin;
38   int end;
39   float *window;
40 } envelope_band;
41
42 typedef struct {
43   int ch;
44   int winlength;
45   int searchstep;
46   float minenergy;
47
48   mdct_lookup  mdct;
49   float       *mdct_win;
50
51   envelope_band          band[VE_BANDS];
52   envelope_filter_state *filter;
53
54   int                   *mark;
55
56   long storage;
57   long current;
58   long curmark;
59   long cursor;
60 } envelope_lookup;
61
62 extern void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi);
63 extern void _ve_envelope_clear(envelope_lookup *e);
64 extern long _ve_envelope_search(vorbis_dsp_state *v);
65 extern void _ve_envelope_shift(envelope_lookup *e,long shift);
66 extern int  _ve_envelope_mark(vorbis_dsp_state *v);
67
68
69 #endif
70