annotate filter/recurse.h @ 0:5242703e91d3 tip

Initial checkin for AIM92 aimR8.2 (last updated May 1997).
author tomwalters
date Fri, 20 May 2011 15:19:45 +0100
parents
children
rev   line source
tomwalters@0 1 /*
tomwalters@0 2 Copyright (c) Applied Psychology Unit, Medical Research Council. 1988, 1989
tomwalters@0 3 ===========================================================================
tomwalters@0 4
tomwalters@0 5 Permission to use, copy, modify, and distribute this software without fee
tomwalters@0 6 is hereby granted for research purposes, provided that this copyright
tomwalters@0 7 notice appears in all copies and in all supporting documentation, and that
tomwalters@0 8 the software is not redistributed for any fee (except for a nominal shipping
tomwalters@0 9 charge). Anyone wanting to incorporate all or part of this software in a
tomwalters@0 10 commercial product must obtain a license from the Medical Research Council.
tomwalters@0 11
tomwalters@0 12 The MRC makes no representations about the suitability of this
tomwalters@0 13 software for any purpose. It is provided "as is" without express or implied
tomwalters@0 14 warranty.
tomwalters@0 15
tomwalters@0 16 */
tomwalters@0 17
tomwalters@0 18 /*
tomwalters@0 19 recurse.h
tomwalters@0 20 =========
tomwalters@0 21
tomwalters@0 22 defines for modular recursive filterbank system
tomwalters@0 23
tomwalters@0 24 J.Holdsworth MRC-APU 17th January 1989.
tomwalters@0 25
tomwalters@0 26 */
tomwalters@0 27
tomwalters@0 28 #define _RECURSE_H_
tomwalters@0 29
tomwalters@0 30 #define NO_PHASE_COMPENSTAION (0)
tomwalters@0 31 #define ENVELOPE_ALIGNMENT (-1)
tomwalters@0 32 #define FINE_ALIGNMENT (-2)
tomwalters@0 33 #define ACUASAL (-2)
tomwalters@0 34
tomwalters@0 35 #define LOG_ZERO (-10)
tomwalters@0 36
tomwalters@0 37 #if !defined( LITTLE_FIRST ) && !defined( BIG_FIRST )
tomwalters@0 38
tomwalters@0 39 #if defined( vax ) || defined( MIPSEL ) || defined( NICHE ) || defined( IBM )
tomwalters@0 40 #define LITTLE_FIRST
tomwalters@0 41 #endif
tomwalters@0 42
tomwalters@0 43 #if defined( sun ) || defined( MIPSEB ) || defined( mc68000 ) || defined( THINK_C )
tomwalters@0 44 #define BIG_FIRST
tomwalters@0 45 #endif
tomwalters@0 46
tomwalters@0 47 #endif
tomwalters@0 48
tomwalters@0 49 #if defined( LITTLE_FIRST )
tomwalters@0 50
tomwalters@0 51 typedef union { long all ; struct { short lo, hi ; } shorts ; } Phase ;
tomwalters@0 52 #define ALL( _var ) ( _var.all )
tomwalters@0 53 #define HI( _var ) ( _var.shorts.hi )
tomwalters@0 54
tomwalters@0 55 #else
tomwalters@0 56
tomwalters@0 57 #if defined( BIG_FIRST )
tomwalters@0 58
tomwalters@0 59 typedef union { long all ; struct { short hi, lo ; } shorts ; } Phase ;
tomwalters@0 60 #define ALL( _var ) ( _var.all )
tomwalters@0 61 #define HI( _var ) ( _var.shorts.hi )
tomwalters@0 62
tomwalters@0 63 #else
tomwalters@0 64
tomwalters@0 65 #ifdef DSP32
tomwalters@0 66
tomwalters@0 67 typedef union { int all ; struct { short lo, hi ; } shorts ; } Phase ;
tomwalters@0 68 #define ALL( _var ) ( ( _var ).all )
tomwalters@0 69 #define HI( _var ) ( ( _var ).shorts.hi & 0xff )
tomwalters@0 70
tomwalters@0 71 #else
tomwalters@0 72
tomwalters@0 73 typedef long Phase ;
tomwalters@0 74 #define ALL( _var ) ( _var )
tomwalters@0 75 #define HI( _var ) ( ( _var ) >> 16 )
tomwalters@0 76
tomwalters@0 77 #endif
tomwalters@0 78
tomwalters@0 79 #endif
tomwalters@0 80 #endif
tomwalters@0 81
tomwalters@0 82 #ifdef DSP32
tomwalters@0 83 typedef float *Table ;
tomwalters@0 84 #else
tomwalters@0 85 typedef int *Table ;
tomwalters@0 86 #endif
tomwalters@0 87
tomwalters@0 88 typedef struct _recursive_filter_state RecursiveFilterState ;
tomwalters@0 89
tomwalters@0 90 typedef struct { short real, imag ; } scomplex ;
tomwalters@0 91 typedef struct { int real, imag ; } icomplex ;
tomwalters@0 92 typedef struct { long real, imag ; } lcomplex ;
tomwalters@0 93 typedef struct { float real, imag ; } fcomplex ;
tomwalters@0 94 typedef struct { double real, imag ; } dcomplex ;
tomwalters@0 95
tomwalters@0 96
tomwalters@0 97 extern RecursiveFilterState *NewRecursiveFilter() ;
tomwalters@0 98 extern double bandwidth_normalisation() ;
tomwalters@0 99 extern int imB() ;
tomwalters@0 100
tomwalters@0 101 extern int DoFilterShortDataArray() ; extern int DoEnvelopeShortDataArray() ;
tomwalters@0 102 extern int DoRealFilterShortDataArray() ; extern int DoRealEnvelopeShortDataArray() ;
tomwalters@0 103
tomwalters@0 104 extern int DoRealFilterFloatDataArray() ; extern int DoRealEnvelopeFloatDataArray() ;
tomwalters@0 105
tomwalters@0 106 extern int DoFilterIntDataArray() ;
tomwalters@0 107 extern int DoRealFilterIntDataArray() ;
tomwalters@0 108 extern int DoRealFilterDoubleDataArray() ;
tomwalters@0 109 extern int DoComplexFilterShortDataArray() ;
tomwalters@0 110 extern int DoComplexFilterFloatDataArray() ;
tomwalters@0 111
tomwalters@0 112 extern int DoNewFilterDataArray() ;
tomwalters@0 113
tomwalters@0 114 /* formuale.h for attempt at safety */
tomwalters@0 115
tomwalters@0 116 extern double Erb(), ErbScale(), FofErbScale(), dBAudiogram(), Audiogram() ;
tomwalters@0 117
tomwalters@0 118 extern int filterSineTableBits, filterSineTableShift ;
tomwalters@0 119 extern unsigned long filterSineTableSize, filterSineTableMask ;
tomwalters@0 120 extern Table filterSineTable, filterCosineTable ;
tomwalters@0 121
tomwalters@0 122
tomwalters@0 123 /* private data structure for filter */
tomwalters@0 124
tomwalters@0 125 struct _recursive_filter_state {
tomwalters@0 126 double k, output_scale ; /* basic real filter parameters */
tomwalters@0 127 long ik, post_divisor, post_log ; /* integer versions of basic parameters */
tomwalters@0 128 int order, over_sample, input_bits ; /* integer filter parameters */
tomwalters@0 129 char *states, *states_end ; /* filter state vector */
tomwalters@0 130 Phase phi, output_phi ; /* integer phase of complex sinusiod */
tomwalters@0 131 #ifdef DSP32
tomwalters@0 132 int delta_phi, output_delta_phi ; /* phase increments for filter cf */
tomwalters@0 133 #else
tomwalters@0 134 long delta_phi, output_delta_phi ; /* phase increments for filter cf */
tomwalters@0 135 #endif
tomwalters@0 136 float gain, k1, k2 ; /* for new filter algorithimn */
tomwalters@0 137 } ;
tomwalters@0 138