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

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

?? sbc.c

?? bluetooth 開發應用bluez-utils-2.23
?? C
?? 第 1 頁 / 共 3 頁
字號:
						slicecount += 2;					}				}			}		} while (bitcount + slicecount < frame->bitpool);		if (bitcount + slicecount == frame->bitpool) {			bitcount += slicecount;			bitslice--;		}		for (ch = 0; ch < 2; ch++) {			for (sb = 0; sb < frame->subbands; sb++) {				if (bitneed[ch][sb] < bitslice + 2) {					bits[ch][sb] = 0;				} else {					bits[ch][sb] = bitneed[ch][sb] - bitslice;					if (bits[ch][sb] > 16)						bits[ch][sb] = 16;				}			}		}		ch = 0;		sb = 0;		while ((bitcount < frame->bitpool) && (sb < frame->subbands)) {			if ((bits[ch][sb] >= 2) && (bits[ch][sb] < 16)) {				bits[ch][sb]++;				bitcount++;			} else if ((bitneed[ch][sb] == bitslice + 1) && (frame->bitpool > bitcount + 1)) {				bits[ch][sb] = 2;				bitcount += 2;			}			if (ch == 1) {				ch = 0;				sb++;			} else {				ch = 1;			}		}		ch = 0;		sb = 0;		while ((bitcount < frame->bitpool) && (sb < frame->subbands)) {			if (bits[ch][sb] < 16) {				bits[ch][sb]++;				bitcount++;			}			if (ch == 1) {				ch = 0;				sb++;			} else {				ch = 1;			}		}	}}/*  * Unpacks a SBC frame at the beginning of the stream in data, * which has at most len bytes into frame. * Returns the length in bytes of the packed frame, or a negative * value on error. The error codes are: * *  -1   Data stream too short *  -2   Sync byte incorrect *  -3   CRC8 incorrect *  -4   Bitpool value out of bounds */static int sbc_unpack_frame(const u_int8_t * data, struct sbc_frame *frame, size_t len){	int consumed;	/* Will copy the parts of the header that are relevant to crc calculation here */	u_int8_t crc_header[11] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };	int crc_pos = 0;	u_int8_t sf;		/* sampling_frequency, temporarily needed as array index */	int ch, sb, blk, bit;	/* channel, subband, block and bit standard counters */	int bits[2][8];		/* bits distribution */	int levels[2][8];	/* levels derived from that */	double scalefactor[2][8];	/* derived from frame->scale_factors */	if (len < 4) {		return -1;	}	if (data[0] != SBC_SYNCWORD) {		return -2;	}	sf = (data[1] >> 6) & 0x03;	switch (sf) {	case SBC_FS_16:		frame->sampling_frequency = 16;		break;	case SBC_FS_32:		frame->sampling_frequency = 32;		break;	case SBC_FS_44:		frame->sampling_frequency = 44.1;		break;	case SBC_FS_48:		frame->sampling_frequency = 48;		break;	}	switch ((data[1] >> 4) & 0x03) {	case SBC_NB_4:		frame->blocks = 4;		break;	case SBC_NB_8:		frame->blocks = 8;		break;	case SBC_NB_12:		frame->blocks = 12;		break;	case SBC_NB_16:		frame->blocks = 16;		break;	}	frame->channel_mode = (data[1] >> 2) & 0x03;	switch (frame->channel_mode) {	case MONO:		frame->channels = 1;		break;	case DUAL_CHANNEL:	/* fall-through */	case STEREO:	case JOINT_STEREO:		frame->channels = 2;		break;	}	frame->allocation_method = (data[1] >> 1) & 0x01;	frame->subbands = (data[1] & 0x01) ? 8 : 4;	frame->bitpool = data[2];	if (((frame->channel_mode == MONO || frame->channel_mode == DUAL_CHANNEL)	     && frame->bitpool > 16 * frame->subbands)	    || ((frame->channel_mode == STEREO || frame->channel_mode == JOINT_STEREO)		&& frame->bitpool > 32 * frame->subbands)) {		return -4;	}	/* data[3] is crc, we're checking it later */	consumed = 32;	crc_header[0] = data[1];	crc_header[1] = data[2];	crc_pos = 16;	if (frame->channel_mode == JOINT_STEREO) {		if (len * 8 < consumed + frame->subbands) {			return -1;		} else {			frame->join = 0x00;			for (sb = 0; sb < frame->subbands - 1; sb++) {				frame->join |= ((data[4] >> (7 - sb)) & 0x01) << sb;			}			if (frame->subbands == 4) {				crc_header[crc_pos / 8] = data[4] & 0xf0;			} else {				crc_header[crc_pos / 8] = data[4];			}			consumed += frame->subbands;			crc_pos += frame->subbands;		}	}	if (len * 8 < consumed + (4 * frame->subbands * frame->channels)) {		return -1;	} else {		for (ch = 0; ch < frame->channels; ch++) {			for (sb = 0; sb < frame->subbands; sb++) {				/* FIXME assert(consumed % 4 == 0); */				frame->scale_factor[ch][sb] = (data[consumed / 8] >> (4 - (consumed % 8))) & 0x0F;				crc_header[crc_pos / 8] |= frame->scale_factor[ch][sb] << (4 - (crc_pos % 8));				consumed += 4;				crc_pos += 4;			}		}	}	if (data[3] != sbc_crc8(crc_header, crc_pos)) {		return -3;	}	sbc_calculate_bits(frame, bits, sf);	for (blk = 0; blk < frame->blocks; blk++) {		for (ch = 0; ch < frame->channels; ch++) {			for (sb = 0; sb < frame->subbands; sb++) {				frame->audio_sample[blk][ch][sb] = 0;				if (bits[ch][sb] != 0) {					for (bit = 0; bit < bits[ch][sb]; bit++) {						int b;	/* A bit */						if (consumed > len * 8) {							return -1;						}						b = (data[consumed / 8] >> (7 - (consumed % 8))) & 0x01;						frame->audio_sample[blk][ch][sb] |= b << (bits[ch][sb] - bit - 1);						consumed++;					}				}			}		}	}	for (ch = 0; ch < frame->channels; ch++) {		for (sb = 0; sb < frame->subbands; sb++) {			levels[ch][sb] = (1 << bits[ch][sb]) - 1;			scalefactor[ch][sb] = 2 << frame->scale_factor[ch][sb];		}	}	for (blk = 0; blk < frame->blocks; blk++) {		for (ch = 0; ch < frame->channels; ch++) {			for (sb = 0; sb < frame->subbands; sb++) {				if (levels[ch][sb] > 0) {					frame->sb_sample[blk][ch][sb] =					    scalefactor[ch][sb] * ((frame->audio_sample[blk][ch][sb] * 2.0 + 1.0) /								   levels[ch][sb] - 1.0);				} else {					frame->sb_sample[blk][ch][sb] = 0;				}			}		}	}	if (frame->channel_mode == JOINT_STEREO) {		for (blk = 0; blk < frame->blocks; blk++) {			for (sb = 0; sb < frame->subbands; sb++) {				if (frame->join & (0x01 << sb)) {					frame->sb_sample[blk][0][sb] =					    frame->sb_sample[blk][0][sb] + frame->sb_sample[blk][1][sb];					frame->sb_sample[blk][1][sb] =					    frame->sb_sample[blk][0][sb] - 2 * frame->sb_sample[blk][1][sb];				}			}		}	}	if (consumed % 8 != 0)		consumed += 8 - (consumed % 8);	return consumed / 8;}static void sbc_decoder_init(struct sbc_decoder_state *state, const struct sbc_frame *frame){	memset(&state->S, 0, sizeof(state->S));	memset(&state->X, 0, sizeof(state->X));	memset(&state->V, 0, sizeof(state->V));	memset(&state->U, 0, sizeof(state->U));	memset(&state->W, 0, sizeof(state->W));	state->subbands = frame->subbands;}static inline void sbc_synthesize_four(struct sbc_decoder_state *state,				struct sbc_frame *frame, int ch, int blk){	int i, j, k;	/* Input 4 New Subband Samples */	for (i = 0; i < 4; i++)		state->S[ch][i] = frame->sb_sample[blk][ch][i];	/* Shifting */	for (i = 79; i >= 8; i--)		state->V[ch][i] = state->V[ch][i - 8];	/* Matrixing */	for (k = 0; k < 8; k++) {		state->V[ch][k] = 0;		for (i = 0; i < 4; i++)			state->V[ch][k] += synmatrix4[k][i] * state->S[ch][i];	}	/* Build a 40 values vector U */	for (i = 0; i <= 4; i++) {		for (j = 0; j < 4; j++) {			state->U[ch][i * 8 + j] = state->V[ch][i * 16 + j];			state->U[ch][i * 8 + j + 4] = state->V[ch][i * 16 + j + 12];		}	}	/* Window by 40 coefficients */	for (i = 0; i < 40; i++)		state->W[ch][i] = state->U[ch][i] * sbc_proto_4_40[i] * (-4);	/* Calculate 4 audio samples */	for (j = 0; j < 4; j++) {		state->X[ch][j] = 0;		for (i = 0; i < 10; i++)			state->X[ch][j] += state->W[ch][j + 4 * i];	}	/* Output 4 reconstructed Audio Samples */	for (i = 0; i < 4; i++)		frame->pcm_sample[ch][blk * 4 + i] = state->X[ch][i];}static inline void sbc_synthesize_eight(struct sbc_decoder_state *state,				struct sbc_frame *frame, int ch, int blk){	int i, j, k;	/* Input 8 New Subband Samples */	for (i = 0; i < 8; i++)		state->S[ch][i] = frame->sb_sample[blk][ch][i];	/* Shifting */	for (i = 159; i >= 16; i--)		state->V[ch][i] = state->V[ch][i - 16];	/* Matrixing */	for (k = 0; k < 16; k++) {		state->V[ch][k] = 0;		for (i = 0; i < 8; i++) {			state->V[ch][k] += synmatrix8[k][i] * state->S[ch][i];		}	}	/* Build a 80 values vector U */	for (i = 0; i <= 4; i++) {		for (j = 0; j < 8; j++) {			state->U[ch][i * 16 + j] = state->V[ch][i * 32 + j];			state->U[ch][i * 16 + j + 8] = state->V[ch][i * 32 + j + 24];		}	}	/* Window by 80 coefficients */	for (i = 0; i < 80; i++)		state->W[ch][i] = state->U[ch][i] * sbc_proto_8_80[i] * (-4);	/* Calculate 8 audio samples */	for (j = 0; j < 8; j++) {		state->X[ch][j] = 0;		for (i = 0; i < 10; i++)			state->X[ch][j] += state->W[ch][j + 8 * i];	}	/* Ouput 8 reconstructed Audio Samples */	for (i = 0; i < 8; i++)		frame->pcm_sample[ch][blk * 8 + i] = state->X[ch][i];}static int sbc_synthesize_audio(struct sbc_decoder_state *state, struct sbc_frame *frame){	int ch, blk;	switch (frame->subbands) {	case 4:		for (ch = 0; ch < frame->channels; ch++) {			memset(frame->pcm_sample[ch], 0,				sizeof(frame->pcm_sample[ch]));			for (blk = 0; blk < frame->blocks; blk++)				sbc_synthesize_four(state, frame, ch, blk);		}		return frame->blocks * 4;	case 8:		for (ch = 0; ch < frame->channels; ch++) {			memset(frame->pcm_sample[ch], 0,				sizeof(frame->pcm_sample[ch]));			for (blk = 0; blk < frame->blocks; blk++)				sbc_synthesize_eight(state, frame, ch, blk);		}		return frame->blocks * 8;	default:		return -EIO;	}}static void sbc_encoder_init(struct sbc_encoder_state *state, const struct sbc_frame *frame){	memset(&state->S, 0, sizeof(state->S));	memset(&state->X, 0, sizeof(state->X));	memset(&state->Y, 0, sizeof(state->Y));	memset(&state->Z, 0, sizeof(state->Z));	state->subbands = frame->subbands;}static inline void sbc_analyze_four(struct sbc_encoder_state *state,				struct sbc_frame *frame, int ch, int blk){	int i, k;	/* Input 4 New Audio Samples */	for (i = 39; i >= 4; i--)		state->X[ch][i] = state->X[ch][i - 4];	for (i = 3; i >= 0; i--)		state->X[ch][i] = frame->pcm_sample[ch][blk * 4 + (3 - i)];	/* Windowing by 40 coefficients */	for (i = 0; i < 40; i++)		state->Z[ch][i] = sbc_proto_4_40[i] * state->X[ch][i];	/* Partial calculation */	for (i = 0; i < 8; i++) {		state->Y[ch][i] = 0;		for (k = 0; k < 5; k++)			state->Y[ch][i] += state->Z[ch][i + k * 8];	}	/* Calculate 4 subband samples by Matrixing */	for (i = 0; i < 4; i++) {		state->S[ch][i] = 0;		for (k = 0; k < 8; k++)			state->S[ch][i] += anamatrix4[i][k] * state->Y[ch][k];	}	/* Output 4 Subband Samples */	for (i = 0; i < 4; i++)		frame->sb_sample[blk][ch][i] = state->S[ch][i];}static inline void sbc_analyze_eight(struct sbc_encoder_state *state,				struct sbc_frame *frame, int ch, int blk){	int i, k;	/* Input 8 Audio Samples */	for (i = 79; i >= 8; i--)		state->X[ch][i] = state->X[ch][i - 8];	for (i = 7; i >= 0; i--)		state->X[ch][i] = frame->pcm_sample[ch][blk * 8 + (7 - i)];	/* Windowing by 80 coefficients */	for (i = 0; i < 80; i++)		state->Z[ch][i] = sbc_proto_8_80[i] * state->X[ch][i];	/* Partial calculation */	for (i = 0; i < 16; i++) {		state->Y[ch][i] = 0;		for (k = 0; k < 5; k++)			state->Y[ch][i] += state->Z[ch][i + k * 16];	}	/* Calculate 8 subband samples by Matrixing */	for (i = 0; i < 8; i++) {		state->S[ch][i] = 0;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆精品国产自产在线| 色综合久久中文字幕| 国产日本欧美一区二区| 粉嫩嫩av羞羞动漫久久久| 国产欧美视频在线观看| 97久久人人超碰| 亚洲国产精品久久不卡毛片| 欧美优质美女网站| 日韩精品电影在线观看| 欧美一区二区三区在线观看 | 中文字幕va一区二区三区| 不卡av电影在线播放| 爽爽淫人综合网网站| 久久久久97国产精华液好用吗 | 国产真实精品久久二三区| 国产亚洲欧美一级| 成人av午夜电影| 日本大胆欧美人术艺术动态| 国产午夜精品久久久久久免费视| 91福利区一区二区三区| 久久国产免费看| 中文字幕一区av| 欧洲精品一区二区三区在线观看| 日产欧产美韩系列久久99| 中文字幕亚洲区| 精品国产乱码91久久久久久网站| 不卡在线观看av| 日产精品久久久久久久性色| 国产精品剧情在线亚洲| 欧美一区二区三区男人的天堂| 91麻豆国产自产在线观看| 国产精品亚洲午夜一区二区三区| 一区二区三区四区乱视频| 国产偷国产偷亚洲高清人白洁| 91麻豆精品91久久久久久清纯| bt7086福利一区国产| 成人一级视频在线观看| 久久精品国产亚洲a| 日本不卡中文字幕| 午夜一区二区三区视频| 中文一区在线播放| 国产午夜亚洲精品理论片色戒| 欧美日韩精品福利| 日韩一区和二区| 日韩女优av电影| 久久久久久久久99精品| 久久午夜老司机| 欧美一级爆毛片| 久久久久亚洲蜜桃| 国产精品视频第一区| 亚洲欧美日韩人成在线播放| 亚洲激情在线播放| 亚洲超碰精品一区二区| 丝袜亚洲另类丝袜在线| 国产精品一二三四五| 91免费视频大全| 6080亚洲精品一区二区| 欧美日韩一区不卡| 国产女人18毛片水真多成人如厕 | 中文字幕第一区二区| 亚洲国产精品综合小说图片区| 六月丁香婷婷久久| 91在线精品一区二区| 国产91精品精华液一区二区三区 | 精品久久久三级丝袜| 亚洲欧美在线aaa| 日本欧美肥老太交大片| 国产精品18久久久| 5566中文字幕一区二区电影| 中文字幕久久午夜不卡| 日韩和欧美一区二区三区| 99久久久国产精品免费蜜臀| 欧美高清在线一区二区| 国产一区二区精品久久91| 欧美影视一区在线| 一区二区三区不卡视频| 欧美在线观看一二区| 亚洲精选一二三| 成人99免费视频| 一区二区三区日韩精品| 欧美天堂一区二区三区| 国产精品国产三级国产有无不卡 | 日韩你懂的在线播放| 老司机午夜精品| 国产精品美女一区二区在线观看| 国产成人av电影在线播放| 欧美成人福利视频| 天堂成人免费av电影一区| 欧美这里有精品| 午夜精品一区二区三区三上悠亚| 色狠狠桃花综合| 午夜精品福利一区二区蜜股av| 欧美性三三影院| 久久99热狠狠色一区二区| 精品美女被调教视频大全网站| 久久精品国产久精国产爱| 2024国产精品视频| 成人午夜电影网站| 亚洲人成精品久久久久久| 成人小视频在线| 一区二区三区在线视频免费 | 成人欧美一区二区三区视频网页 | 成人sese在线| 欧美激情资源网| 欧美日韩三级在线| 国产风韵犹存在线视精品| 亚洲综合色在线| 国产精品久久久久久久浪潮网站 | 中文字幕一区二区三区不卡| 欧美日韩精品一区二区在线播放| 国产大片一区二区| 国产在线视频一区二区三区| 日韩精品欧美精品| 婷婷国产在线综合| 亚洲精品综合在线| **网站欧美大片在线观看| 国产日韩欧美精品在线| 精品国产一区二区三区久久久蜜月| 在线播放欧美女士性生活| 色婷婷综合久久久久中文 | 欧美亚洲国产一区二区三区va | 91极品美女在线| 色哟哟在线观看一区二区三区| 国产91在线|亚洲| 国产麻豆91精品| 国产成人精品午夜视频免费 | 久久丁香综合五月国产三级网站| 日韩综合一区二区| 国产在线观看一区二区| 成人听书哪个软件好| 欧美伊人精品成人久久综合97| 91精品福利在线| 日韩一区二区三区免费看 | 蜜桃视频一区二区三区在线观看| 国产成人免费av在线| 欧美一级理论片| 蜜桃av一区二区三区电影| 欧美日韩一区不卡| 国产精品美女久久久久久久网站| 激情综合色综合久久综合| 精品国产免费人成在线观看| 日本不卡一二三| 26uuu欧美日本| 成人一级黄色片| 丁香六月久久综合狠狠色| 欧美日韩一区中文字幕| 中文字幕精品一区二区精品绿巨人| 性久久久久久久| 欧美在线啊v一区| 国产精品毛片高清在线完整版| 久久99国产精品尤物| 精品国产电影一区二区| 日韩和欧美一区二区| 欧美日本在线播放| 亚洲三级电影网站| 色婷婷综合五月| 一区二区三区日韩欧美| 色综合视频一区二区三区高清| 国产视频一区在线播放| 国产成都精品91一区二区三| 亚洲精品一区二区三区福利| 韩国毛片一区二区三区| 欧美sm美女调教| 国产v综合v亚洲欧| 国产精品理论片| 欧美三级日韩三级| 日本三级韩国三级欧美三级| 欧美一级在线免费| 国产精品白丝jk黑袜喷水| 国产欧美一区二区在线观看| 欧美日韩日日摸| 日韩理论电影院| 成人美女在线观看| 日韩三级精品电影久久久| 日韩经典一区二区| 日本道免费精品一区二区三区| 色域天天综合网| 亚洲国产另类精品专区| 欧美性猛片xxxx免费看久爱| 一区二区高清在线| 日韩一区二区影院| 91在线视频观看| 久久精品国产999大香线蕉| 国产欧美中文在线| 7777精品伊人久久久大香线蕉 | 欧美人牲a欧美精品| 国产精品一区二区视频| 亚洲成人av资源| 亚洲欧洲三级电影| 国产日韩av一区| 精品动漫一区二区三区在线观看| 97久久精品人人做人人爽| 国产一区二区免费在线| 免费观看久久久4p| 日韩在线一区二区| 伊人夜夜躁av伊人久久| 亚洲色图在线看| 一区二区三区日韩| 一区二区三区不卡视频 | 国产人成亚洲第一网站在线播放|