📄 header.h
字号:
/* This material contains proprietary software of Entropic Speech, Inc. Any reproduction, distribution, or publication without the the prior written permission of Entropic Speech, Inc. is strictly prohibited. Any public distribution of copies of this work authorized in writing by Entropic Speech, Inc. must bear the notice "Copyright (c) 1987-1990 Entropic Speech, Inc. Copyright (c) 1990-1995 Entropic Research Laboratory, Inc. All rights reserved." @(#)header.h 1.97 7/23/96 ESI This file contains the header structures for ESPS files. It also contains some declarations used by all esps programs for the header access routines.*/#ifndef header_H#define header_H#ifdef __cplusplusextern "C" {#endif#include <stdio.h>#include <esps/esps.h>/* * Structure of a SPS data file header *//* Z domain functions are represented by the following structure; */struct zfunc { short nsiz; /* length of numerator polynomial */ short dsiz; /* length of denominator polynomial */ float *zeros; /* pointer to numerator polynomial */ float *poles; /* pointer to denominator polynomial */};/* do not change anything of these values without understanding the code in headers.c Changes here might prevent processing of old data files.*/#define MAX_SOURCES 10#define MAX_STRING 32767#define NSPARES 10#define HD_VERSION "1.97"#define DATESIZE 26#define VERSIONSIZE 8#define PROGSIZE 16#define GENTABSIZ 100#define USERSIZ 8struct header {/* fields common to all SPS headers *//* fixed size part first */ struct fixpart { short type; /* file type */#ifndef NOPAD short pad1; /**/#endif long check; /* check field */ char date[DATESIZE]; /* file creation date */ char hdvers[VERSIONSIZE]; /* header version */ char prog[PROGSIZE]; /* program name */ char vers[VERSIONSIZE]; /* prog version */ char progdate[DATESIZE]; /* prog compile date */ long ndrec; /* number of data records */ short tag; /* YES if data has tag */ short nd1; /* used for reading old files only */ long ndouble; /* number of doubles */ long nfloat; /* number of floats */ long nlong; /* number of longs */ long nshort; /* number of shorts */ long nchar; /* number of chars */ long fixpartsiz; /* fixed header size */ long hsize; /* total header size */ char user[USERSIZ]; /* user name */ short edr; /* YES if EDR_ESPS, NO for native */ short machine_code; /* machine that produced file */ short spares[NSPARES]; /* spares */ } common;/* variable part size next */ struct varsize { char *source[MAX_SOURCES]; /* pointers to src file names */ struct header *srchead[MAX_SOURCES];/* pointers to src headers */ char *typtxt; /* text field */ char *comment; /* comment field */ char *refer; /* reference file for tags */ short nnames; /* number of source file names */ short nheads; /* number of source file headers */ struct gen_hd *gentab[GENTABSIZ]; /* generic item symbol table */ short ngen; /* number of generic items */ struct header *refhd; /* reference header */ char *current_path; /* cwd at time file was created */ } variable; /* type specific portion of the header */ union { struct sd_header *sd; /* sampled data file */ struct spec_header *spec; /* spectral record file */ struct filt_header *filt; /* filter coefficient file */ struct scbk_header *scbk; /* scaler codebook file */ struct fea_header *fea; /* feature file *//* any local type specific headers will be defined in the following include file. */#ifdef ESI#include <esps/localhd1.h>#endif } hd;};/* the include file localhd2.h contain the structure definitions for local type specific headers. */#ifdef ESI#include <esps/localhd2.h>#endif/* What follows are the general type specific header structures*//* Sampled Data File specific header */#define SD_SPARES 16struct sd_header { short equip; /* A/D equipment */#ifndef NOPAD short pad1; /**/#endif float max_value; /* range of A/D or max value */ float sf; /* sample frequency */ float src_sf; /* source file sf */ short synt_method; /* synthesis method */#ifndef NOPAD short pad2; /**/#endif float scale; /* scale factor */ float dcrem; /* DC term removed */ short q_method; /* quant method */ short v_excit_method; /* voiced excitation */ short uv_excit_method;/* unvoiced excitation */ short spare1; /* spare */ short nchan; /* number of channels for multiplexed data */ short synt_interp; /* reflection coefficient interpolation */ short synt_pwr; /* power source for synthesis */ short synt_rc; /* reflection coefficient interpolation */ short synt_order; /* synthesis filter order */#ifndef NOPAD short pad3; /**/#endif long start; /* starting point processed */ long nan; /* number of points processed */ short spares[SD_SPARES];/* spares */ struct zfunc *prefilter; /* prefilter */ struct zfunc *de_emp; /* deemphasis filter */};/* SPEC Spectral Record File specific header */#define SPEC_SPARES 20struct spec_header { long start; /* starting point analyzed */ long nan; /* number of points analyzed */ short frmlen; /* analysis window width */ short order_vcd; /* model order voiced */ short order_unvcd; /* model order unvoiced */ short win_type; /* data window type */ float sf; /* sampling frequency */ short spec_an_meth; /* analysis method */#ifndef NOPAD short pad1; /**/#endif float dcrem; /* DC term removed */ short post_proc; /* post-processing method */ short frame_meth; /* how speech was divided into frames */ short voicing; /* voicing indicator appears in each record */ short freq_format; /* how to determine the set of frequencies */ short spec_type; /* are data power, log power, complex, etc. */ short contin; /* discrete distribution or continuous density */ long num_freqs; /* number of frequencies */ short spares[SPEC_SPARES];/* spares */ float *freqs; /* frequencies (if listed in header) */ struct zfunc *pre_emp; /* preemphasis filter */};/* FILT filter coefficient header */#define FILT_SPARES 20struct filt_header { short max_num; /* maximum number of numerator coefficients. */ short max_den; /* maximum number of denominator coefficients. */ short func_spec; /* desired response function specification */ short nbands; /* number of frequency bands */ short npoints; /* number of points */ short g_size; /* grid size parameter */ short nbits; /* number of bits */ short type; /* type of filter */ short method; /* filter design method */ short spares[FILT_SPARES]; /* spares */#ifndef NOPAD short pad1; /**/#endif float *bandedges; /* array of band edges */ float *points; /* array of or points */ float *gains; /* array of gain values */ float *wts; /* array of weighting values */};/* SCBK scaler quantization codebook header */#define SCBK_SPARES 20struct scbk_header { long num_items; /* number of items processed */ short distortion; /* distortion measure used */ unsigned short num_cdwds; /* number of codeswords */ float convergence; /* convergence threshold */ short codebook_type; /* type of codebook */ short element_num; /* element number */ short spares[SCBK_SPARES]; /* spares */};/* FEA feature file header */#define FEA_SPARES 16struct fea_header { short fea_type; /* indicates special feature-file types */ short segment_labeled;/* if YES, records contain filename, start and length of segment */ unsigned short field_count; /* number of fields */#ifndef NOPAD short field_order; /* YES if fields stored in field order on file, instead of by data type (default)*/#endif char **names; /* name of each field */ long *sizes; /* total number of items in field */ short *ranks; /* number of dimensions in field */ long **dimens; /* array dimensions for field */ short *types; /* type of field */ char ***enums; /* arrays of values for coded types */ long *starts; /* starting point for this field */ short *derived; /* indicates whether field was derived */ char ***srcfields; /* for derived fields, array of source field names */ short spares[FEA_SPARES]; /* spares */ long ndouble; /* number of doubles in feature record */ long ndcplx; /* number of double complex in feature record */ long nfloat; /* number of floats in feature record */ long nfcplx; /* number of float complex in feature record */ long nlong; /* number of longs in feature record */ long nlcplx; /* number of long complex in feature record */ long nshort; /* number of shorts in feature record */ long nscplx; /* number of short complex in feature record */ long nbyte; /* number of bytes in feature record */ long nbcplx; /* number of byte complex in feature record */};/* symbol table for generic header items in this structure, codes points to an array of the possible coded values for the symbol. It is an array of character strings, terminated by a NULL. */struct gen_hd { char *name; /* symbol name */ unsigned int size; /* size of item */ short type; /* type of symbol */ char *d_ptr; /* pointer to the data */ char **codes; /* codes for CODED data type */ struct gen_hd *next; /* next in chain */};/* ESPS header preamble. This little header comes before the header described above. It is intended to make it possible to identify and use an ESPS file, if the standard header processing cannot be done.*/struct preamble {#ifndef DEC_ALPHA long machine_code; /* defined below */ long check_code; /* version check code */ long data_offset; /* data offset (in bytes, from 0) in file */ long record_size; /* record size in bytes */ long check; /* ESPS check number, same as main header */ long edr; /* YES if EDR_ESPS, NO if native */ long align_pad_size; /* alignment pad need for some SD files */ long foreign_hd; /* pointer to foreign header, -1 if */#else int machine_code; /* defined below */ int check_code; /* version check code */ int data_offset; /* data offset (in bytes, from 0) in file */ int record_size; /* record size in bytes */ int check; /* ESPS check number, same as main header */ int edr; /* YES if EDR_ESPS, NO if native */ int align_pad_size; /* alignment pad need for some SD files */ int foreign_hd; /* pointer to foreign header, -1 if */#endif /* there is none */};/* The next part of this file defines symbols to be used in programs for certain field values.*//* A/D equipment codes; value for: * equip */#define EF12M 1#define AD12F 2#define DSC 3#define LPA11 4#define AD12FA 5#define AD12 6#define AD16M 7#define LOCALad1 8#define LOCALad2 9#define RTI_732 10extern char *equip_codes[]; /* quantization methods; values for: * piq_method rcq_method pwq_method lpq_method q_method, ros_q_method */#define LPC10 1#define MULAW 2 /* only for q_method in SD */#define LPC10PA 3#define LPC10PB 4#define ROSA 5#define AVGROSA 6#define ROSPA 7#define ROSPB 8#define ROSPWRA 9#define ROSPWRB 10#define ROSB 11#define JND 12#define LPC10PC 13#define ROS1 14#define ROS1B 15#define ROS2 16#define ROS1C 17#define ROS1D 18#define ROS1E 19#define ROS2B 20#define ROS2C 21#define VQ 22#define SPAREqm1 23#define SPAREqm2 24#define SPAREqm3 25extern char *quant_methods[]; /* window type codes; values for: * win_type */#define HAMMING 1extern char *win_type_codes[]; /* synthesis methods; values for: * synt_method */#define PSYNCH 1extern char *synt_methods[];/* synthesis reflection coefficient computation methods; values for: * synt_rc */#define ANA 1#define SINX 2extern char *synt_ref_methods[];/* excitation methods; values for: * u_exite_method, uv_exite_method */#define WHITE 1#define IMPULSE 2extern char *excit_methods[];/* synthesis interpolation methods; values for: * synt_interp */#define PULSE 1 #define SAMPLE 2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -