📄 output.c
字号:
/* ******************************************************************************** * * 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 Entropic Speech, Inc.; all rights reserved" * * Program: output * * Written by: Jim Elliott * * Performs output functions for histo program. * ******************************************************************************** *//* * SCCS program and date keywords. */#ifndef lintstatic char *sccs_id = "@(#)output.c 1.1 8/14/87 ESI";#endif/* * System include files. */#include <stdio.h>/* * ESPS include files. */#include <esps/esps.h>#include <esps/fea.h>#include <esps/feaqhist.h>#include "histo.h"/* * Internal functions and variables. */int *combine_tables();/* ******************************************************************************** * Subroutine to write histogram data to output file. ******************************************************************************** */write_histo( hist_type, hist_ext, hist_pwr, hist_len, hist_spec_intra, hist_spec_inter, feaqhist_rec, comb_frq, comb_vcg, cont_spc, oh, ofp )FILE *ofp;int hist_type[], hist_ext[], hist_len[], hist_pwr[], hist_spec_inter[], hist_spec_intra[];short comb_frq, comb_vcg, cont_spc;struct feaqhist *feaqhist_rec;struct header *oh;{ int i, j, *type; for ( i = 0; i <= 2*MAX_TYPE; i++ ) put_rec( oh, ofp, feaqhist_rec, TYPE, AMP, i - MAX_TYPE, hist_type[i] ); for ( i = 0; i <= 2*MAX_EXT; i++ ) put_rec( oh, ofp, feaqhist_rec, EXT, AMP, i - MAX_EXT, hist_ext[i] ); for ( i = 0; i <= 2*MAX_PWR; i++ ) put_rec( oh, ofp, feaqhist_rec, POWER, get_dtype( i, MAX_PWR ), i - MAX_PWR, hist_pwr[i] ); for ( i = 0; i <= 2*MAX_LEN; i++ ) put_rec( oh, ofp, feaqhist_rec, LENGTH, get_dtype( i, MAX_LEN ), i - MAX_LEN, hist_len[i] ); type = combine_tables( hist_spec_intra, hist_spec_inter, comb_frq, comb_vcg ); for ( i = 0; i < 2*MAX_ORD; i++ ) { if ( !type[i] ) continue; for ( j = 0; j < FSZ; j++ ) put_rec( oh, ofp, feaqhist_rec, type[i]+INTER, get_dtype( j, MAX_SPEC ), j - MAX_SPEC, hist_spec_inter[ i*FSZ + j ] ); if ( cont_spc ) continue; for ( j = 0; j < FSZ; j++ ) put_rec( oh, ofp, feaqhist_rec, type[i]+INTRA, get_dtype( j, MAX_SPEC ), j - MAX_SPEC, hist_spec_intra[ i*FSZ + j ] ); }}/* ******************************************************************************** * Subroutine to combine Huffman tables for spectral data. ******************************************************************************** */int *combine_tables( h_intra, h_inter, comb_frq, comb_vcg )int h_inter[], h_intra[];short comb_frq, comb_vcg;{ int i, j, k, z; static int type_vf[ 2*MAX_ORD ] = {SPEC,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, type_0f[ 2*MAX_ORD ] = {VSPEC,0,0,0,0,0,0,0,0,0,USPEC,0,0,0,0,0,0,0,0,0}, type_v0[ 2*MAX_ORD ] = {CF12,OF12,CF34,OF34,CF56,OF56,CF78,OF78,CF90,OF90, 0,0,0,0,0,0,0,0,0,0}, type_00[ 2*MAX_ORD ] = {VCF12,VOF12,VCF34,VOF34,VCF56,VOF56,VCF78,VOF78, VCF90,VOF90,UCF12,UOF12,UCF34,UOF34,UCF56,UOF56,0,0,0,0}; if ( comb_vcg == NO && comb_frq == NO ) return( type_00 ); else if ( comb_vcg == NO && comb_frq == YES ) { for ( i = 0; i < FSZ; i++ ) for ( j = 1; j < MAX_ORD; j++ ) for ( k = 0; k < 2; k++ ) { z = i + k*VSZ; h_intra[z] += h_intra[ z + j*FSZ ]; h_inter[z] += h_inter[ z + j*FSZ ]; } return( type_0f ); } else if ( comb_vcg == YES && comb_frq == NO ) { for ( i = 0; i < FSZ; i++ ) for ( j = 0; j < MAX_ORD; j++ ) { z = i + j*FSZ; h_intra[z] += h_intra[ z + VSZ ]; h_inter[z] += h_inter[ z + VSZ ]; } return( type_v0 ); } else if ( comb_vcg == YES && comb_frq == YES ) { for ( i = 0; i < FSZ; i++ ) for ( j = 1; j < 2*MAX_ORD; j++ ) { h_intra[i] += h_intra[ i + j*FSZ ]; h_inter[i] += h_inter[ i + j*FSZ ]; } return( type_vf ); } return( NULL );}/* ******************************************************************************** * Subroutine to specify histogram data type. ******************************************************************************** */get_dtype( i, imax )int i, imax;{ if ( i == 0 || i == 2*imax ) return( AMP_ESC ); return( AMP_DIFF );}/* ******************************************************************************** * Subroutine to output FEA_QHIST file record. ******************************************************************************** */put_rec( oh, ofp, feaqhist_rec, htype, dtype, value, count )FILE *ofp;int count, dtype, htype, value;struct feaqhist *feaqhist_rec;struct header *oh;{ *feaqhist_rec->hist_type = htype; *feaqhist_rec->data_type = dtype; *feaqhist_rec->value = value; *feaqhist_rec->count = count; put_feaqhist_rec( feaqhist_rec, oh, ofp );}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -