亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? qnt12.c

?? MELPe 1200 bps, fixed point
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* ================================================================== */
/*                                                                    */ 
/*    Microsoft Speech coder     ANSI-C Source Code                   */
/*    SC1200 1200 bps speech coder                                    */
/*    Fixed Point Implementation      Version 7.0                     */
/*    Copyright (C) 2000, Microsoft Corp.                             */
/*    All rights reserved.                                            */
/*                                                                    */ 
/* ================================================================== */

/*------------------------------------------------------------------*/
/*																	*/
/* File:		qnt12.c 											*/
/*																	*/
/* Description: quantization for 1200bps							*/
/*																	*/
/*------------------------------------------------------------------*/

#include "sc1200.h"
#include "lpc_lib.h"
#include "vq_lib.h"
#include "global.h"
#include "macro.h"
#include "qnt12_cb.h"
#include "mat_lib.h"
#include "math_lib.h"
#include "qnt12.h"
#include "constant.h"
#include "mathhalf.h"
#include "msvq_cb.h"
#include "fsvq_cb.h"
#include "dsp_sub.h"
#include "melp_sub.h"

#define	LSP_INP_CAND		5
#define NF_X_NUM_GAINFR		(NF * NUM_GAINFR)

#define X0333_Q15			10923                        /* (1/3) * (1 << 15) */
#define X0667_Q15			21845                        /* (2/3) * (1 << 15) */

/* ------ Local prototypes ------ */
static void		wvq1(Shortword target[], Shortword weights[],
					 const Shortword codebook[], Shortword dim,
					 Shortword cbsize, Shortword index[], Longword dist[],
					 Shortword cand);
static Shortword	InsertCand(Shortword c1, Shortword s1, Shortword dMin[], 
							Shortword distortion, Shortword entry, 
							Shortword nextIndex[], Shortword index[]);
static Shortword	wvq2(Shortword target[], Shortword weights[],
						 Shortword codebook[], Shortword dim,
						 Shortword index[], Longword dist[], Shortword cand);
static Shortword	WeightedMSE(Shortword n, Shortword weight[], 
						const Shortword x[], Shortword target[],
						Shortword max_dMin);
static void		lspVQ(Shortword target[], Shortword weight[], Shortword qout[],
					  const Shortword codebook[], Shortword tos,
					  const Shortword cb_size[], Shortword cb_index[],
					  Shortword dim, BOOLEAN flag);


