⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 history.c

📁 speech signal process tools
💻 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: history * *  Written by: Jim Elliott * *  Handles output to history file for decode program. * ******************************************************************************** *//* *  SCCS program and date keywords. */#ifndef lintstatic char *sccs_id = "@(#)history.c	1.1	10/6/87 ESI";#endif/* *  System include files. */#include <stdio.h>/* *  ESPS include files. */#include <esps/esps.h>#include <esps/anafea.h>#include <esps/encode.h>#include <esps/fea.h>#include <esps/feaqhist.h>/* *  System functions and variables. */char *ctime();long time();/* ******************************************************************************** *  Subroutine to print header information to history file. ******************************************************************************** */print_header( dump, hfp, ifn, tfn, ofn, version, date, chan_rate, comb_frq,    comb_vcg, cont_pwr, cont_spc, sync_intv, sync_len )char *date, dump, *ifn, *tfn, *ofn, *version;FILE *hfp;float chan_rate;int sync_intv, sync_len;short comb_frq, comb_vcg, cont_pwr, cont_spc;{    long	tloc;			/* For date and time */    static char        init = YES;		/* Flag for initial call */    if ( init )    {	init = NO;	tloc = time( 0 );	Fprintf( hfp, "Decode statistics output on %s", ctime( &tloc ) );	Fprintf( hfp, "Decode version %s, date %s\n\n", version, date );	Fprintf( hfp, "Input file: %s\n", ifn );	Fprintf( hfp, "Huffman file: %s\n", tfn );	Fprintf( hfp, "Output file: %s\n\n", ofn );	Fprintf( hfp, "Huffman table combinations:\n\n" );	Fprintf( hfp, "\tFrequency: %s\n", noyes[ comb_frq ] );	Fprintf( hfp, "\tVoicing: %s\n\n", noyes[ comb_vcg ] );	Fprintf( hfp, "Continuous coding options:\n\n" );	Fprintf( hfp, "\tPower: %s\n", noyes[ cont_pwr ] );	Fprintf( hfp, "\tSpectrum: %s\n\n", noyes[ cont_spc ] );	Fprintf( hfp, "Channel rate: %6.1f\n", chan_rate );	Fprintf( hfp, "Sync interval (frames): %d\n", sync_intv );	Fprintf( hfp, "Sync length: %d\n\n", sync_len );    }    if ( !dump )	return;    Fprintf( hfp, "Frame\tFrame\tSpect.\tPower\tLength\tBits/\n" );    Fprintf( hfp, "  #\tSamples\tBits\tBits\tBits\tFrame\n\n" );}/* ******************************************************************************** *  Subroutine to print frame-by-frame bit statistics to history file. ******************************************************************************** */print_frm_stats( bs, anafea_rec, prev_type, hfp )FILE *hfp;short prev_type;struct anafea *anafea_rec;struct bit_stats bs;{    char *flag = "";    static int nfrm;    nfrm++;    if ( prev_type == NONE ||        *anafea_rec->frame_type != prev_type )    {        if ( *anafea_rec->frame_type == VOICED )            flag = "*V";        else            flag = "*U";    }    Fprintf( hfp, "%d%s\t%d\t%d\t%d\t%d\t%d\n",	nfrm, flag,	*anafea_rec->frame_len,	bs.frm_spec,	bs.frm_pwr,	bs.frm_len,	bs.frm_bits );}/* ******************************************************************************** *  Subroutine to print cumulative bit statistics to history file. ******************************************************************************** */print_cum_stats( bs, u_vect, v_vect, order_unvcd, order_vcd, hfp )FILE *hfp;int u_vect[], v_vect[];long order_unvcd, order_vcd;struct bit_stats bs;{    int i;    Fprintf( hfp, "\nBit allocation summary:\n\n\\	Sync:               %8d (%4.1f%%)\n\	Stuff:              %8d (%4.1f%%)\n\	Type:               %8d (%4.1f%%)\n\	Extension:          %8d (%4.1f%%)\n\	Unvoiced Power:     %8d (%4.1f%%)\n\	Unvoiced Spectrum:  %8d (%4.1f%%)\n\	Unvoiced Length:    %8d (%4.1f%%)\n\	Voiced Power:       %8d (%4.1f%%)\n\	Voiced Spectrum:    %8d (%4.1f%%)\n\	Voiced Pulse Length:%8d (%4.1f%%)\n\n\	Total:              %8d\n\n",	bs.sync,   100.0 * (float) bs.sync   / (float) bs.tot,	bs.stuff,  100.0 * (float) bs.stuff  / (float) bs.tot,	bs.ftype,  100.0 * (float) bs.ftype  / (float) bs.tot,	bs.ext,    100.0 * (float) bs.ext    / (float) bs.tot,	bs.u_pwr,  100.0 * (float) bs.u_pwr  / (float) bs.tot,	bs.u_spec, 100.0 * (float) bs.u_spec / (float) bs.tot,	bs.u_len,  100.0 * (float) bs.u_len  / (float) bs.tot,	bs.v_pwr,  100.0 * (float) bs.v_pwr  / (float) bs.tot,	bs.v_spec, 100.0 * (float) bs.v_spec / (float) bs.tot,	bs.v_len,  100.0 * (float) bs.v_len  / (float) bs.tot,	bs.tot );    Fprintf( hfp, "Number of voiced frames:   %5d\n", bs.vcd_frm );    Fprintf( hfp, "Number of unvoiced frames: %5d\n", bs.unv_frm );    Fprintf( hfp, "Number of pitch pulses:    %5d", bs.pulses );    if ( bs.pulses )    {	Fprintf (hfp, "\n\n" );	Fprintf( hfp, "Bits/pulse to code voiced power: %4.2f\n",	    (float) bs.v_pwr / (float) bs.pulses );	Fprintf( hfp, "Bits/pulse to code pulse length: %4.2f",	    (float) bs.v_len / (float) bs.pulses );    }    if ( bs.u_spec )    {	Fprintf( hfp, "\n\nBreakdown for unvoiced spectrum:\n" );	for ( i = 0; i < order_unvcd; i++ )	    Fprintf( hfp, "\n\t%2d:%8d (%4.1f%%)\t[%4.2f bits/LSF]", i+1, u_vect[i],		100.0 * (float) u_vect[i] / (float) bs.u_spec,		    (float) u_vect[i] / (float) bs.unv_frm );    }    if ( bs.v_spec )    {	Fprintf( hfp, "\n\nBreakdown for voiced spectrum:\n" );	for ( i = 0; i < order_vcd; i++ )	    Fprintf( hfp, "\n\t%2d:%8d (%4.1f%%)\t[%4.2f bits/LSF]", i+1, v_vect[i],		100.0 * (float) v_vect[i] / (float) bs.v_spec,		    (float) v_vect[i] / (float) bs.vcd_frm );    }    Fprintf( hfp, "\n" );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -