freq.h 1.9 KB
Newer Older
Monty Montgomery's avatar
Monty Montgomery committed
1 2 3 4
/*
 *
 *  postfish
 *    
Monty Montgomery's avatar
Monty Montgomery committed
5
 *      Copyright (C) 2002-2005 Monty and Xiph.Org
Monty Montgomery's avatar
Monty Montgomery committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 *
 *  Postfish is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *   
 *  Postfish is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *   
 *  You should have received a copy of the GNU General Public License
 *  along with Postfish; see the file COPYING.  If not, write to the
 *  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * 
 */

#include "postfish.h"
Monty Montgomery's avatar
Monty Montgomery committed
25
#include <fftw3.h>
Monty Montgomery's avatar
Monty Montgomery committed
26 27

typedef struct {
28 29 30
  float       *fftwf_buffer; 
  fftwf_plan  fftwf_forward; 
  fftwf_plan  fftwf_backward;
Monty Montgomery's avatar
Monty Montgomery committed
31
  
Monty Montgomery's avatar
Monty Montgomery committed
32 33 34 35 36
  int qblocksize;
  int bands;

  float **ho_window;
  float  *ho_area;
Monty Montgomery's avatar
Monty Montgomery committed
37
  
Monty Montgomery's avatar
Monty Montgomery committed
38
  float *window;
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
} freq_class_setup;


typedef struct {
  time_linkage out;
  feedback_generic_pool feedpool;
  freq_class_setup *fc;

  int *activeP;
  int *active1;
  int *active0;

  u_int32_t mutemask0;
  u_int32_t mutemask1;
  u_int32_t mutemaskP;

  float **lap1;
  float **lap0;
  float **lapC;

  float **cache1;
  float **cache0;
Monty Montgomery's avatar
Monty Montgomery committed
61 62
  int cache_samples;
  int fillstate;     /* 0: uninitialized
Monty Montgomery's avatar
Monty Montgomery committed
63 64 65
			1: half-primed
			2: nominal
			3: eof processed */
66 67
  float **peak;
  float **rms;
Monty Montgomery's avatar
Monty Montgomery committed
68 69
} freq_state;

70 71


Monty Montgomery's avatar
Monty Montgomery committed
72
extern int pull_freq_feedback(freq_state *ff,float **peak,float **rms);
73
extern int freq_class_load(freq_class_setup *f,const float *frequencies, int bands);
74
extern int freq_load(freq_state *f,freq_class_setup *fc,int ch);
75

Monty Montgomery's avatar
Monty Montgomery committed
76
extern int freq_reset(freq_state *f);
77 78 79 80
extern time_linkage *freq_read(time_linkage *in, 
			       freq_state *f, 
			       int *visible, int *active,
			       void (*func)(float *,int i));