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