michael@0: /******************************************************************** michael@0: * * michael@0: * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * michael@0: * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * michael@0: * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * michael@0: * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * michael@0: * * michael@0: * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * michael@0: * by the Xiph.Org Foundation http://www.xiph.org/ * michael@0: * * michael@0: ******************************************************************** michael@0: michael@0: function: PCM data envelope analysis and manipulation michael@0: last mod: $Id: envelope.h 16227 2009-07-08 06:58:46Z xiphmont $ michael@0: michael@0: ********************************************************************/ michael@0: michael@0: #ifndef _V_ENVELOPE_ michael@0: #define _V_ENVELOPE_ michael@0: michael@0: #include "mdct.h" michael@0: michael@0: #define VE_PRE 16 michael@0: #define VE_WIN 4 michael@0: #define VE_POST 2 michael@0: #define VE_AMP (VE_PRE+VE_POST-1) michael@0: michael@0: #define VE_BANDS 7 michael@0: #define VE_NEARDC 15 michael@0: michael@0: #define VE_MINSTRETCH 2 /* a bit less than short block */ michael@0: #define VE_MAXSTRETCH 12 /* one-third full block */ michael@0: michael@0: typedef struct { michael@0: float ampbuf[VE_AMP]; michael@0: int ampptr; michael@0: michael@0: float nearDC[VE_NEARDC]; michael@0: float nearDC_acc; michael@0: float nearDC_partialacc; michael@0: int nearptr; michael@0: michael@0: } envelope_filter_state; michael@0: michael@0: typedef struct { michael@0: int begin; michael@0: int end; michael@0: float *window; michael@0: float total; michael@0: } envelope_band; michael@0: michael@0: typedef struct { michael@0: int ch; michael@0: int winlength; michael@0: int searchstep; michael@0: float minenergy; michael@0: michael@0: mdct_lookup mdct; michael@0: float *mdct_win; michael@0: michael@0: envelope_band band[VE_BANDS]; michael@0: envelope_filter_state *filter; michael@0: int stretch; michael@0: michael@0: int *mark; michael@0: michael@0: long storage; michael@0: long current; michael@0: long curmark; michael@0: long cursor; michael@0: } envelope_lookup; michael@0: michael@0: extern void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi); michael@0: extern void _ve_envelope_clear(envelope_lookup *e); michael@0: extern long _ve_envelope_search(vorbis_dsp_state *v); michael@0: extern void _ve_envelope_shift(envelope_lookup *e,long shift); michael@0: extern int _ve_envelope_mark(vorbis_dsp_state *v); michael@0: michael@0: michael@0: #endif