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

📄 speex_decode.cpp

📁 KphoneSI (kpsi) is a SIP (Session Initiation Protocol) user agent for Linux, with which you can in
💻 CPP
字号:
#include <stdlib.h>#include <stdio.h>#include "speex_define.h"void initspeexDecode(                   /* (o) Number of bytes encoded */     speex_Dec_Inst_t *global_vars   /* (i/o) Encoder instance */ ){	int tmp;/*Create a new decoder state in narrowband mode*/	global_vars->state = speex_decoder_init(&speex_nb_mode);/*Set the perceptual enhancement on*/	tmp=1;	speex_decoder_ctl(global_vars->state, SPEEX_SET_ENH, &tmp);	/*Initialization of the structure that holds the bits*/	speex_bits_init(&global_vars->bits);}void termspeexDecode(                   /* (o) Number of bytes encoded */     speex_Dec_Inst_t *global_vars   /* (i/o) Encoder instance */ ){    speex_bits_destroy(&global_vars->bits);    speex_decoder_destroy(global_vars->state);}int speex_decode (	speex_Dec_Inst_t *global_vars,    short *decoded_data,			/* output */    short *encoded_data,				/* input */	int lg){	float output[FRAME_SIZE];	char cbits[200];	short * ifc;	char * ifc2;	int i;	ifc2 = (char*) encoded_data;	for (i=0; i<lg;i++) {		cbits [i] = *ifc2;		ifc2++;		}	int nbBytes =lg;	/*Copy the data into the bit-stream struct*/	speex_bits_read_from(&global_vars->bits, cbits, nbBytes);	/*Decode the data*/	speex_decode(global_vars->state, &global_vars->bits, output);	ifc = decoded_data;	for (i=0; i<FRAME_SIZE;i++) {		*ifc = output [i];		ifc++;		}	return FRAME_SIZE;}

⌨️ 快捷键说明

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