/****************************************************************************
**
** Function:		pitch_vq
**
** Description: 	Pitch values of three frames are vector quantized
**
** Arguments:
**
**	melp_param *par ---- input/output melp parameters
**
** Return value:	None
**
*****************************************************************************/
void pitch_vq(struct melp_param *par)
{
	register Shortword	i;
	static BOOLEAN	prev_uv_flag = TRUE;
	static Shortword	prev_pitch = LOG_UV_PITCH_Q12;                 /* Q12 */
	static Shortword	prev_qpitch = LOG_UV_PITCH_Q12;                /* Q12 */
	const Shortword		*codebook;
	Shortword	cnt, size, pitch_index;
	Shortword	temp1, temp2;
	Longword	L_temp;
	Shortword	dcb[PITCH_VQ_CAND * NF];                               /* Q12 */
	Shortword	target[NF], deltp[NF];                                 /* Q12 */
	Shortword	deltw[NF];                                              /* Q0 */
	Shortword	weights[NF];                                            /* Q0 */
	Shortword	indexlist[PITCH_VQ_CAND];
	Longword	distlist[PITCH_VQ_CAND];                               /* Q25 */


	/* ---- Compute pitch in log domain ---- */
	for (i = 0; i < NF; i++)
		target[i] = log10_fxp(par[i].pitch, 7);                        /* Q12 */

	cnt = 0;
	for (i = 0; i < NF; i++){
		if (par[i].uv_flag)
			weights[i] = 0;                                             /* Q0 */
		else {
			weights[i] = 1;
			cnt++;
		}
	}

	/* ---- calculate delta ---- */
	for (i = 0; i < NF; i++){
		if (prev_uv_flag || par[i].uv_flag){
			deltp[i] = 0;
			deltw[i] = 0;
		} else {
			deltp[i] = sub(target[i], prev_pitch);
			deltw[i] = DELTA_PITCH_WEIGHT_Q0;
		}
		prev_pitch = target[i];
		prev_uv_flag = par[i].uv_flag;
	}

	if (cnt == 0){

		for (i = 0; i < NF; i++)
			par[i].pitch = UV_PITCH;
		prev_qpitch = LOG_UV_PITCH_Q12;

	} else if (cnt == 1){

		for (i = 0; i < NF; i++){
			if (!par[i].uv_flag){
				quant_u(&target[i], &(quant_par.pitch_index), PIT_QLO_Q12,
						PIT_QUP_Q12, PIT_QLEV_M1, PIT_QLEV_M1_Q8, TRUE, 7);
				quant_u_dec(quant_par.pitch_index, &par[i].pitch,
							PIT_QLO_Q12, PIT_QUP_Q12, PIT_QLEV_M1_Q8, 7);
			} else
				par[i].pitch = LOG_UV_PITCH_Q12;
		}

		/* At this point par[].pitch temporarily holds the pitches in the     */
		/* log domain with Q12.                                               */

		prev_qpitch = par[NF - 1].pitch;                               /* Q12 */

		for (i = 0; i < NF; i++)
			par[i].pitch = pow10_fxp(par[i].pitch, 7);                  /* Q7 */

	} else if (cnt > 1){                     /* cnt == 2, 3, ......, (NF - 1) */
		/* ----- set pointer -----*/
		if (cnt == NF){                          /* All NF frames are voiced. */
			codebook = pitch_vq_cb_vvv;
			size = PITCH_VQ_LEVEL_VVV;
		} else {
			codebook = pitch_vq_cb_uvv;
			size = PITCH_VQ_LEVEL_UVV;
		} /* This part changed !!! (12/13/99) */

		/* ---- select candidate using static pitch distortion ---- */
		wvq1(target, weights, codebook, NF, size, indexlist, distlist,
			 PITCH_VQ_CAND);

		/* -- select index using static and delta pitch distortion -- */
		temp1 = 0;
		for (i = 0; i < PITCH_VQ_CAND; i++){
			L_temp = L_mult(indexlist[i], NF);
			L_temp = L_shr(L_temp, 1);
			temp2 = extract_l(L_temp);

			/* Now temp1 is (i*NF) and temp2 is (indexlist[i]*NF).            */

			dcb[temp1] = sub(codebook[temp2], prev_qpitch);            /* Q12 */
			v_equ(&dcb[temp1 + 1], &codebook[temp2 + 1], NF - 1);
			v_sub(&dcb[temp1 + 1], &codebook[temp2], NF - 1);
			temp1 = add(temp1, NF);
		}

		pitch_index = wvq2(deltp, deltw, dcb, NF, indexlist, distlist,
						   PITCH_VQ_CAND);

		if (par[NF - 1].uv_flag)
			prev_qpitch = LOG_UV_PITCH_Q12;
		else
			prev_qpitch = codebook[pitch_index*NF + NF - 1];           /* Q12 */

		for (i = 0; i < NF; i++){
			if (par[i].uv_flag)
				par[i].pitch = UV_PITCH_Q7;
			else
				par[i].pitch = pow10_fxp(codebook[pitch_index*NF + i], 7);
		}

		quant_par.pitch_index = pitch_index;
	}
}


