/**************************************************************************/ /* File: snr_prms.h */ /**************************************************************************/ /* Project: Computing SNR of a given signal Class: EE 8993 Spring 96 */ /* Author: Neeraj Deshmukh Date: February 19, 1996 */ /**************************************************************************/ /*======================================================================== This file declares the various parameters and the SNR_Detector class for the signal-to-noise computation of any given signal ========================================================================*/ /*------------------------------------------------------------------------ make sure definitions are only made once ------------------------------------------------------------------------*/ #ifndef __ISIP_SNR_PRMS #define __ISIP_SNR_PRMS /*------------------------------------------------------------------------ system and ISIP include files ------------------------------------------------------------------------*/ #include #include #include #include #include #include /*------------------------------------------------------------------------ declaration of global data types ------------------------------------------------------------------------*/ typedef char *String; /*------------------------------------------------------------------------ declaration of global constants ------------------------------------------------------------------------*/ #define WINDOW_DURATION 0.03 // 30 ms window #define FRAME_DURATION 0.02 // 20 ms frame #define SAMPLE_FREQUENCY 8000 // sampling rate #define PREEMPHASIS 0.95 // pre-emphasis coef #define MAX_FRAMES 1500 #define SAMPLE_SCALE_FACTOR 3.05185e-05 #define DB_CONSTANT 10 #define PI 3.1415927 // intervals for cumulative energy distribution // #define NUM_BINS 10000 #define NOMINAL_SIG_NOISE 0.85 #define NOMINAL_NOISE 0.15 /*------------------------------------------------------------------------ declaration of non-method static functions ------------------------------------------------------------------------*/ extern FILE *open_file_cc (String name, String mode); /*------------------------------------------------------------------------ declaration of SNR_Detector class ------------------------------------------------------------------------*/ class SNR_Detector { // members // protected: /*---------------------- signal parameters data ----------------------*/ int_2 *signal_frame_d; // signal frame int_2 frame_dur_d; // duration of frame in samples float *ham_window_d; // hamming window int_2 window_dur_d; // duration of window in samples int_2 win_offset_d; // offset between frame and window int_2 frame_offset_d; // offset between frame and window /*---------------------- signal processing data ----------------------*/ float *energy_var_d; // energy variance array // methods // public: /*-------------------------- constructors & destructors --------------------------*/ SNR_Detector (); ~SNR_Detector (); /*--------------------------- main SNR computing function ---------------------------*/ void compute_snr_cc (); private: /*---------------------------- internal calculation methods ----------------------------*/ void ham_window_cc (); // create hamming window float compute_energy_cc (); // compute the energy density float cumul_energy_dist_cc (int num_frames_l); }; #endif