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

📄 larcbk2rc.c

📁 speech signal process tools
💻 C
字号:
/*					  This material contains proprietary software of Entropic Processing, Inc.     Any reproduction, distribution, or publication without the the prior	     written permission of Entropic Processing, Inc. is strictly prohibited.  Any public distribution of copies of this work authorized in writing by  Entropic Processing, Inc. must bear the notice			 								               "Copyright 1986 Entropic Processing, Inc." 				 	  This program converts a LAR codebook file to a RC codebook file.  Alan Parker, EPI, Washington, DC.*/#include <stdio.h>#include <sps/sps.h>#include <sps/scbk.h>#ifdef SCCSstatic char *sccs_id = "@(#)larcbk2rc.c	1.5 9/3/86 EPI";#define VERSION "1.5";#define DATE "9/3/86";#endif#ifndef VERSION#define VERSION "debug"#endif#ifndef DATE#define DATE "none"#endif#define SYNTAX USAGE ("larcbk2rc [-x debug-level] infile outfile")main(argc,argv)int argc;char **argv;{  int getopt(), c;  extern optind;  extern char *optarg, *get_cmd_line();  FILE *in=stdin, *out=stdout;  struct header *ih, *oh;  struct scbk_data *in_rec;  char *infile="<stdin>", *ofile="<stdout>";  float lar_to_rc();  int debug=0,i;  while ((c = getopt(argc,argv,"x:")) != EOF) {    switch(c) {	  case 'x':	     debug = atoi(optarg);		 break;  	  default:	     fprintf(stderr,"larcbk2rc: unknown option.\n");	     SYNTAX;    }  }  if(argc-optind < 2)   SYNTAX;  ofile = argv[argc-1];  if(strcmp(ofile,"-") == 0)   ofile = "<stdout>";  else   TRYOPEN(argv[0],ofile,"w",out);  infile = argv[optind];  if(strcmp(infile,"-") == 0)   infile = "<stdin>";  else   TRYOPEN(argv[0],infile,"r",in);  if(debug) fprintf(stderr,"larcbk2rc: infile: %s, outfile: %s\n",  			infile,ofile);  if(!(ih=read_header(in)))   NOTSPS(argv[0],infile);  if(ih->common.type != FT_SCBK) {   fprintf(stderr,"larcbk2rc: input file not SCBK.\n");  }  if(ih->hd.scbk->codebook_type != LAR_CBK &&     ih->hd.scbk->codebook_type != LAR_VCD_CBK &&     ih->hd.scbk->codebook_type != LAR_UNVCD_CBK) {   fprintf(stderr,"larcbk2rc: input file not type LAR.\n");   exit(1);  }  oh = copy_header(ih);  if(ih->hd.scbk->codebook_type == LAR_CBK)    oh->hd.scbk->codebook_type = RC_CBK;  if(ih->hd.scbk->codebook_type == LAR_VCD_CBK)    oh->hd.scbk->codebook_type = RC_VCD_CBK;  if(ih->hd.scbk->codebook_type == LAR_UNVCD_CBK)    oh->hd.scbk->codebook_type = RC_UNVCD_CBK;  add_source_file(oh,infile,ih);  add_comment(oh,get_cmd_line(argc,argv));  write_header(oh,out);  in_rec = allo_scbk_rec(ih);  if(get_scbk_rec(in_rec,ih,in) == EOF) {   fprintf(stderr,"larcbk2rc: error reading record in %s\n",infile);   exit(1);  }  if(debug) fprintf(stderr,"larcbk2rc: num_cdwds = %d\n",   ih->hd.scbk->num_cdwds);  in_rec->final_dist = -1;  for(i=0; i<ih->hd.scbk->num_cdwds-1;i++) {   in_rec->cdwd_dist[i] = -1;   if(debug) fprintf(stderr,"qtable[%d].enc: %f\n",i,    in_rec->qtable[i].enc);   if(debug) fprintf(stderr,"qtable[%d].dec: %f\n",i,    in_rec->qtable[i].dec);   in_rec->qtable[i].enc = lar_to_rc(in_rec->qtable[i].enc);   in_rec->qtable[i].dec = lar_to_rc(in_rec->qtable[i].dec);  }  /* we have to handle the last case as a special case */  i = ih->hd.scbk->num_cdwds-1;  if(debug) fprintf(stderr,"qtable[%d].enc: %f\n",i,   in_rec->qtable[i].enc);  if(debug) fprintf(stderr,"qtable[%d].dec: %f\n",i,   in_rec->qtable[i].dec);  in_rec->cdwd_dist[i] = -1;  in_rec->qtable[i].dec = lar_to_rc(in_rec->qtable[i].dec);  put_scbk_rec(in_rec,oh,out);  fclose(out);}

⌨️ 快捷键说明

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