/****************************************************************************
**
** Function:		wvq1
**
** Description: 	Pitch vq the first stage
**
**    The purpose of wvq1() is to loop through all the "cbsize" entries of
**    codebook[] (PITCH_VQ_LEVEL_VVV or PITCH_VQ_LEVEL_UVV, 512 or 2048) and
**    record the "cand" entries (PITCH_VQ_CAND, 16) which yields the minimum
**    errors.
**
** Arguments:
**	Shortword target[] 	: target vector (Q12)
**	Shortword weights[]	: weighting vector (Q0)
**	Shortword codebook[]: codebook (Q12)
**	Shortword dim 		: vector dimension
**	Shortword cbsize	: codebook size
**	Shortword index[]	: output candidate index list
**	Longword dist[]		: output candidate distortion list (Q25)
**	Shortword cand		: number of output candidates
**
** Return value:	None
**
*****************************************************************************/
static void		wvq1(Shortword target[], Shortword weights[],
					 const Shortword codebook[], Shortword dim,
					 Shortword cbsize, Shortword index[], Longword dist[],
					 Shortword cand)
{
	register Shortword	i, j;
	Shortword	maxindex;
	Longword	err, maxdist;                                          /* Q25 */
	Longword	L_temp;
	Shortword	temp;                                                  /* Q12 */


	/* ------ Initialize the distortion ------ */
	L_fill(dist, LW_MAX, cand);

	maxdist = LW_MAX;
	maxindex = 0;

	/* ------ Search the codebook ------ */
	for (i = 0; i < cbsize; i++){

		err = 0;

		/* Here the for loop computes the distortion between target[] and     */
		/* codebook[] and stores the result in Longword err.  If              */
		/* (err < maxdist) then we execute some actions.  If err is already   */
		/* larger than or equal to maxdist, there is no need to keep          */
		/* computing the distortion.  This improvement is only marginal       */
		/* because "dim" is small (NF == 3).                                  */

		for (j = 0; j < dim; j++){
			if (weights[j] > 0){               /* weights[] is either 1 or 0. */
				/*	err += SQR(target[j] - codebook[j]); */
				temp = sub(target[j], codebook[j]);                    /* Q12 */
				L_temp = L_mult(temp, temp);                           /* Q25 */
				L_temp = L_shr(L_temp, 2);                             /* Q23 */
				err = L_add(err, L_temp);
				if (err >= maxdist)
					break;
			}
		}
		if (err < maxdist){
			index[maxindex] = i;
			dist[maxindex] = err;

			/* The following loop forgets maxindex and maxdist and finds them */
			/* from scratch.  This is very inefficient because "cand" is      */
			/* PITCH_VQ_CAND (== 16) and we know the maximum is always        */
			/* replaced just now by the new "err".  However, an attempt of    */
			/* keeping dist[] sorted (so the following loop is not needed     */
			/* every time we update maxdist) only shows minimal improvement.  */

			maxdist = 0;
			for (j = 0; j < cand; j++){
				if (dist[j] > maxdist){
					maxdist = dist[j];
					maxindex = j;
				}
			}
		}
		codebook += dim;                              /* Pointer arithmetics. */
	}
}


