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

📄 complex.c

📁 2400bps MELP语音编解码源程序。
💻 C
字号:
/*

2.4 kbps MELP Proposed Federal Standard speech coder

Fixed-point C code, version 1.0

Copyright (c) 1998, Texas Instruments, Inc.  

Texas Instruments has intellectual property rights on the MELP
algorithm.  The Texas Instruments contact for licensing issues for
commercial and non-government use is William Gordon, Director,
Government Contracts, Texas Instruments Incorporated, Semiconductor
Group (phone 972 480 7442).

The fixed-point version of the voice codec Mixed Excitation Linear
Prediction (MELP) is based on specifications on the C-language software
simulation contained in GSM 06.06 which is protected by copyright and
is the property of the European Telecommunications Standards Institute
(ETSI). This standard is available from the ETSI publication office
tel. +33 (0)4 92 94 42 58. ETSI has granted a license to United States
Department of Defense to use the C-language software simulation contained
in GSM 06.06 for the purposes of the development of a fixed-point
version of the voice codec Mixed Excitation Linear Prediction (MELP).
Requests for authorization to make other use of the GSM 06.06 or
otherwise distribute or modify them need to be addressed to the ETSI
Secretariat fax: +33 493 65 47 16.

*/
/* Complexity counting functions */

#include <stdio.h>
#include "spbstd.h"

extern int complexity, saturation;

#define MAX_CMPLX 50

long cm_max[MAX_CMPLX];
long max_complexity;
long prev_complexity;
long sat_cnt[MAX_CMPLX];
long prev_saturation = 0;
static long frame = 0;

int cm_index;

/* Complexity_count: update max counter for current index */
int complexity_count()
{

    long temp;

    /* Check maximum complexity for current index */
    temp = complexity - prev_complexity;
    if (temp > cm_max[cm_index])
	cm_max[cm_index] = temp;

    /* Check for saturations */
    temp = saturation - prev_saturation;
    if (temp > 0) {
	sat_cnt[cm_index] += temp;
	printf("%d saturations in frame %d, index %d\n",
	       (int) temp, (int) frame, (int) cm_index);
    }

    /* Increment index and previous value */
    cm_index++;
    prev_complexity = complexity;
    prev_saturation = saturation;

    /* Check overall total complexity */
    if (complexity > max_complexity)
	max_complexity = complexity;

    return(0);

}

/* Complexity_reset: reset counters */
int complexity_reset()
{
    cm_index = 0;
    complexity = 0;
    prev_complexity = 0;

    frame++;

    return(0);
}

/* Complexity_print: print final complexity */
#define C_MOPS ((1.0/1000000)*8000/180) /* convert complexity to WMOPS */

int complexity_print()
{
    int i;
    long cm_total = 0;

    printf("Worst case total WMOPS = %6.2f, saturations = %d\n",
	   max_complexity*C_MOPS, saturation);

    printf("Individual cases:\n");
    for (i = 0; i < MAX_CMPLX; i++) {
	if (cm_max[i] == 0) {
	    printf("Sum of worst cases = %6.2f\n",cm_total*C_MOPS);
	    break;
	}
	else 
	    printf("%6.2f  %d\n",cm_max[i]*C_MOPS,(int) sat_cnt[i]);
	cm_total += cm_max[i];
    }
    return(0);
}
	    

⌨️ 快捷键说明

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