/****************************************************************************
**
** Function:		wvq2
**
** Description: 	Pitch vq the second stage
**
** Arguments:
**	Shortword target[] 	: target vector (Q12)
**	Shortword weights[]	: weighting vector (Q0)
**	Shortword codebook[]: codebook (Q12)
**	Shortword dim 		: vector dimension
**	Shortword index[]	: codebook index
**	Longword dist[]		: distortion (Q25)
**	Shortword cand		: number of input candidates
**
** Return value:	Shortword ---- the final codebook index
**
*****************************************************************************/
static Shortword	wvq2(Shortword target[], Shortword weights[],
						 Shortword codebook[], Shortword dim,
						 Shortword index[], Longword dist[], Shortword cand)
{
	register Shortword	i, j;
	Shortword	ind;
	Longword	err, min;        
	Longword	L_temp;
	Shortword	temp;


	/* To reduce the complexity, we should try to increase the opportunity of */
	/* making (err >= min).  In other words, set "min" as small as possible   */
	/* before the loop begins.  One idea is to find the i which minimizes     */
	/* dist[] and use it to compute "min" and "ind" first, then loop through  */
	/* all candidates except this i.  This scheme only reduces about 1/100 of */
	/* the execution time, so it is not implemented here.                     */

	min = LW_MAX;
	ind = 0;

	for (i = 0; i < cand; i++){
		err = dist[i];

		for (j = 0; j < dim; j++){
			if (weights[j] > 0){

				/* weights[] are either 0 or a positive constant              */
				/* DELTA_PITCH_WEIGHT_Q0 == 1.  Note that the following code  */
				/* segment no longer works correctly if DELTA_PITCH_WEIGHT_Q0 */
				/* is changed to other value.                                 */

				/*	err += weights[j] * SQR(target[j] - codebook[j]); */

				temp = sub(target[j], codebook[j]);                    /* Q12 */
				L_temp = L_mult(temp, temp);                           /* Q25 */
				L_temp = L_shr(L_temp, 2);                             /* Q23 */
				err = L_add(err, L_temp);                              /* Q23 */

				/* Exit the loop if (err >= min). */
				if (err >= min)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产很黄免费观看久久| 欧美一区二区私人影院日本| 国产999精品久久| 精品亚洲aⅴ乱码一区二区三区| 亚洲va在线va天堂| 亚洲高清视频的网址| 一区二区三区美女视频| 夜夜嗨av一区二区三区中文字幕| 亚洲乱码国产乱码精品精98午夜 | 欧美极品另类videosde| 久久久久久久久久久黄色| 久久夜色精品国产欧美乱极品| 久久综合九色综合欧美就去吻| 久久久久久久性| 国产日韩欧美精品综合| 亚洲欧美激情一区二区| 免费不卡在线视频| 美腿丝袜亚洲综合| 国产一区二区免费视频| 国产一区二区免费看| 国产精品1区2区3区| 国产91露脸合集magnet| 91丝袜高跟美女视频| 欧美性猛交xxxx乱大交退制版| 欧美丝袜第三区| 91精品国产91久久久久久一区二区 | 成人av电影在线| 色欧美88888久久久久久影院| 欧美日韩亚洲综合在线| 日韩欧美国产wwwww| 国产欧美一二三区| 亚洲制服丝袜av| 麻豆一区二区三| 成人精品免费网站| 91黄视频在线观看| 日韩一区二区电影| 国产午夜精品一区二区三区视频| 亚洲欧洲中文日韩久久av乱码| 亚洲第一久久影院| 国产乱子伦视频一区二区三区| 99re成人精品视频| 777午夜精品免费视频| 国产清纯在线一区二区www| 亚洲精品欧美综合四区| 久久99国产精品免费网站| www.亚洲精品| 日韩亚洲欧美在线观看| 国产精品美女一区二区三区 | 国产成人精品免费看| 欧美性猛交xxxx乱大交退制版| 欧美精品一区二区三区蜜桃| 亚洲免费在线观看| 极品少妇xxxx精品少妇| 色偷偷88欧美精品久久久| 欧美大片日本大片免费观看| 亚洲精品国产a| 国产高清不卡一区二区| 欧美日韩电影一区| 国产精品系列在线| 免费一级片91| 91免费在线视频观看| 欧美mv日韩mv亚洲| 夜夜嗨av一区二区三区网页 | 欧美卡1卡2卡| 国产精品久久久久久户外露出| 日韩中文字幕区一区有砖一区| 99久久精品一区| 精品久久五月天| 天天色图综合网| 色综合视频在线观看| 国产亚洲一区二区三区在线观看| 天天色综合天天| 一本色道综合亚洲| 中文字幕第一区综合| 久久国产精品色| 91精品国产欧美一区二区18| 亚洲美女区一区| 97se亚洲国产综合自在线不卡| 久久久久九九视频| 精品一区二区三区免费观看| 欧美精品三级在线观看| 一区二区三区美女| 99久久精品一区| 国产精品久久久久久久裸模| 高清国产一区二区| 国产午夜一区二区三区| 国内精品写真在线观看| 精品国产免费人成在线观看| 天天综合网 天天综合色| 日本精品免费观看高清观看| 亚洲人xxxx| 色综合久久久久综合99| 中文字幕一区二区三区精华液 | 老色鬼精品视频在线观看播放| 欧美色精品天天在线观看视频| 亚洲精品一二三| 91亚洲精品一区二区乱码| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 亚洲免费观看在线视频| 99re免费视频精品全部| 亚洲欧洲另类国产综合| 成人av小说网| 专区另类欧美日韩| 91在线一区二区三区| 中文字幕日韩av资源站| 99久久精品国产导航| 亚洲精品日日夜夜| 欧洲精品在线观看| 亚洲一区二区黄色| 欧美日韩一区二区三区在线| 亚洲一区二区三区在线播放 | 亚洲午夜电影在线| 欧美性猛片xxxx免费看久爱| 亚洲国产精品人人做人人爽| 91精品国产91久久综合桃花| 日韩电影在线一区二区| 经典三级在线一区| 日韩精品中文字幕在线不卡尤物| 亚洲国产精品自拍| 51精品视频一区二区三区| 日韩1区2区3区| 精品欧美黑人一区二区三区| 国产高清一区日本| 亚洲日本一区二区三区| 欧美亚洲国产一卡| 蜜臀久久99精品久久久久宅男| 久久综合色8888| 丁香婷婷综合色啪| 成人免费视频国产在线观看| 久久亚洲春色中文字幕久久久| 国内精品不卡在线| 久久人人爽人人爽| 亚洲国产一二三| 在线精品亚洲一区二区不卡| 色婷婷av一区二区三区软件| 在线观看国产91| 日韩一区二区麻豆国产| 久久精品亚洲一区二区三区浴池 | 国产精品三级久久久久三级| 亚洲婷婷综合色高清在线| 亚洲一区二区精品久久av| 免费精品视频在线| 国产成人亚洲精品狼色在线| 成人av资源网站| 欧美亚洲一区二区在线| 337p粉嫩大胆色噜噜噜噜亚洲| 成人白浆超碰人人人人| 色综合中文字幕国产 | 国产精品一级在线| 成人精品视频一区二区三区尤物| 日本韩国欧美三级| 欧美一级片免费看| 国产欧美日韩一区二区三区在线观看| 国产精品初高中害羞小美女文| 亚洲国产欧美日韩另类综合| 国产主播一区二区| 色一情一伦一子一伦一区| 日韩三级视频在线看| 国产精品伦一区| 日本亚洲一区二区| fc2成人免费人成在线观看播放| 欧美日韩一区三区四区| 国产欧美精品一区二区三区四区| 亚洲国产一区二区三区| 岛国av在线一区| 在线成人午夜影院| 国产精品国产三级国产aⅴ原创| 欧美aaaaaa午夜精品| 一本在线高清不卡dvd| 久久综合久久综合久久综合| 亚洲超碰97人人做人人爱| 国产激情视频一区二区三区欧美 | 99国产欧美久久久精品| 欧美日韩国产综合久久| 久久久久久9999| 日产精品久久久久久久性色| 99久久国产综合色|国产精品| 精品国产欧美一区二区| 日本亚洲天堂网| 欧美日韩亚洲综合| 亚洲美女淫视频| 99国产精品99久久久久久| 久久免费视频一区| 蜜臀av亚洲一区中文字幕| 欧美日韩一本到| 亚洲码国产岛国毛片在线| 成人短视频下载| 亚洲国产精品成人久久综合一区| 美女在线一区二区| 欧美久久久久久久久久| 一区二区在线看| 日本韩国欧美一区二区三区| 最新成人av在线| 国产91在线观看| 欧美成人综合网站| 日本系列欧美系列| 91麻豆精品国产91久久久久久久久 | 精品亚洲aⅴ乱码一区二区三区| 欧美一区二区三区四区视频| 日韩va欧美va亚洲va久久|