CN1245706C - 多模式语音编码器 - Google Patents

多模式语音编码器 Download PDF

Info

Publication number
CN1245706C
CN1245706C CNB008159408A CN00815940A CN1245706C CN 1245706 C CN1245706 C CN 1245706C CN B008159408 A CNB008159408 A CN B008159408A CN 00815940 A CN00815940 A CN 00815940A CN 1245706 C CN1245706 C CN 1245706C
Authority
CN
China
Prior art keywords
gain
rate
voice
classification
frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CNB008159408A
Other languages
English (en)
Other versions
CN1451155A (zh
Inventor
高扬
A·本雅塞因
J·蒂森
E·肖洛莫特
苏环宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Magnesium Microwave Technology Co ltd
Marion Bide Technology Co ltd
Mindspeed Technologies LLC
Original Assignee
Conexant Systems LLC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from US09/574,396 external-priority patent/US6782360B1/en
Application filed by Conexant Systems LLC filed Critical Conexant Systems LLC
Publication of CN1451155A publication Critical patent/CN1451155A/zh
Application granted granted Critical
Publication of CN1245706C publication Critical patent/CN1245706C/zh
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS OR SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING; SPEECH OR AUDIO CODING OR DECODING
    • G10L19/00Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis
    • G10L19/04Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis using predictive techniques
    • G10L19/16Vocoder architecture
    • G10L19/167Audio streaming, i.e. formatting and decoding of an encoded audio signal representation into a data stream for transmission or storage purposes
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS OR SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING; SPEECH OR AUDIO CODING OR DECODING
    • G10L19/00Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis
    • G10L19/04Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis using predictive techniques
    • G10L19/16Vocoder architecture
    • G10L19/18Vocoders using multiple modes
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS OR SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING; SPEECH OR AUDIO CODING OR DECODING
    • G10L19/00Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03GCONTROL OF AMPLIFICATION
    • H03G3/00Gain control in amplifiers or frequency changers without distortion of the input signal
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS OR SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING; SPEECH OR AUDIO CODING OR DECODING
    • G10L19/00Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis
    • G10L19/04Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis using predictive techniques
    • G10L19/16Vocoder architecture
    • G10L19/18Vocoders using multiple modes
    • G10L19/24Variable rate codecs, e.g. for generating different qualities using a scalable representation such as hierarchical encoding or layered encoding

Abstract

揭示一种语音压缩系统(10),它能够把语音信号(18)编码成用于接着进行解码的位流,以产生合成语音(20)。语音压缩系统(10)通过使所要求的平均位速率与再现语音的感知质量平衡而使位流消耗的带宽最优化。语音压缩系统(10)包括全-速率编解码器(22)、半-速率编解码器(24)、四分之一-速率编解码器(26)、及八分之一-速率编解码器(28)。根据速率选择选择地激励编解码器(22、24、26和28),此外,根据类型分析选择地激励全和半-速率编解码器(22和24)。选择地激励每个编解码器(22、24、26和28),以不同的的位速率对语音信号(18)进行编码和解码,强调语音信号(18)的不同方面,以提高合成语音(20)的总质量。

Description

多模式语音编码器
发明人
Yang Gao,Adil Benyassine,Jes Thyssen,Eyal Shlomot,Huan-yu Su
版权注意事项附注
本专利文件揭示的一部分包括受版权保护的材料。当专利文件或专利揭示出现在专利和商标事务所专利文件或记录中时,本版权所有人不反对任何人对它进行传真复制,然而在别的方面保留所有的版权。
技术领域
本发明涉及语音通信系统,尤其,涉及用于数字语音编码的系统。
背景技术
人类通信的一种流行模式是使用通信系统。通信系统包括有线和无线的基于无线电的两种系统。无线通信系统与基于有线的系统在电气上连接,并使用射频(RF)通信与移动通信装置进行通信。当前,例如,在蜂窝系统中的通信可用的射频是在中心频率约900MHz的蜂窝频率范围中,以及在中心频率约1900MHz的个人通信业务(PCS)频率范围中。在无线系统中的数据和话音发送具有消耗一部分射频的带宽。由于诸如蜂窝系统之类的无线通信装置的扩大流行而导致话务增加,希望在无线系统中的发送带宽减小。
由于使用数字技术的抗扰度、可靠性、设备的小型化以及执行复杂的信号处理功能的能力,无线无线电通信中的数字发送在话音和数据两方面的应用日益增加。语音信号的数字发送包括下列步骤:用模数转换器对模拟语音波形取样、语音压缩(编码)、发送、语音解除压缩(解码)、数模转换以及在耳机或扬声器中再现。用模数转换器对模拟语音波形取样产生一个数字信号。然而,在用来表示模拟语音波形的数字信号中使用的位数产生相当大的带宽。例如,以8000Hz(每0.125ms一次)的实例取样的语音信号,每个取样由16位表示,则将导致每秒128,000(16×8000)位的位速率,或128Kbps(每秒千位)。
可以使用语音压缩来减少表示语音的位数,从而减小发送所需要的带宽。然而,语音压缩可以导致解除压缩的语音的质量降低。一般,较高位速率将产生较高质量,而较低位速率将产生较低质量。然而,诸如编码技术之类的现代语音压缩技术可以以相对低的位速率产生相对高质量的解除压缩的语音。一般,现代编码技术试图表示语音信号的感知重要特征而无需保存实际的语音波形。
降低位速率所使用的一种编码技术包括根据被压缩的语音信号部分改变语音压缩的程度(即,改变位速率)。一般,使用较多位数对以合适感知表示的难度较大的语音信号部分(诸如话音的语音、破裂音或话音的有力的开始)进行编码和发送。相反,使用较少位数对以合适感知表示的难度较小的语音信号部分(诸如无话音的、或字之间的静音)进行编码和发送。所产生的语音信号的平均位速率比用提供相同质量的解除压缩语音的固定速率的情况要低许多。
通常称为编码的语音压缩系统包括编码器和解码器,而且可能用于降低数字语音信号的位速率。已经对语音编码开发了许多算法,这些算法减少对原始语音进行数字编码而同时试图保持高质量再现语音所需要的位数。如在M.R.Schroeder和B.S.Atal的题为“激励代码的线性预测:极低速率处的高质量语音”(Proc.ICASSP-85,937-940页,1985年)的文章中描述激励代码的线性预测(CELP)编码技术,提供一种有效的语音编码技术。基于可变速率CELP的语音编码器的例子是设计成供CDMA(码分多址)应用的TIA(电信工业协会)IS-127标准的。CELP编码技术使用数种预测技术以从语音信号除去冗余。CELP编码方法是基于帧的,在意义上它把取样输入语音信号存储在称为帧的取样块中。然后可以处理帧以产生数字形式的压缩语音信号。
CELP编码方法使用两类预测器,短期预测器和长期预测器。一般,在长期预测器之前应用短期预测器。通常把从短期预测器上得到的预测误差称为短期剩余,而把从长期预测器上得到的预测误差称为长期剩余。可以使用包括多个固定密码本输入或矢量的固定密码本对长期剩余进行编码。可以选择输入之一,并乘以固定密码本增益,以表示长期剩余。也可以把短期预测器称为LPC(线性预测编码)或频谱的表示,一般包括10个预测参数。也可以把长期预测器称为音调(pitch)预测器或自适应密码本,一般包括滞后参数和长期预测器增益参数。也可以把每个滞后参数称为音调滞后,也可以把每个长期预测器增益参数称为自适应密码本增益。滞后参数定义在自适应密码本中的一个输入或矢量。
CELP编码器执行LPC分析以确定短期预测器参数。在LPC分析之后可以确定长期预测器参数。此外,确定最佳表示发生长期剩余的固定密码本输入和固定密码本增益。在CELP编码中使用按分析的合成(ABS)(analysis-by-synthesis)的有用原理。在ABS方法中,使用反预测滤波器和施加感知的权重测量,通过合成固定密码本、最佳固定密码本增益、以及最佳长期预测器参数,而从它们找到最佳的作用。然后可以量化短期(LPC)预测系数、固定密码本增益以及滞后参数和长期增益参数。可以从编码器把量化系数(index),以及固定密码本系数发送到解码器。
CELP解码器使用固定密码本系数以获取来自固定密码本的矢量。可以使矢量乘以固定密码本增益,以产生长期激励(也称为固定密码本作用)。可以把长期预测器作用和长期激励相加以产生通常简称为激励的短期激励。长期预测器作用包括来自过去乘以长期预测器增益的短期激励。另一方面,长期预测器作用的相加可以看为自适应密码本作用,或作为长期(音调)滤波。可以使短期激励通过使用通过编码器量化的短期(LPC)预测系数的短期反预测滤波器(LPC),以产生合成的语音。然后可以通过降低感知编码噪声的后—滤波器来传递合成的语音。
这些语音压缩技术已经导致发送语音信号所用的带宽量减小。然而,在把系统资源分配给大量用户的通信系统中,进一步减小带宽是特别重要的。相应地,对语音编码系统和方法有一种需求,即,要能够使语音再现所需要的平均位速率最小,而同时提供高质量的解除压缩的语音。
发明的揭示
本发明提供用于对语音信号进行编码和解码的系统。实施例可以使用CELP编码技术和基于预测的编码作为框架,以应用使用波形匹配和与感知有关的技术的信号处理功能。这些技术允许产生与包括感知特征的原始语音近于相似的合成语音,而同时保持相当低的位速率。实施例的一种应用是在无线通信系统中。在这个应用中,可以在移动通信装置处发生原始语音的编码或解码以产生合成语音。此外,可以在基于有线的系统中或其它无线通信系统中发生编码和解码,以提供到基于有线的系统的接口。
语音压缩系统的一个实施例包括全速率编解码器、半速率编解码器、四分之一速率编解码器和八分之一速率编解码器,每个都能够对语音信号进行编码和解码。全速率、半速率、四分之一速率和八分之一速率编解码器分别以位速率8.5Kbps、4Kbps、2Kbps和0.8Kbps对语音信号进行编码。语音压缩系统在语音信号的帧上执行速率选择,以选择编解码器中之一。在一帧一帧的基础上执行速率选择。通过把语音信号分割成有限时间长度的分段而产生帧。由于可能用不同的位速率对每个帧进行编码,所以语音压缩系统是以平均位速率对语音进行编码的可变速率语音压缩系统。
根据包括在特定帧中的语音信号部分指出的语音信号的每个帧的特征而确定速率选择。例如,可以指出帧的特征为稳定话音的、不稳定话音的、无话音的、背景噪声、静音等。此外,速率选择是根据一个模式的,语音压缩系统正在所述模式中操作。不同模式表示所要求的平均位速率。设计编解码器,用于在不同特征的语音信号中的最优化编码。最优化编码对提供最高感知质量的合成语音而同时保持所要求的平均位速率的要求作出平衡,从而使可用带宽的应用最大。在操作期间,语音压缩系统根据模式以及帧的特征选择地激励编解码器,试图使合成语音的感知质量最佳。
一旦速率选择选择了全速率或半速率编解码器,就出现语音信号的类型分类,以进一步优化编码。类型分类可以是第一类型(即,类型1),用于包含不快速变化的谐波结构和共振峰结构的帧,或用于所有其它帧的第二类型(即,类型0)。可以根据类型分类来调节全速率和半速率编解码器的位分配,以进一步优化帧的编码。通过加强在每个帧中的语音信号的不同方面而使位分配的调节提供改进了感知质量的再现语音信号。
相应地,语音编码器能够选择地激励编解码器,以使再现语音信号的总质量最高,而同时保持所要求的平均位速率。根据对下面的附图和详细说明的研究,熟悉本技术领域的人员会明了和变得明了其它的系统、方法、特征和优点。意图是包括在本说明中的所有这种另外的系统、方法、特征和优点都在本发明的范围内,并受到所附的权利要求书的保护。
附图简述
在附图中的部件不需要标定、加强,而是说明本发明的原理。此外,在附图中,用相同的标记在不同的视图中表示相应的部件。
图1是语音压缩系统的一个实施例的方框图;
图2是在图1中示出的编码系统的一个实施例的扩展方框图;
图3是在图1中示出的解码系统的一个实施例的扩展方框图;
图4是示出全速率编解码器的一个实施例的位分配的表;
图5是示出半速率编解码器的一个实施例的位分配的表;
图6是示出四分之一速率编解码器的一个实施例的位分配的表;
图7是示出八分之一速率编解码器的一个实施例的位分配的表;
图8是在图2中示出的预—处理模块的一个实施例的扩展方框图;
图9是在图2中示出的用于全速率和半速率编解码器的起始帧处理模块的一个实施例的扩展方框图;
图10是在图2中示出的用于全速率和半速率编解码器的第一子帧处理模块的一个实施例的扩展方框图;
图11是是在图2中示出的用于全速率和半速率编解码器的第一帧处理模块、第二子帧处理模块以及第二帧处理模块的一个实施例的扩展方框图;
图12是在图3中示出的用于全速率和半速率编解码器的解码系统的一个实施例的扩展方框图。
执行本发明的模式
参考语音信号来讨论实施例,然而,任何其它信号的处理也是可能的。还可以理解,在数字上可以通过浮点、固定点、十进制或可能导致数值稍有偏离但是不牺牲功能的其它相似的数字表示来表示所揭示的数字值。此外,不打算用作为模块识别的功能块来表示分立的结构,在各种实施例中,可以组合或进一步再分割。
图1是语音压缩系统10的一个实施例的方框图。语音压缩系统10包括可以连接如图的编码系统12、通信媒体14以及解码系统16。语音压缩系统10可以是任何系统,它能够接收语音信号18和对其编码,然后对它进行解码,以产生后—处理的合成语音20。在一个典型的通信系统中,把无线通信系统电气地连接到在基于有线的通信系统中的公用电话交换网(PSTN)。在无线通信系统中,一般使用多个基站,以提供与诸如蜂窝电话或便携式无线电收发机之类的移动通信装置的无线电通信。
语音压缩系统10进行操作,以接收语音信号18。例如,话筒(未示出)可以捕获发送器(未示出)发出的语音信号18,并通过模数转换器(未示出)数字化。发送器可以是人类话音、音乐乐器或能够发出模拟信号的任何其它装置。语音信号18可以表示任何类型的声音,诸如,话音语音、无话音的语音、背景噪声、静音、音乐等。
编码系统12进行操作,以对语音信号18进行编码。编码系统12可以是能够接收通过模数转换器数字化的语音信号18和对其进行编码的移动通信装置、基站或任何其它无线或有线通信装置的一部分。有线通信装置可以包括互联网协议上的话音(VoIP)装置和系统。编码系统12使语音信号18分段成为帧,以产生位流。语音压缩系统10的一个实施例使用一些帧,所述帧包括取样速率为8000Hz(相当于每帧20毫秒)的160个取样。可以把通过位流表示的帧提供给通信媒体14。
通信媒体14可以是任何发送机构,诸如能够携带编码系统12产生的位流的通信信道、无线电波、微波、有线发送、光纤发送或任何媒体。通信媒体14还可以包括在位流发送中使用的发送装置和接收装置。通信媒体14的一个示例实施例可以包括在无线通信系统中用于无线电通信的通信信道、天线以及相关联的收发机。通信媒体14还可以是一个存储机构,诸如能够存储和取得编码系统12产生的位流的存储器器件、存储媒体或其它装置。通信媒体14进行操作,以把编码系统12产生的位流发送到解码系统16。
解码系统16接收来自通信媒体14的位流。解码系统14可以是能够接收位流的移动通信装置、基站或其它无线或有线通信装置的一部分。解码系统16进行操作,以对位流进行解码和产生数字形式的后—处理的合成语音20。然后可以通过数模转换器(未示出)把后—处理的合成语音20转换成模拟信号。接收机(未示出)可以接收数模转换器的模拟输出,所述接收机可以是能够接收模拟信号的人耳、磁带记录器或任何其它装置。另一方面,能够接收数字信号的数字记录装置、语音识别装置或任何其它装置可以接收后—处理的合成语音20。
语音压缩系统10的一个实施例包括模式线21。模式线21携带模式信号,所述模式信号通过表示用于位流的所要求的平均位速率而控制语音压缩系统10。例如,可以通过使用模式信号产生模块的无线通信系统在外部产生模式信号。模式信号产生模块根据多个因素来确定模式信号,所述因素诸如后—处理的合成语音20所要求的质量、可用的带宽、用户的业务合同或任何其它有关的因素。在语音压缩系统10正在操作的通信系统中,所述通信系统控制和选择模式信号。可以把模式信号提供给编码系统12,以帮助判定在编码系统12中可以激励多个编解码器中的哪个编解码器。
编解码器包括分别位于编码系统12中和解码系统16中的编码器部分和解码器部分。在语音压缩系统10的一个实施例中,有4个编解码器,即,全速率编解码器22、半速率编解码器24、四分之一速率编解码器26以及八分之一速率编解码器28。可操作编解码器22、24、26和28的每一个以产生位流。每个编解码器22、24、26和28产生的位流的大小,因而是通过通信媒体14发送位流所需要的带宽或容量,是不同的。
在一个实施例中,全速率编解码器22、半速率编解码器24、四分之一速率编解码器26以及八分之一速率编解码器28分别产生每帧170位、80位、40位和16位。每个帧的位流的大小相当于位速率,即,全速率编解码器22的8.5Kbps、半速率编解码器24的4.0Kbps、四分之一速率编解码器26的2.0Kbps以及八分之一速率编解码器28的0.8Kbps。然而,在另外的实施例中,较少的或更多的编解码器以及其它的位速率也是可能的。通过用各种编解码器来处理语音信号18的帧,得到平均位速率。编码系统12根据帧的特征和模式信号提供的所要求平均位速率判定可以使用编解码器22、24、26和28中的哪一个对特定的帧进行编码。根据包括在特定帧中的语音信号18的部分指出帧的特征。例如,可以指出帧的特征为稳定话音的、不稳定话音的、无话音的、有力的开始、背景噪声、静音等。
在一个实施例中,模式信号线21上的模式信号识别模式0、模式1和模式2。3种模式的每一种提供不同的所要求平均位速率,这可以改变编解码器22、24、26和28的每一个的使用百分比。可以把模式0称为高级模式,其中,可以用全速率编解码器22对大多数帧进行编码;可以用半速率编解码器24对较少的帧进行编码;而四分之一速率编解码器26和八分之一速率编解码器28可以对包括静音和背景噪声的帧进行编码。可以把模式1称为标准模式,其中,可以用全速率编解码器22对诸如有力的开始的帧和某些话音的帧之类的高信息容量帧进行编码。此外,可以用半速率编解码器24对其它话音的帧和无话音的帧进行编码,可以用四分之一速率编解码器26对某些无话音的帧进行编码,以及可以用八分之一速率编解码器28对静音和背景噪声进行编码。
可以把模式2称为经济模式,其中,可以用全速率编解码器22只对高信息容量的少数帧进行编码。用半速率编解码器24对模式2中的大多数帧进行编码,除了可能用四分之一速率编解码器26对某些无话音的帧进行编码之外。在模式2中可以用八分之一速率编解码器28对静音和稳定的背景噪声进行编码。相应地,通过改变编解码器22、24、26和28的选择,语音压缩系统10可以按所要求的平均位速率传递再现语音而同时试图保持可能的最高质量。在另外的实施例中可能有另外的模式,诸如工作在超经济模式中的模式3,或半速率最大模式,其中,所激励的最大编解码器是半速率编解码器24。
还可以通过半速率信号线30提供语音压缩系统10的进一步的控制。半速率信号线30提供半速率信令标志。可以通过诸如无线通信系统之类的外部源提供半速率信令标志。当激励时,半速率信令标志指挥语音压缩系统10使用半速率编解码器24作为最大速率。通过语音压缩系统10正在其中操作的通信系统执行何时激励半速率信令标志的判定。相似于模式信号判定,半速率信令模块根据通信系统确定的多个因素控制半速率信令标志的激励。在另外的实施例中,半速率信令标志可以指挥语音压缩系统10使用一个编解码器22、24、26和28来代替其它的,或识别一个或多个编解码器22、24、26和28作为最大或最小速率。
在语音压缩系统10的一个实施例中,全速率和半速率编解码器22和24可以根据eX-CELP(扩展的CELP)方法,而四分之一速率和八分之一速率编解码器26和28可以根据感知匹配方法。eX-CELP方法扩展在感知匹配和传统CELP的波形匹配之间的传统的平衡。尤其,eX-CELP方法使用速率选择和将在以后描述的类型分类对帧进行分类。在帧的不同分类中,可以使用具有不同感知匹配、不同波形匹配、以及不同位分配的不同的编码方法。四分之一速率编解码器26和八分之一速率编解码器28的感知匹配方法不使用波形匹配,当对帧进行编码时,代之以集中在感知方面。
用eX-CELP方法或感知匹配方法的每个帧的编码可以根据进一步把帧分割成多个子帧。每个编解码器22、24、26和28的子帧的大小和数目可以不同。此外,相应于eX-CELP方法,每个分类的子帧可以是不同的。在子帧中,可以用数种预测的和非预测的标量和矢量量化技术对语音参数和波形进行编码。在标量量化中,可以通过在标量表示表中最接近入口的索引位置来表示语音参数或元素。在矢量量化中,可以组合数个语音参数形成矢量。在矢量的表示表中,可以通过最接近入口的索引位置来表示矢量。
在预测编码中,可以根据过去预测一个元素。元素可以是标量或矢量。然后可以使用标量的表(标量量化)或矢量的表(矢量量化)量化预测误差。相似于传统CELP的eX-CELP方法使用有力的按分析的合成(ABS)方案,用于选择数个参数的最佳表示。尤其,参数可以是自适应密码本、固定密码本以及它们相应的增益。ABS方案使用反预测滤波器和感知权重测量来选择最佳密码本入口。
语音压缩系统10的实施例的一种实施可以在诸如数字信号处理器(DSP)芯片之类的信号处理器件中,移动通信装置或无线电发送基站中。可以用源代码对信号处理器件进行编程。首先可以把源代码转换到固定点,然后转换成信号处理器件特定的编程语言。然后可以下载经转换的源代码,并在信号处理器件中运行。源代码的一个例子是语音压缩系统10的一个实施例利用的C语言计算机程序,把它包括在所附的显微照相附录中作为附录A和B。
图2是在图1中示出的编码系统12的更详细的方框图。编码系统12的一个实施例包括预—处理模块34、全速率编码器36、半速率编码器38、四分之一速率编码器40和八分之一速率编码器42,可以连接它们如图所示。速率编码器36、38、40和42包括起始帧—处理模块44和激励—处理模块54。
通过预—处理模块34在帧的级别上处理编码系统12接收到的语音信号18。可操作预—处理模块34以提供语音信号18的起始处理。起始处理可以包括能够使接着进行编码的语音信号18最优化的滤波、信号增强、噪声去除、放大和其它相似的技术。
全、半、四分之一和八分之一速率编码器36、38、40和42分别是全、半、四分之一和八分之一速率编解码器22、24、26和28的编码部分。起始帧—处理模块44执行起始帧处理、语音参数获取和判定速率编码器36、38、40和42中哪一个将对特定帧进行编码。可以示意地把起始帧—处理模块44再分割成多个起始帧处理模块,即,起始全帧处理模块46、起始半帧—处理模块48、起始四分之一帧—处理模块50和起始八分之一帧—处理模块52。然而,应该注意,起始帧—处理模块44执行对于所有速率编码器36、38、40和42是共同的处理和对于每个速率编码器36、38、40和42是特定的特定处理。起始帧—处理模块44到各个起始帧处理模块46、48、50和52的再分割相应于各个速率编码器36、38、40和42。
起始帧—处理模块44执行共同的处理以确定激励速率编码器36、38、40和42中之一的速率选择。在一个实施例中,速率选择是根据语音信号18的帧的特征和语音压缩系统10正在操作的模式的。速率编码器36、38、40和42中之一的激励相应地激励起始帧—处理模块46、48、50和52。
激励特定的起始帧—处理模块46、48、50和52,以对语音信号18中对于整个帧共同的方面进行编码。通过起始帧—处理模块44的编码使包含在一个帧中的语音信号18的参数量化。经量化的参数导致一部分位流的产生。一般,位流是语音信号18(已经经过速率编码器36、38、40和42中之一通过编码系统12处理)的帧的经压缩的表示。
除了速率选择之外,起始帧—处理模块44还执行处理,以确定通过全和半—速率编码器36和38处理的每个帧的类型分类。一个实施例的类型分类把通过帧表示的语音信号18分类作为第一类型(即,类型1)或作为第二类型(即,类型0)。一个实施例的类型分类与语音信号18的特性和特征无关。在另外的实施例中,可以提供另外的类型分类和支持处理。
类型1类别包括展现稳定特性的语音信号18的帧。展现稳定特性的帧包括不快速改变的谐波结构和共振峰结构。可以把所有其它帧分类成类型0类别。在另外的实施例中,另外的类型分类根据时间—域、频率域等可以把帧分类成另外的类别。类型分类使通过起始全—速率帧—处理模块46和起始半—速率帧—处理模块48的编码最优化,如将在下面描述。此外,相应于全和半—速率编码器36和38的激励—处理模块54的部分可以使用类型分类和速率选择两者以使编码最优化。
可以把激励—处理模块54的一个实施例再分割成全—速率模块56、半—速率模块58、四分之一—速率模块60和八分之一—速率模块62。速率模块56、58、60和62对应于速率编码器36、38、40和42,如在图2中所示。一个实施例的全和半—速率模块56和58两者包括提供基本上不同编码的多个帧处理模块和多个子帧处理模块,如将描述。
用于全和半—速率编码器36和38两者的激励处理模块54的部分包括类型选择器模块、第一子帧处理模块、第二子帧处理模块、第一帧处理模块和第二子帧处理模块。尤其,全—速率模块56包括F型选择器模块68、F0第一子帧处理模块70、F1第一帧—处理模块72、F1第二子帧处理模块74和F1第二帧—处理模块76。术语“F”表示全—速率,而“0”和“1”分别表明类型0和类型1。相似地,半—速率模块58包括H型选择器模块78、H0第一子帧处理模块80、H1第一帧—处理模块82、H1第二子帧处理模块84和H1第二帧—处理模块86。
F和H型选择器模块68、78指挥语音信号18的处理,根据类型分类进一步使编码处理最优化。类型1的类别表示帧包括不快速改变的谐波结构和共振峰结构,诸如稳定的话音语音。相应地,可以分配用于表示分类成类型1的帧的位,以促进在表示帧中取得这些方面的优点的编码。类型0的类别表示帧可能展现不稳定的特性,例如,快速改变的谐波结构或共振峰结构,或帧可能展现稳定的无话音的特征或象噪声的特征。对于分类成类型0的帧,必然要调节位分配,以较佳表示和考虑这个特性。
对于全—速率模块56,当把正在处理的帧分类成类型0时,F0第一子帧—处理模块70产生一部分位流。帧的类型0类别激励F0第一子帧—处理模块70以在子帧的基础上处理帧。当把正在处理的帧分类成类型1时,F1第一帧—处理模块72、F1第二子帧处理模块74和F1第二帧—处理模块76组合而产生一部分位流。类型1类别包括在全速率模块56中的子帧和帧两者的处理。
相似地,对于半速率模块58,当把正在处理的帧分类成类型0时,H0第一子帧—处理模块80产生一部分位流。此外,当把正在处理的帧分类成类型1时,H1第一帧—处理模块82、H1第二子帧处理模块84和H1第二帧—处理模块86组合而产生一部分位流。如同全—速率模块56,类型1类别包括子帧和帧两者的处理。
四分之一和八分之一—速率模块60和62分别是四分之一和八分之一—速率编码器40和42的一部分,并不包括类型分类。不包括类型分类是由于所处理的帧的特性。当激励时,四分之一和八分之一—速率模块60和62分别在子帧基础上和帧基础上产生一部分位流。
速率模块56、58、60和62产生一部分位流,所述位流与起始帧处理模块46、48、50和52产生的位流的相应部分组合,以产生帧的数字表示。例如,可以组合起始全—速率帧—处理模块46和全—速率模块56产生的位流部分,以形成当激励全—速率编码器36以对帧进行编码时所产生的位流。可以进一步组合来自编码器36、38、40和42中的每一个位流,以形成表示语音信号18的多个帧的位流。通过解码系统16对编码器36、38、40和42产生的位流进行解码。
图3是在图1中示出的解码系统16的扩展方框图。解码系统16的一个实施例包括全—速率解码器90、半—速率解码器92、四分之一—速率解码器94、八分之一—速率解码器96、合成滤波器模块98和后—处理模块100。全、半、四分之一和八分之一—速率解码器90、92、94和96、合成滤波器模块98和后—处理模块100是全、半、四分之一和八分之一—编解码器22、24、26和28的解码部分。
解码器90、92、94和96接收位流,并对数字信号进行解码,以再现语音信号18的不同参数。可以根据速率选择激励解码器90、92、94和96,以对每个帧进行解码。可以通过诸如在无线通信系统中的控制信道之类的分立信息发送机构把速率选择从编码系统12提供给解码系统16。在这个示例实施例中,可以向移动通信装置提供速率选择,作为在无线通信系统中的基站产生的广播信标信号的一部分。一般,产生广播信标信号,以提供在基站和移动通信装置之间用于建立通信的识别信息。
合成滤波器98和后—处理模块100是解码器90、92、94和96中的每一个的解码过程的一部分。组合使用合成滤波器98使通过解码器90、92、94和96解码的语音信号18的参数产生合成语音。传递合成语音使之通过后—处理模块100,以产生后—处理的合成语音20。
全—速率解码器90的一个实施例包括F型选择器102和多个激励再现模块。激励再现模块包括F0激励再现模块104和F1激励再现模块106。此外,全—速率解码器90包括线性预测系数(LPC)再现模块107。LPC再现模块107包括F0LPC再现模块108和F1 LPC再现模块110。
相似地,半—速率解码器92的一个实施例包括H型选择器112和多个激励再现模块。激励再现模块包括H0激励再现模块114和H1激励再现模块116。此外,半—速率解码器92包括线性预测系数(LPC)再现模块,它是H LPC再现模块118。虽然原理上相似,但是设计全和半—速率解码器90和92使之分别对来自相应的全和半—速率编码器36和38的位流进行解码。
F和H型选择器102和112根据类型分类选择地激励全和半—速率解码器90和92的相应部分。当类型分类是类型0时,激励F0或H0激励再现模块104或114。反之,当类型分类是类型1时,激励F1或H1激励再现模块106或116。分别通过类型0和类型1类型分类激励F0或F1LPC再现模块108或110。单单根据速率选择激励H LPC再现模块118。
四分之一—速率解码器94包括Q激励再现模块120和Q LPC再现模块122。相似地,八分之一—速率解码器96包括E激励再现模块124和E LPC再现模块126。单单根据速率选择激励相应的Q或E激励再现模块120或124和相应的Q或E LPC再现模块122或126两者。
可操作每个激励再现模块,当激励时,在短期激励线128上提供短期激励。相似地,可操作每个LPC再现模块,以在短期预测系数线130上产生短期预测系数。把短期激励和短期预测系数提供给合成滤波器98。此外,在一个实施例中,把短期预测系数提供给后—处理模块100,如在图3中所示。
后—处理模块100可以包括滤波、信号增强、噪声减轻、放大、倾斜校正和能够改进合成语音的感知质量的其它相似技术。可操作后—处理模块100,以降低可听见的噪声而不降低合成语音的质量。通过加强合成语音的共振峰结构或通过只抑制在感知上与合成语音无关的频域中的噪声而实现降低可听见的噪声。由于在较低位速率时可听见的噪声变得更受人注意,所以可以激励后—处理模块100的一个实施例,以提供与根据速率选择的后—处理不同的合成语音的后—处理。可操作后—处理模块100的另一个实施例,以根据速率选择向解码器90、92、94和96的不同组提供不同的后—处理。
在操作期间,在图2中示出的起始帧—处理模块44分析语音信号18,以确定速率选择和激励编解码器22、24、26和28中之一。例如,如果根据速率选择激励全速率编解码器22来处理帧,则全—速率帧—处理模块46判定帧的类型分类和产生一部分位流。根据类型分类,全—速率模块56产生帧的其余的位流。
根据速率选择,全—速率解码器90可以接收位流并对其进行解码。全—速率解码器90使用在编码期间确定的类型分类对位流进行解码。合成滤波器98和后—处理模块100使用从位流解码的参数以产生后—处理的合成语音20。每个编解码器22、24、26和28产生的位流明显地包括不同的位分配,以加强在帧中的语音信号18的不同参数和/或特征。
位分配
图4、5、6和7是表,分别示出全—速率编解码器22、半—速率编解码器24、四分之一—速率编解码器26和八分之一—速率编解码器28的位分配。位分配指定在相应的编码器36、38、40和42中通过起始帧—处理模块44产生的位流部分和通过激励—处理模块54产生的位流部分。此外,位分配指定在表示帧的位流中的位数。相应地,根据所激励的编解码器22、24、26和28而改变位速率。根据在帧基础上还是在子帧基础上产生代表性的位流,编码系统12可以分别把位流分类成第一部分和第二部分。将如下所述,位流的第一部分和第二部分根据所选择的编解码器22、24、26和28而改变,以对语音信号18的帧进行编码和解码。
1.1全—速率编解码器的位分配
现在参考图2、3和4,将描述全—速率编解码器22的全—速率位流。现在参考图4,全—速率编解码器22的位分配包括线频谱频率(LSF)部分140、类型部分142、自适应密码本部分144、固定密码本部分146和增益部分147。增益部分147包括自适应密码本增益部分148和固定密码本增益部分150。进一步通过类型0列152和类型1列154定义位流分配。类型0和类型1列152和154根据如上所述的类型分类指定在位流中的位分配。在一个实施例中,类型0列152和类型1列154两者都使用5毫秒的子帧的每一个来处理语音信号18。
在图2中示出的起始全帧—处理模块46产生LSF部分140。根据短期预测器参数产生LSF部分140。把短期预测器参数转换成多个线频谱频率(LSF)。LSF表示帧的频谱包络。此外,确定来自以前帧的LSF的多个预测的LSF。从LSF减去预测的LSF以产生LSF预测误差。在一个实施例中,LSF预测误差包括10个参数的矢量。把LSF预测误差和预测的LSF组合,以产生多个量化的LSF。内插和转换量化的LSF以形成每个子帧的多个量化的LPC系数Aq(z),将在下面详细地讨论。此外,量化LSF预测误差以产生发送到解码系统16的LSF部分140。
当在解码系统16处接收位流时,使用LSF部分140找出表示量化的LSF预测误差的矢量。把量化的LSF预测误差加到预测的LSF上,以产生量化的LSF。相似于编码系统12,从在解码系统16中的以前帧的LSF确定预测的LSF。可以使用预定的权重,对每个子帧内插所产生的LSF。预定的权重定义一个内插路径,它可以是固定的或可变的。内插路径在以前帧的量化的LSF和当前帧的量化的LSF之间。可以使用内插路径以对当前帧中的每个子帧提供频谱包络表示。
对于分类成类型0的帧,使用多个级156和内插单元158对LSF部分140的一个实施例进行编码,如在图4中所示。级156表示用于对帧的LSF部分140进行编码的LSF预测。可以使用内插单元158以提供在以前帧的量化的LSF和当前正在处理的帧的量化的LSF之间的多个内插路径。一般,内插单元158表示在解码期间在线频谱频率(LSF)的轮廓中的可选择的调节。由于分类为类型0的帧的不—稳定频谱特性而可以使用可选择的调节。对于分类为类型1的帧,由于这种帧的稳定频谱特性而可以只使用级156和预定的线性内插路径对LSF部分140进行编码。
LSF部分140的一个实施例包括2位,以对分类为类型0的帧的内插单元158进行编码。这些位识别特定的内插路径。每个内插路径调节每个子帧的以前量化的LSF的权重和每个子帧的当前量化的LSF的权重。可以根据在接连的子帧之间的频谱包络中的变化程度来确定内插路径的选择。例如,如果在帧中间的频谱包络中有潜在的变化,则内插单元158选择一个内插路径,该内插路径降低来自以前帧的量化的LSF的影响。内插单元158的一个实施例可以表示每个子帧的4个不同的内插路径中的任何一个。
可以使用多个移动平均预测器系数来产生预测的LSF。预测器系数确定使用多少过去帧的LSF来预测当前帧的LSF。在全—速率编解码器22中的预测器系数使用一个LSF预测器系表。一般,可以通过下列矩阵示出该表:
Figure C0081594000241
表1
在一个实施例中,m等于2,而n等于10。相应地,预测阶(order)是2,而预测系数有两个矢量,每个包括10个元素。LSF预测器系表的一个实施例的名称为“Float64B_85k”,并包括在所附的显微照相附录的附录B中。
一旦已经确定预测的LSF,就可以使用实际LSF计算LSF预测误差。可以使用全维(full dimensional)多级量化器量化LSF预测误差。包括多个量化矢量的LSF预测误差量化表表示与多级量化器一起使用的每个级156。多级量化器确定每级156的LSF部件140的一部分。根据删除搜索方法确定LSF部分140的部分。删除搜索方法从每个级确定允许量化矢量候选者。在所有级的候选者的确定结束时,同时产生选择每个级的最佳量化矢量的判定。
在第一级中,多级量化器确定多个候选者第一级量化误差。候选者第一级量化误差是LSF预测误差和位于第一级中的最接近匹配量化矢量之间的差。然后多级量化器通过识别与候选者第一级量化误差匹配最佳的位于第二级中的量化矢量而确定多个候选者第二级量化误差。对于级中的每一个完成这个迭代过程,并保持来自每个级的允许候选者。当已经对所有级确定候选者时,同时发生每个级的最佳表示量化矢量的最后选择。LSF部分140包括来自每个级的最接近匹配量化矢量的索引位置。LSF部分140的一个实施例包括25位,以对在级156中的索引位置进行编码。一般,可以通过下列矩阵示出用于量化方法的LSF预测误差量化表:
表2
类型0和类型1两种类别的量化表的一个实施例使用4级(j=4),其中每个量化矢量由10个元素(n=10)来表示。这个实施例的级156包括级156中之一的128个量化矢量(r=128)和在余留级156中的64个量化矢量(s=64)。相应地,可以使用级156中之一包括128个量化矢量的7位对在级156中的量化矢量的索引位置进行编码。用于类型0和类型1两者的LSF预测误差量化表的一个实施例的名称为“Float64B_85k”,并包括在所附的显微照相附录的附录B中。
在解码系统16中,在全—速率解码器90中的F0或F1 LPC再现模块108、110从位流得到LSF部分140,如在图3中所示。可以使用LSF部分140再现量化的LSF,如上所述。可以内插和转换量化的LSF以形成当前帧的每个子帧的线性预测编码系数。
对于类型0类别,可以通过F0 LPC再现模块108执行再现。再现包括确定预测的LSF、对量化的LSF预测误差解码和再现量化的LSF。此外,可以使用所识别的内插路径来内插量化的LSF。如上所述,通过形成LSF部分140的一部分的内插单元158对F0LPC再现模块108识别4个内插路径中之一。类型1类别的再现包括通过F1 LPC再现模块110使用预定的线性内插路径和LSF预测误差量化表。LSF部分140形成位流的第一部分的一部分,因为在类型0和类型1两种类别中是在帧基础上对它编码的。
类型部分142也形成位流的第一部分的一部分。如在图2中所示,F型选择器模块68产生类型部分142,以表示特定帧的类型分类。现在参考图3,在全—速率解码器90中的F型选择器模块102从位流接收类型部分142。
自适应密码本部分144的一个实施例可以是一个开环自适应密码本部分144a或一个闭环自适应密码本部分144b。分别通过起始全帧—处理模块46或F0第一子帧—处理模块70产生开环或闭环自适应密码本部分144a、144b,如在图2中所示。当把帧分类成类型0时,在位流中可以用闭环自适应密码本部分144b代替开环自适应密码本部分144a。一般,开环目的涉及不包括按分析的合成(ABS)的帧基础上的处理。在子帧基础上执行闭环处理,并包括按分析的合成(ABS)。
对根据语音信号18的周期性的音调滞后进行编码而产生自适应密码本部分144。对于一个帧产生开环自适应密码本部分144a,而在子帧基础上产生闭环自适应密码本部分144b。相应地,开环自适应密码本部分144a是位流的第一部分的一部分,而闭环自适应密码本部分144b是位流的第二部分的一部分。如在图4所述的一个实施例中,开环自适应密码本部分144a包括8位,而闭环自适应密码本部分144b包括26位。使用将在下面描述的自适应密码本矢量可以产生开环自适应密码本部分144a和闭环自适应密码本部分144b。现在参考图3,解码系统16接收开环或闭环自适应密码本部分144a或144b。分别通过F0或F1激励再现模块104或106对开环或闭环自适应密码本部分144a或144b进行解码。
固定密码本部分146的一个实施例可以是类型0固定密码本部分146a或类型1固定密码本部分146b。通过F0第一子帧—处理模块70产生类型0固定密码本部分146a,如在图2中所示。F1子帧—处理模块72产生类型1固定密码本部分146b。使用在子帧基础上的固定密码本矢量和按分析的合成而产生类型0或类型1固定密码本部分146a或146b,如将在下面描述。固定密码本部分146表示使用n-脉冲密码本的子帧的长期剩余,其中,n是在密码本中的脉冲数。
现在参考图4,一个实施例的类型0固定密码本部分146a包括每子帧22位。类型0固定密码本部分146a包括多个n-脉冲密码本中之一的识别、在密码本中的脉冲位置以及相应于脉冲位置的代表性脉冲的符号(量“n”)。在示例实施例中,多达2位指定已经对3个n-脉冲密码本中的哪一个进行编码。尤其,把2位的第一位设置成“1”,以指定使用3个n-脉冲密码本中的第一个。如果把第一位设置成“0”,则2位的第二位指定是否使用3个n-脉冲密码本中第二或第三个。相应地,在示例实施例中,3个n-脉冲密码本中的第一个具有21位,以代表脉冲位置和符号,而3个n-脉冲密码本中的第二和第三个具有可用的20位。
在n-脉冲密码本中之一中的每个代表性脉冲包括相应的迹(track)。迹是在子帧中的取样位置的清单,其中,在清单中的每个取样位置是脉冲位置中之一。可以把正在进行编码的子帧分割成多个取样位置,其中,每个取样位置包括一个取样值。相应的代表性脉冲的迹只列出来自子帧的一部分取样位置。可以通过在相应迹中的脉冲位置中之一来表示在n-脉冲密码本中之一中的每个代表性脉冲。
在操作期间,顺序地把代表性脉冲中的每一个放置在相应的迹中的每个脉冲位置上。把代表性脉冲转换成信号,所述信号可以与在使用ABS的子帧的取样位置上的取样值进行比较。把代表性脉冲与取样值进行比较,所述取样值在时间上比脉冲位置的取样位置较晚的那些取样位置上。使代表性脉冲和时间上较晚的取样值之间的差最小的脉冲位置形成类型0固定密码本部分146a。可以通过形成类型0固定密码本部分146a的一部分的相应的脉冲位置来表示在所选择的n脉冲密码本中的每个代表性脉冲。在迹表中包括迹,一般可以通过下列矩阵表示:
表3
迹表的一个实施例是名称为“static short track_5_4_0(静态短迹_5_4_0)”“static short track_5_3_2”和“static short track_5_3_1”的表,而把在名称为“tracks.tab”的库中的“static short track_5_3_1”包括在所附的显微照相附录的附录B中。
在图4中示出的示例实施例中,n-脉冲密码本是3个5-脉冲密码本160,其中,3个5-脉冲密码本160的第一个包括5个代表性脉冲,因此n=5。第一代表性脉冲具有迹,所述迹包括子帧中的40个取样位置中的16个(f=16)。把来自3个5-脉冲密码本160的第一个的第一代表性脉冲与在取样位置中的取样值进行比较。对出现在与第一代表性脉冲相关联的迹中的一个取样位置进行识别,作为使用4位的脉冲位置。在迹中识别的取样位置是在子帧中的取样位置,它使第一代表性脉冲和时间上较晚的取样值之间的差最小,如上所述。在迹中的脉冲位置的识别形成类型0固定密码本部分146a的一部分。
在这个示例实施例中,第二和第四代表性脉冲有具有16个取样位置(g和i=16)的相应的迹,而第三和第五代表性脉冲有具有8个取样位置(h和j=8)的相应的迹。相应地,使用4位来识别第二和第四代表性脉冲的脉冲位置,而使用3位来识别第三和第五代表性脉冲的脉冲位置。结果,用于3个5-脉冲密码本160的第一个的类型0固定密码本部分146a包括用于识别脉冲位置的18位。
还可以在类型0固定密码本部分146a中识别在经识别的脉冲位置中的代表性脉冲的符号。在示例实施例中,1位表示第一代表性脉冲的符号,1位表示第二和第四代表性脉冲两者的组合符号以及1位表示第三和第五代表性脉冲两者的组合符号。组合符号使用在脉冲位置中的信息的冗余,用单个位发送两个不同的符号。相应地,用于3个5-脉冲密码本160的第一个的类型0固定密码本部分146a包括3位,用于指定总数为21位的符号。
在示例实施例中,3个5-脉冲密码本160的第二和第三个还包括5个代表性脉冲(n=5)和在迹表中的迹,每个包括8个取样位置(f、g、h、i、j=8)。相应地,使用3位来识别在3个5-脉冲密码本160的第二和第三个中的代表性脉冲的每一个的脉冲位置。此外,在这个示例实施例中,使用1位来识别每个脉冲位置的符号。
在示例实施例中,对于分类为类型1的帧,n-脉冲密码本是8-脉冲密码本162(n=8)。使用每子帧的30位对8-脉冲密码本162进行编码,以产生类型1固定密码本部分146b的一个实施例。30位包括26位,如在类型0类别中使用迹识别脉冲位置,以及4位识别符号。迹表的一个实施例是在包括在所附的显微照相附录的附录B中的名称为“tracks.tab”的库中的名称为“static INT16 track8_4_0”的表。
在示例实施例中,与第一和第五代表性脉冲相关联的迹包括使用4位编码的16个取样位置。与其余代表性脉冲相关联的迹包括使用3位编码的8个取样位置。第一和第五代表性脉冲、第二和第六代表性脉冲、第三和第七代表性脉冲、以及第四和第八代表性脉冲使用用于两个相应代表性脉冲的组合符号。如在图3中所示,当解码系统16接收到位流时,F0或F1激励再现模块104或106对迹的脉冲位置进行解码。分别对于3个5-脉冲密码本160中之一或8-脉冲密码本162通过F0或F1激励再现模块104或106对迹的脉冲位置进行解码。固定密码本部分146是位流的第二部分的一部分,因为是在子帧基础上产生的。
再参考图4,一般,增益部分147表示自适应和固定密码本增益。对于类型0类别,增益部分147是类型0自适应和固定密码本增益部件148a、150a,表示自适应和固定两种密码本增益。类型0自适应和固定密码本增益部件148a、150a是位流的第二部分的一部分,因为是在子帧基础上编码的。如在图2中所示,通过F0第一子帧—处理模块70产生类型0自适应和固定密码本增益部件148a、150a。
对于分类为类型0的帧的每个子帧,通过两维矢量量化器(2D VQ)164对类型0自适应和固定密码本增益联合编码,以产生类型0自适应和固定密码本增益部件148a、150a。在一个实施例中,量化包括把固定密码本增益转换成以分贝(dB)为单位的固定密码本能量。此外,可以从以前帧的量化的固定密码本能量产生预测的固定密码本能量。使用多个固定密码本预测器系数可以得到预测的固定密码本能量。
相似于LSF预测器系数,固定密码本预测器系数确定可以使用多少过去帧的固定密码本能量来预测当前帧的固定密码本能量。从固定密码本能量减去预测的固定密码本能量以产生预测固定密码本能量误差。通过对于每个子帧调节以前帧和当前帧的权重,可以计算预测的固定密码本能量,使预测的固定密码本误差最小。
使预测固定密码本能量误差与自适应密码本增益组合以形成两—维矢量。在预测固定密码本能量误差和自适应密码本增益量化之后,如下所述,可以把两—维矢量称为量化的增益矢量
Figure C0081594000301
。把两—维矢量与在2维增益量化表中的多个预定矢量进行比较。识别索引位置,所述索引位置是在最佳地表示两—维矢量的预定矢量的2维增益量化表中的位置。索引位置是子帧的自适应和固定密码本增益部件148a、150a。帧的自适应和固定密码本增益部件148a、150a表示对于每个子帧的识别的索引。
预定矢量包括2个元素,一个元素表示自适应密码本增益,而一个元素表示预测固定密码本能量误差。一般,2维增益量化表可以表示为:
Figure C0081594000302
表4
一个实施例的两维矢量量化器(2D VQ)164利用每子帧的7位来识别128个量化矢量(n=128)中之一的索引位置。2维增益量化表的一个实施例的名称是“Float64 gainVQ_2_128_8_5”,并包括在所附的显微照相附录的附录B中。
对于类别为类型1的帧,通过F1第一帧—处理模块72产生类型1自适应密码本增益部件148b,如在图2中所示。相似地,F1第二帧—处理模块76产生类型1固定密码本增益部件150b。在帧的基础上产生类型1自适应密码本增益部件148b和类型1固定密码本增益部件150b,以形成位流的第一部分的一部分。
再参考图4,在一个实施例中使用多—维矢量量化器(4-维前置矢量量化器(4D pre VQ))166产生类型1自适应密码本增益部件148b。在一个实施例中使用术语“前置”来突出在固定密码本中搜索任何子帧之前对在帧中的所有子帧的自适应密码本增益进行量化。在另外的实施例中,多—维量化器是n维矢量量化器,它量化n个子帧的矢量,其中,n可以是任何数目的子帧。
通过4-维前置矢量量化器(4D pre VQ)166量化的矢量是自适应密码本增益矢量,它具有表示来自每个子帧的每个自适应密码本增益的元素。如将在下面讨论,量化之后,还可以把自适应密码本增益矢量称为量化的音调增益
Figure C0081594000311
通过在前置—增益量化表中的搜索而执行自适应密码本增益矢量的量化以产生自适应密码本增益部件148b。前置—增益量化表包括多个预定矢量,可以搜索这些矢量以识别能最佳地表示自适应密码本增益矢量的预定矢量。在前置—增益量化表中的所识别预定矢量的索引位置是类型0自适应固定密码本增益部件148b。一个实施例的自适应固定密码本增益部件148b包括6位。
在一个实施例中,预定矢量包括4个元素,每个子帧1个元素。相应地,前置—增益量化表一般可以表示为:
Figure C0081594000312
表5
前置—增益量化表的一个实施例包括64个预定矢量(n=64)。把前置—增益量化表的一个实施例称为“Float64 gp4_tab”,并包括在所附的显微照相附录的附录B中。
可以使用用于n子帧的多—维矢量量化器相似地对类型l固定密码本增益部件150b进行编码。在一个实施例中,多—维矢量量化器是4-维延迟矢量量化器(4D delayed VQ)168。术语“延迟”突出了只在固定密码本中搜索所有子帧之后才发生子帧的固定密码本增益的量化。再参考图2,F1第二帧—处理模块76确定每个子帧的固定密码本增益。可以通过在子帧基础上产生的第一缓冲参数确定固定密码本增益,直到已经处理整个帧。当已经处理帧时,使用缓冲的参数对所有子帧的固定密码本增益量化,以产生类型1固定密码本增益部件150b。在一个实施例中,类型1固定密码本增益部件150b包括10位,如在图4中所示。
通过用以分贝(dB)为单位的多个固定密码本能量表示的固定密码本增益而产生类型1固定密码本增益部件150b。量化固定密码本能量以产生多个量化的固定密码本能量,然后转换它们,以产生多个量化的固定密码本增益。此外,从以前帧的量化的固定密码本能量误差预测固定密码本能量,以产生多个预测的固定密码本能量。预测的固定密码本能量和固定密码本能量之间的差是多个预测固定密码本能量误差。在一个实施例中,可以对于4个子帧的每一个使用不同的预测系数,以产生预测的固定密码本能量。在这个实施例中,从以前帧的4个量化的固定密码本能量误差预测第一、第二、第三和第四子帧的预测的固定密码本能量。这个实施例的第一、第二、第三和第四子帧的预测系数可以分别是{0.7,0.6,0.4,0.2}、{0.4,0.2,0.1,0.05}、{0.3,0.2,0.075,0.025}和{0.2,0.075,0.025,0.0}。
可以组合预测固定密码本能量误差以形成固定密码本增益矢量,当量化时,可以把它称为量化的固定密码本增益(^gk c)。在一个实施例中,每个子帧的预测固定密码本能量误差表示在矢量中的元素。使用在延迟增益量化表中的多个预定矢量量化预测固定密码本能量误差。在量化期间,可以结合感知加权以使量化误差最小。在延迟增益量化表中识别预定矢量的索引位置是帧的固定密码本增益部件150b。
一个实施例的延迟增益量化表中的预定矢量包括4个元素。相应地,可以通过以前讨论的表5来表示延迟增益量化表。延迟增益量化表的一个实施例包括1024个预定矢量(n=1024)。把延迟增益量化表的一个实施例称为“Float64gainVQ_4_1024”,并包括在所附的显微照相附录的附录B中。
再参考图3,可以根据类型分类通过在解码系统16中的全—速率解码器90对固定和自适应密码本增益部件148和150进行解码。F0激励再现模块104对类型0自适应和固定密码本增益部件148a、150a进行解码。相似地,通过F1激励再现模块106对类型1自适应密码本增益部件148b和类型1固定增益部件150b进行解码。
固定和自适应密码本增益部件158和160的解码包括通过全—速率解码器90产生相应的预测增益,如上所述。然后使用相应的索引位置,从相应的量化表查找相应的量化矢量。然后把相应的量化矢量与相应的预测增益组合,以产生相应的量化密码本增益。从类型0固定和自适应密码本增益部件148a和150a产生的量化的密码本增益表示子帧的固定和自适应密码本增益两者的值。从类型0自适应密码本增益部件148a和类型1固定密码本增益部件150b产生的量化的密码本增益分别表示在帧中的每个子帧的固定和自适应密码本增益的值。
1.2半—速率编解码器的位分配
现在参考图2、3和5,将描述半—速率编解码器24的半—速率位流。半—速率编解码器24在许多方面与全—速率编解码器22相似,但是具有不同的位分配,为简单计,着眼于讨论其差别。现在参考图5,半—速率编解码器24的一个实施例的位流分配包括线频谱频率(LSF)部件172、类型部件174、自适应密码本部件176、固定密码本部件178、以及增益部件179。增益部件179进一步包括自适应密码本增益部件180和固定密码本增益部件182。还进一步通过类型0列184和类型1列186定义半—速率编解码器24的位流。在一个实施例中,类型0列184使用每个包括80个取样的两个10毫秒的子帧。一个实施例的类型1列186使用3个子帧,其中,第一和第二子帧包括53个取样,而第三子帧包括54个取样。
虽然与全—速率编解码器22相似地产生,但是对于类型0和类型1两种类别,LSF部件172包括多个级188和预测器交换机190。此外,LSF部件172的一个实施例包括形成位流的第一部分的一部分的21位。在图2中示出的起始半帧—处理模块48产生LSF部件172,相似于全—速率编解码器22。再参考图5,一个实施例的半—速率编解码器24包括3个级188,2个具有128个矢量,而1个具有64个矢量。对于分类成类型1的帧,半—速率编解码器24的3个级188与全—速率编解码器22相似地操作,除了选择预测器系数的组之外,如下所述。用7位来定义128个矢量的每一个的索引位置,而用6位来定义64个矢量的每一个的索引位置。把半速率编解码器24的LSF预测误差量化表的一个实施例称为“Float64CBes_40k”,并包括在所附的显微照相附录的附录B中。
在预测器系数组之间的选择方面,半—速率编解码器24还与全—速率编解码器22不同。一个实施例的预测器交换机190使用1位来识别两种可能的预测器系数中的一组。可以使用预测器系数的所选择组来确定预测的线频谱频率(LSF),相似于全—速率编解码器22。预测器交换机190确定和识别哪个预测器系数组将最佳地使量化误差最小。可以把预测器系数组包括在一般通过下列矩阵示出的LSF预测器系数表中:
Figure C0081594000341
表6
在一个实施例中,在每个包括10个元素(n=10)的两组的每一组中有4个预测器系数(m=4)。把在一个实施例中用于半—速率编解码器24的LSF预测器系数表称为“Float64 B-40K”,并包括在所附的显微照相附录的附录B中。再参考图3,在解码系统16中的H LPC再现模块118使用LSF预测误差量化表和LSF预测器系数表。H LPC再现模块118从位流接收LSF部件172和对其进行解码,以再现量化的帧LSF。相似于全—速率编解码器22,对于分类成类型1的帧,半—速率编解码器24使用预定的线性内插路径。然而,对于分类成类型0和类型1两者的帧,半—速率编解码器24使用预定的线性内插路径。
在半—速率编解码器24中的自适应密码本部件176根据语音信号18的周期性相似地模拟音调滞后。对于类型0类别,在子帧的基础上对自适应密码本部件176编码,而对于类型1类别在帧基础上作所述编码。如在图2中所示,对于具有类型1类别的帧,起始半帧—处理模块48对开环自适应密码本部件176a进行编码。对于具有类型0类别的帧,H0第一子帧—处理模块80对闭环自适应密码本部件176b进行编码。
再参考图5,通过每帧的7位对开环自适应密码本部件176a进行编码,而通过每子帧的7位对闭环自适应密码本部件176b进行编码。相应的,开环自适应密码本部件176a是位流的第一部分的一部分,而闭环自适应密码本部件176b是位流的第二部分的一部分。如图3所示,解码系统16接收闭环自适应密码本部件176b。使用H0激励再现模块114通过半—速率解码器92对闭环自适应密码本部件176b进行解码。类似地,H1再现模块116解码开环自适应密码率部件176a。
用于半—速率编解码器24的固定密码本部件178的一个实施例与对长期剩余进行编码的类型分类有关,如同在全—速率编解码器22中。再参考图2,分别通过H0第一子帧—处理模块80或H1第二子帧—处理模块84分别产生类型0固定密码本部件178a或类型1固定密码本部件178b。相应地,类型0和类型1固定密码本部件178a和178b形成位流的第二部分的一部分。
再参考图5,使用每子帧的15位(带有识别密码本的多达2位,如在全—速率编解码器22中所使用)对一个示例实施例的类型0固定密码本部件178a进行编码。对类型0固定密码本部件178a的编码包括使用多个n-脉冲密码本,在示例实施例中,它们是2-脉冲密码本192和3-脉冲密码本194。此外,在这个实施例中,使用高斯密码本195,它包括随机激励的入口。对于n-脉冲密码本,半—速率编解码器24使用相似于全—速率编解码器22的迹表。在一个实施例中,把称为“static INT16track_2_7_1”、“static INT16track_1_3_0”和“static INT16track_3_2_0”的迹表包括在所附的显微照相附录的附录B中名称为“track.tab”的库中。
在2-脉冲密码本192的一个实施例中,对于每个代表性脉冲,在迹表中的每个迹包括80个取样位置。使用13位对第一和第二代表性脉冲两者的脉冲位置进行编码。通过识别第一代表性脉冲的脉冲位置、使脉冲位置乘以80和加上第二代表性脉冲的脉冲位置得到结果而完成80个可能的脉冲位置的编码1。最终结果是—个值,这个值可以在带有用于表示两个代表性脉冲的符号的附加位的13位中进行编码,如在全—速率编解码器22中。
在3-脉冲密码本194的一个示例实施例中,通过组合一般位置和离开它的相对位移而产生脉冲位置,所述一般位置可以是由4位定义的16个取样位置中之一。相对位移可以是3个值,表示在3-脉冲密码本194中的3个代表性脉冲中的每一个。该值表示离开一般位置的位置差,而且对于每个代表性脉冲,可以通过2位来定义。3个代表性脉冲的符号的每一个可以通过1位来定义,致使脉冲位置和符号的总位数是13位。
高斯密码本195一般表示噪声类语音信号,可以使用两个基于正交的随机矢量进行编码。类型0固定密码本部件178a表示从高斯密码本195产生的两个基于正交的随机矢量。类型0固定密码本部件178a表示如何扰乱在高斯表中的多个基于正交的随机矢量,以增加基于正交的随机矢量的数目而无需增加存储要求。在这个示例实施例中,基于正交的随机矢量的数目从32个矢量增加到45个矢量。包含32个矢量且每个矢量包括40元素的高斯表表示例示的实施例的高斯密码本。在这个示例实施例中,使用于编码的两个基于正交的随机矢量相互交错,以表示在每个子帧中的80个取样。一般可以用下列矩阵来表示高斯密码本:
Figure C0081594000361
表7
把高斯密码本195的一个实施例称为“double bv”,并包括在所附的显微照相附录的附录B中。对于高斯密码本195的示例实施例,11位识别用于编码的两个基于正交的随机矢量两者的组合的索引(位置和干扰),而2位定义基于正交的随机矢量的符号。
类型1固定密码本部件178b的编码包括使用多个n-脉冲密码本,在示例实施例中,是2-脉冲密码本196和3-脉冲密码本197。2-脉冲密码本196和3-脉冲密码本197的功能相似于类型0类别的2-脉冲密码本192和3-脉冲密码本194,但结构不同。使用每子帧的13位对一个示例实施例中的类型1固定密码本部件178b编码。13位中,1位识别2-脉冲密码本196或3-脉冲密码本197,而12位表示相应的脉冲位置和代表性脉冲的符号。在示例实施例的2-脉冲密码本196中,对于使用5位编码带有剩余2位用于每个代表性脉冲的符号的每个代表性脉冲,迹包括32个取样位置。在3-脉冲密码本197中,一般位置包括使用4位编码的8个取样位置。通过2位对相对位移进行编码,用3位对代表性脉冲的符号进行编码。相似于类型0分类的帧。
再参考图3,解码系统16接收类型0或类型1固定密码本部件178a和178b。分别通过H0激励再现模块114或H1再现模块116对类型0或类型1固定密码本部件178a和178b进行解码。使用2-脉冲密码本192、3-脉冲密码本194或高斯密码本195而发生类型0固定密码本部件178a的解码。使用2-脉冲密码本196或3-脉冲密码本197对类型1固定密码本部件178b进行解码。
再参考图5,增益部件179的一个实施例包括类型0自适应和固定密码本增益部件180a和182a。使用全—速率编解码器22使用的两维矢量量化器(2D VQ)164和2维增益量化表(表4)可以使类型0自适应和固定密码本增益部件180a和182a量化。在一个实施例中,把2维增益量化表称为“Float64 gainVQ_3_128”,并包括在所附的显微照相附录的附录B中。
使用多—维矢量量化器还可以产生类型1自适应和固定密码本增益部件180b和182b,相似于全—速率编解码器22。在一个实施例中,分别把3-维前置矢量量化器(3D pre VQ)198和3-维延迟矢量量化器(3D delayed VQ)200用于自适应和固定增益部件180b和182b。矢量量化器198和200使用相应的增益量化表执行量化。在一个实施例中,增益量化表是分别用于自适应和固定密码本增益的前置—增益量化表和延迟增益量化表。多—维增益表可以是相似的结构,并包括多个预定矢量。在一个实施例中,对于分类成类型1的帧的每个子帧,每个多—维增益表包括3个元素。
相似于全—速率编解码器22,用于自适应增益部件180b的3-维前置矢量量化器(3D pre VQ)198可以直接量化自适应增益。此外,用于固定增益部件182b的3-维延迟矢量量化器(3D delayed VQ)200可以量化固定密码本能量预测误差。可以使用不同的预测系数来预测每个子帧的固定密码本能量。在一个较佳实施例中,从以前帧的3个量化的固定密码本能量误差来预测第一、第二和第三子帧的预测的固定密码本能量。在这个实施例中,在这个实施例中,分别使用系数{0.6,0.3,0.1}、{0.4,0.25,0.1}和{0.3,0.15,0.075}的组来预测第一、第二和第三子帧的预测的固定密码本能量。
一般可以把半—速率编解码器24的增益量化表表示为:
表8
3-维前置矢量量化器(3D pre VQ)198使用的前置—增益量化表的一个实施例包括16个矢量(n=16)。3-维延迟矢量量化器(3D delayed VQ)200使用延迟增益量化表的一个实施例,它包括256个矢量(n=256)。把一个实施例中用于3-维前置矢量量化器(3D preVQ)198和3-维延迟矢量量化器(3D delayedVQ)200的增益量化表分别称为“Float64 gp3_tab”和“float64 gainVQ_3_256”,并包括在所附的显微照相附录的附录B中。
再参考图2,通过H0第一子帧—处理模块80产生类型0自适应和固定密码本增益部件180a和182a。H1第一子帧—处理模块82产生类型1自适应密码本增益部件180b。相似地,H1第二帧—处理模块86产生类型1固定密码本增益部件182b。再参考图3,解码系统16接收类型0自适应和固定密码本增益部件180a和182a。H0激励再现模块114根据类型分类对类型0自适应和固定密码本增益部件180a和182a进行解码。相似地,H1激励再现模块116对类型1自适应增益部件180b和类型1固定密码本增益部件182b进行解码。
1.3 四分之一—速率编解码器的位分配
现在参考图2、3和6,现在将说明四分之一—速率编解码器26的四分之一速率位流。四分之一—速率编解码器26的示例实施例在帧和子帧两种基础上操作,但是不包括类型分类作为编码过程的一部分,如在全和半—速率编解码器22和24中。现在参考图6,四分之一—速率编解码器26产生的位流包括LSF部分202和能量部分204。四分之一—速率编解码器26的一个实施例使用两个10毫秒的子帧(每个使用每帧39位处理帧)进行操作。
当把帧分类成类型0时,使用与全—速率编解码器22相似的LSF量化方案在帧基础上对LSF部分202进行编码。四分之一—速率编解码器26利用内插元素206和多个级208对LSF编码以表示帧的频谱包络。使用27位对LSF部分202的一个实施例进行编码。27位表示以2位编码的内插元素206,和以25位编码的级208中的4个。级208包括使用7位编码的一个级和使用6位编码的3个级。在一个实施例中,四分之一—速率编解码器26使用由全—速率编解码器22使用的确切的量化表和预测器系数表。把一个实施例的量化表和预测器系数表分别称为“Float64CBes_85k”和“Float64 B_85k”,并包括在所附的显微照相附录的附录B中。
能量部分204表示能量增益,它可以乘以通过编码系统12和解码系统16两者产生的相似的而又是随机数的一个矢量。在一个实施例中,使用每子帧的6位对能量部分204进行编码。首先根据随机数确定子帧的能量增益而产生能量部分204。此外,根据过去帧的能量增益确定子帧的预测的能量增益。
从能量增益减去预测的能量增益,以确定能量增益预测误差。使用能量增益量化器和在能量增益量化表中的多个预定的标量量化能量增益预测误差。对于帧,通过能量部件204可以表示每个子帧的预定标量的索引位置。
一般可以通过下列矩阵表示能量增益量化表:
表9
在一个实施例中,能量增益量化表包括预定标量中的64(n=64)个。把能量增益量化表的一个实施例称为“Float64 gainSQ_1_64”,并包括在所附的显微照相附录的附录B中。
在图2中,通过起始四分之一帧—处理模块50在帧的基础上对LSF部分202进行编码。相似地,通过四分之一速率模块60在子帧的基础上对能量部件204进行编码。现在参考图3,解码系统16接收LSF部分202。通过Q LPC再现模块122对LSF部分202进行解码,而通过Q激励再现模块120对能量部件204进行解码。对于分类成类型1的帧,LSF部分202的解码与全—速率编解码器22的解码方法相似。对能量部件204解码以确定能量增益。可以把在解码系统16中产生的相似而又是随机数的一个矢量乘以能量增益,以产生短期激励。
1.4 八分之一—速率编解码器的位分配
在图2、3、和7中,八分之一—速率编解码器28的八分之一—速率位流可以不包括类型分类作为编码过程的一部分,并且只可以在帧基础上操作。现在参考图7,相似于四分之一—速率编解码器26,八分之一—速率编解码器28的位流包括LSF部分240和能量部分242。当把帧分类成类型1时,可以使用和全—速率编解码器22相似的LSF量化方案对LSF部分240进行编码。八分之一—速率编解码器28利用多个级244,以对短期预测器或帧的频谱表示进行编码。在3个级244中使用每帧的11位对LSF部分240的一个实施例进行编码。以4位对3个级244中的2个进行编码,而以3位对3个级244中的最后一个进行编码。
产生八分之一—速率编解码器28的LSF部分240的量化方法包括相似于全—速率编解码器22的LSF预测误差量化表和预测器系数表。一般可以通过以前讨论的表1和2来表示LSF预测误差量化表和预测器系数表。在示例实施例中,八分之一—速率编解码器28的LSF量化表包括3级(j=3),在2级中具有16个量化矢量(r=16),而在1级中具有8个量化矢量(s=8),每个量化矢量具有10个元素(n=10)。一个实施例中的预测器系数表包括每个具有10个元素(n=10)的4个矢量(m=4)。分别把量化表和预测器系数表的一个实施例称为“Float64Cbes_08k”和“Float64 B_08k”,并包括在所附的显微照相附录的附录B中。
在图2中,通过起始八分之一帧—处理模块52在帧的基础上对LSF部分240进行编码。通过八分之一速率模块62在帧的基础上对能量部件242进行编码。能量部件242表示可以与四分之一—速率编解码器26相似地确定和编码的能量增益。能量部件242的一个实施例表示每帧的5位,如在图7中所示。
相似于四分之一—速率编解码器26,可以使用能量增益和预测的能量增益来确定能量预测误差。使用能量增益量化器和在能量增益量化表中的多个预定标量量化能量预测误差。一般可以通过表9表示能量增益量化表,如上所述。一个实施例的能量增益量化器使用包括32个矢量(n=32)的能量增益量化表,把它称为“Float64 gainSQ_1_32”,并包括在所附的显微照相附录的附录B中。
在图3中,在接收之后可以通过解码系统16对LSF部分240和能量部分242进行解码。分别通过E LPC再现模块126和D激励再现模块124对LSF部分240和能量部分242进行解码。对于分类成类型1的帧,LSF部分240的解码与全—速率编解码器22相似。通过把解码的能量增益施加到相似而又是随机数的矢量可以对能量部分242进行解码,如在四分之一—速率编解码器26中。
语音压缩系统10的一个实施例能够使用4个编解码器22、24、26和28中之一产生位流然后对其进行解码。可以根据速率选择和类型分类,对通过特定的编解码器22、24、26和28产生的位流进行编码,突出在帧中的语音信号18的不同参数。相应地,可以使从位流解码的后—处理的合成语音20的感知质量最优化而同时保持所要求的平均位速率。
现在提供在图2和3中的实施例中描述的语音压缩系统的配置和操作的详细讨论。结合讨论,建议读者阅读包含在所附显微照相附录的附录A中的源代码,以加强理解。
预—处理模块
现在参考图8,提供在图2中的预—处理模块34的扩展方框图。预—处理模块34的一个实施例包括静音增强模块302、高通滤波器模块304和噪声抑制模块306。预—处理模块34接收语音信号18,并提供预—处理语音信号308。
静音增强模块302接收语音信号18,其作用是跟踪最小噪声判定。静音增强功能自适应地跟踪语音信号18围绕零的最小判定和电平,并检测当前帧是否为“静音噪声”。如果检测到“静音噪声”的帧,则可以使语音信号18倾斜到零—电平。否则,可以不修改语音信号18。例如,A-定律编码方案可以把这种不可听到的“静音噪声”转换成可清楚地听到的噪声。在预—处理模块34可以放大接近0到约+8或-8的值的取样值之前,A-定律对语音信号18进行编码和解码,从而把几乎不可听到的噪声转换成可听到的噪声。在通过静音增强模块302处理之后,可以把语音信号18提供给高通滤波器模块304。
高通滤波器模块304可以是第二阶极点—零滤波器,而且可以通过下列传递函数H(z)给出:
H ( z ) = 0.92727435 - 1.8544941 z - 1 + 0.92727435 z - 2 1 - 1.9059465 z - 1 + 0.9114024 z - 2 (公式1)
在把分子的系数除以2的高通滤波期间,输入可以按比例减小一个2的因子。
在高通滤波器处理之后,可以把语音信号18传递到噪声抑制模块306。噪声抑制模块306使用在频域中的噪声减法,而且可以是许多众知噪声抑制技术中的一种。噪声抑制模块306可以包括噪声抑制算法使用的傅里叶变换程序,如在题为“用于宽带扩频数字系统的增强的可变速率编解码器,语音业务选择3”的TIA/EIA IS127标准的4.1.2节中所描述。
一个实施例的噪声抑制模块306把语音信号18的每个帧转换成频谱幅度可以和频谱相位分开的频域。可以组合频谱幅度成为遵守人类听觉信道频带的频带。可以对于每个频带计算衰减增益。可以计算衰减增益,使之在可能有谐波结构的频谱区域上较少地加强。在这种区域中,可以通过强的话音语音来屏蔽背景噪声。相应地,任何语音的衰减可能使原始语音的质量失真而在噪声降低中没有任何感知的改进。
在计算衰减增益之后,可以把在每个频带中的频谱幅度乘以衰减增益。然后可以把频谱幅度与原始频谱相位组合,并可以把语音信号18传递回时域。可以重叠—和—相加时域信号以产生预—处理语音信号308。可以把预—处理语音信号308提供给起始帧—处理模块44。
起始帧处理模块
图9是在图2中示出的起始帧—处理模块44的方框图。起始帧—处理模块44的一个实施例包括LSF产生部分312,感知加权滤波器模块314、开环音调估计模块316、特征表示部分318、速率选择模块320、音调预—处理模块322以及类型分类模块324。特征表示部分318进一步包括话音活动检测(VAD)模块326和特征表示模块328。LSF产生部分312包括LPC分析模块330、LSF平滑模块332和LSF量化模块334。此外,在全—速率编码器36中,LSF产生部分312包括内插模块338,以及在半—速率编码器38中,LSF产生部分包括预测器交换机模块336。
参考图2,起始帧—处理模块44进行操作以产生LSF部分140、172、202和240,以及确定速率选择和类型分类。速率选择和类型分类通过激励—处理模块54控制处理。在图9中示出的起始帧—处理模块44是起始全帧—处理模块46和起始半帧—处理模块48的一个实施例的示意图。起始四分之一帧—处理模块50和起始八分之一帧—处理模块52有某种程度的不同。
如上所述,在一个实施例中,起始四分之一—速率帧—处理模块50和起始八分之一—速率帧—处理模块52不发生类型分类。此外,不分开地处理长期预测器和长期预测器剩余以表示在图6和7中示出的能量部分204和242。相应地,在起始四分之一—速率帧—处理模块50和起始八分之一—速率帧—处理模块52中只可操作在图9中示出的LSF部分312、特征表示部分318和速率选择模块320。
为了促进对起始帧—处理模块44的理解,首先讨论操作的一般概述,接着是详细的讨论。现在参考图9,起初把预—处理语音信号308提供给LSF产生部分312、感知加权滤波器模块314和特征表示部分318,然而,在特征表示部分318中的某些处理与发生在开环音调估计模块316中的处理无关。LSF产生部分312估计预—处理语音信号308的频谱表示,并对其进行编码。在预—处理语音信号308的编码期间,感知加权滤波器模块314根据在通过人类听觉系统处理的期间发生的自然屏蔽进行操作以提供感知加权。开环音调估计模块316确定每个帧的开环音调滞后。特征表示部分318分析预—处理语音信号308的帧,并指出帧的特征表示,使接着的处理最优化。
在通过特征表示部分318处理期间和处理之后,音调预—处理模块322可以使用所产生的帧的特征表示,以产生在闭环音调滞后的产生中使用的参数。此外,速率选择模块320使用帧的特征表示来确定速率选择。根据通过音调预—处理模块322确定的音调滞后的参数和特征表示,类型分类模块324确定类型分类。
3.1 LPC分析模块
在LSF产生部分312中的LPC分析模块330接收预—处理语音信号308。LPC分析模块330确定用于产生LSF部分312的短期预测参数。在LPC分析模块330的一个实施例中,对于预—处理语音信号308的帧执行3个第10阶的LPC分析。可以使分析定中心于帧的第二四分之一中、帧的第四四分之一中以及超前。超前是一种语音分段,它伸出到下一个帧以减少过渡效应。在超前中的分析包括来自当前帧的取样和来自预—处理语音信号308的下一个帧的取样。
可以对在帧中的每个LPC分析使用不同的窗口,以计算线性预测系数。使用自动相关方法执行在一个实施例中的的LPC分析,以计算自动相关系数。可以从在每个窗口中的多个数据取样计算自动相关系数。在LPC分析期间,可以把60Hz的带宽扩展和1.001的白噪声校正因子施加到自动相关系数。在接着的编码期间,带宽扩展提供对着信号的附加强度和四舍五入误差。白噪声校正因子有效地添加-40dB的噪声限,以降低频谱动态范围和进一步调节在接着的编码期间的误差。
可以使用Leroux-Gueguen算法从自动相关系数计算多个反射系数。然后可以把反射系数转换成线性预期系数。线性预期系数再转换成LSF(线频谱频率),如上所述。可以量化在第四四分之一中计算的LSF,并发送到解码系统16,作为LSF部件140、172、202、240。对分类成类型0的帧,可以使用在第二四分之一中计算的LSF来确定全—速率编码器36的内插路径。内插路径是可选择的,而且可以用内插单元158进行识别。此外,可以在编码系统12中使用在第二四分之一和超前中计算的LSF,以产生短期剩余和加权的语音,将在下面描述。
3.2 LSF平滑模块
在稳定背景噪声期间,在量化LSF之前,可以通过LSF平滑模块332对在帧的第四四分之一中计算的LSF进行平滑。平滑LSF,以较佳地保留背景噪声的感知特征。由将在下面描述的通过VAD模块326提供的话音活动判定和帧的频谱表示展开的分析来控制平滑。把LSF平滑系数表示为βlsf。在一个实施例中:
1.在“平滑”背景噪声分段的开始处,可以使平滑系数平方地倾斜经过5个帧从0到0.9。
2.在“平滑”背景噪声分段期间,平滑系数可以是0.9。
3.在“平滑”背景噪声分段的结束处,可以使平滑系数立即降低到0。
4.在非“平滑”背景噪声分段期间,平滑系数可以是0。
根据LSF平滑系数,可以计算用于量化的LSF为:
lsfn(k)=βlsf·lsfn-1(k)+(1-βlsf)·lsf2(k),k=1,2,...,10  (公式2)
其中,lsfn(k)和lsfn-1(k)分别表示当前的和以前的帧的平滑的LSF,而lsf2(k)表示中心在当前帧的最后四分之一处的LPC分析的LSF。
3.3 LSF量化模块
通过LSF量化模块334可以在LSF域中对由平滑的LSF给出的第10阶LPC模型进行量化(公式2)。量化的值是多个量化的LPC系数Aq(z)342。量化方案使用第n阶移动平均预测器。在一个实施例中,对于全—速率编解码器22和四分之一速率编解码器26,量化方案使用第二阶移动平均预测器。对于半—速率编解码器24,可以使用第四阶移动平均交换的预测器。对于八分之一速率编解码器28,可以使用第四阶移动平均预测器。如上所述,在各个编解码器中可以通过多—级密码本来执行LSF预测误差的量化。
LSF量化的误差指标是权重的均方误差测量值。权重的均方误差的加权是LPC幅度谱的函数。相应地,给出量化的目标值如下:
{ l s ^ f n ( 1 ) , l s ^ f n ( 1 ) , . . . , l s ^ f n ( 10 ) } = arg min { Σ k = 1 10 w i · ( lsf n ( k ) - l s ^ f n ( k ) ) 2 } , (公式3)
其中,权重可以是:
wi=|P(lsfn(i))|0.4                               (公式4)
而|P(f)|是在频率f处的LPC功率谱(索引n表示帧号)。在示例实施例中,有10个系数。
在一个实施例中,检查量化的LPC系数Aq(z)342的排序特性。如果一对LSF倒转,则可以对它们再—排序。当两个或多个LSF对倒转时,可以宣布擦除量化的LPC系数Aq(z)342,而且可以使用将在下面讨论的解码系统16的帧擦除隐藏进行再现。在一个实施例中,在量化的LPC系数Aq(z)342的相邻系数之间可以强制最小为50Hz的间隔。
3.4 预测器交换机模块
在半—速率编解码器24中可操作预测器交换机模块336。如上所述,使用移动平均预测器系数可以产生预测的LSF。预测器系数确定使用多少过去帧的LSF来预测当前帧的LSF。把预测器交换机模块336耦合到LSF量化模块334,以提供使用量化误差最小的预测器系数,已如上述。
3.5 LSF内插模块
对于在全—速率编解码器22中的每个子帧,也可以内插量化的和未量化的LSF。内插量化的和未量化的LSF以提供每个子帧的量化的和未量化的线性预测参数。LSF内插模块338选择全—速率编解码器22的具有类型0类别的帧的内插路径,如上所述。对于其它帧,可以使用预定的线性内插路径。
内插模块338相对于以前帧的LSF和在帧的第二四分之一处计算的LSF而分析当前帧的LSF。可以根据在子帧之间的频谱包络中的变化程度来选择内插路径。不同的内插路径调节用于当前子帧的以前帧的LSF的权重和当前帧的LSF的权重,如上所述。通过内插模块338调节之后,可以把内插的LSF转换成每个子帧的预测器系数。
对于在全—速率编解码器22,以及对于半—速率编解码器24、四分之一—速率编解码器26和八分之一—速率编解码器28中的类型1类别,可以使用预定的线性内插路径来调节权重。相似地,在内插之后可以把内插的LSF转换成预测器系数。此外,可以进一步对预测器系数加权,以产生感知加权滤波器模块314使用的系数。
3.6 感知加权滤波器模块
可操作感知加权滤波器模块314以接收预—处理语音信号308和对其进行滤波。可以通过突出预—处理语音信号308的谷区域和不突出它的峰区域而执行通过感知加权滤波器模块314的滤波。感知加权滤波器模块314的一个实施例有两部分。第一部分可以是传统的极点—零滤波器
W 1 ( z ) = A ( z / γ 1 ) A ( z / γ 2 ) (公式5)
其中,A(z/γ1)和1/A(z/γ2)分别是零—滤波器和极点—滤波器。从每个子帧的内插的LSF和分别通过γ1和γ2的加权可以得到零—滤波器和极点—滤波器的预测系数。在感知加权滤波器模块314的实施例中,权重是γ1=0.9和γ2=0.5。感知加权滤波器模块314的第二部分可以是如下的自适应低通滤波器:
W 2 ( z ) = 1 1 - ηz - 1 (公式6)
其中,η是稳定长期频谱特征的函数,将在下面讨论。在一个实施例中,如果稳定长期频谱特征具有与公用电话交换网(PSTN)相关联的典型的倾斜,则η=0.2,否则,η=0.0。通常把典型的倾斜称为修改的IRS特征或频谱倾斜。在感知加权滤波器模块314处理之后,可以把预—处理语音信号308描述为加权的语音344。把加权的语音344提供给开环音调估计模块316。
3.7 开环音调估计模块
开环音调估计模块316产生帧的开环音调滞后。在一个实施例中,开环音调滞后实际上包括3个开环音调滞后,即,帧的第一半个的第一音调滞后、帧的第二半个的第二音调滞后和帧的超前部分的第三音调滞后。
对于每一个帧,开环音调估计模块316根据当前帧估计第二和第三音调滞后。第一开环音调滞后是来自可以进一步调节的以前帧的第三开环音调滞后(超前)。对3个开环音调滞后进行平滑以提供连续的音调轮廓。开环音调滞后的平滑使用一组探索性的和特定的判定规则,以保留帧的最佳音调轮廓。开环音调估计是根据通过sw(n)表示的加权语音344的。在一个实施例中,开环音调估计模块316估计的值是范围从17到148的滞后。
可以使用归一化的相关,R(k),来确定第一、第二和第三开环音调滞后,可以根据下式计算所述归一化相关:
R ( k ) = Σ n = 0 79 s w ( n ) · s w ( n - k ) ( Σ n = 0 79 s w ( n ) · s w ( n ) ) ( Σ n = 0 79 s w ( n - k ) · s w ( n - k ) ) (公式7)
其中,在示例实施例中,n=79,表示在子帧中的取样数。确定多个区域中的每一个区域的最大归一化相关R(k)。区域可以是表示在可能滞后范围中的4个子范围的4个区域。例如,从17-33滞后的第一区域、从34-67滞后的第二区域、从68-137滞后的第三区域和从138-148滞后的第四区域。与使来自每个区域的归一化相关值R(k)最大的滞后相对应的一个开环音调滞后是起始音调滞后候选者。根据归一化相关值、特征表示信息和开环音调滞后的历史,从起始音调滞后候选者中选择最佳候选者。可以对第二音调滞后和第三音调滞后执行这个过程。
最后,可以调节第一、第二和第三开环音调滞后,使之与总的音调轮廓和来自帧的开环音调滞后有最佳的配合。把开环音调滞后提供给音调预—处理模块322进行进一步处理,将在下面描述。开环音调估计模块316还提供音调滞后和在音调滞后处的归一化相关值。把在音调滞后处的归一化相关称为音调相关,并表示为Rp。在特征表示部分318中指出帧的特征时使用音调相关Rp
3.8 特征表示部分
可操作特征表示部分318来分析预—处理语音信号308的每个帧和指出它们的特征。在起始帧—处理模块44和激励—处理模块54中的多个模块利用特征表示信息。尤其,在速率选择模块320和类型分类模块324中使用特征表示信息。此外,在量化和编码期间可以使用特征表示信息,尤其,在使用与级有关的加权方法感知地突出语音的重要特征时,这将在下面描述。
通过特征表示部分318的预—处理语音信号308的特征表示发生于每个帧。一般可以把特征表示部分318的一个实施例的操作描述为预—处理语音信号308的6类分析。6类是:话音活动判定、无话音噪声状语音的识别、6-类信号特征表示、噪声—对—信号比的推导、4-等级特征表示以及稳定长期频谱特征的特征表示。
3.9 话音活动检测(VAD)模块
话音活动检测(VAD)模块326执行话音活动判定作为特征表示中的第一步。VAD模块326进行操作,以判定预—处理语音信号308是否是语音的某种形式,或是否只是静音或背景噪声。VAD模块326的一个实施例通过跟踪背景噪声的性能来检测话音活动。VAD模块326监测当前帧的参数和表示背景噪声的参数之间的差异。可以使用一组预定门限值把帧分类成语音帧或背景噪声帧。
VAD模块326进行操作,以根据监测多个参数(诸如,在帧中的取样的最大绝对值、以及反射系数、预测误差、LSF和LPC分析模块330提供的第10阶自动相关系数)来判定话音活动。此外,VAD模块326的一个实施例使用来自最近帧的音调滞后和自适应密码本增益的参数。因为尚不可得到当前帧的音调滞后和自适应密码本增益,所以VAD模块326使用的音调滞后和自适应密码本增益是来自以前帧的。可以使用VAD模块326执行的话音活动判定来控制编码系统12的数个方面,以及形成特征表示模块328的最后级特征表示判定的一部分。
3.10 特征表示模块
在通过VAD模块326的话音活动判定之后,激励特征表示模块328。特征表示模块328执行如上所述的预—处理语音信号308的第二、第三、第四和第五类分析。第二类是无话音噪声状语音帧的检测。
3.10.1 无话音噪声状语音检测
一般,无话音噪声状语音帧不包括话音帧包括的谐波结构。在一个实施例中,无话音噪声状语音帧的检测是根据预—处理语音信号308的,并给出加权的剩余信号Rw(z):
Rw(Z)=A(z/γ1)·S(z)                   (公式8)
其中,A(z/γ1)表示具有权重γ1的零—滤波器,而S(z)是预—处理语音信号308。可以使用诸如下列6个参数之类的多个参数来判定当前帧是否是无话音噪声状语音帧:
1.在帧的第一3/4上的预—处理语音信号308的能量。
2.在预定门限值以下的帧中的语音取样的计数。
3.使用加权的剩余信号和帧大小确定剩余锐度。通过取样绝对值的平均值对取样的最大绝对值的比值给出锐度。可以从公式8确定加权的剩余信号。
4.表示预—处理语音信号308的幅度谱的倾斜的第一反射系数。
5.预—处理语音信号308的过零速率。
6.预—处理语音信号308和加权的剩余信号之间的预测测量。
在一个实施例中,把一组门限值与上列参数进行比较,以得出帧是否为无话音噪声状语音帧的判定。在控制音调预—处理模块322中和控制固定密码本搜索中可以使用所得的判定,下面将对两者进行描述。此外,在确定预—处理语音信号308的6-类信号特征表示中使用无话音噪声状语音帧判定。
3.10.2 6-类信号特征表示
特征表示模块328还可以执行第三类分析,即,6-类信号特征表示。根据帧的主要特征把帧的特征定为6类中之一而执行6-类信号特征表示。在一个实施例中,可以把6类描述为:
0.静音/背景噪声
1.稳定噪声状无话音语音
2.不稳定无话音
3.有力的开始
4.不稳定话音
5.稳定话音
在另外的实施例中,也可以包括其它类别,诸如特征为破裂音的帧。起初,特征表示模块328在静音/背景噪声帧(0类)、不稳定无话音帧(2类)、有力的开始的帧(3类)和通过4类和5类表示的话音帧之间进行区分。在音调预—处理模块322的激励期间,可以执行不稳定(4类)和稳定(5类)的话音帧的特征表示。此外,特征表示模块328起初可以不在稳定噪声状无话音帧(1类)和不稳定无话音帧(2类)之间进行区分。在使用上述无话音噪声状语音算法判定,通过音调预—处理模块322处理期间,也可以识别特征表示分类。
例如,特征表示模块328使用预—处理语音信号308和通过VAD模块326的话音活动检测执行特征表示。此外,特征表示模块328可以利用相应于第二开环音调滞后的帧的开环音调滞后和归一化相关Rp
通过特征表示模块328可以从预—处理语音信号308得到多个频谱倾斜和多个绝对最大值。在示例实施例中,4个重叠分段的频谱倾斜包括80个取样,对所述每个取样进行计算。通过80个取样的Hamming窗口可以对4个重叠分段加权。从预—处理语音信号308的8个重叠分段得到示例实施例的绝对最大值。一般,8个重叠分段中的每一个的长度约为开环音调滞后的周期的1.5倍。可以使用绝对最大值来产生幅度包络的平滑轮廓。
每帧可以更新或内插频谱倾斜、绝对最大值和音调相关Rp参数多次。对于特征为背景噪声的帧,通过VAD模块326还可以对这些参数计算多次平均值。在示例实施例中,使用20个取样的每一个的8个分段得到每个参数的8个更新的估计值。可以从特征不是背景噪声的接着的帧的参数估计值减去背景噪声的参数的估计值,以产生一组“清除噪声的”参数。
可以从“清除噪声的”参数和开环音调滞后计算一组基于统计的判定参数。每个基于统计的判定参数表示原始参数的统计特性,诸如,平均、偏差、开方、最大值或最小值。使用一组预定的门限值参数,可以根据统计判定参数对当前帧作出初始特征表示判定。根据初始特征表示判定、过去特征表示判定和VAD模块326的话音活动判定,可以作出帧的初始分类判定。初始分类判定指出帧的特征为0、2、3类中之一,或为通过4类或5类表示的话音帧。
3.10.3 噪声—对—信号比推导
除了帧特征表示之外,一个实施例的特征表示模块328还通过推导噪声—对—信号比(NSR)执行第四类分析。NSR是传统的畸变指标,可以象背景噪声能量的估计和帧的帧能量之间的比值那样进行计算。通过使用修改的话音活动判定,NSR计算的一个实施例保证在比值中只包括真实的背景噪声。VAD模块326使用初始话音活动判定、预—处理语音信号308的帧的能量、以及从超前部分计算的LSF而导出修改的话音活动判定。如果修改的话音活动判定指示帧是背景噪声,则更新背景噪声的能量。
例如,使用移动平均值从帧能量更新背景噪声。如果背景噪声的能量电平大于帧能量的能量电平,则用帧能量来替代。通过帧能量的替代可以包括使背景噪声的能量电平偏移成较低,并截去结果。结果表示可以在NSR的计算中使用的背景噪声能量的估计值。
在计算NSR之后,特征表示模块328执行初始分类判定的校正,以修改分类判定。可以使用初始分类判定、话音活动判定和无话音噪声状语音判定来执行校正。此外,例如,还可以使用以前计算的参数,这些参数表示通过反射系数表达的频谱、音调相关Rp、NSR、帧的能量、以前帧的能量、剩余锐度以及加权语音的锐度。把初始分类判定的校正称为特征表示调谐。如果识别这些条件,则特征表示调谐可以改变初始分类判定,以及设置有力的开始条件标志和有噪声的话音标志。此外,调谐还可以触发在通过VAD模块326的话音活动判定中的改变。
3.10.4 4-等级特征表示
特征表示模块328还可以产生第五类特征表示,即,4-等级特征表示。4-等级特征表示是控制音调预—处理模块322的一个参数。4-等级特征表示的一个实施例在4个类别之间进行区分。类别的标号可以从数字1到4。使用标号1的类别使音调预—处理模块322复位,以便在音调预—处理期间防止超过延迟预算的延迟累加。一般,其余的类别表示增加话音强度。增加话音强度是语音的周期性的测量。在另一个实施例中,可以包括更多或更少的类别,以表示话音强度的电平。
3.10.5 稳定长期频谱特征
特征表示模块328还可以通过判定预—处理语音信号308的稳定长期频谱特征而执行第六类分析。例如,使用诸如LSF、6-类信号特征表示和开环音调增益之类的频谱信息在多个帧上判定稳定长期频谱特征。判定是根据这些参数的长期平均值的。
3.11 速率选择模块
在通过特征表示模块328修改分类判定之后,速率选择模块320可以进行称之为开环速率选择的初始速率选择。例如,在确定开环速率选择中,速率选择模块320可以使用修改的分类判定、NSR、有力的开始标志、剩余能量、锐度、音调相关Rp、以及诸如反射系数之类的频谱参数。还可以根据语音压缩系统10正在其中操作的模式选择开环速率选择。调谐速率选择模块320以提供每个模式指示的所要求的平均位速率。在通过音调预—处理模块322处理之后,可以修改速率选择模块320,将在下面描述。
3.12 音调预—处理模块
音调预—处理模块322在帧的基础上进行操作,以执行分析和修改加权的语音344。例如,音调预—处理模块322在加权的语音344的音调周期上可以使用压缩或扩大技术,以便改进编码过程。通过音调预—处理模块322量化开环音调滞后,以产生开环自适应密码本部分144a或176a,如上参考图2、4和5所讨论。如果帧的最后类型分类是类型1,则这个量化表示帧的音调滞后。然而,如果在音调预—处理模块322的处理之后改变类型分类,则也改变了音调滞后量化,以表示闭环自适应密码本部分144b或176b,如上参考图2、4和5所讨论。
对开环音调估计模块316产生的帧的开环音调滞后进行量化和内插,以产生音调迹348。一般,音调预处理模块322试图修改加权的语音344以适合音调迹348。如果修改是成功的,则帧的最后的类别是类型1。如果修改不成功,则帧的最后的类型分类是类型0。
如下面进一步详述,音调预—处理修改过程可以执行连续时间加权的语音344的扭曲。扭曲引入可变延迟。在一个实施例中,在编码系统12中的最大可变延迟是20个取样(2.5毫秒)。可以在一个音调周期一个音调周期的基础上修改加权的语音344,具有在相邻音调周期之间的重叠,以避免再现/修改分段之间的不连续。可以根据音调迹348修改加权的语音344,以产生修改的加权语音350。此外,通过音调预—处理模块322产生数个未量化的音调增益352。如果帧的类型分类是类型1,则使用未量化的音调增益352来产生类型1自适应密码本增益部件148b(对于全速率编解码器22)或180b(对于半—速率编解码器24)。把音调迹348、修改的加权语音350和未量化的音调增益352提供给激励—处理模块54。
如上所述,通过特征表示模块328的4-等级特征表示控制音调—预处理。在一个实施例中,如果帧主要是背景噪声或具有低音调相关的无话音,诸如,类别1,则帧保持不变,并使音调—预处理的累加延迟复位到零。如果帧是预—主要脉冲状无话音,诸如,类别2,则可以保持累加的延迟,除了简单的时间偏移之外无需信号的任何扭曲。可以根据输入语音信号18的累加延迟确定时间偏移。对于保持4—等级特征表示的帧,为了最佳地扭曲信号,可以执行音调预—处理算法的核心程序。
一般,在一个实施例中的音调预—处理模块322的核心程序执行3个主要的任务。第一,尝试修改加权的语音344,使之与音调迹348匹配。第二,估计信号的音调增益和音调相关。最后,根据在音调预—处理分析期间得到的附加信号信息精选语音信号18的特征表示和速率选择。在另一个实施例中,可以使附加的音调预—处理包括,诸如,波形内插。一般,可以使用波形内插来修改某些不正规的过渡分段,使用前向—反向波形内插技术以增强规则的加权的语音344和抑制不规则的加权的语音344。
3.12.1 修改
加权的语音344的修改提供更正确地配合到音调—编码模型的加权的语音344,所述音调—编码模型相似于松弛代码激励的线性预测(RCELP)语音编码方法。在TIA(电信工业协会)IS-127标准中提供RCELP语音编码的实施例子。没有任何感知质量损失的修改的性能包括精细的音调搜索、分段大小的估计、目标信号扭曲以及信号扭曲。可以在帧等级基础上执行精细音调搜索,而同时可以对每个音调周期执行分段大小的估计、目标信号扭曲和信号扭曲。
3.12.1.1 精细音调搜索
根据以前确定的第二和第三音调滞后、速率选择和累加的音调预—处理延迟可以在加权的语音344上执行精细音调搜索。精细音调搜索搜索分数音调滞后。分数音调滞后是与滞后的量化组合的非整数音调滞后。通过搜索用于量化开环音调滞后的滞后量化表和寻找使加权的语音344的音调相关最大的滞后而得到组合。在一个实施例中,由于与不同速率选择相关联的不同的量化技术,对于每个编解码器执行不同的搜索。在搜索区域中执行搜索,开环音调滞后识别以及累加的延迟控制所述搜索区域。
3.12.1.2 估计分段大小
分段大小按照音调周期而有某些较小的调节。一般,使音调周期的音调合成(主脉冲)的位置向着分段的终端,以便允许在感知最重要部分(音调合成)上的扭曲的最大正确度。对于给定的分段,开始点是固定的,而结束点可以移动,以得到最佳模型配合。结束点的移动有效地伸张或压缩时标。结果,偏移分段开始处的取样较困难,最大偏移将向着分段的结束端发生。
3.12.1.3 用于扭曲的目标信号
用于时间扭曲的目标信号的一个实施例是从修改的加权语音350(通过S’w(n)表示)得到的当前分段和音调迹348(通过Lp(n)表示)的合成。根据音调迹348,Lp(n),可以使用第21阶Hamming加权的Sinc窗口内插修改的加权语音350而得到目标信号S’w(n),n=0,...,Ns-1,的每个取样值,
s w t ( n ) = Σ i = - 10 10 w s ( f ( L p ( n ) ) , i ) · s w ′ ( n - i ( L p ( n ) ) ) , 则n=0,...,Ns-1  (公式9)
其中,i(Lp(n))和f(Lp(n))分别是音调滞后的整数和分数部分;ws(f,i)是Hamming加权的Sinc窗口,而Ns是分段的长度。通过swt w(n)=we(n)·s’w(n)给出加权的目标swt w(n)。加权函数,we(n),可以是两—分段(piece)线性函数,它在音调合成中突出音调合成而不突出“噪声”。根据4-等级分类,通过对于较高周期性的分段增加在音调合成上的重点,可以适配权重。
使加权的目标swt w(n)和加权的语音344之间的归一化交叉相关最大的整数偏移是sw(n+τacc),其中,sw(n+τacc)是根据可以通过最大化找到的累加的延迟τacc而偏移的加权的语音344
R ( τ shift ) = Σ n = 0 N s - 1 s w wt ( n ) · s w ( n + τ acc + τ shift ) ( Σ n = 0 N s - 1 s w wt ( n ) 2 ) · ( Σ n = 0 N s - 1 s w ( n + τ acc + τ shift ) 2 ) . (公式10)
通过搜索在τshift附近的R(τshift)的上取样形式可以确定精选的(分数)偏移。这可以产生最后的最佳偏移τopt以及相应的归一化交叉相关Rnopt)。
3.12.1.4 信号扭曲
根据通过
(公式11)
Figure C0081594000544
(公式12)
给出的映射,可以再现分段的修改的加权语音350,其中,τc是定义扭曲函数的参数。一般,τc规定音调合成的开始。公式11给出的映射规定时间扭曲,而公式12给出的映射规定时间偏移(无扭曲)。可以使用Hamming加权的Sinc窗口函数来执行两者。
3.12.2 音调增益和音调相关估计
可以在音调周期基础上对音调增益和音调相关进行估计,并分别通过公式11和12定义。为了使通过公式9定义的目标s’w(n)和通过公式11和12定义的最后的修改信号s’w(n)之间的均方误差最小,估计音调增益,并可通过下式给出
g a = Σ n = 0 N s - 1 s w ′ ( n ) · s w t ( n ) Σ n = 0 N s - 1 s w t ( n ) 2 (公式13)
把音调增益提供给激励—处理模块54作为未量化的音调增益352。可以给出音调相关如下
R a = Σ n = 0 N s - 1 s w ′ ( n ) · s w t ( n ) ( Σ n = 0 N s - 1 s w ′ ( n ) 2 ) · ( Σ n = 0 N s - 1 s w t ( n ) 2 ) (公式14)
在音调周期基础上可以得到两个参数,并且可以线性地内插两个参数。
3.12.3 精选的类别和精选的速率选择
在通过音调预—处理模块322的音调—预处理之后,把平均音调相关和音调增益提供给特征表示模块328和速率选择模块320。用音调相关和音调增益,特征表示模块328和速率选择模块320分别产生最后的特征表示类别和最后的速率选择。通过对帧的6-类信号特征表示和开环速率选择进行精选可以确定最后的特征表示类别和最后的速率选择。
尤其,特征表示模块328判定应该把具有特征表示为话音帧的一个帧的特征定为4类“不稳定话音”还是5类“稳定话音”。此外,根据特定帧是修改的无话音噪声状语音的以前判定,可能发生特定帧是稳定噪声状无话音语音的最后判定。可以把符合噪声状无话音语音的帧的特征定为1类,“稳定噪声状无话音语音”。
根据最后特征表示类别,通过速率选择模块320的开环速率选择和在半速率信号线30上的半速率信令标志(图1),可以确定最后速率选择。把最后速率选择提供给激励—处理模块54作为速率选择指示符354。此外,把帧的最后特征表示类别提供给激励—处理模块54作为控制信息356。
3.13 类型分类模块
对于全速率编解码器22和半速率编解码器24,类型分类模块324还可以使用最后特征表示类别。判定具有最后特征表示类别为0类到4类的帧是类型0帧,而判定5类帧是类型1帧。把类型分类提供给激励—处理模块54作为类型指示符358。
4.0 激励处理模块
根据速率选择,来自类型分类模块324的类型指示符358选择地激励全—速率模块54或半—速率模块56,如在图2中所示。图10是方框图,表示在图2中示出的,对于类型0类别激励的F0或H0第一子帧—处理模块70或80。相似地,图11是方框图,表示对于类型1类别激励的F1或H1第一子帧—处理模块72或82、F1或H1第二子帧—处理模块74或84和F1或H1第二帧—处理模块76或86。如上所述,“F”和“H”分别表示全—速率编解码器22和半—速率编解码器24。
在图2中示出的四分之一—速率模块60和八分之一—速率模块62的激励可以根据速率选择。在一个实施例中,产生和定标伪随机序列以表示短期激励。能量部件204和242(图2)表示伪随机序列的定标,如上所述。在一个实施例中,从位流获取用于产生伪随机序列而使用的“种子”,从而提供编码系统12和解码系统16之间的同步性。
如上所述,激励—处理模块54还接收修改的加权语音350、未量化的音调增益352、速率指示符354和控制信息356。在处理期间,四分之一和八分之一速率编解码器26和28不使用这些信号。然而,可以使用这些参数进一步处理在全—速率编解码器22和半—速率编解码器24中的语音信号18的帧。如下所述,全—速率编解码器22和半—速率编解码器24根据帧的类型分类为类型0或类型1而使用这些参数。
4.1 用于全—速率编解码器和半—速率编解码器的类型0帧的激励处理模
现在参考图10,F0或H0第一子帧—处理模块70、80的一个实施例包括自适应密码本部分362、固定密码本部分364和增益量化部分366。对于类型0的帧的处理和编码与传统CELP编码,例如,TIA(电信工业协会)标准IS-127,有些相似。对于全—速率编解码器22,可以把帧分割成4个子帧,而对于半—速率编解码器24,可以把帧分割成2个子帧,如上所述。在子帧的基础上执行在图10中表示的功能。
F0或H0第一子帧—处理模块70、80进行操作(图2),以确定闭环音调滞后和自适应密码本的相应的自适应密码本增益。此外,使用固定密码本量化长期剩余,还确定相应的固定密码本增益。还执行闭环音调滞后的量化和自适应密码本增益和固定密码本增益的联合量化。
4.1.1 自适应密码本部分
自适应密码本部分362包括自适应密码本368、第一乘法器370、第一合成滤波器372、第一感知加权滤波器374、第一减法器376和第一最小化模块378。自适应密码本部分362使用按分析的合成(ABS)方法执行从自适应密码本386搜索最佳闭环音调滞后。
可以把来自相应于闭环音调滞后的自适应密码本368的一个分段称为自适应密码本矢量(va)382。可以使用来自图9的音调预—处理模块322的音调迹348来识别自适应密码本368中的一个区域,以搜索自适应密码本矢量(va)382。第一乘法器370使选择的自适应密码本矢量(va)382乘以增益(ga)384。增益(ga)384是未量化的,并表示计算的起始自适应密码本增益,将在下面描述。把所产生的信号传递到第一合成滤波器372,它执行与上述LPC分析相反的功能。第一合成滤波器372接收来自LSF量化模块334的量化的LPC系数Aq(z)342,并且和第一感知加权滤波器374一起产生第一再合成语音信号386。第一减法器376从修改的加权语音350中减去第一再合成语音信号386,以产生长期误差信号388。修改的加权语音350是在自适应密码本368中搜索的目标信号。
第一最小化模块378接收长期误差信号388,长期误差信号388是一个矢量,表示在量化闭环音调滞后中的误差。第一最小化模块378执行矢量的能量计算,并确定相应的均方误差。此外,对于自适应密码本矢量(va)382,第一最小化模块378控制来自自适应密码本368的矢量的搜索和选择,以便减少长期误差信号388的能量。
重复搜索过程,直到第一最小化模块378已经对于每个子帧选择来自自适应密码本368的自适应密码本矢量(va)382的最佳矢量。在自适应密码本368中的自适应密码本矢量(va)382的最佳矢量的索引位置形成闭环自适应密码本部分144b、176b的一部分(图2)。这个搜索过程有效地使长期误差信号388的能量最小。通过选择来自自适应密码本368的最佳自适应密码本矢量(va)382而选择最佳闭环音调滞后。所产生的长期误差信号388是更小的自适应密码本矢量(va)382的经滤波的最佳矢量的修改的加权语音350。
4.1.1.1 全—速率编解码器的闭环自适应密码本搜索
通过闭环自适应密码本部分144b在位流中表示全—速率编解码器22的闭环音调滞后。对于全—速率编解码器22的一个实施例,用8位来表示第一和第三子帧的闭环音调滞后,而用5位来表示第二和第四子帧的闭环音调滞后,如上所述。在一个实施例中,滞后是在17到148滞后的范围中。8位和5位可以表示相同的音调分辨率。然而,8位还可以表示闭环音调滞后的整个范围,而5位可以表示围绕以前帧闭环音调滞后的闭环音调滞后的有限值。在示例实施例中,闭环音调滞后分辨率是0.2,均匀地在滞后17和滞后33之间。从示例实施例的滞后33到滞后91,分辨率从0.2逐渐增加到0.5,而从滞后91到滞后148的分辨率均匀地是1.0。
自适应密码本部分362执行闭环整数音调滞后的整数滞后搜索。对于第一和第三子帧(即,用8位表示的那些子帧),可以在[Lp-3,…,Lp+3]的范围上执行整数滞后搜索。其中,Lp是子帧音调滞后。从音调迹348得到子帧音调滞后,使用音调迹348来识别在自适应密码本368中的矢量。可以根据
R ( l ) = Σ n = 0 39 t ( n ) · ( e ( n - l ) * h ( n ) ) Σ n = 0 39 ( e ( n - l ) * h ( n ) ) 2 , (公式15)
计算整数滞后搜索范围的交叉—相关函数R(l),其中,t(n)是目标信号,它是修改的加权语音350,e(n)是通过自适应密码本矢量(va)382表示的自适应密码本作用,h(n)是第一合成滤波器372和感知加权滤波器374的组合响应。在示例实施例中,在子帧中有40个取样,虽然也可以使用更多或更少的取样。
可以选择使R(l)最大的闭环整数音调滞后作为精选的整数滞后。可以通过使用第9阶Hamming加权的Sinc对交叉—相关函数R(l)进行上取样而确定来自自适应密码本矢量(va)382的自适应密码本368的最佳矢量。在上取样之后,是在自适应密码本368中的矢量搜索,所述自适应密码本368相应于在精选的整数滞后的1个取样中的闭环音调滞后。对于每个子帧,可以通过在位流中的闭环自适应密码本部分144b表示索引位置,所述索引位置在自适应密码本矢量(va)382的最佳矢量的自适应密码本368中。
可以根据下式估计起始自适应密码本增益:
g = Σ n = 0 39 t ( n ) · ( e ( n - L p opt ) * h ( n ) ) Σ n = 0 39 ( e ( n - L p opt ) * h ( n ) ) 2 (公式16)
其中,Lp opt表示自适应密码本矢量(va)382的最佳矢量的滞后,而e(n-Lp opt)表示自适应密码本矢量(va)382的最佳矢量。此外,在这个实施例中,估计以0.0≤g≤1.2为界,而n表示在子帧中的40个取样。当1=Lp opt时,通过R(l)给出归一化自适应密码本相关。根据归一化自适应密码本相关、起始类别判定和自适应密码本作用的锐度可以进一步使起始自适应密码本增益归一化。在增益(ga)384中产生归一化。增益(ga)384是未量化的,并表示闭环音调滞后的起始自适应密码本增益。
4.1.1.2 半—速率编码的闭环自适应密码本
通过闭环自适应密码本部件176b(图2)表示半—速率编解码器24的闭环音调滞后。对于一个实施例的半—速率编解码器24,每个以7位对两个子帧中的每一个的闭环音调滞后进行编码,每个表示在17到127滞后范围中的滞后。可以在范围[Lp-3,…,Lp+3]上执行整数滞后搜索,与全—速率编解码器22中执行分数搜索相对。可以计算交叉—相关函数R(l),如在公式15中,其中,在80个取样的示例实施例子帧大小上执行相加。选择使R(l)最大的闭环音调滞后作为精选的整数滞后。通过在位流中的闭环自适应密码本部件176b表示每个子帧在自适应密码本矢量(va)382的最佳矢量的自适应密码本368中的索引位置。
可以根据公式16计算自适应密码本增益的起始值,其中,在80个取样的示例实施例子帧大小上执行相加。然后可以施加上述归一化过程,结果是未量化的增益(ga)384。
在通过固定密码本部分364进行搜索的期间,使用通过全—速率编解码器22或半—速率编解码器24产生的长期误差信号388。在固定密码本搜索之前,得到可施加于帧的来自图9的VAD模块326的话音活动判定。可以把用于帧的话音活动判定再分割成用于每个子帧的子帧话音活动判定。可以使用子帧话音活动判定,以改进固定密码本作用的感知选择。
4.1.2  固定密码本部分
固定密码本部分364包括固定密码本390、第二乘法器392、第二合成滤波器394、第二感知加权滤波器396、第二减法器398和第二最小化模块400。通过固定密码本部分364对固定密码本作用的搜索相似于自适应密码本部分362中的搜索。
从固定密码本390提供表示子帧的长期剩余的固定密码本矢量(vc)402。第二乘法器392使固定密码本矢量(vc)402乘以增益(gc)404。增益(gc)404是未量化的,并表示可以计算的固定密码本增益的起始值,如下所述。把所产生的信号提供给第二合成滤波器394。第二合成滤波器394接收来自LSF量化模块334的量化的LPC系数Aq(z)342,并且和第二感知加权滤波器396一起产生第二再合成语音信号406。第二减法器398从长期误差信号388中减去第二再合成语音信号406,以产生一个矢量,它是固定密码本误差信号408。
第二最小化模块400接收固定密码本误差信号408,它表示在通过固定密码本390量化长期剩余中的误差。第二最小化模块400使用固定密码本误差信号408的能量控制
来自固定密码本292的固定密码本矢量(vc)402的矢量选择,以便降低固定密码本误差信号408的能量。第二最小化模块400还接收来自图9的特征表示模块328的控制信息356。
包括在控制信息356中的最后的特征表示类别控制第二最小化模块400如何选择来自固定密码本390的固定密码本矢量(vc)402的矢量。重复该过程,直到通过第二最小化模块400的搜索已经对于每个子帧选择来自固定密码本390的固定密码本矢量(vc)402的最佳矢量。固定密码本矢量(vc)402的最佳矢量使在第二再合成语音信号406中的误差相对于长期误差信号388为最小。索引识别固定密码本矢量(vc)402的最佳矢量,如上所述,可以使用来形成固定密码本部分146a和178a。
4.1.2.1 全—速率编解码器的固定密码本搜索
如上参考图2和4所述,使用3个5-脉冲密码本160,类型0的帧的固定密码本部分146a可以表示全—速率编解码器22的4个子帧中的每一个。当开始搜索时,使用长期误差信号388可以确定在固定密码本390中的固定密码本矢量(vc)402的矢量,表示为:
t ′ ( n ) = t ( n ) - g a · ( e ( n - L p opt ) * h ( n ) ) (公式17)
在搜索期间的前向方向上,可以把音调增强施加到在固定密码本390中的3个5-脉冲密码本160(在图4中示出)中。搜索是对于固定密码本矢量(vc)402的最佳矢量的迭代的,受控制的复杂性搜索。在搜索固定密码本矢量(vc)402的最佳矢量的同时,可以找到通过增益(gc)404表示的固定密码本增益的起始值。
在示例实施例中,在3个5-脉冲密码本160的每一个中完成固定密码本矢量(vc)402的最佳矢量的搜索。在3个5-脉冲密码本160的每一个中的搜索过程结束处,已经识别固定密码本矢量(vc)402的候选最佳矢量。对候选最佳矢量的每一个使用相应的固定密码本误差信号408可以确定3个5-脉冲密码本160中之一的选择和将使用相应的候选最佳矢量中的哪一个。首先通过第二最小化模块400执行对相应的固定密码本误差信号408中的每一个的加权均方误差(WMSE)的确定。为了本讨论的目的,将把来自3个5-脉冲密码本160中的每一个的候选最佳矢量的加权均方误差(WMSE)称为第一、第二和第三固定密码本WMSE。
首先可以对第一、第二和第三固定密码本WMSE加权。在全—速率编解码器22中,对于类别为类型0的帧,可以通过子帧话音活动判定对第一、第二和第三固定密码本WMSE加权。此外,可以通过第一、第二和第三固定密码本WMSE的每一个的锐度测量和来自图9的特征表示模块328的NSR提供权重。根据权重,可以选择3个5-脉冲密码本160中之一和在该密码本中的最佳候选矢量。
然后对所选择的5-脉冲密码本160精细搜索固定密码本矢量(vc)402的最佳矢量的最后判定。在所选择最佳候选矢量附近的3个5-脉冲密码本160中所选择的一个中的矢量上执行精细搜索。索引是在位流中的固定密码本部件178a的一部分,所述索引识别在3个5-脉冲密码本160中所选择的一个中的固定密码本矢量(vc)402的最佳矢量。
4.1.2.2 半—速率编解码器的固定密码本搜索
对于类型0类别的帧,固定密码本部件178a表示半—速率编解码器24的两个子帧的每一个。如上所述,参考图5,可以根据脉冲密码本192、194和高斯密码本195来表示。可以与全—速率编解码器22相似地确定通过增益(gc)404表示的固定密码本增益的起始目标。此外,可以与全—速率编解码器22相似地,对在固定密码本390中的固定密码本矢量(vc)402的搜索加权。在半—速率编解码器24中,可以从脉冲密码本192和194以及高斯密码本195把权重施加到最佳候选矢量。施加权重以确定从感知观点看来最合适的固定密码本矢量(vc)402。此外,可以进一步增加在半—速率编解码器24中的加权均方误差(WMSE)的权重,以突出感知见解。可以通过在权重中包括另外的参数来实现进一步增强。另外的因子可以是闭环音调滞后和归一化自适应密码本相关。
除了增强权重之外,在为最佳候选矢量搜索密码本192、194、195之前,可以把某些特征加入脉冲密码本192、194的入口。这些特征可以提供感知质量的进一步增强。在一个实施例中,通过使用3种增强来修改第二合成滤波器394的滤波响应可以得到搜索期间的增强的感知质量。通过把高频噪声注入固定密码本可以实现第一种增强,它修改高频频带。使高频噪声脉冲响应与第二合成滤波器394的脉冲响应卷积,可以把高频噪声的注入结合到第二合成滤波器394的响应中。
可以使用第二种增强,把另外的脉冲结合到可以通过以前量化的子帧中的高相关确定的位置中。可以根据相关强度调节另外脉冲的幅度,从而允许解码系统16执行相同的操作而不需要来自编码系统12的另外的信息。也可以把来自这些另外脉冲的作用结合到第二合成滤波器394的脉冲响应中。第三种增强用较弱的短期频谱滤波器对固定密码本390滤波,以补偿由于带宽扩展和LSF的量化引起的共振峰锐度的降低。
根据使固定密码本误差信号408的能量最小而搜索固定密码本矢量(vc)402的最佳矢量,如上所述。首先可以在2-脉冲密码本192上执行搜索。其次可以两个步骤搜索3-脉冲密码本194。第一步骤可以确定用于称之为集中搜索的第二步骤的一个中心。对于在脉冲密码本192和194两者中的搜索,可以来回施加加权音调增强。可以使用快搜索程序最后搜索高斯密码本195,所述快搜索程序用于确定编码的两个基于正交的矢量,如上所述。
可以相似于全—速率编解码器22而执行密码本192、194和195以及固定密码本矢量(vc)402的最佳矢量中之一的选择。索引是在位流中的固定密码本部件178a的一部分,所述索引识别在所选择的密码本中的固定密码本矢量(vc)402的最佳矢量。
此时,已经分别在自适应和固定密码本368、390中找到自适应密码本矢量(va)382和固定密码本矢量(vc)402的最佳矢量。现在可以用最佳增益值来替代增益(ga)384和增益(gc)404的未量化的初始值。可以根据以前确定的自适应密码本矢量(va)382和固定密码本矢量(vc)402的最佳矢量来确定最佳增益值。在确定最佳增益之后,把它们一起量化。在增益量化部分366中发生增益的确定和量化。
4.1.3 增益量化部分
一个实施例的增益量化部分366包括2维VQ增益密码本412、第三乘法器414、第四乘法器416、加法器418、第三合成滤波器420、第三感知加权滤波器422、第三减法器424、第三最小化模块426、以及能量修改部分428。一个实施例的能量修改部分428包括能量分析模块430和能量调节模块432。可以在增益量化部分366中执行固定和自适应密码本增益的确定和量化。此外,在能量修改部分428中发生修改的加权语音350的进一步的修改,如将讨论,以形成可以用于量化的修改的目标信号434。
确定和量化包括搜索,以确定量化增益矢量(^gac)433,它表示自适应密码本增益和固定密码本增益的联合量化。可以通过使加权的均方误差最小而得到用于搜索的自适应和固定密码本增益,根据:
{ g a , g c } = arg min { Σ n = 0 79 ( t ( n ) - ( ( g a v a ( n ) * h ( n ) ) + ( g c v c ( n ) * h ( n ) ) ) ) 2 } (公式18)
其中,va(n)是自适应密码本矢量(va)382的最佳矢量,vc(n)是固定密码本矢量(vc)402的最佳矢量,如上所述。在示例实施例中,根据包括80个取样的帧进行相加,诸如在半—速率编解码器24的一个实施例中。根据归一化自适应密码本相关的门限值,可以联合地(同时得到ga和gc)或顺序地(先得到ga然后得到gc)得到最小化。然后可以修改一部分增益,以平滑在存在背景噪声时的再现语音的起伏。把经修改的增益表示为g’a和g’c。可以使用修改的增益产生修改的目标信号434,通过:
t″(n)=ga′va(n)*h(n)+gc′vc(n)*h(n)               (公式19)
在2维VQ增益密码本412中执行量化增益矢量
Figure C0081594000632
433的最佳矢量的搜索。2维VQ增益密码本412可以是以前讨论的如表4所示的2维增益量化表。对于量化增益矢量 433的矢量搜索2维VQ增益密码本412,使均方误差最小,即,使下式为最小
E = Σ n = 0 79 ( t ′ ′ ( n ) - ( g ^ a v a ( n ) * h ( n ) + g ^ c v c ( n ) * h ( n ) ) ) 2 , (公式20)
其中,可以从2维VQ增益密码本412导出量化固定密码本增益 435和量化自适应密码本增益
Figure C0081594000643
436。在示例实施例中,根据包括80个取样的帧进行相加,诸如在半—速率编解码器24的一个实施例中。在2维VQ增益密码本412中的量化矢量实际上表示自适应密码本增益和固定密码本增益的相关因子,如上所述。
在确定修改的目标信号434之后,把量化增益矢量
Figure C0081594000644
433传递到乘法器414、416。第三乘法器414使来自适应密码本368的自适应密码本矢量(va)382的最佳矢量乘以量化固定密码本增益 435。把第三乘法器414的输出提供给加法器418。相似地,第四乘法器使量化自适应密码本增益
Figure C0081594000646
436和来自固定密码本390的固定密码本矢量(vc)402的最佳矢量相乘。把第四乘法器416的输出也提供给加法器418。加法器418使来自414、416的输出相加,并把所产生的信号提供给第三合成滤波器420。
第三合成滤波器420和感知加权滤波器422的组合产生第三再合成语音信号438。如同用第一和第二合成滤波器372和394一样,第三合成滤波器420接收量化的LPC系数Aq(z)342。第三减法器424从修改的目标信号434减去第三再合成语音信号438以产生第三误差信号442。第三最小化模块426接收第三误差信号442,第三误差信号442表示通过2维VQ增益密码本412从固定密码本增益和自适应密码本增益的联合量化产生的误差。第三最小化模块426使用第三误差信号442的能量来控制从2维VQ增益密码本412搜索和选择矢量,以便降低第三误差信号442的能量。
重复该过程直到第三最小化模块426已经对于每个子帧从2维VQ增益密码本412选择最佳矢量,它使第三误差信号442的能量最小。一旦对于每个子帧已经使第三误差信号442的能量最小,就使用联合量化增益
Figure C0081594000647
Figure C0081594000648
435和436的索引位置来产生每个帧的增益部分147、179。对于全—速率编解码器22,增益部分147是固定和自适应增益部分48a、150a,而对于半—速率编解码器24,增益部分179是自适应和固定增益部件180a和182a。
可以用任何其它装置来代替合成滤波器372、394和420、感知加权滤波器374、396和422、最小化模块378、400和426、乘法器370、392、414和416、加法器418以及减法器376、398和424(以及在本应用中描述的任何其它滤波器、最小化模块、乘法器、加法器和减法器),或用熟悉本技术领域的人员众知的对于特定应用合适的方法进行修改。
4.2 全—速率编解码器和半—速率编解码器的类型1帧的激励处理模块
在图11中,F1、H1第一帧处理模块72和82包括3维/4维开环VQ模块(3维/4维开环矢量量化模块)454。一个实施例的F1、H1第二子帧处理模块74和84包括自适应密码本368、固定密码本390、第一乘法器456、第二乘法器458、第一合成滤波器460以及第二合成滤波器462。此外,F1、H1第二子帧处理模块74和84包括第一感知加权滤波器464、第二感知加权滤波器466、第一减法器468、第二减法器470、第一最小化模块472以及能量调节模块474。F1、H1第二帧处理模块76和86包括第三乘法器476、第四乘法器478、加法器480、第三合成滤波器482、第三感知加权滤波器484、第三减法器486、缓冲模块488、第二最小化模块490以及3维/4维VQ增益密码本492。
在激励—处理模块54中,类别为类型1的帧的处理提供在帧基础上和在子帧基础上的两种处理,如上所述。为了简化的目的,下面的讨论将涉及在全速率编解码器22中的模块。除非另行指出,认为在半速率编解码器24中的模块的作用相似。通过F1第一帧—处理模块72的自适应密码本增益的量化产生自适应增益部件148b。F1第二子帧处理模块74和F1第二帧处理模块76进行操作,以确定固定密码本矢量和相应的固定密码本增益,分别如上所述。F1第二子帧处理模块74使用迹表,如上所述,以产生固定密码本部分146b,如在图2中所示。
F1第二帧—处理模块76量化固定密码本增益以产生固定增益部分150b。在一个实施例中,全—速率编解码器22对4个固定密码本增益的量化使用10位,而半—速率编解码器24对3个固定密码本增益的量化使用8位。可以使用移动平均预测来执行量化。一般,在执行预测和量化之前,把预测状态转换成合适的维(dimension)。
4.2.1 第一帧处理模块
3维/4维开环VQ模块(3维/4维开环矢量量化模块)454的一个实施例可以是以前讨论的用于全—速率编解码器22的4-维前置矢量量化器(4D preVQ)166和相关联的前置—增益量化表。3维/4维开环VQ模块454的另一个实施例可以是以前讨论的用于半—速率编解码器24的3-维前置矢量量化器(3D preVQ)198和相关联的前置—增益量化表。3维/4维开环VQ模块454接收来自音调预—处理模块322的未量化的音调增益352。未量化的音调增益352表示开环音调滞后的自适应密码本增益,如上所述。
g ^ a k
3维/4维开环VQ模块454量化未量化的音调增益352,以产生量化的音调增益 496,它表示每个子帧的最佳量化音调增益,其中,k是子帧数。在一个实施例中,对于全—速率编解码器22有4个子帧,而对于半—速率编解码器24有3个子帧,它们分别相应于每个子帧的4个量化增益 和3个量化增益
Figure C0081594000664
在前置增益量化表中的量化的音调增益
Figure C0081594000665
496的索引位置表示全—速率编解码器22的自适应增益部件148b或半—速率编解码器24的自适应增益部件180b。把量化的音调增益
Figure C0081594000666
496提供给F1第二子帧—处理模块74或H1第二子帧—处理模块84。
4.2.2 第二子帧处理模块
F1或H1第二子帧—处理模块74或84使用音调预—处理模块322提供的音调迹348来识别自适应密码本矢量(vk a)498。自适应密码本矢量(vk a)498表示每个子帧的自适应密码本作用,其中,k等于子帧数。在一个实施例中,全—速率编解码器22有4个子帧,而半—速率编解码器24有3个子帧,它们分别相应于每个子帧的4个矢量(v1 a,v2 a,v3 a,v4 a)和3个矢量(v1 a,v2 a,v3 a)。
可以从位于自适应密码本368和音调迹348中的过去矢量得到自适应密码本矢量(vk a)498的所选择的矢量。其中,音调迹348可以内插,并由Lp(n)表示。相应地,不需要搜索。可以用第21阶Hamming加权的Sinc窗口在自适应密码本中内插过去的自适应密码本矢量(vk a)498而得到自适应密码本矢量(vk a)498,通过:
v a ( n ) = Σ i = - 10 10 w s ( f ( L p ( n ) ) , i ) · e ( n - i ( L p ( n ) ) ) (公式21)
其中,e(n)是过去激励,i(Lp(n))和f(Lp(n))分别是音调滞后的整数和分数部分,而ws(f,i)是Hamming加权的Sinc窗口。
通过第一乘法器456使自适应密码本矢量(vk a)498和量化的音调增益 496相乘。第一乘法器456产生一个信号,该信号通过第一合成滤波器460和第一感知加权滤波器模块464处理,以提供第一再合成语音信号500。第一合成滤波器460接收来自LSF量化模块334的量化的LPC系数Aq(z)342作为处理的一部分。第一减法器468从通过音调预—处理模块322提供的修改的加权语音350减去第一再合成语音信号500,以产生长期误差信号502。
F1或H1第二子帧—处理模块74或84还执行对于固定密码本作用的搜索,相似于如上所述的F0或H0第一子帧—处理模块70和80所执行的。在搜索期间,从固定密码本390选择表示子帧的长期剩余的固定密码本矢量(vk c)504的矢量。第二乘法器458使固定密码本矢量(vk c)504乘以增益(gk c)506,其中,k是子帧数。增益(gk c)506是未量化的,并且表示每个子帧的固定密码本增益。通过第二合成滤波器462和第二感知加权滤波器466处理所产生的信号,以产生第二再合成语音信号508。第二减法器470从长期误差信号502减去第二再合成语音信号508,以产生固定的密码本误差信号510。
第一最小化模块472接收固定的密码本误差信号510和控制信息356。第一最小化模块472的操作与在图10中示出的以前讨论的第二最小化模块400的操作相似。重复搜索过程,直到第一最小化模块472从每个子帧的固定密码本390已经选择固定密码本矢量(vk c)504的最佳矢量。固定密码本矢量(vk c)504的最佳矢量使固定密码本误差信号510的能量最小。索引识别固定密码本矢量(vk c)504的最佳矢量,如上所述,并形成固定密码本部分146b和178b。
4.2.2.1 全—速率编解码器的固定密码本搜索
在一个实施例中,对于类型1的帧的4个子帧中的每一个,全—速率编解码器22使用在图4中示出的8-脉冲密码本162,如上所述。固定密码本矢量(vk c)504的目标是长期误差信号502,如上所述。根据通过t(n)表示的,从起始帧—处理模块44除去自适应密码本作用的修改的加权语音350来确定通过t’(n)表示的长期误差信号502,相应于:
t′(n)=t(n)-ga·(va(n)*h(n)).                    (公式22)
在搜索固定密码本矢量(vk c)504的最佳矢量期间,可以在前向方向上施加音调增强。此外,使用具有控制复杂性的迭代搜索过程以确定固定密码本矢量(vk c)504的最佳矢量,搜索过程使固定密码本剩余508最小。在搜索期间确定通过增益(gk c)506表示的起始固定密码本增益。索引识别固定密码本矢量(vk c)504的最佳矢量,和形成固定密码本部分146b,如上所述。
4.2.2.2 半—速率编解码器的固定密码本搜索
在一个实施例中,对于半—速率编解码器24的类别为类型1的帧的3个子帧中的每一个用13位表示长期剩余,如上所述。可以以与在全—速率编解码器22中的固定密码本搜索相似的方法确定长期剩余。与类型0的帧的半—速率编解码器24的固定密码本搜索相似,可以把高频噪声注入、通过在以前帧中的高相关确定的附加脉冲以及弱的短期频谱滤波器引入第二合成滤波器462的脉冲响应中。此外,还可以把前向音调增强引入第二合成滤波器462的脉冲响应中。
在一个实施例中,对于2-脉冲密码本196和3-脉冲密码本197执行完全搜索,如在图5中所示。对于每个子帧的长期剩余表示选择脉冲密码本196、197和使固定密码本误差信号510最小的固定密码本矢量(vk c)504的最佳矢量。此外,与全—速率编解码器22相似,在搜索期间可以确定通过增益(gk c)506表示的起始固定密码本增益。索引识别固定密码本矢量(vk c)504的最佳矢量和形成固定密码本部件178b。
如上所述,F1或H1第二子帧—处理模块74或84在子帧基础上操作。然而,F1或H1第二帧—处理模块76或86在帧基础上操作。相应地,可以把通过F1或H1第二子帧—处理模块74或84确定的参数存储在缓冲模块488中,供以后在帧基础上使用。在一个实施例中,所存储的参数是自适应密码本矢量(vk a)的最佳矢量和固定密码本矢量(vk c)504的最佳矢量。此外。可以存储修改的目标信号512和表示起始自适应和固定密码本增益的增益
Figure C0081594000681
、(gk c)496和506。将在下面描述修改的目标信号512。
此时,已经识别自适应密码本矢量(vk a)498的最佳矢量、固定密码本矢量(vk c)504的最佳矢量以及量化的音调增益
Figure C0081594000682
496的最佳音调增益。使用这些最佳矢量和最佳音调增益,将确定增益(gk c)506的最佳固定密码本增益。增益(gk c)506的最佳固定密码本增益将替代以前对于增益(gk c)506确定的未量化的起始固定密码本增益。为了确定最佳固定密码本增益,通过第二帧—处理模块76和86执行每个子帧的固定密码本增益的联合延迟量化。
4.2.3 第二帧处理模块
在帧基础上可操作第二帧处理模块76和86,以产生通过固定增益部件150b和182b表示的固定密码本增益。首先以与类别为类型0的帧的增益确定和量化相似的方式确定修改的目标512。对于每个子帧确定修改的目标512,并表示为t”(n)。使用自适应密码本矢量(vk a)498和固定密码本矢量(vk c)504的最佳矢量以及自适应密码本增益和从公式18得到的固定密码本增益的起始值可以得到修改的目标,通过:
t″(n)=gava(n)*h(n)+gcvc(n)*h(n).                 (公式23)
通过最小化可以得到待在搜索中使用的每个子帧的固定密码本增益的起始值:
{ g c } = arg min { Σ n = 0 N - 1 ( t ( n ) - ( ( g ^ a v a ( n ) * h ( n ) ) + ( g c v c ( n ) * h ( n ) ) ) ) 2 } (公式24)
其中,va(n)是特定子帧的自适应密码本作用,而vc(n)是特定子帧的固定密码本作用。此外,^ga是特定子帧的量化和归一化的自适应密码本增益,它是量化的固定密码本增益(^gk c)513的元素之一。对计算的固定密码本增益gc进行进一步的归一化和校正,以在第三再合成语音信号和已经被缓冲的修改的目标信号512之间提供最佳的能量匹配。可以使用来自以前的子帧的未量化的固定密码本增益,以产生自适应密码本矢量(vk a)498,用于根据公式21处理下一个子帧。
在3维/4维VQ增益密码本492中执行对于量化的固定密码本增益 513的矢量的搜索。3维/4维VQ增益密码本492可以是以前讨论的多维增益量化器,并且和增益量化表相关联。在一个实施例中,3维/4维VQ增益密码本492可以是以前讨论的用于全—速率编解码器22的4维延迟VQ增益量化器168。如上所述,使用如表5所示的相关联的延迟增益量化表可以操作4维延迟VQ增益量化器168。在另一个实施例中,3维/4维VQ增益密码本492可以是以前讨论的用于半—速率编解码器24的3-维延迟矢量量化器200。使用如以前讨论的表8示出的延迟增益量化表可以操作3-维延迟矢量量化器200。
3维/4维VQ增益密码本492可以搜索使能量最小的量化的固定密码本增益
Figure C0081594000693
513的矢量,与以前讨论的图10的2维VQ增益密码本412相似。在3维/4维VQ增益密码本492中的量化矢量实际上表示预测固定密码本增益的校正因子,如上所述。在搜索期间,在确定修改的目标信号512之后,第三乘法器476使自适应密码本矢量(vk a)498乘以量化的音调增益 496。此外,第四乘法器478使固定密码本矢量(vk c)504乘以量化的固定密码本增益
Figure C0081594000701
513。加法器480对从乘法器476和478产生的信号进行相加。
从加法器480产生的信号通过第三合成滤波器482和感知加权滤波器模块484传递,以产生第三再合成语音信号514。如同第一和第二合成滤波器模块460、462,第三合成滤波器482接收来自LSF量化模块334的量化的LPC系数Aq(z)342作为处理的一部分。第三减法器486从以前存储在缓冲模块488中的修改的目标信号512中减去第三再合成语音信号514。所产生的信号是称之为第三误差信号516的加权的均方误差。
第三最小化模块490接收第三误差信号516,第三误差信号516表示从通过3维/4维VQ增益密码本492的固定密码本增益的量化而产生的误差。为了降低第三误差信号516的能量,第三最小化模块490使用第三误差信号516,以控制来自3维/4维VQ增益密码本492的矢量的搜索和选择。重复搜索过程直到第三最小化模块490已经对于每个子帧从3维/4维VQ增益密码本492选择最佳矢量,它使第三误差信号516中的误差最小。一旦已经使第三误差信号516的能量最小,就使用在3维/4维VQ增益密码本492中的量化的固定密码本增益 513的索引位置来产生全—速率编解码器22的固定密码本增益部件150b,以及半—速率编解码器24的固定密码本增益部件182b。
4.2.3.1 3维/4维VQ增益密码本
在一个实施例中,当3维/4维VQ增益密码本492是4-维密码本时,可以对它进行搜索,以减小:
E = Σ n = 0 39 ( t 1 ( n ) - ( g ^ a 1 v a 1 ( n ) * h ( n ) + g ^ c 1 v c 1 ( n ) * h ( n ) ) ) 2
+ Σ n = 0 39 ( t 2 ( n ) - ( g ^ a 2 v a 2 ( n ) * h ( n ) + g ^ c 2 v c 2 ( n ) * h ( n ) ) ) 2
+ Σ n = 0 39 ( t 3 ( n ) - ( g ^ a 3 v a 3 ( n ) * h ( n ) + g ^ c 3 v c 3 ( n ) * h ( n ) ) ) 2
+ Σ n = 0 39 ( t 4 ( n ) - ( g ^ a 4 v a 4 ( n ) * h ( n ) + g ^ c 4 v c 4 ( n ) * h ( n ) ) ) 2 (公式25)
g ^ a k
其中,如上所述,在子帧处理期间,可以缓冲起源于起始帧—处理模块44的量化的音调增益
Figure C0081594000708
和{t1(n),t2(n),t3(n),t4(n)),{v1 a(n),
g ^ a k
v2 a(n),v3 a(n),v4 a(n)},和{v1 c(n),v2 c(n),v3 c(n),v4 c(n))。在示例实施例中,从10-位密码本得到固定密码本增益
Figure C0081594000712
其中,密码本的入口包括用于预测固定密码本增益的4-维校正因子,如上所述。此外,n=40表示每帧40个取样。
在另一个实施例中,当3维/4维VQ增益密码本492是3维密码本时,可以对它进行搜索,以减小:
E = Σ n = 0 52 ( t 1 ( n ) - ( g ^ a 1 v a 1 ( n ) * h ( n ) + g ^ c 1 v c 1 ( n ) * h ( n ) ) ) 2
+ Σ n = 0 52 ( t 2 ( n ) - ( g ^ a 2 v a 2 ( n ) * h ( n ) + g ^ c 2 v c 2 ( n ) * h ( n ) ) ) 2
+ Σ n = 0 53 ( t 3 ( n ) - ( g ^ a 3 v a 3 ( n ) * h ( n ) + g ^ c 3 v c 3 ( n ) * h ( n ) ) ) 2 (公式26)
g ^ a k
其中,如上所述,在子帧处理期间,可以缓冲起源于起始帧—处理模块44的量化的音调增益
Figure C0081594000717
和{t1(n),t2(n),t3(n)),{v1 a(n),v2 a(n),v3 a(n)),和(v1 c(n),v2 c(n),v3 c(n)}。在示例实施例中,从8-位密码本得到固定密码本增益
Figure C0081594000718
其中,密码本的入口包括用于预测固定密码本增益的3-维校正因子。固定密码本增益的预测可以根据在对数域中的固定密码本能量的移动平均预测。
5.0解码系统
现在参考图12,图中示出表示图3的全和半—速率解码器90和92的扩展方框图。全和半—速率解码器90和92包括激励再现模块104、106、114和116和线性预测系数(LPC)再现模块107和118。激励再现模块104、106、114和116中的每一个的一个实施例包括自适应密码本368、固定密码本390、2维VQ增益密码本412、3维/4维开环VQ密码本454、以及3维/4维VQ增益密码本492。激励再现模块104、106、114和116还包括第一乘法器530、第二乘法器532、和加法器534。在一个实施例中,LPC再现模块107、118包括LSF解码模块536和LSF转换模块538。此外,半—速率编解码器24包括预测器交换机模块36,而全—速率编解码器22包括内插模块338。
在图12中还示出合成滤波器模块98和后—处理模块100。在一个实施例中,后—处理模块100包括短期后滤波器模块540、长期滤波器模块542、倾斜补偿滤波器模块544和自适应增益控制模块546。根据速率选择,可以对位流进行解码以产生后—处理后合成语音20。解码器90和92执行位流部分对于算法参数的反向映射。在反向映射之后可以接着在全和半—速率编解码器22和24中的类型分类有关合成。
四分之一—速率编解码器26和八分之一—速率编解码器28的解码与全和半—速率编解码器22和24相似。然而,如上所述,四分之一和八分之一—速率编解码器26和28使用相似的但是是随机数的矢量和能量增益,来代替自适应和固定密码本368和390和相关联的增益。可以使用随机数和能量增益来再现表示帧的短期激励的激励能量。除了预测器交换机模块336和内插模块338之外,LPC再现模块122和126和全和半—速率编解码器22、24相似。
5.1 激励再现
在全和半速率解码器90和92中,激励再现模块104、106、114和116的操作较大地依赖类型部件142和174提供的类型分类。自适应密码本368接收音调迹348。解码系统16从在通过编码系统12在位流中提供的自适应密码本部分144和174再现音调迹348。自适应密码本368根据类型部分142和174提供的类型分类把量化的自适应密码本矢量(vk a)550提供给乘法器530。乘法器530使量化的自适应密码本矢量(vk a)550乘以自适应密码本增益矢量(gk a)552。自适应密码本增益矢量(gk a)552的选择还与类型部分142和174提供的类型分类有关。
g ^ a k
在示例实施例中,如果在全—速率编解码器22中把帧分类成类型0,则2维VQ增益密码本412把自适应密码本增益矢量(gk a)552提供给乘法器530。从自适应和固定密码本增益部件148a和150a确定自适应密码本增益矢量(gk a)552。自适应密码本增益矢量(gk a)552与量化增益矢量
Figure C0081594000722
433的最佳矢量的一部分是相同的,所述量化增益矢量
Figure C0081594000723
433是通过如上所述的F0第一子帧—处理模块70的增益和量化部分366确定的。从闭环自适应密码本部分144b确定量化的自适应密码本矢量(vk a)550。相似地,量化的自适应密码本矢量(vk a)550与通过F0第一子帧—处理模块70确定的自适应密码本矢量(va)382的最佳矢量是相同的。
2维VQ增益密码本412是2-维的,而且把自适应密码本增益矢量(gk a)552提供给乘法器530,并将固定的密码本增益矢量(gk c)提供给乘法器532。相似地,从自适应和固定密码本增益部件148a和150a确定固定密码本增益矢量(gk c)554,并且它是量化增益矢量
Figure C0081594000731
433的最佳矢量的一部分。还是根据类型分类,固定密码本390把量化的固定密码本矢量(vk a)556提供给乘法器532。从密码本识别符、脉冲位置(或半—速率编解码器24的高斯密码本195)以及固定密码本部分146a提供的脉冲符号再现量化的固定密码本矢量(vk a)556。固定密码本矢量(vk a)556与如上所述的通过F0第一子帧—处理模块70确定的固定密码本矢量(vc)402的最佳矢量相同。乘法器532使量化的固定密码本矢量(vk a)556乘以固定密码本增益矢量(gk c)554。
如果帧的类型分类是类型1,则多—维矢量量化器把自适应密码本增益矢量(gk a)552提供给乘法器530。其中,在多—维矢量量化器中的维数与子帧数有关。在一个实施例中,多—维矢量量化器可以是3维/4维开环VQ 454。相似地,多—维矢量量化器把固定密码本增益矢量(gk c)554提供给乘法器532。通过增益部件147和179提供自适应密码本增益矢量(gk a)552和固定密码本增益矢量(gk c)554,并且分别与量化的音调增益 496和量化的固定密码本增益
Figure C0081594000733
513相同。
在类别为类型0或类型1的帧中,加法器534接收来自第一乘法器530的输出,并与第二乘法器532的输出相加。从加法器534的输出是短期激励。把短期激励提供给在短期激励线128上的合成滤波器模块98。
5.2 LPC再现
在解码器90和92中的短期(LPC)预测系数的产生与在编码系统12中的处理相似。LSF解码模块536再现来LSF部件140和172的量化的LSF。LSF解码模块536使用编码系统12使用相同的LSF预测误差量化表和LSF预测器系数表。对于半—速率编解码器24,预测器交换机模块336选择预测器系数组中之一来计算通过LSF部件140、172引导的预测的LSF。使用与在编码系统12中使用的线性内插路径相同的线性内插路径,发生量化的LSF的内插。对于分类为类型0的全速率编解码器622,内插模块338选择与由LSF部件140和172导向的在编码系统12中所用内插路径相同的一种。量化的LSF加权之后在LSF转换模块538中转换成量化的LPC系数Aq(z)342。量化的LPC系数Aq(z)342是提供给在短期预测系数线130上的合成滤波器98的短期预测系数。
5.3 合成滤波器
合成滤波器98可以使用量化的LPC系数Aq(z)342对短期预测系数进行滤波。合成滤波器98可以是短期反向预测滤波器,它在后—处理之前产生合成语音。然后合成的语音可通过后处理模块100。也可以把短期预测系数提供给后—处理模块100。
5.4 后—处理
后—处理模块100根据速率选择和短期预测系数处理合成语音。短期后滤波器模块540可以是第一个处理合成语音的。如上面参考图9所述,根据通过特征表示模块328确定的速率选择和长期频谱特征可以适配在短期后滤波器模块540中的滤波参数。短期后滤波器可以描述为:
H st ( z ) = A ^ ( z / γ 1 , n ) A ^ ( z / γ 2 ) (公式27)
其中,在示例实施例中,γ1,n=0.75·γ1,n-1+0.25·r0,而γ2=0.75,以及根据速率选择和长期频谱特征确定r0。处理在长期滤波模块542中继续进行。
长期滤波器模块542对于在合成语音中的音调周期执行精细调谐搜索。在一个实施例中,使用音调相关和与速率有关的控制增益的谐波滤波来执行精细调谐搜索。对于四分之一—速率编解码器26和八分之一—速率编解码器28,禁止谐波滤波。在一个实施例中,倾斜补偿滤波器模块544是一—阶有限脉冲响应(FIR)滤波器。可以根据以前参考图9讨论的感知加权滤波器模块314的频谱倾斜来调谐FIR滤波器。还可以根据也是参考图9讨论的通过特征表示模块328确定的长期频谱特征来调谐滤波器。
后滤波可以包括自适应增益控制模块546。自适应增益控制模块546使已经在后—处理模块100中处理的合成语音的能量电平达到在后处理之前的合成语音电平。还可以在自适应增益控制模块546中执行电平平滑和适配。后—处理模块100的处理结果是后—处理合成语音20。
在解码系统16的一个实施例中,例如,解码系统16识别帧,所述帧是通过解码系统16接收的,由于在无线电发送期间的信号丢失而已经被擦除。解码系统16可以接连着执行帧擦除隐藏操作。该操作包括从以前帧内插擦除帧的语音参数。可以使用外插语音参数来合成擦除帧。此外,可以执行参数平滑,以保证接在擦除帧之后的帧的语音连续。在另一个实施例中,解码系统16还包括不良速率确定能力。通过识别在位流中的不正常序列来实现解码系统16接收的帧的不良速率选择的识别,并宣布擦除特定帧。
语音压缩系统10的上述实施例使用全—速率编解码器22、半—速率编解码器24、四分之一—速率编解码器26和八分之一—速率编解码器28而执行可变速率语音压缩。编解码器22、24、26和28使用不同的编码方法,用不同的位分配和位速率进行操作,以对语音信号18的帧进行编码。根据帧的类型分类,全和半—速率编解码器22和24的编码方法具有不同的感知匹配、不同的波形匹配和不同的位分配。四分之一和八分之一—速率编解码器26和28只使用参数感知表示对帧进行编码。模式信号识别语音压缩系统10的所要求的平均位速率。语音压缩系统10选择地激励编解码器22、24、26和28,以平衡所要求的平均位速率,以使后—处理合成语音20的感知质量最优化。
在已经描述本发明的各种实施例的同时,熟悉本技术领域基本技术的人员会明了,可能有更多的实施例和实施,都在本发明的范围内。相应地,只有根据所附的权利要求书和它们的等效物来限定本发明。
附件A
/*============================================================*/
/*=====================================================*/
/*Conexant System Inc.                                              */
/*4311 Jamboree Road                                                 */
/*Newport Beach,CA 92660                                              */
/*---------------------------------------------*/ 
/*Copyright(C)2000 Conexant System Inc.                               */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                   */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*=====================================================*/
/*FILE:const.h                                                    */
/*=====================================================*/
/*============================================================*/
/*=========================Coding Parameters=======================*/
/*============================================================*/
#define        sqr(a)         ((a)*(a))
#define        cube(a)        ((a)*(a)*(a))
#define        MAX(a,b)      ((a)>(b)?(a):(b))
#define        ABS(a)         (((a)<0)?-(a):(a))
#define        MIN(a,b)      (((a)<(b))?(a):(b))
#define        SIGN(a)        (((a)>=0)?(1):(-1))
#define        ROUND(a)       (INT64)((a)>0?((a)+0.5):((a)-0.5))
#define        AVG(a,b,c)   (INT16)(((a)+(b)+(c))/(3.0)+0.5)
#define        MAXFLT         1.0e30
#define        MINFLT         1.0e-30
#define        EPSI           0.00000000000000001
#define        L_PREV         60   /*length of previous speech data*/
#define        L_FRM          160  /*length of coding frame*/
#define        L_SF           80   /*maximun length of subframe*/
#define        L_SF3          54   /*length of subframe*/
#define        L_SF4          40   /*length of subframe*/
#define        L_SF0          53   /*length of subframe*/
#define        N_SF_MAX       4    /*maximun number of subframes*/
				
				<dp n="d67"/>
#define        N_SF4       4        /*number of subframes 8.5k*/
#define        N_SF3       3        /*number of subframes 4.0k mode 1*/
#define        N_SF2       2        /*number of subframes 4.0k mode 0*/
#define        NP          10
#define        NP          10
#define        L_LPC       240      /*length of LPC window*/
#define        L_LPCLHD    80       /*length of LPC lookahead*/
/*===================================================*/
/*====================Coding Parameters====================*/
/*===================================================*/
#define FS           8000.0    /*Sampling frequency*/
#define       RATE8_5K    8            /*8.5kbps*/
#define       RATE4_0K    4            /*4.0kbps*/
#define       RATE2_0K    2            /*2.0kbps*/
#define       RATE0_8K    0            /*0.8kbps*/
/*----------------------------------------------------------*/
/*          Bit-rate including overhead for the four rates       */
/*----------------------------------------------------------*/
#define RATE_1_1 9600    /*8.5kbit/s source coding*/
#define RATE_1_2 4800    /*4.0kbit/s source coding*/
#define RATE_1_4 2400    /*2.0kbit/s source coding*/
#define RATE_1_8 1200    /*0.8kbit/s source coding*/
#define NUM_SINC_WIN     21  /*Number of quantized Sinc interpolation    */

                         /*windows                                  */
/*======================================================*/
/*=======================SPEECH ENAHNCEMENT========================*/
/*======================================================*/
#define ENH_DELAY  24
				
				<dp n="d68"/>
/*=============================================*/
/*=================PRE AND POST PROCESSING=================*/
/*=============================================*/
#define   PPR_FLT_ORDER 2
#define   LP_FLT_ORDER  1
#define SE_MEM_SIZE     4
#define SE_HIS_SIZE     5
#define SE_RAMP_SIZE    40
#define   DELTA_THRLD   48.0
/*=============================================*/
/*===============DEFINITIONS FOR CLASSIFICATION==============*/
/*=============================================*/
#define MEM_CLASS 140
#define N_Lp 3
#define MAX_N_SF 8
#define MAX_L_SF 20
#define L_LPC_SF     40/*SHOULD NOT BE CHANGED-HARDWIRED AT PLACES*/
#define OVERLAP      20
#define LPC_WIN1     (L_LPC_SF+2*OVERLAP)
#define CLA_MEM_SIZE    4
#define SLOPE_MAX_SIZE  5
/*=============================================*/
/*============DEFINITIONS FOR PERCEPTUAL WEIGHTING===============*/
/*=============================================*/
#define GAMMA1 0.9
/*=============================================*/
/*=================FIXED COEDEBOOK SEARCH==================*/
/*=============================================*/
#define MAXPN             11
#define MAX_FB_PULSE_NUM  5
				
				<dp n="d69"/>
#define  SEG_NUM_M1          8
#define  SEG_NUM_M0          16
#define L_HF    20
#define L_CORR  80
#define L_WSP   (L_CORR+L_SF+10)
#define PAST_PGAIN_MAX2 0.8
/*==========================================================*/
/*=====================Gaussian codebook sizes=======================*/
/*==========================================================*/
#define N_GAUSS_13b  45    /*Entries 1.basis vector:13bit codebook*/
#define NUM_PRESELECT 2
/*==========================================================*/
/*======================DEFINITIONS FOR LTP=======================*/
/*==========================================================*/
#define SINC_LIMIT_E 10
#define LEN_SINC_E      (2*SINC_LIMIT_E+1)
#define LEN_SINC_TAB_E  (NUM_SINC_WIN*LEN_SINC_E)
/*==========================================================*/
/*==================DEFINITIONS FOR PITCH PRE-PROCESSING====================*/
/*==========================================================*/
#define L_PP    (L_PREV+L_FRM+L_LPCLHD)/*length of sig_ppr=260*/
#define SINC_LIMIT_PP  10
#define LEN_SINC_PP    (2*SINC_LIMIT_PP+1)
#define LEN_SINC_TAB_PP(NUM_SINC_WIN*LEN_SINC_PP)
#define HALFP          2
#define MAX_PULS_NUM   5
#define MAX_DIF_TAB    16
#define MAX_L_TG       180        /*Maximum length for LT preprocessing    */

                           /*Note:it must to be>=L_FRM and>L_SF  */
				
				<dp n="d70"/>
#define MAX_DELAY    20
/*========================================================*/
/*====================DEFINITIONS FOR OPEN LOOP PITCH====================*/
/*========================================================*/
#define NUM_MAX_SRCH    4
#define SINC_LIMIT      4
#define LEN_SINC    (2*SINC_LIMIT+1)
#define LEN_SINC_TAB(NUM_SINC_WIN*LEN_SINC)
#define DELT_F          (1.0/((double)NUM_SINC_WIN-1.0))/*Precision of the  */

                                                   /*interpolation    */
#define MIN_LAG 17                    /*minimum pitch lag */
#define MAX_LAG     (L_FRM+SINC_LIMIT_E+2)/*Maximum pitch lag               */

                                  /*Note:must to be>170 and*/

                                  /*     >HI_LAG+11          */
#define L_OLPIT     (L_FRM+L_LPCLHD+MAX_LAG)     /*Open loop pitch window*/
#define HI_LAG      120             /*maximum pitch lag*/
#define HI_LAG2     148             /*maximum pitch lag*/
#define MIN_LAG2    (HI_LAG2-127)   /*minimum pitch lag*/
#define PIT_F_MEM   3
/*=========================================================*/
/*===================DEFINITIONS FOR CLOSED LOOP PITCH====================*/
/*=========================================================*/
#define LEN_PITCH_TAB_5BIT  17
#define LEN_PITCH_TAB_7BIT  129
#define LEN_PITCH_TAB_8BIT  257
#define MAX_PIT_IDX_5b      16
#define MAX_PIT_IDX_7b      127
#define MAX_PIT_IDX_8b      255
#define DELT_F2             (1.0/(FLOAT64)DELT_F)
/*=========================================================*/
				
				<dp n="d71"/>
/*=====================DEFINITIONS FOR GAIN MA-VQ=========================*/
/*============================================================*/
#define PAST_PGAIN_MIN    0.2        /*minimum value of the past quantized    */

                          /*pitch gain for the adaptive prefilter */

                          /*in the algebraic codebok search            */
#define PAST_PGAIN_MAX    1.0        /*maximum value of the past quantized    */

                          /*pitch gain for the adaptive prefilter  */

                          /*in the algebraic codebok search           */
#define MSMAX_1_64        64
#define MSMAX_1_32        32
#define MSMAX_2_64        64
#define MSMAX_2_128       128
#define MSMAX_3_256       256
#define MSMAX_4_1024      1024
#define GP_BUF_SIZE       8
#define BETA_BUF_SIZE     4
#define GVQ_VEC_SIZE_2D   2
#define GVQ_VEC_SIZE_3D   3
#define TAB_SIZE_GVQ_3D   16
#define GVQ_VEC_SIZE_4D   4
#define TAB_SIZE_GVQ_4D   64
#define CORR_SIZE         6
/*========================================================*/
/*===========================SMOOTHING=========================*/
/*========================================================*/
#define DSP_BUFF_SIZE    4
#define SMO_BUFF_SIZE    15
#define MAX_GRP_SIZE     5
#define HL_COUNT_MAX     15
				
				<dp n="d72"/>
#define ADAPT_THRESHOLDS  1
#define N_MODE_SUB_START  -4
#define UPDATE_MAX        15
#define CONSEC_MAX        31
/*-------------------------------------------------------*/
/*                        Smooth LSF                               */
/*-------------------------------------------------------*/
#define  BETA_FRM  0.90
#define  BETA_SUB  0.70
#define  dSP1      0.0015
#define  dSP2      0.0025
#define  dSP_int1  0.0024
#define  Rllim     0.50
/*============================================================*/
/*=====================DEFINITIONS FOR LSF MA-VQ==========================*/
/*============================================================*/
#define MAX_CAND_LSFQ 10       /*the maximal number of condidate per stage*/
#define N_LSFVQCDBK   5        /*number of LSF codebooks*/
#define MAXLNp        10       /*maximal order of LPC*/
#define MAXLTT 08k    3        /*the maximal number of codebooks*/
#define MAXLTT_40k    3        /*the maximal number of codebooks*/
#define MAXLTT_85k    4        /*the maximal number of codebooks*/
#define LP_08k     1        /*number of switch predictors*/
#define LPL_08k    1        /*the number of delayed predictors*/
#define LMS1_08k   16       /*the number of entries for the 1 code*/
#define LMS2_08k   16       /*the number of entries for the 2 code*/
#define LMS3_08k   8        /*the number of entries for the 3 code*/
#define LMSMAX_08k 16
#define LQMA_08k   4
#define LP_40k     2        /*number of switch predictors*/
#define LPL_40k    2        /*the number of delayed predictors*/
#define LMS1_40k   128      /*the number of entries for the 1 code*/
#define LMS2_40k   128      /*the number of entries for the 2 code*/
#define LMS3_40k   64       /*the number of entries for the 3 code*/
				
				<dp n="d73"/>
#define LMSMAX_40k 128
#define LQMA_40k   4
#detine LP_85k    1         /*number of switch predictors*/
#define LPL_85k   1         /*the number of delayed predictors*/
#define LMS1_85k  128       /*the number of entries for the 1 code*/
#define LMS2_85k  64        /*the number of entries for the 2 code*/
#define LMS3_85k  64        /*the number of entries for the 3 code*/
#define LMS4_85k  64        /*the number of entries for the 4 code*/
#define LMSMAX_85k 128
#define LQMA_85k  2
#define LTT_08k  3          /*the number of stages for T*/
#define LTT_40k  3          /*the number of stages for T*/
#define LTT_85k  4          /*the number of stages for T*/
/*========================================================*/
/*======================DEFINITIONS FOR VAD========================*/
/*========================================================*/
#define VOICE              1
#define NOISE              0
#define INIT_FRAME         32
#define INIT_COUNT         10
#define VAD_LPC_ORDER      4
#define LTP_BUFF_SIZE      5
#define FLAG_VAD_MEM_SIZE  2
#define VAD_MEM_SIZE       3
#define VAD_MIN MEM_SIZE   8
#define MAX_ENERGY         1.0e30
#define MIN_LAG            17       /*minimum pitch lag*/
/*=======================================================*/
/*==================DEFINITIONS FOR BAD FRAME HANDLING===================*/
/*=======================================================*/
				
				<dp n="d74"/>
#define  BFH_OH 1             /*LSF:bad frame handling overhang*/
#define  ERNG_MEM_SIZE 3
#define  MAX_BFI_COUNT 5
/*=========================================================*/
/*====================ENCODER/DECODER INDEX STRUCTURE======================*/
/*=========================================================*/
#defome PACKWDSNUM  12  /*the number of words to pack the SMV bits

                    (1 for rate/erasure control,11*16=171 for data*/
typedef struct{

               INT16 idx_lsf[N_LSFVQCDBK+1];

           INT16 idx_SVS_deci;

           INT16 idx_ltp_deci[N_SF_MAX];

               INT16 idx_pitch[N_SF_MAX];

           INT16 idx_Gp_VQ;

           INT16 idx_Gc_VQ;

           INT16 idx_gainVQ[N_SF_MAX];

           INT16 idx_subcpcb[N_SF_MAX][5];

           INT16 idx_cpcbsign[N_SF_MAX][20];

               INT16 idx_cpcb[N_SF_MAX][20];

           INT16 idx_center[N_SF_MAX];

           INT16 fix_rate;

           INT16 idx_lpc_int;

           INT16 idx_vad;

           INT16 idx_pitchgainQ[N_SF_MAX];

           INT16 ltp_mode;

           INT16 idx_pit_frac[N_SF_MAX];

           INT16 idx_pit_int[N_SF_MAX];

           INT16 idx_fcbpit_frac[N_SF_MAX][2];

           INT16 idx_fcbpit_int[N_SF_MAX][2];

              }PARAMETER;
/*=========================================================*/
/*---------------------------END--------------------------*/
/*=========================================================*/
				
				<dp n="d75"/>
/*=================================================*/
/*========================================*/
/*Conexant System Inc.                                       */
/*4311 Jamboree Road                                         */
/*Newport Beach,CA 92660                                     */
/*----------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                      */
/*----------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                 */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*========================================*/
/*FILE:decoder.c                                                   */
/*========================================*/
/*----------------------------------------------*/
/*--------------------INCLUDE----------------------*/
/*----------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″mcutil.h″
#include″gputil.h″
#include″ext_var.h″
#include″lib_lpc.h″
#include″lib_qlsf.h″
#include″lib_geq.h″
#include″lib_bit.h″
#include″lib_cla.h″
#include″lib_pit.h″
#include″lib_ltp.h″
#include″lib_ppr.h″
#include″lib_fcs.h″
#include″lib_gcb.h″
#include″lib_flt.h″
				
				<dp n="d76"/>
#ifdef DIAG_SMV
#include″lib_dia.h″
#endif
/*------------------------------------------------------*/
/*------------------------FUNCTIONS--------------------------*/
/*------------------------------------------------------*/
/*==========================================*/
/*FUNCTION:dec_smv_frame().                                  */
/*------------------------------------------------*/
/*PURPOSE:Performs processing on one frame.                  */
/*------------------------------------------------*/
/*ALGORITHM:                                                 */
/*------------------------------------------------*/
/*INPUT ARGUMENTS:                                           */
/*         _(INT16[])serial:intput frame bitstream.     */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                          */
/*         _(FLOAT64[])sigout:output decoded frame.     */
/*------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                    */
/*              _None.                                  */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:                                          */
/*              _None.                                  */
/*==========================================*/
void dec_smv_frame(INT16 PackedWords[],FLOAT64*sigout,INT16 switch_flag)

     { 

     /*----------------------------------------------*/

     INT16   i_sf,i_s,l_sf,i,j,n_sf;

     FLOAT64 x,y;

     /*----------------------------------------------*/

     /*          Parameters for bitstream processing         */

     /-----------------------------------------------*/
				
				<dp n="d77"/>
    INT16 parm[3];

    INT16 shft_count;

    INT16 PackWdsPtr[2];

    PARAMETER channel;

    /*---------------------------------------------*/

    /*                     Gain MA-VQ                         */

    /*---------------------------------------------*/

    FLOAT64 gainQ[N_SF_MAX];

    /*---------------------------------------------*/

    /*                  LSF quantisation                      */

    /*---------------------------------------------*/

    INT16 exp_flg;

    FLOAT64 lsfq_new_dec[NP],lpcgain_q;

    /*---------------------------------------------*/

    /*                  Bad Frame Concealement                */

    /*---------------------------------------------*/

    INT16 bfi;

    INT16 update;

    FLOAT64 enrg;

    FLOAT64 fec_refl[NP];

    FLOAT64 temp_lagf;

    FLOAT64 ET_buf[N_SF_MAX];

    /*---------------------------------------------*/

    FLOAT64 ForPitch_dec[L_FRM];

    FLOAT64 ForPitch_decTEMP[L_FRM];
/*================================================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤                             ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤                DECODER                   ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤                             ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
				
				<dp n="d78"/>
/*=====================================================================*/
/*=====================================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤BFI MANAGEMENT¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*=====================================================================*/

    bfi=0;

    update=0;

    /*---------------------------------------------*/

    /*       Initalizing bit un-packing parameters           */

    /*---------------------------------------------*/

    PackWdsPtr[0]=16;

    PackWdsPtr[1]=1;

    switch(PackedWords[0])

        {

        case 0:nrerror(″Blank detected...″);

             break;

        case 1:channel.fix_rate=RATE0_8K;

                 if(bfh_oh>0)

                     {

                     N_bfi=0;

                     bfh_oh--;

                     }

            break;

        case 2:channel.fix rate=RATE2_0K;

                 if(bfh_oh>0)

                     {

                     N_bfi=0;

                     bfh_oh--;

                     }

            break;

        case 3:channel.fix_rate=RATE4_0K;

                 if(bfh_oh>0)

                     {

                     N_bfi=0;
				
				<dp n="d79"/>
                   bfh_oh--;

                   }

         break;

    case 4:channel.fix_rate=RATE8_5K;

              if(bfh_oh>0)

                   {

                   N_bfi=0;

                   bfh_oh--;

                   }

         break;

    case 14:bfi=1;

               N_bfi++;

               bfh_oh=BFH_OH+1;

         break;

    case 15:nrerror(″Full Rate Portable detected...?\n″);

         break;

    default:nrerror(″Illegal control word\n″);

         break;

    }
if(bfi==1)

     nbfi_count=0;
else if(mbfi_count<5)

    nbfi_count++;
if(nbfi_count>3)

     bfi_caution=0;
if(bfi==1)

     {

     frm_erasure++;

     channel.fix_rate=fix_rate_mem;

     channel.idx_SVS_deci=SVS_deci_mem;

     }
/*---------------------------------------------*/
/*        Decode bit-stream if is a good frame              */
				
				<dp n="d80"/>
/*---------------------------------------------*/
if(bfi==0)

     {

     BIT_bits_to_cdbk_index(PackedWords,PackWdsPtr,&amp;channel);

     if(channel.fix_rate==RATE2_0K)

          {

          parm[0]=channel.idx_lsf[0];

          parm[1]=channel.idx_lsf[1];

          parm[2]=channel.idx_lpc_int;

          seed_dec=0x00000000;

          shft_count=15;

          for(j=0;j<3;j++)

               {

               shft_count-=bitno0[j];

               seed_dec=seed_dec^(((long)parm[j]])<<shft_count);

               }

          }

     else

          {

          if(channel.fix_rate=RATE0_8K)

              {

              parm[0]=channel.idx_lsf[0];

              parm[1]=channel.idx_lsf[1];

              parm[2]=channel.idx_lsf[2];

              seed_dec=0x00000000;

              snft_count=11;

              for(j=0;j<3;j++)

                   {

                   shft_count-=bitnol[j];

                   seed_dec=seed_dec^(((long)parm[j])<<shft_count);

                   }

              }

         }

    }
else

    {

    /*----------------------------------------------*/

    /*              Save adaptive codebook temporaly             */
				
				<dp n="d81"/>
        /*----------------------------------------------*/

        cpy_dvector(ext_dec,ext_dec_mem,0,MAX_LAG-1);

        }
/*=======================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤LSF INVERSE QUANTIZATION AND INTERPOLATION¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*=======================================================*/

    /*---------------------------------------------*/

    /*              Get the quantized lsf                     */

    /*---------------------------------------------*/

    LSF_Q_lsf_decode(bfi_caution,&amp;exp_flg,lsfq_new_dec,channel.idx_lsf,

                  bfi,nbfi_count,channel.fix_rate);

    /*---------------------------------------------*/

    /*      Interpolate the QUANTIZED lsf and calculate corresponding    */

    /*                     the LPC coefficients                       */

    /*---------------------------------------------*/

    if(channel.fix_rate==RATE4_0K)

         {

         if(channel.idx_SVS_deci==1)

             LPC_interpolate_lpc_4to3(lsfq_new_dec,(FLOAT64*)NULL,

                                              lsfq_old_dec,pdcfq_dec,1);

         else

             LPC_interpolate_lpc_4to2(lsfq_new_dec,(FLOAT64*)NULL,

                                              lsfq_old_dec,pdcfq_dec,1);

         }

    else

         {

         if((channel.fix_rate==RATE2_0K)‖

                  ((channel.fix_rate==RATE8_5K)&amp;&amp;

                       (channel.idx_SVS_deci==0)))
#ifdef ALGO_BUG_FIX

                            if(bfi==0)

                                 {

                                 LPC_adptive_interp_dec(lsfq_new_dec,
				
				<dp n="d82"/>
                           lsfq_old_dec,pdcfq_dec,

                               channel.idx_lpc_int);

                      }

                  else

                       LPC_adptive_interp_dec(lsfq_new_dec,

                           lsfq_old_dec,pdcfq_dec,0);
#else

                  LPC_adptive_interp_dec(lsfq_new_dec,lsfq_old_dec,

                           pdcfq_dec,channel.idx_lpc_int);
#endif

       else

           LPC_adptive_interp_dec(lsfq_new_dec,lsfq_old_dec,

                        pdcfq_dec,0);

       }

    LPC_pred2refl(pdcfq_dec[0],fec_refl,NP);

    /*------------------------------------------------------*/

    /*         Determination of the flatness of the input speech    */

    /*------------------------------------------------------*/

    CLA_Identify_Input(channel.idx_SVS_deci,pdcfq_dec[0],lsfq_new_dec[0],

            pgain_past_dec,&amp;lpcgain_q,channel.fix_rate,&amp;FlatSp_Flag);

    /*------------------------------------------------------*/

    /*             Interpolation of Pitch Lag                        */

    /*------------------------------------------------------*/

    if(channel.idx_SVS_deci==1)

         {

         PIT_pitch_track_recons(fix_rate_mem,bfi,past_bfi,ppast_bfi,

                                lag_f,SVS_deci_mem,qua_gainQ,channel,

                                     &amp;pitchf,pitch_f_mem,ForPitch_decTEMP);

         PIT_PitchInterpolat(pitchf,pitch_f_mem,ForPitch_dec,0);

         }

    if((channel.idx_SVS_deci==0)&amp;&amp;(channel.fix_rate==RATE8_5K))
				
				<dp n="d83"/>
     temp_lagf=PitLagTab8b[channel.idx_pitch[0]];
else if((channel.idx_SVS_deci==0)&amp;&amp;(channel.fix_rate==RATE4_0K))

     temp_lagf=PitLagTab7b[channel.idx_pitch[0]];
LTP_adap_cbk_correction(fix_rate_mem,bfi,past_bfi,ppast_bfi,

                       qua_gainQ,gainQ,SVS_deci_mem,temp_lagf,

                       &amp;update,pitch_f_mem,lag,lag_f,

                       ForPitch_decTEMP,ext_dec_mem,ext_dec,

                       unfcod_dec,channel);
  /*---------------------------------------------*/
  /*    Gaussian excitation for very low bit rates               */
/*---------------------------------------------*/
if((channel.fix_rate==RATE2_0K)‖(channel.fix_rate==RATE0_8K))

     {

     cpy_dvector(gp_buf+4,gp_buf,0,4-1);

     ini_dvector(gp_buf+4,0,4-1,0.0);

     GCB_gauss_excit_dec(&amp;seed_dec,channel.fix_rate,qua_unfcod[1]);

     if(channel.fix_rate==RATE2_0K)

         {

         /*---------------------------------------------*/

         /*      Decode the fixed codebook gain for sub-frame    */

         /*          #1 and #3 coded with 6+6bits            */

         /*---------------------------------------------*/

        if((fix_rate_mem==RATE8_5K)‖(fix_rate_mem==RATE0_8K))

             GEQ_update_mem_4d_to_2d();

        else if((fix_rate_mem==RATE4_0K)&amp;&amp;(SVS_deci_mem!=0))

             GEQ_update_mem_3d_to_2d();

        GEQ_dec_gains_1_6(0,channel.idx_gainVQ[0],qua_gainQ,

                            qua-unfcod[1],N_bfi);

        GEQ_dec_gains_1_6(2,channel.idx_gainVQ[1],qua_gainQ,

                            qua_unfcod[1],N_bfi);

        qua_gainQ[1][1]=qua_gainQ[1][0];

        qua_gainQ[1][3]=qua_gainQ[1][2];

        }

    else
				
				<dp n="d84"/>
      {

      /*---------------------------------------------*/

      /*        Decode the fixed codebook gain for sub-frame  */

      /*                    #1 coded with 6bits           */

      /*---------------------------------------------*/

      if((fix_rate_mem==RATE4_0K)‖(fix_rate_mem==RATE2_0K)

           {

           if(SVS_deci_mem==0)

               GEQ_update_mem_2d_to_4d();

           else

               GEQ_update_mem_3d_to_4d();

           }

        GEQ_dec_gains_1_5(channel.idx_gainVQ[0],qua_gainQ,

                             qua_unfcod[1],N_bfi);

        for(i=0;i<N_SF4;i++)

            qua_gainQ[1][i]=qua_gainQ[1][0];

        }

    }
/*==================================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤SUB-FRAME PROCESSING¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*==================================================================*/
/*---------------------------------------------*/
/*-------------------VARIABLE DESCRIPTION----------------*/
/*---------------------------------------------*/
/*                                                           */
/*  pdcfq_dec     - quantized prediction coefficients        */
/*  unfcod_dec[0] - adaptive codebook(ACB)vector             */
/*  unfcod_dec[1] - algebraic codebook(CDBK)vector           */
/*  gainQ[0]      - ACB gain                                 */
/*  gainQ[1]      - CDBK gain                                */
/*                                                           */
/*  ext_dec       - adaptive codebook                        */
/*  lag[i_sf]     - integrallag of the current subframe      */
/*  lagf[i_sf]    - fractional lag ofthe current subframe    */
/*                                                           */
				
				<dp n="d85"/>
/*------------------------------------------------------------*/

    /*--------------------------------------------------------*/

    /*              Set number of subframes                        */

    /*--------------------------------------------------------*/

    if(channel.fix_rate!=RATE4_0K)

        n_sf=N_SF4;

    else

        {

        if(channel.idx_SVS_deci==1)

            n_sf=N_SF3;

        else

            n_sf=N_SF2;

        }
/*---------------------------------------------------------*/
/*¤¤¤¤¤¤¤¤First decoding loop for the decoder classification purpose¤¤¤¤¤¤¤¤*/
/*---------------------------------------------------------*/

    i_s=0;

    for(i_sf=0;i_sf<n_sf;i_sf++)

        {

        /*==================================================*/

        /*----------------------------------------------------------*/

        /*                 Set length of subframe                           */

        /*----------------------------------------------------------*/

        if(channel.fix_rate!=RATE4_0K)

        l_sf=L_SF4;

        else

            {

            if(channel.idx_SVS_deci==1)

                {

                if(i_sf==N_SF3-1)

                    l_sf=L_SF3;

                else

                    l_sf=L_SF0;

                }

            else
				
				<dp n="d86"/>
         l_sf=L_SF;

    }
/*--------------------------------------------*/
/*               Adaptive Codebook Contribution          */
/*--------------------------------------------*/
if((channel.fix_rate==RATE8_5K)‖

            (channel.fix_rate==RATE4_0K))

            {

            if(channel.idx_SVS_deci==1)

                {

                LTP_PP_pitch_ext_decod(ForPitch_dec+i_s,ext_dec,

                            i_sf,unfcod_dec[0],lag,lag_f,l_sf);

                cpy_dvector(unfcod_dec[0],qua_unfcod[0]+i_s,0,

                            l_sf-1);

                lag[i_sf]=(INT16)(ForPitch_dec[l_sf/2+i_s]+0.5);

                }

            else

                {

                if(channel.fixrate==RATE8_5K)

                    LTP_8_5k_pitch_decod(bfi,ext_dec,i_sf,

                       unfcod_dec[0],lag,lag f,l_sf,

                            channel.idx_pitch);

            else

                    LTP_7b_pitch_decod(bfi,ext_dec,i_sf,

                       unfcod_dec[0],lag,lag_f,l_sf,

                            channel.idx_pitch);

            cpy_dvector(unfcod_dec[0],qua_unfcod[0]+i_s,

                            0,l_sf-1);

            }

        }

    else

        {   

        gainQ[0]=0.0;

        qua_gainQ[0][i_sf]=0.0;

        ini_dvector(unfcod_dec[0],0,l_sf-1,0.0);

        ini_dvector(qua_unfcod[0]+i_s,0,l_sf-1,0.0);
				
				<dp n="d87"/>
        }
/*------------------------------------------------*/
/*                Fixed Codebook Contribution            */
/*------------------------------------------------*/
switch(channel.fix_rate)

    {

    /*--------------------------------------------*/

    /*                     RATE 8.5kps                   */

    /*--------------------------------------------*/

    case RATE8_5K:

         if(channel.idx_SVS_deci==1)

             {

             GEQ_Dec_PitchGain_4D(N_bfi,i_sf,channel.idx_Gp_VQ,

                                 gainQ);

             if(bfi==0)

                  FCS_cdbk_decod_30b_sub40(unfcod_dec[1],

                     l_sf,i_sf,lag[i_sf],gainQ[0],&amp;channel);

             }

         else

             {

             if(bfi==0)

                  FCS_cdbk_decod_22b_sub40(unfcod_dec[1],

                      l_sf,i_sf,lag[i_sf],pgain_past_dec,

                           &amp;channel);

             }

       break;

    /*--------------------------------------------*/

    /*                       RATE 4.0kps                 */

    /*--------------------------------------------*/

    case RATE4_0K:

         if(channel.idx_SVS_deci==1)

             {

             GEQ_Dec_PitchGain_3D(N_bfi,i_sf,channel.idx_Gp_VQ,

                                    gainQ);
				
				<dp n="d88"/>
           if(bfi==0)

                FCS_cdbk_decod_13b_sub54(ext_dec,

                        pdcfq_dec[i_sf],unfcod_dec[1],l_sf,

                            i_sf,lag[i_sf],gainQ[0],

                                 fix_rate_mem,lpcgain_q,

                                      &amp;channel);

           }

       else

           {

           if(bfi==0)

               FCS_cdbk_decod_15b_sub80(ext_dec,

                      pdcfq_dec[i_sf],unfcod_dec[1],l_sf,

                          i_sf,lag[i_sf],pgain_past_dec,

                              fix_rate_mem,lpcgain_q,

                                   &amp;channel);

           }

      break;

    /*--------------------------------------------*/

    /*                 RATE 2.0kps                    */

    /*--------------------------------------------*/

    case RATE2_0K:

         cpy_dvector(qua_unfcod[1]+i_s,unfcod_dec[1],0,

                                         l_sf-1);

         gainQ[1]=qua_gainQ[1][i_sf];

         break;

    /*--------------------------------------------*/

    /*                 RATE 0.8kps                             */

    /*--------------------------------------------*/

    case RATE0_8K:

         break;

    default:nrerror(″Invalid rate!!″);

         break;

    }
/*--------------------------------------------*/
				
				<dp n="d89"/>
if((bfi==1)&amp;&amp;((channel.fix_rate==RATE8_5K)‖

              (channel.fix_rate==RATE4_0K)))

    {

    for(i=0;i<l_sf;i++)

        unfcod_dec[1][i]=GCB_gauss_noise(&amp;seed_bfi_exc);

    }
/*--------------------------------------------*/
/*          Adaptive and Fixed Codebook Gains         */
/*--------------------------------------------*/
if((channel.fix_rate==RATE8_5K)‖

         (channel.fix_rate==RATE4_0K))

         {

         /*------------------------------------------*/

         /*RATE 8.5kbps and 4.0kbps    */

         /*------------------------------------------*/

         cpy_dvector(unfcod_dec[1],qua_unfcod[1]+i_s,0,

                                    l_sf-1);

         if(channel.idx_SVS_deci==0)

             {

             if(channel.fix_rate==RATE8_5K)

                 {

                 if(((fix_rate_mem==RATE4_0K)‖

                           (fix_rate_mem==RATE2_0K))&amp;&amp;

                                (i_sf==0))

                      {

                      if(SVS_deci_mem=0)

                          GEQ_update_mem_2d_to_4d();

                      else

                          GEQ_update_mem_3d_to_4d();

                      }

                 GEQ_dec_gains_2_7(channel.fix_rate,lag[0],

                          channel.idx_gainVQ[i_sf],gainQ,

                              N_bfi,unfcod_dec[1],i_sf,l_sf);

                 if((fec_refl[0]>0.0)&amp;&amp;(N_bfi>0))

                             gainQ[0]=0.4;
				
				<dp n="d90"/>
        }

    else

        {

        if(((fix_rate_mem==RATE8_5K)‖

             (fix_rate_mem==RATE0_8K))&amp;&amp;

                  (i_sf==0))

                  {

                  GEQ_update_mem_4d_to_2d();

                  }

        else

           {

           if((fix_rate_mem==RATE4_0K)&amp;&amp;

                     (SVS_deci_mem!=0)&amp;&amp;

                         (i_sf==0))

                         {

                         GEQ_update_mem_3d_to_2d();

                         }

           }

        GEQ_dec_gains_2_7(channel.fix_rate,lag[0],

                         channel.idx_gainVQ[i_sf],

                             gainQ,N_bfi,unfcod_dec[1],

                                  i_sf,l_sf);

        if((fec_refl[0]>0.0)&amp;&amp;(N_bfi>0))

             gainQ[0]=0.4;

        }

    }
else

    {

    if(channel.fix_rate==RATE8_5K)

         {   

         if(((fix_rate_mem==RATE4_0K)‖

                   (fix_rate_mem==RATE2_0K))&amp;&amp;(i_sf==0))

                   {

                   if(SVS_deci_mem==0)

                       GEQ_update_mem_2d_to_4d();

                   else

                       GEQ_update_mem_3d_to_4d();

                   }

         GEQ_dec_gc_4_10(channel.idx_Gc_VQ,&amp;(gainQ[1]),

                          N_bfi,unfcod_dec,i_sf);
				
				<dp n="d91"/>
                           }

                      else

                           {

                           if(((fix_rate_mem==RATE8_5K)‖

                                (fix_rate_mem==RATE0_8K))&amp;&amp;(i_sf==0))

                                     GEQ_update_mem_4d_to_3d();

                           else_if(SVS_deci_mem==0)

                                     GEQ_update_mem_2d_to_3d();

                           GEQ_dec_gc_3_8(channel.idx_Gc_VQ,&amp;(gainQ[1]),

                                     N_bfi,unfcod_dec,i_sf);

                           }

                      }

    #ifdefPROG_BUG_FIX

                   qua_gainQ[1][i_sf]=gainQ[1];

    #endif

                   qua_gainQ[0][i_sf]=gainQ[0];

                   pgain_past_dec=gainQ[0];

                   if(pgain_past_dec<PAST_PGAIN_MIN)

                       pgain_past_dec=PAST_PGAIN_MIN;

                   if(pgain_past_dec>PAST_PGAIN_MAX)

                       pgain_past_dec=PAST_PGAIN_MAX;

                   }

               else

                   {

                   /*------------------------------------------*/

                   /*               RATE 2.0kbps and 0.8kbps         */

                   /*------------------------------------------*/

                   gainQ[0]=0.0;

                   pgain_past_dec=0.0;

                   qua_gainQ[0][i_sf]=0.0;

                   gainQ[1]=qua_gainQ[1][i_sf];

                   }

                /*--------------------------------------------*/

                /*                 Build the excitation             */

                /*--------------------------------------------*/

                if(exp_flg==1)
				
				<dp n="d92"/>
                  wad_dvector(qua_unfcod[0]+i_s,gainQ[0],

                                    qua_unfcod[1]+i_s,0.7*gainQ[1],

                                     ext_dec+MAX_LAG,0,l_sf-1);

          else

                  wad_dvector(qua_unfcod[0]+i_s,gainQ[0],

                                    qua_unfcod[1]+i_s,gainQ[1],

                                        ext_dec+MAX_LAG,0,l_sf-1);
#ifdef PROG_BUG_FIX

            GEQ_energy_extrapolation(i_s,i_sf,l_sf,gainQ,

                    qua_unfcod,bfi,lag,ext_dec,Prev_Beta_Pitch,

                            ET_buf,ForPitch_dec,channel);
#else

            GEQ_energy_extrapolation(i_s,i_sf,l_sf,gainQ,bfi,lag,

                       ext_dec,Prev_Beta_Pitch,ET_buf,channel);
#endif

            /*--------------------------------------------*/

            /*             Temporary buffer                       */

            /*--------------------------------------------*/

            cpy_dvector(ext_dec+MAX_LAG,sigout+i_s,0,l_sf-1);

            /*--------------------------------------------*/

            /*              Update the adaptive codebook           */

            /*--------------------------------------------*/

            cpy_dvector(ext_dec+l_sf,ext_dec,0,MAX_LAG-1);

            i_s+=l_sf;

            /*============================================*/

            }

       if((channel.fix_rate=RATE4_0K)&amp;&amp;(channel.idx_SVS_deci==1))

            {

            cpy_dvector(gp_buf+4,gp_buf,0,4-1);

            gp_buf[4]=qua_gainQ[0][0];

            gp_buf[5]=gp_buf[6]=qua_gainQ[0][1];

            gp_buf[7]=qua_gainQ[0][2];
				
				<dp n="d93"/>
            }

        else

            {

            if((channel.fix_rate==RATE4_0K)&amp;&amp;

                (channel.idx_SVS_deci!=1))

                {

                cpy_dvector(gp_buf+4,gp_buf,0,4-1);

                if((ET_buf[0]<40.0)&amp;&amp;(qua_gainQ[0][0]>0.7))

                    gp_buf[4]=gp_buf[5]=0.4;

                else

                    gp_buf[4]=gp_buf[5]=qua_gainQ[0][0];

                if((ET_buf[1]<40.0)&amp;&amp;(qua_gainQ[0][1]>0.7))

                    gp_buf[6]=gp_buf[7]=0.4;

                else

                    gp_buf[6]=gp_buf[7]=qua_gainQ[0][1];

                }

            else

                {

                if(channel.fix_rate==RATE8_5K)

                    {

                    cpy_dvector(gp_buf+4,gp_buf,0,4-1);

                    for(i=0;i<4;i++)

                        {

                        if((ET_buf[i]<40.0)&amp;&amp;(qua_gainQ[0][i]>0.7)

                             &amp;&amp;(channel.idx_SVS_deci!=1))

                                gp_buf[i+4]=0.4;

                        else

                                gp_buf[i+4]=qua_gainQ[0][i];

                        }

                    }

                }

            }
/*---------------------------------------------*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤Second decoding loop¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*---------------------------------------------*/

    i_s=0;
				
				<dp n="d94"/>
for(i_sf=0;i_sf<n_sf;i_sf++)

    {

    /*----------------------------------------------*/

    /*                 Set the subframe length          */

    /*----------------------------------------------*/

    if(channel.fix_rate!=RATE4_0K)

        l_sf=L_SF4;

    else

        {

    if(channel.idx_SVS_deci==1)

        {

        if(i_sf==N_SF3-1)

             l_sf=L_SF3;

        else

             l_sf=L_SF0;

        }

    else

        l_sf=L_SF;

    }
  cpy_dvector(sigout+i_s,sigsyn_dec+NP,0,l_sf-1);
  /*----------------------------------------------*/
  /*                    Synthesis filter                */
  /*----------------------------------------------*/
  FLT_allsyn(sigsyn_dec+NP,l_sf,pdcfq_dec[i_sf],NP,

                    sigsyn_dec+NP,synth_mem_dec);
  /*----------------------------------------------*/
  /*                      Post processing               */
  /*----------------------------------------------*/
  switch(channel.fix_rate)

      {

      case RATE8_5K:

              if(FlatSp_Flag==0)

                   {

                   x=0.65;
				
				<dp n="d95"/>
                    y=0.4;

                    }

                else

                       {

                       x=0.63;

                       y=0.4;

                       }

            break;

       case RATE4_0K:x=0.63;

                       y=0.5;

            break;

       case RATE2_0K:x=0.63;

                       y=0.0;

            break;

       case RATE0_8K:x=0.63;

                       y=0.0;

            break;

       default:nrerror(″Invalid fix_rate!!!″);

            break;

       }

    PPR_post_process(sigsyn_dec,pdcfq_dec[i_sf],x,y,

                lag_f[i_sf],l_sf,FlatSp_Flag,channel.fix_rate);

    /*----------------------------------------------*/

    /*          Update the synthesized speech buffer          */

    /*----------------------------------------------*/

    cpy_dvector(sigsyn_dec+NP,sigout+i_s,0,l_sf-1);

    /*----------------------------------------------*/

    i_s+=l_sf;

    /*==========================================*/

    }
dot_dvector(sigout,sigout,&amp;enrg,0,L_FRM-1);
				
				<dp n="d96"/>
    enrg_buff[0]=enrg_buff[1];

    enrg_buff[l]=enrg_buff[2];

    enrg_buff[2]=10.0*log10(enrg/L_FRM+EPSI);

    if((enrg_buff[2]<45.0)&amp;&amp;(bfi==1)&amp;&amp;(channel.fix_rate==RATE8_5K)

         &amp;&amp;(channel.idx_SVS_deci==0))

         {

         ini_dvector(past_energyq_4d,0,GVQ_VEC_SIZE_4D-1,-30.0);

         bfi_caution=1;

         }

    else if((enrg_buff[2]<45.0)&amp;&amp;(bfi==1)&amp;&amp;

              (channel.fix_rate==RATE4_0K)&amp;&amp;(channel.idx_SVS_deci==0))

         {

         ini_dvector(past_energyq_2d,0,GVQ_VEC_SIZE_2D-1,-30.0);

         bfi_caution=1;

         }

    ppast_bfi=past_bfi;

    past_bfi=bfi;

    SVS_deci_mem=channel.idx_SVS_deci;

    fix_rate_mem=channel.fix_rate;
#ifdef MEM_TEST

    for(i=0;i<2;i++)

        ini_dvector(unfcod_dec[i],0,L_SF-1,-1.0);

    for(i=0;i<2;i++)

        ini_dvector(qua_unfcod[i],0,L_FRM-1,-1.0);

    for(i=0;i<N_SF MAX;i++)

        ini_dvector(pdcfq_dec[i],0,NP-1,-1.0);

    ini_dvector(ext_dec,MAX_LAG,MAX_LAG+L_SF-1,-1.0);

    ini_dvector(sigsyn_dec,NP,NP+L_SF-1,-1.0);

    ini_dvector(lsfq_new_dec,0,NP-1,-1.0);
#endif
				
				<dp n="d97"/>
    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*================================================================*/
/*-------------------------END----------------------------*/
/*================================================================*/
				
				<dp n="d98"/>
/*==================================================================================*/
/*===========================================================================*/
/*Conexant System Inc.                                        */
/*4311 Jamboree Road                                          */
/*Newport Beach,CA 92660                                      */
/*---------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                        */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                                            */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*===========================================================================*/
/*FILE:decoder.h                                                    */
/*===========================================================================*/
/*--------------------------------------------------------------*/
/*-----------------------------FUNCTIONS------------------------------*/
/*--------------------------------------------------------------*/
void dec_smv_frame(INT16[],FLOAT64[],INT16);
/*==================================================================================*/
/*---------------------------------END-----------------------------------*/
/*==================================================================================*/
				
				<dp n="d99"/>
/*====================================================*/
/*==============================================*/
/*Conexant System Inc.                                                    */
/*4311 Jamboree Road                                                       */
/*Newport Beach,CA 92660                                                  */
/*----------------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                                   */
/*----------------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                    */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.   */
/*=============================================*/
/*FILE:encoder.c                                                    */
/*=============================================*/
/*----------------------------------------------------*/
/*-----------------------------INCLUDE---------------------*/
/*----------------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″gputil.h″
#include″mcutil.h″
#include″ext_var.h″
#include″lib_qlsf.h″
#include″lib_geq.h″
#include″lib_vad.h″
#include″lib_lpc.h″
#include″lib_cla.h″
#include″lib_snr.h″
#include″lib_pwf.h″
#include″lib_bit.h″
#include″lib_pit.h″
#include″lib_smo.h″
#include″lib_prc.h″
#include″lib_flt.h″
#include″lib_fcs.h″
#include″lib_ltp.h″
				
				<dp n="d100"/>
#include″lib_ppr.h″
#include″lib_ppp.h″
#include″lib_gcb.h″
#ifdef DIAG_SMV
#include″lib_dia.h″
#endif
/*---------------------------------------------------------*/
/*----------------------------FUNCTIONS-------------------------*/
/*---------------------------------------------------------*/
/*=====================================================*/
/*FUNCTION:enc_smv_frame().                                         */
/*---------------------------------------------------------*/
/*PURPOSE:Performs processing on one frame.                         */
/*---------------------------------------------------------*/
/*ALGORITHM:                                                        */
/*---------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                    */
/*       _(FLOAT64[])sigpp:input frame.                         */
/*       _(INT16)smv_mode:selected SMV mode.                        */
/*       _(INT16)switch_flag:switching mode flag.               */
/*       _(char)signaling:signal information.                */
/*--------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                 */
/*       _(INT16[])PackedWords:output frame bitstream.              */
/*       _(FLOAT64[])enc_sigout:output processed frame.             */
/*       _(INT16*)FlatSpFlag:flat input speech flag.              */
/*       _(FLOAT64*)avg_rate:ave_rage bit rate.                      */
/*       _(INT16*)VoicingClass:Frame classification.           */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                           */
/*             _None.                                           */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                 */
/*             _None.                                           */
/*=====================================================*/
				
				<dp n="d101"/>
void enc_smv_frame(FLOAT64 sigpp[],INT16 PackedWords[],FLOAT64 enc_sigout[],

                  INT16 smv_mode,INT16 switch_flag,INT16 *FlatSpFlag,

                      char signaling,FLOAT64*avg_rate,INT16*VoicingClass)

    {

    /*---------------------------------------------*/

    /*Misc.parameters                                               */

    /*---------------------------------------------*/

    FLOAT64*px,*buf;

    FLOAT64 g1,g2,val1,val2;

    INT16 i_sf,i,j,k,l,i_s,l_sf,n_sf;

    FLOAT64x;
#ifdef DIAG_SMV

     FLOAT64 y;
#endif

    /*---------------------------------------------*/

    /*       Variables for Voice Activity Detection           */

    /*---------------------------------------------*/

    INT16 avg_lag;

    /*---------------------------------------------*/

    /*             Variables for classification               */

    /*---------------------------------------------*/

    INT16 NoisyV_fiag,OnSetFlag;

    FLOAT64 FrmResEng,ResEng[N_SF2];

    FLOAT64 lpcgain_q;

    /*---------------------------------------------*/

    /*             Variables for LPC smoothing                */

    /*---------------------------------------------*/

    FLOAT64 beta_frm,beta_sub;

    FLOAT64 refl0[N_SF_MAX];

    /*---------------------------------------------*/

    /*               Parameters for LPC smoothing             */
				
				<dp n="d102"/>
/*---------------------------------------------*/
FLOAT64LP_CF[N_SF_MAX+1];
FLOAT64 lsf_int[NP];
/*---------------------------------------------*/
/*                Variables for Smoothing                   */
/*---------------------------------------------*/
INT16 exc_mode,speech_mode;
FLOAT64 pitch_corr[2];
/*---------------------------------------------*/
/*   Parameters for LPC analysis and quantization           */
/*---------------------------------------------*/
  FLOAT64 lsf_new2[NP],lsf_new3[NP],lsfq_new[NP];
/*---------------------------------------------*/
/*         Variables for Pitch Interpolation                */
/*---------------------------------------------*/
FLOAT64 ForPitch[L_FRM+L_FRM/2];
/*---------------------------------------------*/
/*         Parameters for pitch pre-processing              */
/*---------------------------------------------*/
FLOAT64 gp_pp[N_SF_MAX];
/*---------------------------------------------*/
/*         Parameters for pitch open loop                   */
/*---------------------------------------------*/
INT16 pre_lag;
/*---------------------------------------------*/
/*                   Parameters for LTP                     */
/*---------------------------------------------*/
FLOAT64 Rp;
				
				<dp n="d103"/>
    /*---------------------------------------------*/

    /*         Parameters for Closed Loop processing          */

    /*---------------------------------------------*/

    FLOAT64 gainQ[N_SF_MAX];

    FLOAT64 hh[L_SF],hh_w[L_SF],hh_m[L_FRM];

    FLOAT64 Tg[L_SF],Tgs[L_SF],Tgs_m[L_SF];

    FLOAT64 res2[L_SF];

    FLOAT64 nsr=0.0;

    FLOAT64 Rp_Wn,ac_sharp,frm_sharp;

    FLOAT64 qua_Tg[L_FRM];

    /*---------------------------------------------*/

    /*               Variables for Signal Sinthesis              */

    /*---------------------------------------------*/

    FLOAT64 sigsyn[L_SF+NP];

    FLOAT64 qua_sigsyn[L_SF+NP];

    /*---------------------------------------------*/

    /*           Parameters for bitstream processing             */

    /*---------------------------------------------*/

    INT64 seed_enc;

    INT16 parm[3];

    INT16 shft_count;

    INT16 PackWdsPtr[2];

    PARAMETER channel;
/*====================================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤                  ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤            ENCODER               ¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤                  ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*====================================================================*/
				
				<dp n="d104"/>
/*==================================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤LPC ANALYSIS¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*==================================================================*/

    /*---------------------------------------------*/

    /*              Second subframe LPC                       */

    /*---------------------------------------------*/

    LPC_analysis(L_LPC,sigpp,lpc_window,rxx,bwe_factor,

                refl[1],&amp;pderr,pdcf[1],lsf_new2,NP,&amp;x,

                  (*FlatSpFlag));

    /*---------------------------------------------*/

    /*               First subframe LPC                       */

    /*---------------------------------------------*/

    for(i=0;i<NP;i++)

        refl[0][i]=0.5*(refl[1][i]+refl[N_SF4-1][i]);

    for(i=0;i<NP;i++)

        lsf_int[i]=0.5*(lsf_new[i]+lsf_new2[i]);

    LPC_lsftop(lsf_int,pdcf[0],NP);

    /*---------------------------------------------*/

    /*        Fourth subframe LPC analysis,used for LSF quantization    */

    /*---------------------------------------------*/

    LPC_analysis(L_LPC,sigpp+L_PP-L_LPC,lpc_windowl,rxx,bwe_factor,

                     refl[N_SF4-1],&amp;pderr,pdcf[N_SF4-1],lsf_new,NP,

                         &amp;lpcgain,(*FlatSpFlag));

    /*---------------------------------------------*/

    /*           VAD based on the fourth subframe LPC LPC               */

    /*---------------------------------------------*/

    flag_vad_mem[1]=flag_vad_mem[0];

    flag_vad_mem[0]=Vad;

    px=sigpp+L_PP-L_FRM-L_LPCLHD;
				
				<dp n="d105"/>
    VAD_voice_detection(px,refl[N_SF4-1],pderr,lag_buf,pgain_buf,

                         lsf_new,rxx,frm_count,&amp;Vad,flag vad_mem);

    /*---------------------------------------------*/

    /*                   Third subframe LPC                      */

    /*---------------------------------------------*/

    for(i=0;i<NP;i++)

        refl[2][i]=0.5*(refl[1][i]+refl[N_SF4-1][i]);

    for(i=0;i<NP;i++)

        lsf_int[i]=0.5*(lsf_new[i]+lsf_new2[i]);

    LPC_lsftop(lsf_int,pdcf[2],NP);

    /*---------------------------------------------*/

    /*                 LPC analysis for Look-Ahead               */

    /*---------------------------------------------*/

    energy_m=energy;

    LPC_analysis(L_LPC,sigpp+L_PP-L_LPC,lpc_window2,rxx,bwe_factor,

                 refl[N_SF4],&amp;pderrr,pdcf[N_SF4],lsf_new3,NP,&amp;x,

                           (*FlatSpFlag));

    energy=rxx[0];
/*=====================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤WEIGHTING SPEECH AND CLASSIFICATION¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*=====================================================*/
#ifndef MEM_TEST

    /*---------------------------------------------*/

    /*             Update the weighted speech buffer          */

    /*---------------------------------------------*/

    cpy_dvector(wspeech+L_FRM,wspeech,0,L_OLPIT-L_FRM-L_LPCLHD-1);
#endif
				
				<dp n="d106"/>
    /*---------------------------------------------*/

    /*                  Generate the residual                  */

    /*---------------------------------------------*/

    PWF_speech_to_residu(sigpp,wspeech,pdcf,wpdcf_zero,GAMMA1);

    /*---------------------------------------------*/

    /*      Temporal noise-like unvoied speech detector        */

    /*---------------------------------------------*/

    VUV=3;

    1=L_FRM+L_LPCLHD;

    CLA_NoisUnvoiceDetect(wspeech+L_OLPIT-1,sigpp+L_PP-1,&amp;VUV,ResEng,

                             &amp;frm_sharp,L_FRM);

    FrmResEng=ResEng[0]+ResEng[1];

    /*---------------------------------------------*/

    /*              Generate the weighted speech               */

    /*---------------------------------------------*/

    PWF_residu_to_wspeech((*FlatSpFlag),wspeech,wspeech,refl,pdcf,

                          wpdcf_pole,LP_CF,wspeech_mem,&amp;Z1_ws_1);
/*=====================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤OPEN-LOOP INTER PITCH LAG SEARCH ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*=====================================================*/

    pre_lag=ol_lag[1];

    PIT_ol_2pitchs(wspeech,L_OLPIT,ol_lag,Rp_sub,frame_class,HI_LAG2);

    for(i=0;i<3;i++)

        lag_buf[i]=lag_buf[i+2];
#ifndef COMPLEXITY_REDUC

    avg_lag=AVG(lag_buf[0],lag_buf[1],lag_buf[2]);

    if(abs((short)(ol_lag[0]/2.0)-avg_lag)<=2)

         lag_buf[3]=(INT16)(ol_lag[0]/2.0);

    else
				
				<dp n="d107"/>
        {

        if(abs((INT16)(ol_lag[0]/3.0)-avg_lag)<=2)

            lag_buf[3]=(INT16)(ol_ag[0]/3.0);

        else

            lag_buf[3]=ol_lag[0];

        }

    if(abs((INT16)(ol_lag[1]/2.0)-avg_lag)<=2)

        lag_buf[4]=(short)(ol_lag[1]/2.0);

    else

        {

        if(abs((INT16)(ol_ag[1]/3.0)-avg_lag)<=2)

            lag_buf[4]=(short)(ol_lag[1]/3.0);

        else

            lag_buf[4]=ol_lag[1];

        }
#else

     lag_buf[3]=ol_lag[0];

     lag_buf[4]=ol_lag[1];
#endif
/*====================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤CLASSIFICATON¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*====================================================*/

    frame_class_m=frame_class;

    frame_class=CLA_signal_classifier(sigpp+L_PP-L_FRM-L_LPCLHD,

                      Rp_sub[1],(double)(ol_lag[1]),Vad);

       /*---------------------------------------------*/

    /*                     Background Noise Level                        */

          /*---------------------------------------------*/

    SNR_Calc_NSR_enc(sigpp+L_PP-L_FRM,lsf_new3,Vad,frame_class,

                    &amp;nsr,L_FRM);

       /*---------------------------------------------*/

    /*                       Class correction                         */

          /*---------------------------------------------*/

    CLA_Class_Correct(&amp;frame_class,&amp;frame_class_pp,&amp;Vad,&amp;VUV,
				
				<dp n="d108"/>
                     &amp;OnSetFlag,frame_class_m,Rp_sub,nsr,refl,

                       frm_sharp,smv_mode,energy_m,energy,

                         FrmResEng,lpcgain,&amp;NoisyV_flag);
/*==================================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤CODEC BIT-RATE SELECTION¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*==================================================================*/

        /*----------------------------------------------*/

    /*                     Fixed rate selection               */

           /*----------------------------------------------*/

    fix_rate_mem=fix_rate;

    if(smv_mode<=1)

         fix_rate=RATE8_5K;

    else

         fix_rate=RATE4_0K;

    if(switch_flag)

         {

         CLA_Rate_Select(smv_mode,frame_class,frame_clas_m,

                             OnSetFlag,Rp_sub,nsr,frm_sharp,

                             refl[2][0],FrmResEng,&amp;fix_rate);

    if((signaling==(char)1)&amp;&amp;(fix_rate==RATE8_5K))

             fix_rate=RATE4_0K;

    }
/*=====================================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤FINE PITCH AND INTERPOLATION¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*=====================================================================*/

    if((fix_rate==RATE4_0K)&amp;&amp;(ol_lag[1]>HI_LAG)&amp;&amp;(frame_class_pp>0))

         frame_class_pp=0;

    /*----------------------------------------------*/

    /*                     Forward fine pitch                    */

    /*----------------------------------------------*/
				
				<dp n="d109"/>
if(frame_class_pp>0)

     {

     low_pit=MAX(min_pit,ol_lag[1]-5);

     if(fix_rate==RATE8_5K)

          high_pit=MIN(HI_LAG2,ol_lag[1]+5);

    else

          high_pit=MIN(HI_LAG,ol_lag[1]+5);

    pre_pitch_index=pitch_index;

    pitch_f_mem[1]=pitch_f_mem[0];

    pitch_f_mem[0]=pitchf;

    1=L_OLPIT-L_LPCLHD;

    lagl=PIT_FinePitch(fix_rate,low_pit,high_pit,wspeech,

                           l,Delay_pp,&amp;Rp,&amp;pitchf,&amp;pitch_index);

    channel.idx_pitch[0]=pitch_index;

    /*----------------------------------------------*/

    /*Pitch interpolation and modify pitch index to avoid too  */

    /*                   large delay                           */

    /*----------------------------------------------*/

    if((fix_rate_mem==RATE2_0K)‖(fix_rate_mem==RATE0_8K))

         {

         pitch_f_mem[1]=pitchf;

         pitch_f_mem[0]=pitchf;

         }

    else if(frame_class_m<6)

         {

         if(fix_rate_mem!=RATE8_5K)

              {

              pitch_f_mem[1]=lag_f[N_SF2-1];

              pitch_f_mem[0]=lag_f[N_SF2-1];

              }

         else

              {

              pitch_f_mem[1]=lag_f[N_SF4-1];
				
				<dp n="d110"/>
            pitch_f_mem[0]=lag_f[N_SF4-1];

            }

        }

    PIT_PitchInterpolat(pitchf,pitch_f_mem,ForPitch,1);

    }
/*====================================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤LT PROCESSING¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*====================================================================*/

    cpy_dvector(NewTg+L_FRM,NewTg,0,NP-1);

    PPP_pitch_preproc(smv_mode,fix_rate,(*FlatSpFlag),nsr,wspeech,

                         NewTg+NP,ForPitch,&amp;Delay_pp,frame_class_pp,

                            &amp;frame_class,&amp;VUV,gp_pp);

    /*----------------------------------------------*/

    /*                           frame_class correction             */

    /*----------------------------------------------*/

    if((VUV==2)&amp;&amp;(frame_class>1)&amp;&amp;(OnSetFlag!=1))

        frame_class=1;

    if((frame_class==6)&amp;&amp;((fix_rate_mem==RATE2_0K)‖

        (fix_rate_mem==RATE0_8K)‖(fix_rate==RATE2_0K)‖

             (fix_rate==RATE0_8K)))

                  frame_class=5;

    if((frame_class==6)&amp;&amp;(frame_class_m<3)&amp;&amp;(switch_flag!=0))

         frame_class=5;

    /*----------------------------------------------*/

    /*            Rate modification because of the complexity      */

    /*----------------------------------------------*/

    if(switch_flag)

        {

        if((smv_mode>=1)&amp;&amp;(fix_rate==RATE8_5K)&amp;&amp;

                (frame_class==1))

                     fix_rate=RATE4_0K;

        if((frame_class_pp>0)&amp;&amp;(frame_class<6)&amp;&amp;
				
				<dp n="d111"/>
           (fix_rate==RATE4_0K)&amp;&amp;

                ((ol_lag[0]<30)‖(ol_lag[1]<30)))

                     fix_rate=RATE8_5K;
#ifdef PROG_BUG_FIX

         if((signaling==(char)1)&amp;&amp; fix_rate==RATE8_5K)

              {

              fix_rate=RATE4_0K;

              if(frame_class==6)

                   frame_class=5;

              if(frame_class_pp>0)

                   {

                   if(ol_lag[0]<30)

                        ol_lag[0]*=2;

                   if(ol_lag[1]<30)

                        ol_lag[1]*=2;

                   }

              }
#else

         if((signaling==(char)1)&amp;&amp;(fix_rate==RATE8_5K))

              {

              fix_rate=RATE4_0K;

              if(frame_class==6)

                   frame_class=5;

              if((frame_class_pp>0)&amp;&amp;

                   ((ol_lag[0]<30)‖(ol_lag[1]<30)))

                        ol_lag[0]*=2;

              }
#endif

          PRC_average_rate(fix_rate,avg_rate);

          }

     channel.fix_rate=fix_rate;

    /*----------------------------------------------*/
				
				<dp n="d112"/>
/*                   Reset open-loop pitch              */
/*----------------------------------------------*/
if(fix_rate==RATE8_5K)

     {

     for(i=0;i<2;i++)

         lag[i]=ol_lag[0];

     for(i=2;i<N_SF4;i++)

         lag[i]=ol_lag[1];

     }
else

     {

     lag[0]=ol_lag[0];

     lag[1]=ol_lag[1];

     }
if(frame_class_pp>0)

     {

     if(fix_rate==RATE8_5K)

          lag[N_SF4-1]=lagl;

     else if(lagl>=30)

          lag[N_SF2-1]=lagl;

     }
/*----------------------------------------------**/
/*             Quantize 3 stable LTP gains with 4bits        */
/*----------------------------------------------*/
if((frame_class==6)&amp;&amp;(fix_rate!=RATE2_0K)&amp;&amp;

     (fix_rate!=RATE0_8K))

     {

     channel.idx_SVS_deci=1;

     if(NoisyV_flag==1)

          for(i=0;i<N_SF4;i++)

              gp_pp[i]*=0.95;

     else if(NoisyV_flag==2)

          for(i=0;i<N_SF4;i++)

              gp_pp[i]*=0.92;

     if((*FlatSpFlag)==0)

          {

          if(smv_mode==0)
				
				<dp n="d113"/>
               {

               for(i=0;i<N_SF4;i++)

                   gp_pp[i]*=0.95;

               }

           else

               {

               for(i=0;i<N_SF4;i++)

                   gp_pp[i]*=0.97;

               }

           }

      if(fix_rate!=RATE8_5K)

           {

           /*----------------------------------------------*/

           /*                 4bits to quantize 3gp                */

           /*----------------------------------------------*/

           GEQ_Quant_PitchGain_3D(gp_pp,&amp;(channel.idx_Gp_VQ));

           }

       else

           {

           /*----------------------------------------------*/

           /*                 6bits to quantize 4gp                 */

           /*----------------------------------------------*/

           GEQ_Quant_PitchGain_4D(gp_pp,&amp;(channel.idx_Gp_VQ));

           }

       }
   else

       channel.idx_SVS_deci=0;
   /*----------------------------------------------*/
   /*                 Back to speech domain                         */
   /*----------------------------------------------*/

    PWF_wspeech_to_speech(NewTg+NP,wpdcf_zero,wpdcf_pole,LP_CF,&amp;Z1_ws_2);
/*===========================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤LPC QUANTIZATION AND INTERPOLATION ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*===========================================================*/
				
				<dp n="d114"/>
/*----------------------------------------------*/
/*    Estimate frame based and initial subframe based smoothing    */
/*----------------------------------------------*/
SMO_lsf_smooth_est(Vad,flag_vad_mem[0],refl[1][0],lsf_new,

                           &amp;beta_frm);
/*----------------------------------------------*/
/*      Smooth LSF,smoothing not active for coder_mode>=3        */
/*----------------------------------------------*/
for(i=0;i<NP;i++)

    lsf_smooth[i]=beta_frm*lsf_smooth[i]+

                            (1.0-beta_frm)*lsf_new[i];
/*----------------------------------------------*/
/*                        LSF quantization                         */
/*----------------------------------------------*/
LSF_Q_lsfqnt(lsf_smooth,lsfq_new,channel.idx_lsf,fix_rate);
/*----------------------------------------------*/
/*Interpolation of LSF and weighting filter coefficients extraction */
/*----------------------------------------------*/
if((*FlatSpFlag)==0)

     {

     if(NoisyV_flag>0)

         x=0.55;

     else

         x=0.6;

    }
else

    x=0.5;
r_pole_ws=0.25*r_pole_ws+0.75*x;
/*----------------------------------------------*/
if((fix_rate==RATE8_5K)‖(fix_rate==RATE2_0K)‖

     (fix_rate==RATE0_8K))

     {
				
				<dp n="d115"/>
    /*---------------------------------------------*/

    /*Interpolate the QUANTIZED lsf and get the LPC coefficients*/

    /*---------------------------------------------*/

    if((fix_rate==RATE2_0K)‖

         ((fix_rate==RATE8_5K)&amp;&amp;(frame_class!=6)))

               LPC_adptive_interp(lsfq_new,lsf_new2,lsfq_old,pdcfq,

                                    &amp;(channel.idx_lpc_iht));

    else

         LPC_adptive_interp_dec(lsfq_new,lsfq_old,pdcfq,0);

    /*---------------------------------------------*/

    for(i=0;i<N_SF4;i++)

        refl0[i]=refl[i][0];

    /*---------------------------------------------*/

    /*Perceptual weighting filter coefficients calculation    */

    /*---------------------------------------------*/

    for(i=0;i<N_SF4;i++)

        {

        val1=1.0;

        for(j=0;j<NP;j++)

            {

          val1*=r_pole_ws;

            wpdcf_pole[i][j]=pdcf[i][j]*val1;

            }

        }

    }
else

    {

    if(frame_class==6)

        {

        /*---------------------------------------------*/

        /*     Interpolate the QUANTIZED lsf and get the LPC   */

        /*                      coefficients                   */

        /*---------------------------------------------*/
				
				<dp n="d116"/>
    LPC_interpolate_lpc_4to3(lsfq_new,(FLOAT64*)NULL,

                                         lsfq_old,pdcfq,1);

    /*----------------------------------------------*/

    /*      Interpolate the UNQUANTIZED lsf and get the LPC  */

    /*                     coefficients                      */

    /*----------------------------------------------*/

    LPC_interpolate_lpc_4to3(lsf_new,lsf_new2,lsf_old,

                                          pdcf,0);

    /*----------------------------------------------*/

    x=6.5/40;

    refl0[0]=(1-x)*refl[0][0]+x*refl[1][0];

    refl0[1]=0.5*(refl[1][0]+refl[2][0]);

    refl0[2]=(1-x)*refl[3][0]+x*refl[2][0];

    /*----------------------------------------------*/

    /*Perceptual weighting filter coefficients calculation  */

    /*----------------------------------------------*/

    for(i=0;i<N_SF3;i++)

        {

        val1=1.0;

        val2=1.0;

        for(j=0;j<NP;j++)

            {

            val1*=GAMMA1;

            val2*=r_pole_ws;

            wpdcf_zero[i][j]=pdc[i][j]*val1;

            wpdcf_pole[i][j]=pdcf[i][j]*val2;

            }

        }

    }
else

    {

    /*----------------------------------------------*/

    /*    Interpolate the QUANTIZED lsf and get the LPC    */

    /*                      coefficients           */
				
				<dp n="d117"/>
        /*----------------------------------------------*/

        LPC_interpolate_lpc_4to2(lsfq_new,(FLOAT64*)NULL,

                                        lsfq_old,pdcfq,1);

        /*----------------------------------------------*/

        /*        Interpolate the UNQUANTIZED lsf and get the LPC  */

        /*                        coefficients                 */

        /*----------------------------------------------*/

        LPC_interpolate_lpc_4to2(lsf_new,lsf_new2,lsf_old,

                                        pdcf,0);

        /*----------------------------------------------*/

        refl0[0]=0.5*(refl[0][0]+refl[1][0]);

        refl0[1]=0.5*(refl[2][0]+refl[3][0]);

        /*----------------------------------------------*/

        /*Perceptual weighting filter coefficients calculation  */

        /*----------------------------------------------*/

        for(i=0;i<N_SF2;i++)

            {

            val1=1.0;

            val2=1.0;

            for(j=0;j<NP;j++)

                {

                val1*=GAMMA1;

                val2*=r_pole_ws;

                wpdcf_zero[i][j]=pdcf[i][j]*val1;

                wpdcf_pole[i][j]=pdcf[i][j]*val2;

                }

            }

        }

    }
/*----------------------------------------------*/
/*                 Flat input speech identifier             */
/*----------------------------------------------*/
				
				<dp n="d118"/>
CLA_Identify_Input(channel.idx_SVS_deci,pdcfq[0],lsfq_new[0],

                  pgain_past,&amp;lpcgain_q,fix_rate,FlatSpFlag);
if(fix_rate==RATE2_0K)

    {

    parm[0]=channel.idx_Isf[0];

    parm[1]=channel.idx_lsf[1];

    parm[2]=channel.idx_lpc_int;

    seed_enc=0x00000000;

    shft_count=15;

    for(j=0;j<3;j++)

        {

        shft_count-=bitno0[j];

        seed_enc=seed_enc^(((long)parm[j])<<shft_count);

        }

    }
else if(fix_rate==RATE0_8K)

    {

    parm[0]=channel.idx_lsf[0];

    parm[1]=channel.idx_lsf[1];

    parm[2]=channel.idx_lsf[2];

    seed_enc=0x00000000;

    shft_count=11;

    for(j=0;j<3;j++)

        {

        shft_count-=bitnol[j];

        seed_enc=seed_enc^(((long)parm[j])<<shft_count);

        }

    }
/*-----------------------------------------------*/
/*         Gaussian excitation for very low bit rates      */
/*-----------------------------------------------*/
if(nsr>0.125)

    x=1.0-0.6*nsr;
else

    x=1.0;
if((fix_rate==RATE0_8K)&amp;&amp;(nsr>0.125))

    x=0.4;
				
				<dp n="d119"/>
if(frame_class==6)

     x=1.0;
NoiseGainFactor=0.5*NoiseGainFactor+0.5*x;
if((fix_rate==RATE2_0K)‖(fix_rate==RATE0_8K))

     {

     GCB_gauss_excit(&amp;seed_enc,fix_rate,fix_rate_mem,nsr,ResEng,

                      qua_unfcod[1],qua_gainQ[1]);

     qua_gainQ[1][0]*=NoiseGainFactor;

     if(fix_rate==RATE2_0K)

          { 

          /*-----------------------------------------------*/

          /*Quantize′qua_gainQ[1][0]′and′qua_gainQ[1][2]′*/

          /*                   with 6+6bits                */

          /*-----------------------------------------------*/

     if((fix_rate_mem==RATE8_5K)‖(fix_rate_mem==RATE0_8K))

          GEQ_update_mem_4d_to_2d();

     else if((fix_rate_mem==RATE4_0K)&amp;&amp;(frame_class_m==6))

          GEQ_update_mem_3d_to_2d();

     qua_gainQ[1][2]*=NoiseGainFactor;

     GEQ_gainNSQMA_1_6(0,qua_unfcod[1],qua_gainQ,

                       &amp;(channel.idx_gainVQ[0]));

     GEQ_gainNSQMA_1_6(2,qua)unfcod[1],qua_gainQ,

                       &amp;(channel.idx_gainVQ[1]));

     qua_gainQ[1][1]=qua_gainQ[1][0];

     qua_gainQ[1][3]=qua_gainQ[1][2];

     }
else

     {

     /*-----------------------------------------------*/

     /*           Quantize′qua_gainQ[1][0]′5bits           */

     /*-----------------------------------------------*/

     if((fix_rate_mem==RATE4_0K)‖(fix_rate_mem==RATE2_0K))

         {

         if(frame_class_m!=6)
				
				<dp n="d120"/>
                    GEQ_update_mem_2d_to_4d();

                else

                    GEQ_update_mem_3d_to_4d();

                }

             GEQ_gainNSQMA_1_5(qua_unfcod[1],qua gainQ,

                                   &amp;(channel.idx_gainVQ[0]));

             for(i=1;i<N_SF4;i++)

                 qua_gainQ[l][i]=qua_gainQ[1][0];

             }

        }

    (*VoicingClass)=frame_class;
#ifdef MEM_TEST

    /*------------------------------------------------*/

    /*         Update the weighted speech buffer              */

    /*------------------------------------------------*/

    cpy_dvector(wspeech+L_FRM,wspeech,0,L_OLPIT-L FRM-L_LPCLHD-1);
#endif
/*=================================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤SUB-FRAME PROCESSING¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*=================================================================*/
/*-----------------------------------------------*/
/*----------------------------VARIABLE DESCRIPTION------------------------*/
/*-----------------------------------------------*/
/*                                                                    */
/*  pdcfq     - quantized prediction coefficients                     */
/*  wpdcf_pole- poles of the perceptual weighting filter              */
/*  wpdcf_zero- zeros of the perceptual weighting filter              */
/*                                                                    */
/*  Tgs       - target signal                                         */
				
				<dp n="d121"/>
/*  Tg         - target signal for codebook search                 */
/*               (no pitch contribution)                           */
/*  hh         - impulse response of the combined synthesis and    */
/*               perceptual weighting filter                       */
/*  unfcod[0]  - adaptive codebook(ACB)vector                      */
/*  unfcod[1]  - algebraic codebook(CDBK)vector                    */
/*  fcod[0]    - filtered ACB vector                               */
/*  fcod[1]    - filtered CDBK vector                              */
/*  gainQ[0]   - ACB gain                                          */
/*  gainQ[1]   - CDBK gain                                         */
/*  gainQ[2]   - CDBK gain                                         */
/*                                                                 */
/*  ext        - adaptive codebook                                 */
/*  lag[i_sf]  - integral lag of the current subframe               */
/*  lagf[i_sf] - fractional lag of the current subframe            */
/*------------------------------------------------*/
/*------------------------------------------------*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤First Loop With Unquantized Fixed CB Gains¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*------------------------------------------------*/

    if(fix_rate!=RATE4_0K)

         n_sf=N_SF4;

    else

        {

        if(frame_class==6)

             n_sf=N_SF3;

        else

             n_sf=N_SF2;

        }

    i_s=0;

    for(i_sf=0;i_sf<n_sf;i_sf++)

        {

        /*------------------------------------------------*/

        /*           Set-up of the sub-frame parameters            */

        /*------------------------------------------------*/

        if(fix_rate!=RATE4_0K)

             l_f=L_SF4;
				
				<dp n="d122"/>
else

    {

    if(frame_class==6)

         {

         if(i_sf==N_SF3-1)

              l_sf=L_SF3;

         else

              l_sf=L_SF0;

         }

    else

         l_sf=L_SF;

    }
/*------------------------------------------------*/
/*The impulse response with the all pole synthesis filter  */
/*         and the percerptual weighting filter             */
/*------------------------------------------------*/
LPC_ImpulseResponse(hh,wpdcf_zero[i_sf],wpdcf_pole[i_sf],

                        pdcfq[i_sf],l_sf);
cpy_dvector(hh,hh_m+i_s,0,l_sf-1);
/*------------------------------------------------*/
/*                      Target signal                    */
/*------------------------------------------------*/
PRC_TargetSignal(wpdcf_zero[i_sf],wpdcf_pole[i_sf],

                     pdcfq[i_sf],NewTg+i_s,ext+MAX_LAG,Tgs,

                         dif_mem,target_mem,l_sf);
if(i_sf==0)

     cpy_dvector(Tgs,Tgs_m,0,l_sf-1);
/*------------------------------------------------*/
/*                   Ideal excitation                         */
/*------------------------------------------------*/
PRC_Ideal_Excit(Tgs,pdcfq[i_sf],wpdcf_pole[i_sf],

                      wpdcf_zero[i_sf],res2,1_sf);
				
				<dp n="d123"/>
/*------------------------------------------------*/
/*                 LTP Contribution                      */
/*------------------------------------------------*/
if((fix_rate==RATE8_5K)‖(fix_rate==RATE4_0K))

     {

     if(frame_class==6)

          {

          /*----------------------------------------------*/

          /*                Pitch lag interpolation              */

          /*----------------------------------------------*/

          LTP_PP_pitch_ext(ForPitch+i_s,Tgs,ext,hh,i_sf,

                                unfcod[0],fcod[0],lag,lag_f,

                                &amp;Rp_Wn,l_sf);

          /*----------------------------------------------*/

          /*                   Pitch gain                         */

          /*----------------------------------------------*/

          gainQ[0]=gp_pp[i_sf];

          if(NoisyV_flag<2)

              gainQ[0]*=0.25*Rp_Wn+0.75;

          }

      else

          {

          /*----------------------------------------------*/

          /*               Close-loop search                    */

          /*----------------------------------------------*/

          if(fix_rate==RATE8_5K)

               LTP_close_8_5k_pitch(Tgs,ext,hh,i_sf,unfcod[0],

                   fcod[0],lag,lag_f,&amp;(gainQ[0]),&amp;Rp_Wn,l_sf,

                    frame_class_pp,channel.idx_pitch);

          else

               LTP_close_7b_pitch(Tgs,ext,hh,i_sf,unfcod[0],

                            fcod[0],lag,lag_f,&amp;(gainQ[0]),

                                 &amp;Rp_Wn,l_sf,frame_class_pp,

                                     channel.idx_pitch);

          /*----------------------------------------------*/

          /*Modify the gainQ[0]to de-emphasize the pitch       */
				
				<dp n="d124"/>
        /*                 contribution in the cdbk search       */

        /*----------------------------------------------*/

        gp_pp[i_sf]=gainQ[0];

        ac_sharp=PPP_sharpness(l_sf,unfcod[0]);

        if((frame_class>1)&amp;&amp;(ac_sharp<0.25))

             {

             x=MAX(MIN(5*ac_sharp-0.25,1.0),0.0);

             gainQ[0]*=(1-x)*Rp_Wn+x;

             }

        }

    /*----------------------------------------------*/

    /*       Save the results for the second loop          */

    /*----------------------------------------------*/

    cpy_dvector(unfcod[0],qua_unfcod[0]+i_s,0,l_sf-1);

    cpy_dvector(fcod[0],qua_fcod[0]+i_s,0,l_sf-1);

    }
else

    {

    gainQ[0]=0.0;

    gp_pp[i_sf]=0.0;

    Rp_Wn=0.0;

    lag_f[i_sf]=lag[i_sf];

    ini_dvector(unfcod[0],0,l_sf-1,0.0);

    ini_dvector(qua_unfcod[0]+i_s,0,l_sf-1,0.0);

    ini_dvector(fcod[0],0,l_sf-1,0.0);

    ini_dvector(qua_fcod[0],0,l_sf-1,0.0);

    }
/*----------------------------------------------*/
/*      Classify the speech subframe,used for excitation     */
/*                        preselection                       */
/*----------------------------------------------*/
SMO_initial_analysis(NewTg+i_s+NP,Vad,lag_f[i_sf],

                          refl0[i_sf],&amp;speech_mode,

                                      pitch_corr,l_sf);
/*----------------------------------------------*/
				
				<dp n="d125"/>
/*        Calculate the Target for codebook search    */
/*----------------------------------------------*/
for(i=0;i<l_sf;i++)

    {

    Tg[i]=Tgs[i]-gainQ[0]*fcod[0][i];

    res2[i]-=gainQ[0]*unfcod[0][i];

    }
/*----------------------------------------------*/
/*        Mode selection of fixed excitation:          */
/*          mixed search vs pure Gaussian              */
/*----------------------------------------------*/
SMO_refined_analysis(res2,speech_mode,pitch_corr,&amp;exc_mode,

                            &amp;beta_sub,l_sf);
/*----------------------------------------------*/
/*               Fixed Codebook search                 */
/*----------------------------------------------*/
k=exc_mode*frame_class;
if(NoisyV_flag==1)

    k=2;
if(NoisyV_flag==2)

    k=1;
switch(fix_rate)

    {

    case RATE8_5K:

            if(frame_class==6)

                  {

                  FCS_cdbk_search_30b_sub40(ext,pdcfq[i_sf],

                          Tg,res2,hh,unfcod[1],l_sf,i_sf,

                               lag[i_sf],k,gp_pp[i_sf],

                                    nsr,Rp_Wn,&amp;channel);

                  }

            else

                  {

                  FCS_cdbk_search_22b_sub40(ext,pdcfq[i_sf],

                          Tg,res2,hh,unfcod[1],l_sf,i_sf,

                               lag[i_sf],k,pgain_past,
				
				<dp n="d126"/>
                           nsr,Rp_Wn,&amp;channel);

                       }

              break;

          case RATE4_0K:

                  if(frame_class==6)

                       {

                       FCS_cdbk_search_13b_sub54(ext,pdccfq[i_sf],

                              Tg,res2,hh,unfcod[1],

                                  l_sf,i_sf,lag[i_sf],k,

                                       gp_pp[i_sf],nsr,Rp_Wn,

                                           fix_rate_mem,

                                           lpcgain_q,&amp;channel);

                       }

                   else

                       {
#ifdef MEM_TEST

                       ini_dvector(&amp;sigsyn[NP],0,L_SF-1,-1.0);

                       ini_dvector(&amp;qua_sigsyn[NP],0,L_SF-1,-1.0);

                       ini_dvector(dif_mem,0,L_SF+NP-1,-1.0);

                       ini_dvector(qua_dif_mem,0,L_SF+NP-1,-1.0);

                       px=&amp;wspeech[L_OLPIT-L_FRM-L_LPCLHD];

                       ini_dvector(px,0,L_FRM+L_LPCLHD-1,-1.0);

                       ini_dvector(hh_w,0,L_SF-1,-1.0);

                       ini_dvector(ForPitch,0,L_FRM+L_FRM/2-1,-1.0);

                       px=&amp;qua_unfcod[0][0];

                       ini_dvector(px,i_s,L_FRM-1,-1.0);

                       px=&amp;qua_unfcod[1][0];

                       ini_dvector(px,i_s,L_FRM-1,-1.0);

                       px=&amp;qua_fcod[0][0]; 

                       ini_dvector(px,i_s,L_FRM-1,-1.0);

                       px=&amp;qua_fcod[1][0];

                       ini_dvector(px,L_s,L_FRM-1,-1.0);

                       ini_dvector(qua_ext,0,MAX_LAG+L_SF-1,-1.0);

                       ini_dvector(qua_Tg,0,L_SF-1,-1.0);
				
				<dp n="d127"/>
                    ini_dvector(rxx,0,NP,-1.0);

                    ini_dvector(refl0,0,N_SF MAX-1,-1.0);

                    for(i=0;i<N_SF_MAX+1;i++)

                         {

                         px=&amp;pdcf[i][0];

                         ini_dvector(px,0,NP-1,-1.0);

                         }

                    ini_dvector(lsfq_new,0,NP-1,-1.0);

                    ini_dvector(lsf_new2,0,NP-1,-1.0);

                    ini_dvector(lsf_new3,0,NP-1,-1.0);

                    ini_dvector(lsf_int,0,NP-1,-1.0);

                    ini_dvector(sigpp,i_s,L_FRM-1,-1.0);
#endif    

                    FCS_cdbk_search_15b_sub80(ext,pdcfq[i_sf],

                            Tg,res2,hh,unfcod[1],l_sf,i_sf,

                               lag[i_sf],k,pgain_past,

                                     nsr,Rp_Wn,fix_rate_mem,

                                         lpcgain_q,&amp;channel);

                    }

            break;

       case RATE2_0K:case RATE0_8K:

               cpy_dvector(qua unfcod[1]+i_s,unfcod[1],0,l_sf-1);

               gainQ[1]=qua_gainQ[1][i_sf];

            break;

       default:nrerror(″Invalid fix_rate!!\n″);

            break;

       }

    /*----------------------------------------------*/

    /*         Filter the selected excitation vector         */

    /*----------------------------------------------*/

    buf=dvector(0,l_sf-1);
				
				<dp n="d128"/>
filterAZ(hh,unfcod[1],fcod[1],buf,(INT16)(l_sf-1),l_sf);
free_dvector(buf,0,l_sf-1);
/*------------------------------------------------*/
/*                      Gains                               */
/*------------------------------------------------*/
if((fix_rate==RATE8_5K)‖(fix_rate==RATE4_0K))

    {

    /*-----------------------------------------------*/

    /*                     Unquantized gains                */

    /*-----------------------------------------------*/

    GainModiDeci=1;

    if((frame_class<6)&amp;&amp;(frame_class>1))

         GEQ_gain_reopt_2(fcod[0],fcod[1],Tgs,gainQ,

                               gainQ+1,l_sf);

    else

        {

        gainQ[0]=gp_pp[i_sf];

        for(i=0;i<l_sf;i++)

             Tg[i]=Tgs[i]-gainQ[0]*fcod[0][i];

        dot_dvector(Tg,fcod[1],&amp;gainQ[1],0,1_sf-1);

        dot_dvector(fcod[1],fcod[1],&amp;val1,0,1_sf-1);

        gainQ[1]/=MAX(val1,0.01);

        }

    /*-----------------------------------------------*/

    /*                Gain normalization                    */

    /*-----------------------------------------------*/

    if(frame_class<6)

         {

         if(GainNormDeci==0)
				
				<dp n="d129"/>
                        beta_sub=0.0;

                    GainNormDeci=0;

                    if((nsr>0.125)‖(frame_class<=1)‖

                            ((fix_rate==RATE4_0K)&amp;&amp;(Rp_Wn<0.5)))

                            {

                            GainNormDeci=1;

                            if(fix_rate==RATE8_5K)

                                 x=ResEng[(short)(i_sf/2)];

                            else

                                 x=ResEng[i_sf];

                            PRC_GainsNorm_Gc_Gp(nsr,x,ext+MAX_LAG,gainQ,

                                       unfcod,fcod,Tgs,Vad*exc_mode,

                                            beta_sub,l_sf);

                            }

                    gainQ[0]*=NoiseGainFactor;

                    gainQ[1]*=NoiseGainFactor;

                    }

                else

                    {

                    if(nsr>0.25)

                         PRC_GainNorm_Gc(ext+MAX_LAG,gainQ,unfcod,

                                                       fcod,Tg,l_sf);
#ifdef PROG_BUG_FIX

                GainNormDeci=0;
#endif

                }

             /*-----------------------------------------------*/

             /*                     Gain Quantization                   */

             /*-----------------------------------------------*/

             /*-----------------------------------------------*/

             /*                      Limit pitch gain                    */

             /*-----------------------------------------------*/

             if(gainQ[0]<0.0)

                  gainQ[0]=0.0;
				
				<dp n="d130"/>
           if(gainQ[0]>1.2)

                gainQ[0]=1.2;

           for(i=0;i<LTP_BUFF_SIZE-1;i++)

               pgain_buf[i]=pgain_buf[i+1];

           pgain_buf[LTP_BUFF_SIZE-1]=gainQ[0];

           if(gainQ[1]<0.0)

               FCS_ChangeSign(&amp;channel,i_sf,l_sf,unfcod[1],fcod[1],

                               gainQ+1);

           /*------------------------------------------------*/
#ifdef MEM_TEST

           cpy_dvector(unfcod[0],qua_unfcod[0]+i_s,0,l_sf-1);

           cpy_dvector(fcod[0],qua_fcod[0]+i_s,0,l_sf-1);
#endif

           cpy_dvector(unfcod[1],qua_unfcod[1]+i_s,0,l_sf-1);

           cpy_dvector(fcod[1],qua_fcod[1]+i_s,0,l_sf-1);

           if(GainModiDeci==0)

               cpy_dvector(Tgs,Tg,0,l_sf-1);

           else

               wad_dvector(fcod[0],gainQ[0],fcod[1],gainQ[1],

                                 Tg,0,lk_sf-1);

           cpy_dvector(Tg,&amp;qua_Tg[i_s],0,l_sf_1);

           /*------------------------------------------------*/

           if(frame_class!=6)

                {

                if(fix_rate!=RATE8_5K)

                     {

                     if(((fix_rate_mem==RATE8_5K)‖

                          (fix_rate_mem==RATE0_8K))&amp;&amp;(i_sf==0))

                               GEQ_update_mem_4d_to_2d();

                     else_if((fix_rate_mem==RATE4_0K)&amp;&amp;

                               (frame_class_m==6)&amp;&amp;(i_sf==0))
				
				<dp n="d131"/>
                         GEQ_update_mem_3d_to_2d();

              GEQ_gainVQMA_2(Tg,unfcod,fcod,gainQ,

                         &amp;(channel.idx_gainVQ[i_sf]),

                            l_sf,fix_rate);

              }

          else

              {

              if(((fix_rate_mem==RATE4_0K)‖

                   (fix_rate_mem==RATE2_0K))&amp;&amp;(i_sf==0))

                   {

                   if(frame_class_m!=6)

                        GEQ_update_mem_2d_to_4d();

                   else

                        GEQ_update_mem_3d_to_4d();

                   }

                GEQ_gainVQMA_2(Tg,unfcod,fcod,gainQ,

                              &amp;(channel.idx_gainVQ[i_sf]),

                                  1_sf,fix_rate);

                }

             }

        /*------------------------------------------------*/

        /*Update the past quantized pitch gain for cdbk search*/

        /*------------------------------------------------*/

        pgain_past=gainQ[0];

        if(pgain_past<PAST_PGAIN_MIN)

                 pgain_past=PAST_PGAIN_MIN;

        if(pgain_past>PAST_PGAIN_MAX)

                 pgain_past=PAST_PGAIN_MAX;

        qua_gainQ[0][i_sf]=gainQ[0];

        qua_gainQ[1][i_sf]=gainQ[1];

        }

    else

        {

        /*------------------------------------------------*/

        /*                   fix_rate==RATE2_0K‖fix_rate==RATE0_8K    */

        /*------------------------------------------------*/
				
				<dp n="d132"/>
    GainNormDeci=0;

    gainQ[0]=0.0;

    pgain_past=gainQ[0];

    qua_gainQ[0][i_sf]=0;

    gainQ[1]=qua_gainQ[1][i_sf];

    cpy_dvector(fcod[1],qua_fcod[1]+i_s,0,l_sf-1);

    }
/*-----------------------------------------------*/
/*       Build the excitation and synthesized signal    */
/*-----------------------------------------------*/
wadd_dvector(unfcod[0],gainQ[0],unfcod[1],gainQ[1],

                       ext+MAX_LAG,0,l_sf-1);
/*-----------------------------------------------*/
/*                           Update memory              */
/*-----------------------------------------------*/
FLT_allsyn(ext+MAX_LAG,l_sf,pdcfq[i_sf],NP,sigsyn+NP,

                                                          synth_mem);
for(i=l_sf-NP,j=0;i<l_sf;i++,j++)

    {

    dif_mem[j]=NewTg[i_s+NP+i]-sigsyn[i+NP];

    target_mem[j]=Tgs[i]-gainQ[0]*fcod[0][i]

                         -gainQ[1]*fcod[1][i];

    }
/*-----------------------------------------------*/
/*                   Update the adaptive codebook                  */
/*-----------------------------------------------*/
cpy_dvector(ext+l_sf,ext,0,MAX_LAG-1);
/*-----------------------------------------------*/
i_s+=l_sf;
/*========================================*/
}
				
				<dp n="d133"/>
/*=================================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤Second Loop With Quantized Fixed CB Gains¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*=================================================================*/

    if((frame_class==6)&amp;&amp;(fix_rate!=RATE2_0K)&amp;&amp;(fix_rate!=RATE0_8K))

         {

         /*-------------------------------------------------*/

         /*                 Quantize 3 fixed CB gains                 */

         /*-------------------------------------------------*/

         if(fix_rate!=RATE8_5K)

              {

              if((fix_rate_mem==RATE8_5K)‖(fix_rate_mem==RATE0_8K)))

                       GEQ_update_mem_4d_to_3d();

              else if(frame_class_m!=6)

                       GEQ_update_mem_2d_to_3d();

              GEQ_gainVQMA_3(qua_Tg,qua_unfcod,qua_fcod,qua_gainQ,

                              &amp;(channel.idx_Gc_VQ));

              }

         else

              {

              if(((fix_rate_mem==RATE4_0K)‖(fix_rate_mem==RATE2_0K)))

                   {

                   if(frame_class_m!=6)

                        GEQ_update_mem_2d_to_4d();

                   else

                        GEQ_update_mem_3d_to_4d();

                   }

              GEQ_gainVQMA_4(qua_Tg,qua_unfcod,qua_fcod,qua_gainQ,

                                &amp;(channel.idx_Gc_VQ));

              }

              /*-------------------------------------------------*/

         i_s=0;

         for(i_sf=0;i_sf<n_sf;i_sf++)

              {

              /*===============================================*/

              if(fix_rate==RATE8_5K)
				
				<dp n="d134"/>
    l_sf=L_SF4;
else

    {

    if(i_sf=N_SF3-1)

         l_sf=L_SF3;

    else

         l_sf=L_SF0;

    }
/*-------------------------------------------------*/
/*                    Target signal                        */
/*-------------------------------------------------*/
if(i_sf>0)

    {

    PRC_TargetSignal(wpdcf_zero[i_sf],wpdcf_pole[i_sf],

                 pdcfq[i_sf],NewTg+i_s,ext+MAX_LAG,Tgs,

                     qua_dif_mem,qua_target_mem,l_sf);

    }
else

    cpy_dvector(Tgs_m,Tgs,0,l_sf-1);
/*-------------------------------------------------*/
/*                  Re-build adaptive CB excitation             */
/*-------------------------------------------------*/
if(i_sf>0)

    {

    LTP_PP_pitch_ext_decod(ForPitch+i_s,qua_ext,i_sf,

                      qua_unfcod[0]+i_s,lag,lag_f,l_sf);

    /*-------------------------------------------------*/

    buf=dvector(0,l_sf-1);

    filterAZ(hh_m+i_s,qua_unfcod[0]+i_s,qua_fcod[0]+i_s,

                                    buf,(INT16)(l_sf-1),l_sf);

    free_dvector(buf,0,l_sf-1);

    /*-------------------------------------------------*/
				
				<dp n="d135"/>
         }

    /*--------------------------------------------------*/

    /*         Build the excitation and synthesized signal     */

    /*--------------------------------------------------*/

    wad_dvector(qua_unfcod[0]+i_s,qua_gainQ[0][i_sf],

                     qua_unfcod[1]+i_s,qua gainQ[1][i_sf],

                         qua_ext+MAX_LAG,0,l_sf-1);

    /*--------------------------------------------------*/

    /*                             Update memory               */

    /*--------------------------------------------------*/

    FLT_allsyn(qua_ext+MAX_LAG,l_sfd,pdccfq[i_sf],NP,

                     qua_sigsyn+NP,qua_synth_mem);

    g1=qua_gainQ[0][i_sf];

    g2=qua_gainQ[1][i_sf];

    for(i=l_sf-NP,j=0;i<1_sf;i++,j++)

        {

        qua_dif_mem[j]=NewTg[i_s+NP+i]-qua_sigsyn[i+NP];

        qua_target_mem[j]=Tgs[i]-g1*qua_fcod[0][i+i_s]

                               -g2*qua_fcod[1][i+i_s];

        }

    /*--------------------------------------------------*/

    /*            Update the adaptive codebook               */

    /*--------------------------------------------------*/

    cpy_dvector(qua_ext+l_sf,qua_ext,0,MAX_LAG-1);

    i_s+=l_sf;

    /*======================================================*/

    }
/*--------------------------------------------------*/
/*              Modify the memorys for next frame           */
				
				<dp n="d136"/>
        /*--------------------------------------------------*/

        cpy_dvector(qua_synth_mem,synth_mem,0,NP-1);

        cpy_dvector(qua_dif_mem,dif_mem,0,NP-1); 

        cpy_dvector(qua_target_mem,target_mem,0,NP-1);

        cpy_dvector(qua_ext,ext,0,MAX_LAG-1);

        /*========================================*/

        }

    else

        {

        /*--------------------------------------------------*/

        /*                 Modify the memorys for next frame             */

        /*--------------------------------------------------*/

        cpy_dvector(synth_mem,qua_synth_mem,0,NP-1);

        cpy_dvector(dif_mem,qua_dif_mem,0,NP-1);

        cpy_dvector(target_mem,qua_target_mem,0,NP-1);

        cpy_dvector(ext,qua_ext,0,MAX_LAG-1);

        }

    /*--------------------------------------------------*/

    /*               Index to bitstream convertion                  */

    /*--------------------------------------------------*/

    BIT_cdbk_index_to_bits(&amp;channel,PackedWords,PackWdsPtr);
#ifdef DIAG_SMV
/*=============================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤             ¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤        DECODER        ¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤             ¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*=============================================*/

    i_s=0;

    for(i_sf=0;i_sf<n_sf;i_sf++)

         {
				
				<dp n="d137"/>
if(fix_rate!=RATE4_0K)

    l_sf=L_SF4;
else

    {

    if(frame_class==6)

         {

         if(i_sf==N_SF3-1)

             l_sf=L_SF3;

         else

             l_sf=L_SF0;

         }

    else

         l_sf=L_SF;

    }
/*---------------------------------------------------*/
cpy_dvector(qua_unfcod[0]+i_s,unfcod[0],0,l_sf-1);
cpy_dvector(qua_unfcod[1]+i_s,unfcod[1],0,l_sf-1);
wad_dvector(unfcod[0],qua_gainQ[0][i_sf],unfcod[1],

                  qua_gainQ[1][i_sf],qua_sigsyn+NP,0,l_sf-1);
FLT_allsyn(qua_sigsyn+NP,l_sf,pdcfq[i_sf],NP,

                  qua_sigsyn+NP,synth_mem_dec);
/*---------------------------------------------------*/
/*                       Post processing                       */
/*---------------------------------------------------*/
switch(fix_rate)

    {

    case RATE8_5K:if((*FlatSpFlag)==0)

                         {

                         x=0.65;

                         y=0.4;

                         }

                     else

                         {

                         x=0.63;

                         y=0.4;
				
				<dp n="d138"/>
                                    }

                 break;

            case RATE4_0K:x=0.63;

                          y=0.5;

                 break;

            case RATE2_0K:x=0.63;

                          y=0.0;

                 break;

            case RATE0_8K:x=0.63;

                          y=0.0;

                 break;

            default:nrerror(″Invalid fix_rate!!″″);

                 break;

            }

        PPR_post_process(qua_sigsyn,pdcfq[i_sf],x,y,lag_f[i_sf],

                                   l_sf,(*FlatSpFlag),fix_rate);

        /*---------------------------------------------------*/

        /*              Update the synthesized speech buffer         */

        /*---------------------------------------------------*/

        cpy_dvector(qua_sigsyn+NP,enc_sigout+i_s,0,l_sf-1);

        /*---------------------------------------------------*/

                i_s+=l_sf;

        }
#endif
#ifdef DIAG_SMV

      DIA_trace_data((FLOAT64)Vad,L_FRM,10000.0,fdia_vad);
#endif

      /*---------------------------------------------------*/
				
				<dp n="d139"/>
    return;

    /*----------------------------------------------------*/

    }
/*=========================================================*/
/*--------------------------------------END-----------------------------*/
/*=========================================================*/
				
				<dp n="d140"/>
/*====================================================*/
/*=====================================*/
/*Conexant System Inc.                                            */
/*4311 Jamboree Road                                              */
/*Newport Beach,CA 92660                                          */
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                        */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                            */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*================================================*/
/*PROTOTYPE:encoder.h                                              */
/*================================================*/
/*----------------------------------------------------*/
/*-------------------------------FUNCTIONS--------------------------*/
/*----------------------------------------------------*/
void enc_smv_frame(FLOAT64 sigpp[],INT16 PackedWords[],FLOAT64 enc_sigout[],

                  INT16 smv_mode,INT16 switch_flag,INT16 *FlatSpFlag,

                      char signaling,FLOAT64 *av_rat,INT16 *VoicingClass);
/*========================================================*/
/*-------------------------------END--------------------------------*/
/*========================================================*/
				
				<dp n="d141"/>
/*===================================================*/
/*=============================================*/
/*Conexant System Inc.                                           */
/*4311 Jamboree Road                                             */
/*Newport Beach,CA 92660                                         */
/*----------------------------------------------------*/
/*Copyright(C)2000 Concxant System Inc.                          */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                              */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation*/
/*or adaptation)without the authorisation of Conexant System Inc. */
/*==================================================*/
/*FILE:ext_var.h                                                  */
/*==================================================*/
#ifdef DIAG_SMV
/*======================================================*/
/*===================DIAGNOSTICS FILE POINTERS===================*/
/*======================================================*/
/*----------------------------------------------------*/
/*                        Encoder unquantized                    */
/*----------------------------------------------------*/
extern FILE *fdia_vad;
/*----------------------------------------------------*/
/*                        Encoder quantized                      */
/*----------------------------------------------------*/
extern FILE *fdia_sp_enc;
/*----------------------------------------------------*/
/*                  Floating point parameter dump                */
/*----------------------------------------------------*/
/*----------------------------------------------------*/
				
				<dp n="d142"/>
/*                            Decoder                        */
/*----------------------------------------------------*/
#endif
/*========================================================================*/
/*===============================FRAME COUNTERS==================================*/
/*========================================================================*/
extern INT64 frm_count;
extern INT64 frm_erasure;
/*========================================================================*/
/*================================SMV CONTROL==================================*/
/*========================================================================*/
extern INT16 smv_mode;
extern INT 16 fix_rate,fix_rate_mem;
/*========================================================================*/
/*===============================NOISE SUPRESSION=================================*/
/*========================================================================*/
extern FLOAT64 MIN_GAIN;
/*========================================================================*/
/*=============================PRE AND POST PROCESSING===============================*/
/*========================================================================*/
extern FLOAT64 *pre_flt_num;
extern FLOAT64 *pre_flt_den;
extern FLOAT64 *pre_flt_buf_z;
extern FLOAT64 *pre_flt_buf_p;
extern FLOAT64 pre_gain;
extern FLOAT64 *lp_flt_num;
extern FLOAT64 *lp_flt_buf;
/*----------------------------------------------------*/
				
				<dp n="d143"/>
extern INT16  *zeroed;
extern FLOAT64 *zero_rate;
extern FLOAT64 *low_rate;
extern FLOAT64 *high_rate;
extern FLOAT64 *low_neg;
extern FLOAT64 *low_pos;
extern INT32  min_delta;
extern FLOAT64  zero_level;
extern FLOAT64  12neg,l1_neg,l1_pos,l2_pos;
/*----------------------------------------------------*/
extern FLOAT64 tc_mem_dec;
extern FLOAT64 tc_coeff;
extern FLOAT64 tc_gain;
extern FLOAT64 *tc_buff_exc;
/*----------------------------------------------------*/
extern FLOAT64 *buff_LTpost;
extern FLOAT64 *PF_mem_syn;
extern FLOAT64 r_zero,r_pole;
extern FLOAT64 pst_scale;
extem FLOAT64 pst_hp_mem;
/*----------------------------------------------------*/
extern F LOAT64 *pst_flt_num;
extern F LOAT64 *pst_flt_den;
extern FLOAT64 *pst_flt_buf_z;
extern FLOAT64 *pst_flt_buf_p;
extern FLOAT64 pst_gain;
/*================================================================*/
/*==============================LPC ANALYSIS============================*/
/*================================================================*/
				
				<dp n="d144"/>
extern FLOAT64 *siglpc;
/*-----------------------------------------------------*/
/*                 LPC analysis window                    */
/*-----------------------------------------------------*/
extern FLOAT64 *lpc_window;
extern FLOAT64 *lpc_window1;
extern FLOAT64 *lpc_window2;
/*-----------------------------------------------------*/
/*                    Tilt analysis window                   */
/*-----------------------------------------------------*/
extern FLOAT64 *tilt_window;
/*-----------------------------------------------------*/
/*                Bandwidth expansion factor             */
/*-----------------------------------------------------*/
extern FLOAT64 *bwe_factor;
/*-----------------------------------------------------*/
/*                     LPC parameters                     */
/*-----------------------------------------------------*/
extern FLOAT64 pderr;
extern FLOAT64 *rxx,**refl,**pdcf,**pdcfp,**pdcfq_dec;
extern FLOAT64 *lsf_new,*lsf_old,*lsf_mid;
/*-----------------------------------------------------*/
extern FLOAT64 erg,lpcgain;
extern FLOAT64  sub_lpcg;
/*-----------------------------------------------------*/
extern FLOAT64  *IntLSF_C;
/*=================================================*/
/*=====================Weighted Speech=====================*/
				
				<dp n="d145"/>
/*================================================================*/
extern FLOAT64 r_pole_ws;
extern FLOAT64 **wpdcf_zero,**wpdcf_pole;
extern FLOAT64 *wspeech,*wspeech_mem;
extern FLOAT64 Z1_ws_1,Z1_ws_2;
extern FLOAT64 *ModiSig_m,*tmp_ws_m;
/*================================================================*/
/*=============================Fixed codebook search=========================*/
/*================================================================*/
extern FLOAT64 **fcod,**unfcod;
extern FLOAT64 **qua_fcod,**qua_unfcod;
/*================================================================*/
/*=========================Residual and target signal buffer=======================*/
/*================================================================*/
/*================================================================*/
/*================================Gain VQ============================*/
/*================================================================*/
extern INT16 GainNormDeci,GainModiDeci;
extern FLOAT64 pgain_past;
extern FLOAT64 pgain_past_dec;
extern FLOAT64 **qua gainQ;
extern FLOAT64 *past_energyq_2d;
extern FLOAT64 *past_energyq_3d;
extern FLOAT64 *past_energyq_4d;
extern FLOAT64 *gp_buf;
extern FLOAT64 past_fixed_energy;
extern FLOAT64 *Prev_Beta_Pitch;
				
				<dp n="d146"/>
extern FLOAT64 *energy_pred_coeff_1;
extern FLOAT64 *energy_pred_coeff_2;
extern FLOAT64 *energy_pred_coeff_3;
extern FLOAT64 *energy_pred_coeff4d_1;
extern FLOAT64 *energy_pred_coeff4d 2;
extern FLOAT64 *energy_pred_coeff4d_3;
extern FLOAT64 *energy_pred_coeff4d_4;
extern FLOAT64 *pred_energy_d38;
extern FLOAT64 *pred_energy_d410;
extern FLOAT64 gp_mean;
extern FLOAT64 gp_fec;
extern FLOAT64 **gain_cb_2_128;
extern FLOAT64 **gain_cb_2_128_8_5;
extern FLOAT64 gp3_tab[TAB_SIZE_GVQ_3D][GVQ_VEC_SIZE_3D];
extern FLOAT64 gp4_tab[TAB_SIZE_GVQ_4D][GVQ_VEC_SIZE_4D];
extern FLOAT64 gainVQ_2_128[MSMAX_2_128][GVQ_VEC_SIZE_2D];
extern FLOAT64 gainVQ_2_128_8_5[MSMAX_2_128][GVQ_VEC_SIZE_2D];
extern FLOAT64 gainVQ_3_256[MSMAX_3_256][GVQ_VEC_SIZE_3D];
extern FLOAT64 gainVQ_4_1024[MSMAX_4_1024][GVQ_VEC_SIZE_4D];
extern FLOAT64 gainSQ_1_32[MSMAX_1_32];
extern FLOAT64 gainSQ_1_64[MSMAX_1_64];
/*=========================================================*/
/*=========================LSF quantizers=========================*/
/*=========================================================*/
extern FLOAT64 ***lsf_cb_08k;
extern FLOAT64 ***lsf_cb_40k;
extern FLOAT64 ***lsf_cb_85k;
extern INT16  *stage_cand_08k;
extern INT16  *stage cand 40k;
extern INT16  *stage_cand_85k;
extern FLOAT64B_08k[LP_08k][LQMA_08k][MAXLNp];
extern FLOAT64B_40k[LP_40k][LQMA_40k][MAXLNp];
				
				<dp n="d147"/>
extern FLOAT64 B_85k[LP_85k][LQMA_85k][MAXLNp];
extern FLOAT64 CBes_08k[MAXLTT_08k][LMSMAX_08k][MAXLNp];
extern FLOAT64 CBes_40k[MAXLTT_40k][LMSMAX_40k][MAXLNp];
extern FLOAT64 CBes_85k[MAXLTT_85k][LMSMAX_85k][MAXLNp];
extern INT16  *MS_08k;
extern INT16  *MS_40k;
extern INT16  *MS_85k;
extern FLOAT64 *last_qlsf;
extern FLOAT64 *lsfq_old,*lsfq_old_dec;
extern FLOAT64 *Mean;
extern FLOAT64 **qes;
extern FLOAT64 **qes_dec;
extern FLOAT64 *lsfq_mem_dec;
extern FLOAT64 *lsfq_mem_enc;
/*====================================================*/
/*=========================PITCH OPEN LOOP====================*/
/*====================================================*/
extern INT16  *ol_lag;
extern INT16  *lag;
extern INT16 lagl,low_pit,high_pit;
extern FLOAT64 *Rp_sub;
extern FLOAT64 pitchf;
/*--------------------------------------------------------*/
/*--------------------------------------------------------*/
extern FLOAT64 *PitLagTab5b;
extern FLOAT64 *PitLagTab7b;
extern FLOAT64 *PitLagTab8b;
				
				<dp n="d148"/>
extern FLOAT64 *SincWindows;
/*--------------------------------------------------------*/
extern INT16 VUVmm,pitch_m,pitch_mm,Iopt0;
extern INT16  *PITmax0;
extern INT16 LagCount,VadCount,Av_lag;
extern FLOAT64 Rp_m;
extern FLOAT64 *Rmax0;
/*--------------------------------------------------------*/
extern FLOAT64 *pitch_f_mem;
/*====================================================*/
/*====================CLOSED PITCH PROCESSING====================*/
/*====================================================*/
extern FLOAT64 *ext;
extern FLOAT64 *SincWindows_E;
extern FLOAT64 *NewTg;
extern FLOAT64 *lag_f;
extern INT16 pitch_index,pre_pitch_index;
/*====================================================*/
/*=====================PITCH PRE-PROCESSING=====================*/
/*====================================================*/
extern FLOAT64 *SincWindows_PP;
extern FLOAT64 Delay_pp,Last_Rp;
extern INT16 frame_class_pp_m;
extern FLOAT64 *targ_mem;
/*====================================================*/
/*====================PRC LIBRARY PROCESSING=====================*/
/*====================================================*/
extern FLOAT64 cl_Eg,ol_Eg;
				
				<dp n="d149"/>
extern FLOAT64 m_lpc_gain;
/*===================================================================*/
/*=============================GCB LIBRARY PROCESSING===========================*/
/*===================================================================*/
extern INT64 seed_exc;
extern FLOAT64 Z1_gcb;
extern FLOAT64 ref_eng_gcb;
extern INT16 rate_mem;
extern INT64 seed_dec;
/*===================================================================*/
/*=============================CLA LIBRARY PROCESSING===========================*/
/*===================================================================*/
extern INT 16VUV,VUVm;
extern INT16 frame_class,frame_class_m,frame_class_pp;
extern FLOAT64 energy,energy_m;
extern INT16 frame_onset;
extern INT16 frame_pit_tab,min_pit,max_pit;
extern INT16 *frame_class_mem,*onstplsv_mem,*voiced_mem;
extern FLOAT64 *window1;
extern FLOAT64 *buffer_cla;
extern FLOAT64 *Lp_buffer;
extern FLOAT64 *buffer_refl0;
extern FLOAT64 *buffer_max_cla;
extern FLOAT64 *buffer_wtilt,*buffer_wmax,*buffer_wRp;
extern FLOAT64 E_noi,T_noi,M_noi,R_noi;
extern FLOAT64 **P_w,MA_avg_wRp,MA_min_wtilt;
extern INT16 SVS_Count,Vad_0_Count,FlaSp_Flag;
extern FLOAT64 Av_value;
/*---------------------------------------------------------*/
extern FLOAT64 Rp_m_cla,lpcg_m_cla;
				
				<dp n="d150"/>
/*---------------------------------------------------------*/
extern INT16 OnSet;
extern INT16 frame_class_mm;
/*---------------------------------------------------------*/
INT16 SVS_deci_mem;
/*=======================================================*/
/*=======================VAD LIBRARY PROCESSING=====================*/
/*=======================================================*/
extern INT16 *lag_buf;
extern FLOAT64 *pgain_buf;
extern INT16 Vad,*flag_vad_mem;
extern INT16 flag;
extern INT16 count_sil;
extern INT16 count_ext;
extern INT16 count_noise;
extern INT16 dec3_flg_mem;
extern INT16 onset_flg,count_onset;
extern FLOAT64 pitch_gain_mean;
extern FLOAT64 **vad_lsf_mem;
extern FLOAT64 min_energy;
extern FLOAT64 mean_energy;
extern FLOAT64 *prev_cml_lsf_diff;
extern FLOAT64 *prev_energy;
extern FLOAT64 snr;
extern FLOAT64 mean_max;
extern FLOAT64 mean_s_energy;
extern FLOAT64 prev_min_energy;
extern FLOAT64 *min_energy_mem;
extern FLOAT64 next_min_energy;
extern FLOAT64 *mean_lsf;
extern FLOAT64 *norm_mean_lsf;
extern FLOAT64 cml_lsf_diff_filt;
extern FLOAT64 onset_trhsd;
				
				<dp n="d151"/>
/*=========================================================*/
/*========================SNR LIBRARY PROCESSING======================*/
/*=========================================================*/
extern FLOAT64 NoiseGainFactor;
extern INT16 n_nois_ext_enc;
extern FLOAT64 NoisEng_enc,eng_old_enc,diff_lsf_m_enc,diff_eng_m_enc;
extern INT16 snr_frm_count,snr_count_vad;
extern FLOAT64 eng_m_enc;
/*=========================================================*/
/*========================SMO LIBRARY PROCESSING======================*/
/*=========================================================*/
extern FLOAT64 *lsf_smooth;
extern INT16 N_mode_sub_est,N_mode_frm;
extern FLOAT64 *lsf_old_smo,*ma_lsf,*dSP_buf;
extern INT16 *N_sub;
extern INT16 consec_low,consec_high,consec_vad_0;
extern INT16 updates_noise,updates_speech,calls,lev_reset;
extern FLOAT64 ma_max_noise,ma_max_speech;
extern FLOAT64 *buffer_smo,*buffer_p,ma_cp;
extern FLOAT64 *buffer_sum_smo,*buffer_max_smo;
extern INT16 N_mode_sub_ref,consec;
extern INT16 updates;
extern FLOAT64 ma_max;
/*========================================================*/
/*=======================FCS LIBRARY PROCESSING======================*/
/*========================================================*/
extern FLOAT64 lpcg_m,alpha;
extern INT16 lag_m,SVS_flag_m;
extern FLOAT64 *wsp_m;
				
				<dp n="d152"/>
extern FLOAT64 *hh_hf;
extern FLOAT64  **PHI;
extern INT16  *MaxIdx;
extern INT16  **track;
extern INT16 **p_track_2_5_0,**p_track_2_7_1;
extern INT16 ***p_track_3_2_80,***p_track_3_2_54;
extern INT16 **p_track_5_4_0,**p_track_5_3_1,**p_track_5_3_2,**p_track_8_4_0;
extern FLOAT64 **unfcod_dec;
/*----------------------------------------------------------*/
/*                              13bits                               */
/*----------------------------------------------------------*/
extern FLOAT64Stab_13b_enc;
extern FLOAT64Stab_13b_dec;
/*----------------------------------------------------------*/
/*                              15bits                               */
/*----------------------------------------------------------*/
extern INT64 seed_bfi_exc;
extern FLOAT64 Stab_15b_enc;
extern FLOAT64 Stab_15b_dec;
/*=============================================*/
/*================FRAME ERASURE CONCEALEMENT================*/
/*=============================================*/
extern INT16 N_bfi,bfh_oh;
extern INT16 past_bfi,ppast_bfi;
extern INT16 bfi_caution,nbfi_count;
extern FLOAT64 *enrg_buff;
extern FLOAT64 *ext_dec_mem;
/*=============================================*/
/*====================SIGNAL SYNTHESIS=================*/
/*=============================================*/
				
				<dp n="d153"/>
extern FLOAT64 *synth_mem,*synth_mem_dec,*dif_mem,*target_mem;
extern FLOAT64 *qua_synth_mem,*qua_dif_mem,*qua_arget_mem,*qua_ext;
extern FLOAT64 *sigsyn_dec,*ext_dec;
/*===========================================================*/
/*============================INDEX=============================*/
/*===========================================================*/
extern INT16 *bitno0,*bitno1;
/*===========================================================*/
/*-----------------------------END--------------------------*/
/*===========================================================*/
				
				<dp n="d154"/>
/*=================================================================*/
/*=======================================================*/
/*Conexant System Inc.                                            */
/*4311 Jamboree Road                                              */
/*Newport Beach,CA 92660                                          */
/*-----------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                           */
/*-----------------------------------------------*/
/*ALL RIGHTS RESERVED:                                            */
/*No part of this software may be reproduced in any form orby any */
/*means or used to make any derivative work(such as transformation*/
/*or adaptation)without the authorisation of Conexant System Inc. */
/*=======================================================*/
/*FILE:gbl_var.h                                                  */
/*=======================================================*/
#ifef DIAG_SMV
/*=================================================================*/
/*==========================DIAGNOSTICS FILE POINTERS===========================*/
/*=================================================================*/
/*------------------------------------------------*/
/*                 Encoder unquantized                        */
/*------------------------------------------------*/
FILE *fdia_vad;
/*------------------------------------------------*/
/*                 Encoder quantized                          */
/*------------------------------------------------*/
FILE *fdia_sp_enc;
/*------------------------------------------------*/
/*               Floating point parameter dump                */
/*------------------------------------------------*/
/*------------------------------------------------*/
				
				<dp n="d155"/>
/*                        Decoder                             */
/*------------------------------------------------*/
#endif
/*===========================================================*/
/*==========================FRAME COUNTERS==========================*/
/*===========================================================*/
INT64 frm_count  =0;
INT64 frm_erasure=0;
/*===========================================================*/
/*===========================SMV CONTROL===========================*/
/*===========================================================*/
INT16 smv_mode;
INT16 fix_rate,fix_rate_mem;
/*===========================================================*/
/*==========================NOISE SUPRESSION=========================*/
/*===========================================================*/
FLOAT64 MIN_GAIN=-13.0;
/*===========================================================*/
/*========================PRE AND POST PROCESSING========================*/
/*===========================================================*/
FLOAT64 *pre_flt_num;
FLOAT64 *pre_flt_den;
FLOAT64 *pre_flt_buf_z;
FLOAT64 *pre_flt_buf_p;
FLOAT64 pre_gain;
FLOAT64 *lp_flt_num;
FLOAT64 *lp_flt_buf;
/*------------------------------------------------*/
				
				<dp n="d156"/>
INT16 *zeroed;
FLOAT64 *zero_rate;
FLOAT64 *low_rate;
FLOAT64 *high_rate;
FLOAT64 *low_neg;
FLOAT64 *low_pos;
INT32 min_delta;
FLOAT64 zero_level;
FLOAT6412_neg,l1_neg,l1_pos,l2_pos;
/*-----------------------------------------------------*/
FLOAT64 tc_mem_dec;
FLOAT64 tc_coeff;
FLOAT64 tc_gain;
FLOAT64 *tc_buff_exc;
/*-----------------------------------------------------*/
FLOAT64 *buff_LTpost;
FLOAT64 *PF_mem_syn;
FLOAT64 r_zero,r_pole;
FLOAT64 pst_scale;
FLOAT64 pst_hp_mem;
/*-----------------------------------------------------*/
FLOAT64 *pst_flt_num;
FLOAT64 *pst_flt_den;
FLOAT64 *pst_flt_buf_z;
FLOAT64 *pst_flt_buf_p;
FLOAT64 pst_gain;
/*===================================================================*/
/*==============================LPC ANALYSIS===============================*/
/*===================================================================*/
FLOAT64 *siglpc;
				
				<dp n="d157"/>
/*----------------------------------------------------*/
/*                      LPC analysis window                          */
/*----------------------------------------------------*/
FLOAT64 *lpc_window;
FLOAT64 *lpc_window1;
FLOAT64 *lpc_window2;
/*----------------------------------------------------*/
/*                      Tilt analysis window                         */
/*----------------------------------------------------*/
FLOAT64 *tilt_window;
/*----------------------------------------------------*/
/*                      Bandwidth expansion factor                   */
/*----------------------------------------------------*/
FLOAT64 *bwe_factor;
/*----------------------------------------------------*/
/*                      LPC parameters                               */
/*----------------------------------------------------*/
FLOAT64 pderr;
FLOAT64 *rxx,**refl,**pdcf,**pdcfq,**pdcfq_dec;
FLOAT64 *lsf_new,*lsf_old,*lsf_mid;
/*----------------------------------------------------*/
FLOAT64 erg,lpcgain;
FLOAT64sub_lpcg;
/*----------------------------------------------------*/
FLOAT64*IntLSF_C;
/*====================================================================*/
/*==============================Weighted Speech============================*/
/*====================================================================*/
				
				<dp n="d158"/>
FLOAT64 r_pole_ws;
FLOAT64 **wpdcf_zero,**wpdcf_pole;
FLOAT64 *wspeech,*wspeech_mem;
FLOAT64 Z1_ws_1,Z1_ws_2;
FLOAT64 *ModiSig_m,*tmp_ws_m;
/*===================================================================*/
/*========-----===============Fixed codebook search=====================--======*/
/*===================================================================*/
FLOAT64 **fcod,**unfcod;
FLOAT64 **qua_fcod,**qua_unfcod;
/*===================================================================*/
/*============---==========Residual and target signal buffer==========================*/
/*===================================================================*/
/*===================================================================*/
/*===============------==========Gain VQ===========================-=====*/
/*===================================================================*/
INT16 GainNormDeci,GainModiDeci;
FLOAT64 pgain_past;
FLOAT64 pgain_past_dec;
FLOAT64 **qua_gainQ;
FLOAT64 **gain_cb_2_128;
FLOAT64 **gain_cb_2_128_8_5;
FLOAT64 *past_energyq_4d;
FLOAT64 *past_energyq_3d;
FLOAT64 *past_energyq_2d;
FLOAT64 *gp_buf;
FLOAT64 past_fixed_energy;
				
				<dp n="d159"/>
FLOAT64 *Prev_Beta_Pitch;
FLOAT64 *energy_pred_coeff_1;
FLOAT64 *energy_pred_coeff_2;
FLOAT64 *energy_pred_coeff_3;
FLOAT64 *energy_pred_coeff4d_1;
FLOAT64 *energy_pred_coeff4d_2;
FLOAT64 *energy_pred_coeff4d_3;
FLOAT64 *energy_pred_coeff4d_4;
FLOAT64 *pred_energy_d38;
FLOAT64 *pred_energy_d410;
FLOAT64 gp_mean;
FLOAT64 gp_fec;
#include″gain_vq.tab″
/*==========================================================*/
/*=====--==================LSF quantizers==========================*/
/*==========================================================*/
FLOAT64 ***lsf_cb_08k;
FLOAT64 ***lsf_cb_40k;
FLOAT64 ***lsf_cb_85k;
INT16  *stage_cand_08k;
INT16  *stage_cand_40k;
INT16  *stage_cand_85k;
#include″lsf_vq.tab″
INT16  *MS_08k;
INT16  *MS_40k;
INT16  *MS_85k;
FLOAT64 *last_qlsf;
				
				<dp n="d160"/>
FLOAT64 *lsfq_old,*lsfq_old_dec;
FLOAT64 *Mean;
FLOAT64 **qes;
FLOAT64 **qes_dec;
FLOAT64 *lsfq_mem_dec;
FLOAT64 *lsfq_mem_enc;
/*============================================================*/
/*==========================PITCH OPEN LOOP===========================*/
/*============================================================*/
INT16  *ol_lag;
INT16  *lag;
INT16 lagl,low_pit,high_pit;
FLOAT64 *Rp_sub;
FLOAT64pitchf;
/*-------------------------------------------------------*/
/*-------------------------------------------------------*/
FLOAT64 *PitLagTab5b;
FLOAT64 *PitLagTab7b;
FLOAT64 *PitLagTab8b;
FLOAT64 *SincWindows;
/*-------------------------------------------------------*/
INT16  VUVmm,pitch_m,pitch_mm,Iopt0;
INT16  *PITmax0;
INT16  LagCount,VadCount,Av_lag;
FLOAT64 Rp_m;
FLOAT64 *Rmax0;
				
				<dp n="d161"/>
/*-------------------------------------------------------*/
FLOAT64 *pitch_f_mem;
/*================================================================*/
/*=========================CLOSED PITCH PROCESSING===========================*/
/*================================================================*/
FLOAT64 *ext;
FLOAT64 *SincWindows_E;
FLOAT64 *NewTg;
FLOAT64 *lag_f;
INT16 pitch_index,pre_pitch_index;
/*================================================================*/
/*=========================PITCH PRE-PROCESSING============================*/
/*================================================================*/
FLOAT64 *SincWindows_PP;
FLOAT64 Delay_pp,Last_Rp;
INT16 frame_class_pp_m;
FLOAT64*targ_mem;
/*================================================================*/
/*=========================PRC LIBRARY PROCESSING============================*/
/*================================================================*/
FLOAT64 cl_Eg,ol_Eg;
FLOAT64 m_lpc_gain;
/*================================================================*/
/*=========================GCB LIBRARY PROCESSING============================*/
/*================================================================*/
INT64 seed_exc;
FLOAT64 Z1_gcb;
FLOAT64 ref_eng_gcb;
INT16 rate_mem;
INT64 seed_dec;
				
				<dp n="d162"/>
/*===============================================================*/
/*=========================CLA LIBRARY PROCESSING===========================*/
/*===============================================================*/
INT16 VUV,VUVm;
INT16 frame_class,frame_class_m,frame_class_pp;
FLOAT64 energy,energy_m;
INT16 frame_onset;
INT16 frame_pit_tab,min_pit,max_pit;
INT16 *frame_class_mem,*onsptlsv_mem,*voiced_mem;
FLOAT64 *window1;
FLOAT64 *buffer_cla;
FLOAT64 *Lp_buffer;
FLOAT64 *buffer_refl0;
FLOAT64 *buffer_max_cla;
FLOAT64 *buffer_wtilt,*buffer_wmax,*buffer_wRp;
FLOAT64 E_noi,T_noi,M_noi,R_noi;
FLOAT64 **P_w,MA_avg_wRp,MA_min_wtilt;
INT16 SVS_Count,Vad_0_Count,FlatSp_Flag;
FLOAT64 Av_value;
/*-------------------------------------------------------*/
FLOAT64 Rp_m_cla,lpcg_m_cla;
/*-------------------------------------------------------*/
FLOAT64 av_pit_lag,av_pit_g;
INT16 PP_model_m,PP_frm_count;
/*-------------------------------------------------------*/
//INT16 SVS_eci_m;
/*-------------------------------------------------------*/
				
				<dp n="d163"/>
INT16 OnSet;
INT16 frame_class_mm;
/*--------------------------------------------------------*/
INT 16SVS_deci_mem;
/*--------------------------------------------------------*/
/*===========================================================*/
/*=======================VAD LIBRARY PROCESSING=========================*/
/*===========================================================*/
INT16 *lag_buf;
FLOAT64 *pgain_buf;
INT16 Vad,*flag_vad_mem;
INT16 flag;
INT16 count_sil;
INT16 count ext;
INT16 count_noise;
INT16 dec3_flg_mem;
INT16 onset_flg,count_onset;
FLOAT64 pitch_gain_mean;
FLOAT64 **vad_lsf_mem;
FLOAT64 min_energy;
FLOAT64 mean_energy;
FLOAT64 *prev_cml_lsf_diff;
FLOAT64 *prev_energy;
FLOAT64 snr;
FLOAT64 mean_max;
FLOAT64 mean_s_energy;
FLOAT64 prev_min_energy;
FLOAT64 *min_energy_mem;
FLOAT64 next_min_energy;
FLOAT64 *mean_lsf;
FLOAT64 *norm_mean_lsf;
FLOAT64 cml_lsf_diff_filt;
FLOAT64 onset_trhsd;
				
				<dp n="d164"/>
/*=============================================================*/
/*=========================SNR LIBRARY PROCESSING=========================*/
/*=============================================================*/
FLOAT64 NoiseGainFactor;
INT16 n_nois_ext_enc;
FLOAT64 NoisEng_enc,eng_old_enc,diff_lsf_m_enc,diff_eng_m_enc;
INT16 snr_frm_count,snr_count_vad;
FLOAT64 eng_m_enc;
/*=============================================================*/
/*=========================SMO LIBRARY PROCESSING=========================*/
/*=============================================================*/
FLOAT64 *lsf_smooth;
INT16 N_mode_sub_est,N_mode_frm;
FLOAT64 *lsf_old_smo,*ma_lsf,*dSP_buf;
INT16 *N_sub;
INT16 consec_low,consec_high,consec_vad_0;
INT16 updates_noise,updates_speech,calls,lev_reset;
FLOAT64 ma_max_noise,ma_max_speech;
FLOAT64 *buffer_smo,*buffer_p,ma_cp;
FLOAT64 *buffer_sum_smo,*buffer_max_smo;
INT16 N_mode_sub_ref,consec;
INT16 updates;
FLOAT64 ma_max;
/*=============================================================*/
/*=========================FCS LIBRARY PROCESSING=========================*/
/*=============================================================*/
FLOAT64 lpcg_m,alpha;
INT16 lag_m,SVS_flag_m;
				
				<dp n="d165"/>
FLOAT64 *wsp_m;
FLOAT64 *hh_hf;
FLOAT64**PHI;
INT16  *MaxIdx;
INT16  **track;
INT16 **p_track_2_5_0,**p_track_2_7_1;
INT16 ***p_track_3_2_80,***p_track_3_2_54;
INT16 **p_track_5_4_0,**p_track_5_3_1,**p_track_5_3_2,**p_track_8_4_0;
FLOAT64 **unfcod_dec;
/*---------------------------------------------------------*/
/*                            13bits                                   */
/*---------------------------------------------------------*/
FLOAT64 Stab_13b_enc;
FLOAT64 Stab_13b_dec;
/*---------------------------------------------------------*/
/*                            15bits                                   */
/*---------------------------------------------------------*/
INT64 seed_bfi_exc;
FLOAT64Stab_15b_enc;
FLOAT64Stab_15b_dec;
/*=================================================================*/
/*=========================FRAME ERASURE CONCEALEMENT===========================*/
/*=================================================================*/
INT16 N_bfi,bfh_oh;
INT16 past_bfi,ppast_bfi;
INT16 bfi_caution,nbfi_count;
FLOAT64 *enrg_buff;
FLOAT64 *ext_dec_mem;
/*===================================================================*/
/*============================SIGNAL SYNTHESIS===============================*/
/*===================================================================*/
				
				<dp n="d166"/>
FLOAT64 *synth_mem,*synth_mem_dec,*dif_mem,*target_mem;
FLOAT64 *qua_synth_mem,*qua_dif_mem,*qua_arget_mem,*qua_ext;
FLOAT64 *sigsyn_dec,*ext_dec;
/*==================================================================================*/
/*=====================================INDEX===========================================*/
/*==================================================================================*/
INT16 *bitno0,*bitno1;
/*==================================================================================*/
/*-----------------------------END----------------------------*/
/*==================================================================================*/
				
				<dp n="d167"/>
/*====================================================================*/
/*=============================================================*/
/*Conexant System Inc.                                                */
/*4311 Jamboree Road                                                   */
/*Newport Beach,CA 92660                                              */
/*---------------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                               */
/*---------------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*=============================================================*/
/*LIBRARY:gputil.c                                                    */
/*=============================================================*/
/*---------------------------------------------------------*/
/*----------------------------------INCLUDE------------------------*/
/*---------------------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″mcutil.h″
#include″gputil.h″
/*---------------------------------------------------------*/
/*---------------------------------FUNCTIONS-----------------------*/
/*---------------------------------------------------------*/
/*============================================================*/
/*FUNCTIONS:file_open_r ()                                             */
/*---------------------------------------------------------*/
/*PURPOSE:These functions open the file named file_name,        */
/*        and return a pointer to this file.                 */
/*---------------------------------------------------------*/
/*INPUT ARGUMENTS:_file name.                                          */
/*---------------------------------------------------------*/
/*OUTPUT ARGUMENTS:_None.                                              */
/*---------------------------------------------------------*/
/*RETURN ARGUMENTS:_pointer to the file.                               */
				
				<dp n="d168"/>
/*======================================= ====================*/
FILE*file_open_r(char*file_name)

    {

    /*-----------------------------------------------------*/

    FILE    *file_ptr;

    /*-----------------------------------------------------*/

    if((file_ptr=fopen(file_name,″r″))==NULL)

         {
#ifdef VERBOSE

         printf(″\nfile name:%s\n″,file_name);

         nrerror(″error opening file(r)...″);
#endif

         }

    /*-----------------------------------------------------*/

    return(file_ptr);

    /*-----------------------------------------------------*/

    }
/*-------------------------------------------------------------*/
/*===========================================================*/
/*FUNCTIONS:file_open_w()                                             */
/*-----------------------------------------------*/
/*PURPOSE:These functions open the file named file_name,*/
/*        and return a pointer to this file.      */
/*-----------------------------------------------*/
/*INPUT ARGUMENTS:_file name.                                */
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS:_None.                                   */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS:_pointer to the file.                     */
/*===========================================================*/
FILE*file_open_w(char*file_name)

    {
				
				<dp n="d169"/>
    /*------------------------------------------------*/

    FILE    *file_ptr;

    /*------------------------------------------------*/

    if((file_ptr=fopen(file_name,″w″))==NULL)

         {
#ifdef VERBOSE

         printf(″\nfile name:%s\n″,file_name);

         nrerror(″error opening file(w)...″);
#endif

         }

    /*------------------------------------------------*/

    return(file_ptr);

    /*------------------------------------------------*/

    }
/*--------------------------------------------------------*/
/*====================================================================*/
/*FUNCTIONS:file_open_rb ()                                       */
/*------------------------------------------------*/
/*PURPOSE:These functions open the file named file_name,*/
/*        and return a pointer to this file.        */
/*------------------------------------------------*/
/*INPUT ARGUMENTS:_file name.                           */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:_None.                               */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:_pointer to the file.                */
/*====================================================================*/
FILE*file_open_rb(char*file_name)

    {

    /*------------------------------------------------*/

    FILE    *file_ptr;
				
				<dp n="d170"/>
    /*------------------------------------------------*/

    if((file_ptr=fopen(file_name,″rb″))==NULL)

         {
#ifdef VERBOSE

         printf(″\nfile name:%s\n″,file_name);

         nrerror(″error opening file(rb)...″);
#endif

         }

    /*------------------------------------------------*/

    return(file_ptr);

    /*------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*============================================================*/
/*FUNCTIONS:file_open_wb  ()                             */
/*------------------------------------------------*/
/*PURPOSE:These functions open the file named file_name,*/
/*        and return a pointer to this file.         */
/*------------------------------------------------*/
/*INPUT ARGUMENTS:_file name.                           */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:_None.                               */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:_pointer to the file.                */
/*================================================一===========*/
FILE*file_open_wb(char *file_name)

    {

    /*------------------------------------------------*/

    FILE    *file_ptr;

    /*------------------------------------------------*/

    if((file_ptr=fopen(file_name,″wb″))==NULL)

         {
				
				<dp n="d171"/>
#ifdet VERBOSE

        printf(″\nfile name:%s\n″,file_name);

        nrerror(″error opening file(wb)...″);
#endif

        }

    /*------------------------------------------------*/

    return(file_ptr);

    /*------------------------------------------------*/

    }
/*----------------------------------------------------------*/
/*======================================================*/
/*FUNCTIONS:output_waves_file ()                           */
/*------------------------------------------------*/
/*PURPOSE:These functions writes an array of double in     */
/*        XWAVES format file.                              */
/*------------------------------------------------*/
/*INPUT ARGUMENTS:_(char*)file_name:name of the xwaves file.*/
/*               :_(FLOAT64*)x     :array of double.        */
/*               :_(INT32)N        :size of the x array.   */
/*               :_(FLOAT64)scale  :scale value.           */
/*               :_(FLOAT64)min    :min range value.       */
/*               :_(FLOAT64)max    :max range value.       */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:_None.                                         */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:_pointer to the file.                          */
/*======================================================*/
void output_waves_file(char*file_name,FLOAT64*x,INT32 N,FLOAT64 scale,\

                                 FLOAT64 min,FLOAT64 max)

    {

    /*------------------------------------------------*/

    FILE  *file_ptr;

    INT32 i;

    INT16 *waves;
				
				<dp n="d172"/>
    /*--------------------------------------------------*/

    waves=svector(0,N-1);

    file_ptr=file_open_wb(file_name);

    waves[0]=(INT16)(max);

    waves[1]=(INT16)(min);

    fwrite(waves,sizeof(INT 16),2L,file_ptr);

    for(i=0;i<N;i++)

    waves[i]=(INT16)(scale * x[i]);

    fwrite(waves,sizeof(INT16),N,file_ptr);

    fclose(file_ptr);

    free_svector(waves,0,N-1);

    /*------------------------------------------------*/

    return;

    /*------------------------------------------------*/

    }
/*------------------------------------------------------*/
/*===================================================*/
/*FUNCTION:file_length()                                 */
/*-------------------------------------------------*/
/*PURPOSE:This function returns the length of a file in */
/*        bytes.                                        */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:_Pointer to a file.                         */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:_None.                                     */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:_Length of the file in bytes.              */
/*===================================================*/
				
				<dp n="d173"/>
INT64 file_length(FILE*file_ptr)

    {

    /*---------------------------------------------*/

    INT64 file_size;

    /*---------------------------------------------*/

    file_size=ftell(file_ptr);

    /*---------------------------------------------*/

    return(file_size);

    /*---------------------------------------------*/

    }
/*-----------------------------------------------------*/
/*======================================================*/
/*FUNCTION:read_signal_double()                           */
/*---------------------------------------------*/
/*PURPOSE:This function reads short samples from a file*/
/*        stores them in an array of double.          */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:_Name of the signal file.               */
/*                _Number of samples.                     */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_Array of double.                      */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                                 */
/*======================================================*/
void read_signal_double(FILE *file_ptr,FLOAT64 *array,INT64 N)

    {

    /*---------------------------------------------*/

    INT16 *array_short;

    INT64 i;

    /*---------------------------------------------*/
				
				<dp n="d174"/>
    array_short=svector(0,N-1);

    if((fread(array_short,sizeof(INT16),(INT32)N,file_ptr)!=

                                                                        (size_t)N)

        nrerror(″error reading file...″);

    for(i=0;i<N;i++)

        *(array+i)=(FLOAT64)(*(array_short+i));

    free_svector(array_short,0,N-1);

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*----------------------------------------------------*/
/*============================================================*/
/*FUNCTION:write_signal_double()                           */
/*---------------------------------------------*/
/*PURPOSE:This function writes short samples to a file  */
/*        from an array of double.                       */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:_Array of double.                        */
/*              _Number of samples.                     */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_Output short file.                     */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                                  */
/*============================================================*/
void write_signal_double(FILE *file_ptr,FLOAT64 *array,INT64 N)

    {

    /*----------------------------------------------*/

    INT16 *array_short;

    INT64 i;

    /*----------------------------------------------*/
				
				<dp n="d175"/>
    array_short=svector(0,N-1);

    for(i=0;i<N;i++)

        *(array_short+i)=(INT16)nint(*(array+i));

    if((fwrite(array_short,sizeof(INT16),(INT32)N,file_ptr))!=

                                                                      (size_t)N)

        nrerror(″error writing file...″);

    free_svector(array_short,0,N-1);

    /*----------------------------------------------*/

    return;

    /*----------------------------------------------*/

    }
/*-----------------------------------------------------*/
/*====================================================*/
/*FUNCTION:get_int().                                     */
/*----------------------------------------------*/
/*PURPOSE:These function read a value from a text file.*/
/*----------------------------------------------*/
/*INPUT ARGUMENTS:_file pointer.                          */
/*----------------------------------------------*/
/*OUTPUT ARGUMENTS:_(INT32*)val:output value.             */
/*----------------------------------------------*/
/*RETURN ARGUMENTS:None.                                  */
/*====================================================*/
void get_int(FILE *file_ptr,INT32 *val)

    {

    /*----------------------------------------------*/

    char buffer[NB_MAX_CHAR];

    /*----------------------------------------------*/

    fgets(buffer,NB_MAX_CHAR,file_ptr);
				
				<dp n="d176"/>
    sscanf(buffer,″%d″,val);

    /*-----------------------------------------------*/

    return;

    /*-----------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*==============================================================*/
/*FUNCTION:get_two_int().                                    */
/*------------------------------------------------*/
/*PURPOSE :These function read two values from a text file.*/
/*------------------------------------------------*/
/*INPUT ARGUMENTS:_file pointer.                             */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                          */
/*            _(INT32*)val1:output value.                */
/*            _(INT32*)val2:output value.                */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:_None.                                    */
/*==============================================================*/
void get_two_int(FILE *file_ptr,INT32 *val1,INT32 *val2)

    {

    /*------------------------------------------------*/

    char buffer[NB_MAX_CHAR];

    /*------------------------------------------------*/

    fgets(buffer,NB_MAX_CHAR,file_ptr);

    sscanf(buffer,″%d%d″,val1,val2);

    /*------------------------------------------------*/

    return;
				
				<dp n="d177"/>
    /*------------------------------------------------*/

    }
/*------------------------------------------------------*/
/*=============================================================*/
/*FUNCTION:get_long().                                       */
/*------------------------------------------------*/
/*PURPOSE :These function read a value from a text file.*/
/*------------------------------------------------*/
/*INPUT ARGUMENTS:_file pointer.                             */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:_(INT64*)val:output value.                */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:_None.                                    */
/*=============================================================*/
void get_long(FILE *file_ptr,INT64 *val)

    {

    /*------------------------------------------------*/

    char buffer[NB_MAX_CHAR];

    /*------------------------------------------------*/

    fgets(buffer,NB_MAX_CHAR,file_ptr);

    sscanf(buffer,″%ld″,val);

    /*------------------------------------------------*/

    return;

    /*------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*=============================================================*/
/*FUNCTION:get_float().                                          */
/*------------------------------------------------*/
				
				<dp n="d178"/>
/*PURPOSE:These function read a value from a text file.*/
/*------------------------------------------------*/
/*INPUT ARGUMENTS:_file pointer.                            */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT32*)val:output value.             */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:_None.                                   */
/*=========================================================================*/
void get_FLOAT32(FILE *file_ptr,FLOAT32 *val)

    {

    /*------------------------------------------------*/

    char buffer[NB_MAX_CHAR];

    /*------------------------------------------------*/

    fgets(buffer,NB_MAX_CHAR,file_ptr);

    sscanf(buffer,″%f″,val);

    /*------------------------------------------------*/

    return;

    /*------------------------------------------------*/

    }
/*----------------------------------------------------*/
/*=========================================================================*/
/*FUNCTION:get_double().                                     */
/*------------------------------------------------*/
/*PURPOSE:These function read a value from a text file.*/
/*------------------------------------------------*/
/*INPUT ARGUMENTS:_file pointer.                             */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)val:output value.              */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:_None.                                    */
/*=========================================================================*/
				
				<dp n="d179"/>
void get_double(FILE*file_ptr,FLOAT64*val)

     {

     /*--------------------------------------------*/

     char buffer[NB_MAX_CHAR];

     /*--------------------------------------------*/

     fgets(buffer,NB_MAX_CHAR,file_ptr);

     sscanf(buffer,″%lf″,val);

     /*--------------------------------------------*/

     return;

     /*--------------------------------------------*/

    }
/*-------------------------------------------------*/
/*====================================*/
/*FUNCTION    :      ini_dvector().                        */
/*--------------------------------------------*/
/*PURPOSE     :        This function initializes a vector of FLOAT64 */
/*           to a given value.                       */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:_(FLOAT64*)v vector of double.          */
/*               _(INT32)nl                        */
/*               _(INT32)nh                        */
/*               _(FLOAT64)val                      */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)initialized v vector.        */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:_None.                            */
/*================================*/
void ini_dvector(FLOAT64*v,INT32 nl,INT32 nh,FLOAT64 val)

     {

     /*----------------------------------------------*/

     INT32  i;
				
				<dp n="d180"/>
  /*---------------------------------------------*/
  for(i=nl;i<=nh;i++)

      v[i]=val;
  /*---------------------------------------------*/

    return;
  /*---------------------------------------------*/
  }
/*-------------------------------------------------*/
/*=================================*/
/*FUNCTION    :  ini_svector().                      */
/*----------------------------------------------*/
/*PURPOSE     :  This function initializes a vector of INT16  */
/*              to a given value.                        */
/*----------------------------------------------*/
/*INPUT ARGUMENTS  :_(INT16*)v vector of int.             */
/*               _(INT32)nl                      */
/*               _(INT32)nh                      */
/*               _(INT16)val                     */
/*----------------------------------------------*/
/*OUTPUT ARGUMENTS:_(INT16*)initialized v vector.        */
/*----------------------------------------------*/
/*RETURN ARGUMENTS:_None.                      */
/*==================================*/
void ini_svector(INT16*v,INT32 nl,INT32 nh,INT16 val)

     {

     /*-----------------------------------------------*/

     INT32 i;

     /*-----------------------------------------------*/

     for(i=nl;i<=nh;i++)

         v[i]=val;
				
				<dp n="d181"/>
  /*---------------------------------------------*/
  return;
  /*---------------------------------------------*/
  }
/*-------------------------------------------------*/
/*===================================*/
/*FUNCTION    :    ini_ivector().                        */
/*---------------------------------------------*/
/*PURPOSE     :   This function initializes a vector of INT32  */
/*             to a given value.                     */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :_(INT32*)v vector of int.            */
/*                _(INT32)nl                       */
/*                _(INT32)nh                       */
/*                _(INT32)val                      */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS: _(INT32*)initialized v vector.         */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                     */
/*====================================*/
void ini_ivector(INT32*v,INT32 nl,INT32 nh,INT32 val)

     {

    /*---------------------------------------------*/

    INT32 i;

    /*---------------------------------------------*/

    for(i=nl;i<=nh;i++)

        v[i]=val;

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/
				
				<dp n="d182"/>
      }
/*---------------------------------------------*/
/*================================*/
/*FUNCTION    : cpy_svector().                    */
/*---------------------------------------------*/
/*PURPOSE    :  This function writes v1 to v2.            */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :_(INT16*)v1 vector of short.           */
/*            _(INT16*)v2 vector of short.           */
/*            _(INT32)nl                            */
/*            _(INT32)nh                            */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_(INT16*)new v2 vector.              */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                       */
/*=================================*/
void cpy_svector(INT16*v1,INT16*v2,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/

     INT32 i;

     /*---------------------------------------------*/

     for(i=nl;i<=nh;i++)

         v2[i]=v1[i];

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*-------------------------------------------------*/
/*-------------------------------------------------*/
				
				<dp n="d183"/>
/*==============================*/
/*FUNCTION    :cpt_ivector().                      */
/*---------------------------------------------*/
/*PURPOSE    :This function writes v1 to v2.          */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:_(INT32*)v1 vector of int.            */
/*               _(INT32*)v2 vector of int.       */
/*               _(INT32)nl      */
/*               _(INT32)nh    */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_(INT32*)new v2 vector.              */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:None.                       */
/*==============================*/
void cpy_ivector(INT32*v1,INT32*v2,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/

     INT32 i;

     /*---------------------------------------------*/

     for(i=nl;i<=nh;i++)

         v2[i]=v1[i];

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*-------------------------------------------------*/
/*============================*/
/*FUNCTION    :cpy_dvector().                   */
/*---------------------------------------------*/
/*PURPOSE    :This function writes v1 to v2.         */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :_(FLOAT64*)v1 vector of double.        */
/*               _(FLOAT64*)v2 vector of double.    */
				
				<dp n="d184"/>
/*      _(INT32)nl                */
/*      _(INT32)nh              */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)new v2 vector.         */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                        */
/*==================================*/
void cpy_dvector(FLOAT64*v1,FLOAT64*v2,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/

     INT32 i;

     /*---------------------------------------------*/

     for(i=nl;i<=nh;i++)

         v2[i]=v1[i];

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*---------------------------------------------*/
/*==================================*/
/*FUNCTION    :sfr_ivector().                    */
/*---------------------------------------------*/
/*PURPOSE           :This function shift rigth velements of n    */
/*                 position.                                */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :_(INT32*)v1 vector of int.                 */
/*                   _(INT32)n number of rigth shift     */
/*                   _(INT32)nllower index              */
/*                   _(INT32)nh higher index            */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_(INT32*)v2 shifted rigth v1 vector.  */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                                 */
				
				<dp n="d185"/>
/*==================================*/
void sfr_ivector(INT32*v1,INT32*v2,INT32 n,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/

     INT32   i;

     /*---------------------------------------------*/

     for(i=nh-n;i>=nl;i--)

         v2[i+n]=v1[i];

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*---------------------------------------------*/
/*=================================*/
/*FUNCTION    :sfr_dvector().                    */
/*---------------------------------------------*/
/*PURPOSE             :This function shift roigth v elements of n    */
/*                     position.                                   */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :_(FLOAT64*)v1 vector of double.        */
/*                   _(INT32)n number of rigth shift            */
/*                   _(INT32)nl lower index                    */
/*                   _(INT32)nh higher index                  */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)v2 shifted rigth v1 vector.    */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                          */
/*=================================*/
void sfr_dvector(FLOAT64*v1,FLOAT64*v2,INT32 n,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/

     INT32  i;
				
				<dp n="d186"/>
   /*---------------------------------------------*/
   for(i=nh-n;i>=nl;i--)

        v2[i+n]=v1[i];
   /*---------------------------------------------*/
   return;
   /*---------------------------------------------*/
   }
/*---------------------------------------------*/
/*=============================*/
/*FUNCTION    :rev_dvector().                       */
/*---------------------------------------------*/
/*PURPOSE          :This function reverse the order of the    */
/*          elements of a vector.                 */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :_(FLOAT64*)v1 vector of double.      */
/*     _(INT32)nl lower index                */
/*     _(INT32)nh higher index           */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)v2 reversed v1 vector.       */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                        */
/*===================================*/
void rev_dvector(FLOAT64*v1,FLOAT64*v2,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/

     INT32 i;

     /*---------------------------------------------*/

     for(i=nl;i<=nh;i++)

         v2[i]=v1[nh-i];

     /*---------------------------------------------*/
				
				<dp n="d187"/>
      return;

      /*---------------------------------------------*/

      }
/*---------------------------------------------*/
/*===============================*/
/*FUNCTION    :sca_dvector().                  */
/*---------------------------------------------*/
/*PURPOSE         :This function scale v1 into v2 by the factor  */
/*           s.                       */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:_(FLOAT64*)v1 vector of double.         */
/*           _(FLOAT64) s scale factor.           */
/*           _(INT32)nl                     */
/*           _(INT32)nh                    */ 
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)v2 scaled vector.         */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                     */
/*==================================*/
void sca_dvector(FLOAT64*v1,FLOAT64s,FLOAT64*v2,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/

     INT32  i;

     /*---------------------------------------------*/

     for(i=nl;i<=nh;i++)

         v2[i]=s*v1[i];

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
				
				<dp n="d188"/>
/*---------------------------------------------*/
/*==============================*/
/*FUNCTION    :dot_dvector().                   */
/*---------------------------------------------*/
/*PURPOSE    :This function calculate the dot product    */
/*      between v1 and v2              */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:_(FLOAT64*)v1 vector of double.        */
/*                 _(FLOAT64*)v2 vector of double.          */
/*                 _(INT32)nl                          */
/*                 _(INT32)nh                         */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                          */
/*             _(FLOAT64*)s dot product.           */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                      */
/*=================================*/
void dot_dvector(FLOAT64*v1,FLOAT64*v2,FLOAT64*s,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/

     INT32  i;

     /*---------------------------------------------*/

     (*s)=0.0;

     for(i=nl;i<=nh;i++)

        (*s)+=v1[i]*v2[i];

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*---------------------------------------------*/
/*===================================*/
				
				<dp n="d189"/>
/*FUNCTION    :add_dvector().                    */
/*---------------------------------------------*/
/*PURPOSE    :This function adds v1 to v2 in v.        */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :_(FLOAT64*)v1 vector of double.         */
/*                   _(FLOAT64*)v2 vector of double.          */
/*                   _(INT32)nl                           */
/*                   _(INT32)nh                            */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)v=v1+v2 vector.           */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                    */
/*==================================*/
void add_dvector(FLOAT64*v1,FLOAT64*v2,FLOAT64*v,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/

     INT32  i;

     /*---------------------------------------------*/

     for(i=nl;i<=nh;i++)

         v[i]=v1[i]+v2[i];

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*---------------------------------------------*/
/*===============================*/
/*FUNCTION    :wad_dvector().                     */
/*---------------------------------------------*/
/*PURPOSE    :This function adds v1 to v2 in v.           */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :_(FLOAT64*)v1 vector of double.       */
/*                   _(FLOAT64)w1 weigth for v1.            */
/*                   _(FLOAT64*)v2 vector of double.           */
				
				<dp n="d190"/>
/*                 _(FLOAT64)w2 weigth for v2.            */
/*                 _(INT32)nl                    */
/*                 _(INT32)nh                */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)v=w1*v1+w2*v2 vector.*/
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                      */
/*=================================*/
void wad_dvector(FLOAT64*v1,FLOAT64 w1,FLOAT64*v2,FLOAT64 w2,

                    FLOAT64*v,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/

     INT32  i;

     /*---------------------------------------------*/

     for(i=nl;i<=nh;i++)

         v[i]=w1*v1[i]+w2*v2[i];

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*---------------------------------------------*/
/*==================================*/
/*FUNCTION    :     mul_dvector().                       */
/*---------------------------------------------*/
/*PURPOSE    :This function multiply v1 by v2 in v.       */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :_(FLOAT64*)v1 vector of double.        */
/*                   _(FLOAT64*)v2 vector of double.          */
/*                   _(INT32)nl                            */
/*                   _(INT32)nh                                   */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)v=v1*v2 vector.         */
/*---------------------------------------------*/
				
				<dp n="d191"/>
/*RETURN ARGUMENTS:_None.                            */
/*==================================*/
void mul_dvector(FLOAT64*v1,FLOAT64*v2,FLOAT64*v,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/

     INT32 i;

     /*---------------------------------------------*/

     for(i=nl;i<=nh;i++)

         v[i]=v1[i]*v2[i];

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*---------------------------------------------*/
/*===================================*/
/*FUNCTION    :dif_dvector().               */
/*---------------------------------------------*/
/*PURPOSE           :This function substracts v2 to v1 into v.     */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :_(FLOAT64*)v1 vector of double.   */
/*                   _(FLOAT64*)v2 vector of double.       */
/*                   _(INT32)nl                          */
/*                   _(INT32)nh                            */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)v=v1-v2 vector.           */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                          */
/*====================================*/
void dif_dvector(FLOAT64*v1,FLOAT64*v2,FLOAT64*v,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/
				
				<dp n="d192"/>
    INT32  i;

    /*---------------------------------------------*/

    for(i=nl;i<=nh;i++)

        v[i]=v1[i]-v2[i];

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*==================================*/
/*FUNCTION    :cml_dvector().                    */
/*---------------------------------------------*/
/*PURPOSE    :This function accumulates v2 to v1.         */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :_(FLOAT64*)vl vector of double.        */
/*                   _(FLOAT64*)v2 vector of double.        */
/*                   _(INT32)nl             */
/*                   _(INT32)nh                     */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)new v1=v1+v2 vector.        */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                       */
/*==================================*/
void cml_dvector(FLOAT64*v1,FLOAT64*v2,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/

     INT32 i;

     /*---------------------------------------------*/

     for(i=nl;i<=nh;i++)

         v1[i]+=v2[i];
				
				<dp n="d193"/>
    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*===================================*/
/*FUNCTION    :cml_dsvector().                          */
/*---------------------------------------------*/
/*PURPOSE    :This function accumulates v2 to v1.       */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:_(INT16*)v1 vector of short.             */
/*                 _(INT16*)v2 vector of short.             */
/*                 _(INT32)nl                               */
/*                 _(INT32)nh                               */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)new v1=v1+v2 vector.       */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                              */
/*=======================================*/
void cml_svector(INT16*v1,INT16*v2,INT32 nl,INT32 nh)

     {

     /*------------------------------------------------*/

     INT32  i;

     /*------------------------------------------------*/

     for(i=nl;i<=nh;i++)

         v1[i]+=v2[i];

     /*------------------------------------------------*/

     return;

     /*------------------------------------------------*/

     }
				
				<dp n="d194"/>
/*---------------------------------------------*/
/*====================================*/
/*FUNCTION    :max_dvector().                          */
/*------------------------------------------*/
/*PURPOSE    :This function finds the maximum of v.    */
/*------------------------------------------*/
/*INPUT ARGUMENTS  :_(FLOAT64*)v vector of double.          */
/*                   _(INT32) nl                         */
/*                   _(INT32) nh                         */
/*------------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)max.                      */
/*------------------------------------------*/
/*RETURN ARGUMENTS:_None.                             */
/*=================================*/
void nax_dvector(FLOAT64*v,FLOAT64*max,INT32 nl,INT32 nh)

     {

     /*----------------------------------------*/

     INT32  i;

     /*----------------------------------------*/

     for(i=nl+1,*max=*(v+nl);i<=nh;i++)

         *max=((*(v+i)>*max)?*(v+i):*max);

     /*----------------------------------------*/

     return;

     /*----------------------------------------*/

     }
/*------------------------------------------*/
/*==================================*/
/*FUNCTION    :min_dvector().                        */
/*------------------------------------------*/
/*PURPOSE    :This function finds the minimum of v.  */
/*------------------------------------------*/
/*INPUT ARGUMENTS  :_(FLOAT64*)v vector of double.      */
				
				<dp n="d195"/>
/*            _(INT32) nl                  */
/*            _(INT32) nh                  */
/*--------------------------------------*/
/*OUTPUT ARGUMENTS:_(FLOAT64*)min.                 */
/*--------------------------------------*/
/*RETURN ARGUMENTS:_None.                         */
/*================================*/
void min_dvector(FLOAT64*v,FLOAT64*min,INT32 nl,INT32 nh)

     {

     /*---------------------------------------------*/

     INT32  i;

     /*---------------------------------------------*/

     for(i=nl+1,*min=*(v+nl);i<=nh;i++)

        *min=((*(v+i)<*min)?*(v+i):*min);

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*-----------------------------------------------*/
/*===================================*/
/*FUNCTION    :limit_dvector().                     */
/*-------------------------------------------*/
/*PURPOSE    :This function limits the range of v.  */
/*-------------------------------------------*/
/*INPUT ARGUMENTS  :_(FLOAT64*)v vector of double.      */
/*                   _(INT32) nl                          */
/*                   _(INT32) nh                          */
/*                   _(FLOAT64) min                         */
/*                   _(FLOAT64) max                         */
/*-------------------------------------------*/
/*-------------------------------------------*/
/*RETURN ARGUMENTS:_None.                            */
/*===============================*/
				
				<dp n="d196"/>
void limit_dvector(FLOAT64*v,INT32 nl,INT32 nh,FLOAT64 min,FLOAT64 max)

     {

     /*---------------------------------------------*/

     INT32  i;

     /*---------------------------------------------*/

     for(i=nl;i<=nh;i++)

        {

        *(v+i)=((*(v+i)<min)?min:*(v+i));

        *(v+i)=((*(v+i)>max)?max:*(v+i));

        }

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*===================================*/
/*---------------------------END------------------------*/
/*===================================*/
				
				<dp n="d197"/>
/*================================*/
/*================================*/
/*Conexant System Inc.                                     */
/*4311 Jamboree Road                                        */
/*Newport Beach,CA 92660                                   */
/*---------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.               */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                                  */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*=======================================*/
/*PROTOYPE FILE;gputil.h                                          */
/*=======================================*/
/*--------------------------------------------------*/
/*---------------------FUNCTIONS------------------------*/
/*--------------------------------------------------*/
FILE*file_open_r    (char*);
FILE*file_open_w    (char*);
FILE*file_open_rb    (char*);
FILE*file_open_wb    (char*);
void output_waves_file (char*,FLOAT64*,INT32,\

                        FLOAT64,FLOAT64,FLOAT64);
INT64   file_length           (FILE*);
void read_signal_double    (FILE*,FLOAT64*,INT64);
void write_signal_double   (FILE*,FLOAT64*,INT64);
void get_int               (FILE *file_ptr,INT32   *val);
void get_long       (FILE *file_ptr,INT64  *val);
void get_float      (FILE *file_ptr,FLOAT32  *val);
void get_double         (FILE *file_ptr,FLOAT64  *val);
void get_two_int        (FILE *file_ptr,INT32*,INT32*);
void ini_svector   (INT16*,INT32,INT32,INT16);
				
				<dp n="d198"/>
void ini_ivector   (INT32*,INT32,INT32,INT32);
void ini_dvector     (FLOAT64*,INT32,INT32,FLOAT64);
void cpy_svector     (INT16*,INT16*,INT32,INT32);
void cpy_ivector     (INT32*,INT32*,INT32,INT32);
void cpy_dvector     (FLOAT64*,FLOAT64*,INT32,INT32);
void rev_dvector     (FLOAT64*,FLOAT64*,INT32,INT32);
void sfr_dvector     (FLOAT64*,FLOAT64*,INT32,INT32,INT32);
void sfr_ivector  (INT32*,INT32*,INT32,INT32,INT32);
void sca_dvector     (FLOAT64*,FLOAT64,FLOAT64*,INT32,INT32);
void dot_dvector     (FLOAT64*,FLOAT64*,FLOAT64*,INT32,INT32);
void cml_dvector     (FLOAT64*,FLOAT64*,INT32,INT32);
void cml_svector     (INT16*,INT16*,INT32,INT32);
void max_dvector     (FLOAT64*,FLOAT64*,INT32,INT32);
void min_dvector     (FLOAT64*,FLOAT64*,INT32,INT32);
void add_dvector     (FLOAT64*,FLOAT64*,FLOAT64*,INT32,INT32);
void wad_dvector (FLOAT64*,FLOAT64,FLOAT64*,FLOAT64,

                    FLOAT64*,INT32,INT32);
void mul_dvector    (FLOAT64*,FLOAT64*,FLOAT64*,INT32,INT32);
void dif_dvector    (FLOAT64*,FLOAT64*,FLOAT64*,INT32,INT32);
void limit_dvector(FLOAT64*,INT32,INT32,FLOAT64,FLOAT64);
/*===================================*/
/*------------------------END----------------------*/
/*===================================*/
				
				<dp n="d199"/>
/*=================================*/
/*=================================*/
/*Conexant System Inc.                                  */
/*4311 Jamboree Road                                     */
/*Newport Beach,CA 92660                                 */
/*---------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                  */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                            */
/*No part ofthis software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*========================================*/
/*PROTOTYPE FILE:lib_bit.c                              */
/*========================================*/
/*---------------------------------------------*/
/*----------------------INCLUDE-----------------------*/
/*---------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″ext_var.h″
#include″gputil.h″
#include″mcutil.h″
#include″lib_bit.h″
/*---------------------------------------------*/
/*---------------------FUNCTIONS----------------------*/
/*---------------------------------------------*/
/*=====================================*/
/*FUNCTION  :BIT_init_lib().                           */
/*---------------------------------------------*/
/*PURPOSE:Performs the bit packing library initialisation.  */
/*---------------------------------------------*/
/*ALGORITHM:                                        */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                                  */
				
				<dp n="d200"/>
/*                 _None.                            */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                            */
/*                 _None.                            */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                         */
/*                 _None.                           */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                           */
 /*                _None.                           */
/*=================================*/
void BIT_init_lib(void)

     {

     /*---------------------------------------------*/

     bitno0[0]=7;

     bitno0[1]=6;

     bitno0[2]=2;

     bitno1[0]=4;

     bitno1[1]=4;

     bitno1[2]=3;

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*---------------------------------------------*/
/*==================================*/
/*FUNCTION         :BIT_bitpack().                             */
/*---------------------------------------------*/
/*PURPOSE            :This function converts the encoder indices into  */
/*                   the bit-stream.                                */
/*---------------------------------------------*/
/*INPUT ARGUMENTS   :                                   */
/*      _(INT16)in:      inputdata.                   */
/*      _(INT16)NoOfBits:  number of bits.                 */
				
				<dp n="d201"/>
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                   */
/*    _(UNS_INT16*)TrWords:trasmitted word.          */
/*    _(INT16*)ptr:  bit and word pointers.        */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                            */
/*                        _None.                         */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                             */
/*                       _None.                         */
/*================================*/
void    BIT_bitpack(INT16 in,UNS_INT16*TrWords,INT16 NoOfBits,

                INT16*ptr)

    {

    /*---------------------------------------------*/

    INT16 temp;

    UNS_INT16*WordPtr;

    /*---------------------------------------------*/

    WordPtr=TrWords+ptr[1];

    *ptr-=NoOfBits;

    if(*ptr>=0)

        *WordPtr=*WordPtr|(in<<*ptr);

    else

        {

        temp=in>>(-*ptr);

        *WordPtr=*WordPtr|temp;

        WordPtr++;

        *ptr=16+*ptr;

        *WordPtr=(INT16)((INT64)((INT64)in<<*ptr)&amp;0xffff);

        }
   ptr[1]=(INT16)(WordPtr-TrWords);
   /*---------------------------------------------*/
   return;
				
				<dp n="d202"/>
    /*--------------------------------------------------*/

    }
/*----------------------------------------------------*/
/*=================================*/
/*FUNCTION  : BIT_bitunpack().                      */
/*-----------------------------------------------*/
/*PURPOSE            : This function converts the decoder bit-stream   */
/*                   into indices.                                   */
/*-----------------------------------------------*/
/*INPUT ARGUMENTS   :                                */
/*     _(UNS_INT16*)RecWords:received word.              */
/*     _(INT16)NoOfBits:number of bits            */
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS:                         */
/*    _(INT16*)out: output data.                           */
/*-----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                        */
/*    _(INT16*)ptr:bit and word pointers.              */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS:                           */
/*    _None.                               */
/*=======================================*/
void    BIT_bitunpack(INT16*out,UNS_INT16*RecWords,INT16 NoOfBits,

                INT16*ptr)

    {

    /*---------------------------------------------*/

    INT64 temp;

    UNS_INT16*WordPtr;

    /*---------------------------------------------*/

    WordPtr=RecWords+ptr[1];

    *ptr-=NoOfBits;

    if(*ptr>=0)

        temp=(INT64)(*WordPtr)<<NoOfBits;

    else

        {
				
				<dp n="d203"/>
       temp=(INT64)(*WordPtr)<<(NoOfBits+*ptr);

       WordPtr++;

       temp=(temp<<(-*ptr))|((INT64)*WordPtr<<(-*ptr));

       *ptr=16+*ptr;

       }

    *WordPtr=(INT16)(temp &amp; 0xffff);

    *out=(INT16)((INT64)(temp &amp; 0xffff0000)>>16);

    ptr[1]=(INT16)(WordPtr-RecWords);

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*------------------------------------------------*/
/*=================================*/
/*FUNCTION     :BIT_cdbk_index_to_bits().            */
/*---------------------------------------------*/
/*PURPOSE              :This function converts the fixed codebook index  */
/*                     into the bit-stream representation.            */
/*---------------------------------------------*/
/*INPUT ARGUMENTS :                             */
/*      _(PARAMETER  *)indices :fixed codebook indices. */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                            */
/*     _(INT16      [])packedwords:bit-stream.         */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                        */
/*     _(INT16   [])packw_ptr:pointer to the bit-stream.*/
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                             */
/*                      _None.                      */
/*=======================================*/
void BIT_cdbk_index_to_bits(PARAMETER *chan,INT16 packedwords[],

                            INT16packw_ptr])

     {
				
				<dp n="d204"/>
/*---------------------------------------------*/
INT16i,i_sf;
/*---------------------------------------------*/
/*        Initalizing bit packing parameters          */
/*---------------------------------------------*/
packw_ptr[0]=16;
/*---------------------------------------------*/
/*                   Points to the second word                */
/*---------------------------------------------*/
packw_ptr[1]=1;
ini_svector(packedwords,0,PACKWDSNUM-1,0);
/*==========================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ Slected bitrate¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*==========================================*/
switch(chan->fix_rate)

    {

    case RATE8_5K:packedwords[0]=4;

        break;

    case RATE4_0K:packedwords[0]=3;

        break;

    case RATE2_0K:packedwords[0]=2;

        break;

    case RATEO_8K:packedwords[0]=1;

        break;

    default:nrerror(″Invalid rate!!″);

        break;

    }
/*======================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤Classification index ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
				
				<dp n="d205"/>
/*=============================================*/
if((chan->fix_rate=RATE8_5K)‖(chan->fix_rate=RATE4_0K))

    BIT_bitpack(chan->idx_SVS_deci,(unsigned short*)packedwords,

                                      1,packw_ptr);
/*=============================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤LSF quantizer index¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*=============================================*/
switch(chan->fix_rate)

    {

    /*---------------------------------------------*/

    /*========case RATE8_5K===========*/

    /*---------------------------------------------*/

    case RATE8_5K:

        /*---------------------------------------------*/

        /*                      25bits                         */

        /*---------------------------------------------*/

        BIT_bitpack(chan->idx_lsf[0],(unsigned short*)packedwords,

                                7,packw_ptr);

        BIT_bitpack(chan->idx_lsf[1],(unsigned short*)packedwords,

                                 6,packw_ptr);

        BIT_bitpack(chan->idx_lsf[2],(unsigned short*)packedwords,

                                 6,packw_ptr);

        BIT_bitpack(chan->idx_lsf[3],(unsigned short*)packedwords,

                                6,packw_ptr);

        /*---------------------------------------------*/

        /*             LSF interpolation 2bits               */

        /*---------------------------------------------*/

        if(chan->idx_SVS_deci=0)

           BIT_bitpack(chan->idx_lpc_int,

                     (unsigned short*)packedwords,2,packw_ptr);

        break;
  /*---------------------------------------------*/
  /*===========case RATE4_0K==============*/
				
				<dp n="d206"/>
/*---------------------------------------------*/
case RATE4_0K:

    /*---------------------------------------------*/

    /*                    21bits                       */

    /*---------------------------------------------*/

    BIT_bitpack(chan->idx_lsf[0],(unsigned short*)packedwords,

                            7,packw_ptr);

    BIT_bitpack(chan->idx_lsf[1],(unsigned short*)packedwords,

                            7,packw_ptr);

    BIT_bitpack(chan->idx_lsf[2],(unsigned short*)packedwords,

                            6,packw_ptr);

    BIT_bitpack(chan->idx_lsf[3],(unsigned shorr*)packedwords,

                            1,packw_ptr);

    break;
/*---------------------------------------------*/
/*============case RATE2_0K===============*/
/*---------------------------------------------*/
case RATE2_0K:

    /*---------------------------------------------*/

    /*                  25bits                     */

    /*---------------------------------------------*/

    BIT_bitpack(chan->idx_lsf[0],(unsigned short*)packedwords,

                            7,packw_ptr);

    BIT_bitpack(chan->idx_lsf[1],(unsigned short*)packedwords,

                            6,packw_ptr);

    BIT_bitpack(chan->idx_lsf[2],(unsigned short*)packedwords,

                            6,packw_ptr);

    BIT_bitpack(chan->idx_lsf[3],(unsigned short*)packedwords,

                            6,packw_ptr);
				
				<dp n="d207"/>
     /*---------------------------------------------*/

     /*                LSF interpolation 2 bits               */
  /*---------------------------------------------*/
  BIT_bitpack(chan->idx_lpc_int,(unsigned short*)packedwords,

                          2,packw_ptr);
  break;
  /*---------------------------------------------*/
  /*==========case RATE0_8K=============*/
  /*---------------------------------------------*/
  case RATE0_8K:

       /*---------------------------------------------*/

       /*                    11bits                         */

       /*---------------------------------------------*/

       BIT_bitpack(chan->idx_lsf[0],(unsigned short*)packedwords,

                               4,packw_ptr);

       BIT_bitpack(chan->idx_lsf[1],(unsigned short*)packedwords,

                                4,packw_ptr);

       BIT_bitpack(chan->idx_lsf[2],(unsigned short*)packedwords,

                               3,packw_ptr);

       break;
   default:nrerror(″Invalid rate!!″);

       break;
   }
/*==============================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤Pitch index ¤¤¤¤¤¤¤¤¤¤¤¤*/
/*==============================================*/
if((chan->fix_rate==RATE8_5K)‖(chan->fix_rate=RATE4_0K))

     {

     if(chan->idx_SVS_deci=1)

         {

         if(chan->fix_rate=RATE8_5K)
				
				<dp n="d208"/>
        BIT_bitpack(chan->idx_pitch[0],

           (unsigned short*)packedwords,8,packw_ptr);

     else if(chan->fix_rate=RATE4_OK)

           BIT_bitpack(chan->idx_pitch[0],

             (unsigned short*)packedwords,7,packw_ptr);

        }
   else

        {

        if(chan->fix_rate=RATE8_5K)

            {

             BIT_bitpack(chan->idx_pitch[0],

               (unsigned short*)packedwords,8,packw_ptr);

             BIT_bitpack(chan->idx_pitch[1],

                (unsigned short*)packedwords,5,packw_ptr);

             BIT_bitpack(chan->idx_pitch[2],

               (unsigned short*)packedwords,8,packw_ptr);

             BIT_bitpack(chan->idx_pitch[3],

               (unsigned short*)packedwords,5,packw_ptr);

            }

       else if(chan->fix_rate=RATE4_0K)

            {

            for(i=0;i<N_SF2;i++)

                BIT_bitpack(chan->idx_pitch[i],

                    (unsigned short*)packedwords,7,packw_ptr);

            }

        }

      }
/*=======================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤Gains index¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*=======================================================*/
switch(chan->fix_rate)

    {

    /*---------------------------------------------*/

    /*=================case RATE8_5K=================*/

    /*---------------------------------------------*/
				
				<dp n="d209"/>
case RATE8_5K:

     if(chan->idx_SVS_deci=1)

         {

          BIT_bitpack(chan->idx_Gp_VQ,

              (unsigned short*)packedwords,6,packw_ptr);

          BIT_bitpack(chan->idx_Gc_VQ,

              (unsigned short*)packedwords,10,packw_ptr);

         }

    else

        {

        for(i=0;i<N_SF4;i++)

            BIT_butpack(chan->idx_gainVQ[i],

                (unsigned short*)packedwords,7,packw_ptr);

        }
   break;
/*---------------------------------------------*/
/*==========case RATE4_0K==========*/
/*----------------------------------------------*/
case RATE4_0K:

     if(chan->idx_SVS_deci=1)

         {

         BIT_bitpack(chan->idx_Gp_VQ,

             (unsigned short*)packedwords,4,packw_ptr);

         BIT_bitpack(chan->idx_Gc_VQ,

             (unsigned short*)packedwords,8,packw_ptr);

        }

    else

        {

        for(i=0;i<N_SF2;i++)

            BIT_bitpack(chan->idx_gainVQ[i],

                (unsigned short*)packedwords,7,packw_ptr);

        }
   break;
/*---------------------------------------------*/
/*=========case RATE2_0K==========*/
/*---------------------------------------------*/
				
				<dp n="d210"/>
   case RATE2_0K:

       for(i=0;i<N_SF2;i++)

           BIT_bitpack(chan->idx_gainVQ[i],

               (unsigned short*)packedwords,6,packw_ptr);

       break;
  case RATE0_8K:

          BIT_bitpack(chan->idx_gainVQ[0],

              (unsigned short*)packedwords,5,packw_ptr);

       break;

    default:nrerror(″Invalid rate!!″);

        break;

    }
/*=======================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤Codeboks index ¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*=======================================*/
switch(chan->fix_rate)

    {

    /*---------------------------------------------*/

    /*===========case RATE8_5K===============*/

    /*---------------------------------------------*/

    case RATE8_5K:

    if(chan->idx_SVS_deci=1)

        {

        /*---------------------------------------------*/

        /*                Stationary voiced speech                  */

        /*---------------------------------------------*/

        for(i_sf=0;i_sf<N_SF4;i_sf++)

            {

            /*---------------------------------------------*/

         /*8 pulses CB:6p×3b+2p×4b+4b signs=30 bits */

           /*---------------------------------------------*/

           for(i=0;i<4;i++)

               BIT_bitpack((chan->idx_cpcbsign[i_sf][i]),
				
				<dp n="d211"/>
                          (UNS_INT16*)packedwords,1,packw_ptr);

      BIT_bitpack((chan->idx_cpcb[i_sf][0]),

                          (UNS_INT16 *)packedwords,4,packw_ptr);

      for(i=1;i<4;i++)

          BIT_bitpack((chan->idx_cpcb[i_sf][i]),

                      (UNS_INT16 *)packedwords,3,packw_ptr);

      BIT_bitpack((chan->idx_cpcb[i_sf][4]),

                        (UNS_INT16*)packedwords,4,packw_ptr);

      for(i=5;i<8;i++)

         BIT_bitpack((chan->idx_cpcb[i_sf][i]),

                      (UNS_INT16*)packedwords,3,packw_ptr);

        }

    /*-----------------------------------*/

    }
else

    {

    /*-----------------------------------*/

    /*           Non-Stationary voiced speech          */

    /*-----------------------------------*/

    for(i_sf=0;i_sf<N_SF4;i_sf++)

        {

        BIT_bitpack((chan->idx_subcpcb[i_sf][0]),

                     (UNS_INT16*)packedwords,1,packw_ptr);

        if(chan->idx_subcpcb[i_sf][0]=1)

            {

            /*------------------------------------*/

            /*5 pulsesCB:3p×4b+2p×3b+3b signs    */

            /*           =21bits                  */

            /*------------------------------*/

            for(i=0;i<3;i++)

                BIT_bitpack((chan->idx_cpcbsign[i_sf][i]),

                    (UNS_INT16*)packedwords,1,packw_ptr);

        BIT_bitpack((chan->idx_cpcb[i_sf][0]),

             (UNS_INT16*)packedwords,4,packw_ptr);
				
				<dp n="d212"/>
        BIT_bitpack((chan->idx_cpcb[i_sf][1]),

              (UNS_INT16*)packedwords,4,packw_ptr);

        BIT_bitpack((chan->idx_cpcb[i_sf][2]),

              (UNS_INT16*)packedwords,3,packw_ptr);

        BIT_bitpack((chan->idx_cpcb[i_sf][3]),

              (UNS_INT16*)packedwords,4,packw_ptr);

        BIT_bitpack((chan->idx_cpcb[i_sf][4]),

              (UNS_INT16*)packedwords,3,packw_ptr);

       }
   else

       {

       BIT_bitpack((chan->idx_subcpcb[i_sf][1]),

              (UNS_INT16*)packedwords,1,packw_ptr);

       /*---------------------------------*/

       /*           5 pulsesCB:5p×3b+5b signs    */

       /*               =20bits                   */

       /*---------------------------------*/

       for(i=0;i<5;i++)

           {

           BIT_bitpack((chan->idx_cpcbsign[i_sf][i]),

              (UNS_INT16*)packedwords,1,packw_ptr);

           BIT_bitpack((chan->idx_cpcb[i_sf][i]),

             (UNS_INT16*)packedwords,3,packw_ptr);

          }

        }

      }

    }
break;
/*---------------------------------------------*/
/*===========case RATE4_0K==============*/
/*---------------------------------------------*/
case RATE4_OK:
if(chan->idx_SVS_deci=1)

     {
				
				<dp n="d213"/>
/*---------------------------------------------*/
/*                Stationary voiced speech              */
/*---------------------------------------------*/
for(i_sf=0;i_sf<N_SF3;i_sf++)

    {

    BIT_bitpack((chan->idx_subcpcb[i_sf][0]),

                (UNS_INT16*)packedwords,1,packw_ptr);

    if(chan->idx_subcpcb[i_sf][0]==1)

        {

        /*--------------------------------------*/

        /*2 pulses CB:2pulses×5bits/pulse+2signs */

        /*           =12bits                  */

        /*--------------------------------------*/

        for(i=0;i<2;i++)

            {

            BIT_bitpack((chan->idx_cpcbsign[i_sf][i]),

              (UNS_INT16*)packedwords,1,packw_ptr);

            BIT_bitpack((chan->idx_cpcb[i_sf][i]),

              (UNS_INT16*)packedwords,5,packw_ptr);

           }

         }

     else

         {

         /*---------------------------------------------*/

         /*   3pulses CB:3pulses×2bits/pulse+   */

         /*   3signs+3bits center=12 bits        */

         /*---------------------------------------------*/

         for(i=0;i<3;i++)

             {

             BIT_bitpack((chan->idx_cpcbsign[i_sf][i]),

               (UNS_INT16*)packedwords,1,packw_ptr);

             BIT_bitpack((chan->idx_cpcb[i_sf][i]),

               (UNS_INT16*)packedwords,2,packw_ptr);

            }

        BIT_bitpack((chan->idx_center[i_sf]),

                (UNS_INT16*)packedwords,3,packw_ptr);

       }

    }
				
				<dp n="d214"/>
      }
else

      {

      /*---------------------------------------------*/

      /*          Non-Stationary voiced speech           */

      /*---------------------------------------------*/

      for(i_sf=0;i_sf<N_SF2;i_sf++)

          {

          BIT_bitpack((chan->idx_subcpcb[i_sf][0]),

                      (UNS_INT16*)packedwords,1,packw_ptr);

          if(chan->idx_subcpcb[i_sf][0]=1)

            {

            /*---------------------------------------------*/

            /*     2 pulses CB:2pulses×6.5bits/pulse      */

            /*              +1sign=12bits                  */

            /*---------------------------------------------*/

            BIT_bitpack((chan->idx_cpcbsign[i_sf][0]),

                    (UNS_INT16*)packedwords,1,packw_ptr);

            BIT_bitpack((chan->idx_cpcb[i_sf][0]),

                    (UNS_INT16*)packedwords,13,packw_ptr);

           }

      else

           {

           BIT_bitpack((chan->idx_subcpcb[i_sf][1]),

                    (UNS_INT16*)packedwords,1,packw_ptr);

           if(chan->idx_subcpcb[i_sf][1]=1)

               {

               /*---------------------------------------------*/

               /*  3pulses CB:3pulses×2bits/pulse    */

               /*    3 signs+4bits center=13bits     */

               /*---------------------------------------------*/

               for(i=0;i<3;i++)

                   {

                   BIT_bitpack((chan->idx_cpcbsign[i_sf][i]),

                  (UNS_INT16*)packedwords,1,packw_ptr);

                  BIT_bitpack((chan->idx_cpcb[i_sf][i]),
				
				<dp n="d215"/>
               (UNS_INT16*)packedwords,2,packw_ptr);

              }

           BIT_bitpack((chan->idx_center[i_sf]),

               (UNS_INT16*)packedwords,4,packw_ptr);

           }

      else

           {

           /*---------------------------------------------*/

           /*      Gaussian codebook,13bits      */

           /*---------------------------------------------*/

           for(i=0;i<2;i++)

               BIT_bitpack((chan->idx_cpcbsign[i_sf][i]),

               (UNS_INT16*)packedwords,1,packw_ptr);

               BIT_bitpack((chan->idx_cpcb[i_sf][0]),

               (UNS_INT16*)packedwords,11,packw_ptr);

               }

             }

          }

        }
break;
/*---------------------------------------------*/
/*=========case RATE2_0K==========*/
/*---------------------------------------------*/
case RATE2_0K:

    break;
/*---------------------------------------------*/
/*===========case RATE0_8K==============*/
/*---------------------------------------------*/
case RATE0_8K:

     break;
/*---------------------------------------------*/
/*==========ERROR==========*/
/*---------------------------------------------*/
				
				<dp n="d216"/>
      default:nrerror(″Invalid rate!!″);

          break;

      }
  /*---------------------------------------------*/
  return;
  /*---------------------------------------------*/
  }
/*-----------------------------------------------*/
/*=======================================*/
/*FUNCTION        :BIT_bits_to_cdbk_index().                 */
/*-----------------------------------------------*/
/*PURPOSE          :This function converts the the bit-stream     */
/*                 representation into the codebook index          */
/*-----------------------------------------------*/
/*INPUT ARGUMENTS  :                              */
/*      _(INT16     [])packedwords:bit-stream.             */
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS:                             */
/*      _(PARAMETER    *)indices  :fixed codebook indices. */
/*-----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                           */
/*     _(INT16     [])packw_ptr:   pointer to the bit-stream.*/
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                               */
/*               _None.                */
/*==================================*/
void BIT_bits_to_cdbk_index(INT16 packedwords[],INT16 packw_pyr[],

                         PARAMETER*chan)

     {

     /*-------------------------------------------*/

     INT16 i,i_sf;

     /*-------------------------------------------*/

         /*=================================*/
				
				<dp n="d217"/>
/*¤¤¤¤¤¤¤¤¤¤¤¤Classification index¤¤¤¤¤¤¤¤¤¤¤*/
/*==============================================*/
if((chan->fix_rate==RATE8_5K)‖

         (chan->fix_rate=RATE4_OK))

              BIT_bitunpack(&amp;chan->idx_SVS_deci,

                  (UNS_INT16*)packedwords,1,packw_ptr);
else

    chan->idx_SVS_deci=0;
/*==============================================*/
/*¤¤¤¤¤¤¤¤¤¤¤LSF quantizer index¤¤¤¤¤¤¤¤¤¤¤¤*/
/*==============================================*/
switch(chan->fix_rate)

    {

    /*---------------------------------------------*/

    /*===========case RATE8_5K============*/

    /*---------------------------------------------*/

    case RATE8_5K:

         /*---------------------------------------------*/

         /*                 25bits                      */

         /*---------------------------------------------*/

         BIT_bitunpack(&amp;chan->idx_1sf[0],

                (UNS_INT16*)packedwords,7,packw_ptr);

         BIT_bitunpack(&amp;chan->idx_lsf[1],

                 (UNS_INT16*)packedwords,6,packw_ptr);

         BIT_bitunpack(&amp;chan->idx_lsf[2],

                 (UNS_INT16*)packedwords,6,packw_ptt);

         BIT_bitunpack(&amp;chan->idx_lsf[3],

                 (UNS_INT16*)packedwords,6,packw_ptr);

         /*---------------------------------------------*/

         /*              LSF interpolation  2bits              */

         /*---------------------------------------------*/
				
				<dp n="d218"/>
     if(chan->idx_SVS_deci=0)

         BIT_bitunpack(&amp;chan->idx_lpc_int,

             (UNS_INT16*)packedwords,2,packw_ptr);

     break;

     /*---------------------------------------------*/

     /*===========case RATE4_0K==============*/

     /*---------------------------------------------*/

     case RATE4_0K:

          /*---------------------------------------------*/

          /*                    21bits                          */

          /*---------------------------------------------*/

          BIT_bitunpack(&amp;chan->idx_lsf[0],

                  (UNS_INT16*)packedwords,7,packw_ptr);

          BIT_bitunpack(&amp;chan->idx_lsf[1],

                  (UNS_INT16*)packedwords,7,packw_ptr);

          BIT_bitunpack(&amp;chan->idx_lsf[2],

                  (UNS_INT16*)packedwords,6,packw_ptr);

          BIT_bitunpack(&amp;chan->idx_lsf[3],

                  (UNS_INT16*)packedwords,1,packw_ptr);

    break;

    /*---------------------------------------------*/

    /*========case RATE2_0K============*/

    /*---------------------------------------------*/
case RATE2_0K:

      /*---------------------------------------------*/

      /*                   25bits                             */

      /*---------------------------------------------*/

      BIT_bitunpack(&amp;chan->idx_lsf[0],

               (UNS_INT 16*)packedwords,7,packw_ptr);
				
				<dp n="d219"/>
     BIT_bitunpack(&amp;chan->idx_lsf[1],

         (UNS_INT16*)packedwords,6,packw_ptr);

     BIT_bitunpack(&amp;chan->idx_lsf[2],

         (UNS_INT16*)packedwords,6,packw_ptr);

     BIT_bitunpack(&amp;chan->idx_lsf[3],

         (UNS_INT16*)packedwords,6,packw_ptr);

     /*---------------------------------------------*/

     /*         LSF interpolation  2bits          */

     /*---------------------------------------------*/

     BIT_bitunpack(&amp;chan->idx_lpc_int,

            (UNS_INT16*)packedwords,2,packw_ptr);
  break;
  /*---------------------------------------------*/
  /*=======case RATE0_8K========*/
  /*---------------------------------------------*/
case RATE0_8K:

      /*---------------------------------------------*/

      /*              11bits                     */

      /*---------------------------------------------*/

      BIT_bitunpack(&amp;chan->idx_lsf[0],

               (UNS_INT16*)packedwords,4,packw_ptr);

      BIT_bitunpack(&amp;chan->idx_lsf[1],

               (UNS_INT16*)packedwords,4,packw_ptr);

      BIT_bitunpack(&amp;chan->idx_lsf[2],

               (UNS_INT16*)packedwords,3,packw_ptr);
   break;
 default:nrerror(″Invalid rate!!″);
   break;
}
				
				<dp n="d220"/>
/*===============================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤Pitch index¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*=====================================*/
if((chan->fix_rate==RATE8_5K)‖

               (chan->fix_rate=RATE4_0K))

               {

               if(chan->idx_SVS_deci==1)

                   {

                    if(chan->fix_rate=RATE8_5K)

                        {

                        BIT_bitunpack(&amp;chan->idx_pitch[0],

                                 (UNS_INT16*)packedwords,8,

                                       packw_ptr);

              }

         else if(chan->fix_rate=RATE4_0K)

              {

              BIT_bitunpack(&amp;chan->idx_pitch[0],

                  (UNS_INT16*)packedwords,7,

                      packw_ptr);

              }

           }

       else

           {

           if(chan->fix_rate=RATE8_5K)

               {

                BIT_bitunpack(&amp;chan->idx_pitch[0],

                          (UNS_INT16*)packedwords,8,

                              packw_ptr);

                BIT_bitunpack(&amp;chan->idx_pitch[1],

                         (UNS_INT16*)packedwords,5,

                             packw_ptr);

                BIT_bitunpack(&amp;chan->idx_pitch[2],

                         (UNS_INT16*)packedwords,8,

                             packw_ptr);

                BIT_bitunpack(&amp;chan->idx_pitch[3],

                         (UNS_INT16*)packedwords,5,

                             packw_ptr;

                }
				
				<dp n="d221"/>
            else if(chan->fix_rate=RATE4_0K)

                 {

                 for(i=0;i<N_SF2;i++)

                     {

                     BIT_bitunpack(&amp;chan->idx_pitch[i],

                              (UNS_INT16*)packedwords,7,

                                  packw_ptr);

                    }

                }

             }

          }
/*====================================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤Gains index ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*====================================================*/
switch(chan->fix_rate)

    {

    /*---------------------------------------------*/

    /*==========case RATE8_5K============*/

    /*---------------------------------------------*/

    case RATE8_5K:

         if(chan->idx_SVS_deci=1)

              {

              BIT_bitunpack(&amp;chan->idx_Gp_VQ,

                     (UNS_INT 16*)packedwords,6,packw_ptr);

              BIT_bitunpack(&amp;chan->idx_Gc_VQ,

                     (UNS_INT16*)packedwords,10,packw_ptr);

              }

         else

              {

              for(i=0;i<N_SF4;i++)

                  BIT_bitunpack(&amp;chan->idx_gainVQ[i],

                        (UNS_INT16*)packedwords,7,packw_ptr);

              }

        break;
  /*---------------------------------------------*/
  /*============case RATE4_0K===========*/
				
				<dp n="d222"/>
   /*---------------------------------------------*/
   case RATE4_0K:

        if(chan->idx_SVS_deci=1)

             {

             BIT_bitunpack(&amp;chan->idx_Gp_VQ,

                     (UNS_INT16*)packedwords,4,packw_ptr);

             BIT_bitunpack(&amp;chan->idx_Gc_VQ,

                     (UNS_INT16*)packedwords,8,packw_ptr);

             }

        else

             {

             for(i=0;i<N_SF2;i++)

                 BIT_bitunpack(&amp;chan->idx_gainVQ[i],

                        (UNS_INT16*)packedwords,7,packw_ptr);

             }

        break;

    /*---------------------------------------------*/

    /*=======case RATE2_0K==========*/

    /*---------------------------------------------*/

    case RATE2_0K:

         for(i=0;i<N_SF2;i++)

             BIT_bitunpack(&amp;chan->idx_gainVQ[i],

                      (UNS_INT16*)packedwords,6,packw_ptr);

         break;

    case RATE0_8K:

            BIT_bitunpack(&amp;chan->idx_gainVQ[0],

                (UNS_INT16*)packedwords,5,packw_ptr);

         break;
   default:nrerror(″Invalid rate!!″);

       break;
   }
/*===================================*/
/*¤¤¤¤¤¤¤¤¤¤¤¤Codeboks index¤¤¤¤¤¤¤¤¤¤¤*/
/*===================================*/
				
				<dp n="d223"/>
switch(chan->fix_rate)

    {

    /*---------------------------------------------*/

    /*==========case RATE8_5K=========*/

    /*---------------------------------------------*/

    case RATE8_5K:

    if(chan->idx_SVS_deci=1)

        {

        /*---------------------------------------------*/

        /*              Stationary voiced speech            */

        /*---------------------------------------------*/

        for(i_sf=0;i_sf<N_SF4;i_sf++)

            {

            /*---------------------------------------------*/

       /* 8pulses CB:6p×3b+2p×4b+4b signs=30bits   */

         /*---------------------------------------------*/

         for(i=0;i<4;i++)

             BIT_bitunpack(&amp;chan->idx_cpcbsign[i_sf][i],

                          (UNS_INT16*)packedwords,1,packw_ptr);

             BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][0],

                          (UNS_INT16*)packedwords,4,packw_ptr);

             for(i=1;i<4;i++)

                BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][i],

                             (UNS_INT16*)packedwords,3,packw_ptr);

             BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][4],

                             (UNS_INT16*)packedwords,4,packw_ptr);

             for(i=5;i<8;i++)

                 BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][i],

                              (UNS_INT16*)packedwords,3,packw_ptr);

            }

         }
   else

        {
				
				<dp n="d224"/>
/*---------------------------------------------*/
/*           Non-Stationary voiced speech         */
/*---------------------------------------------*/
for(i_sf=0;i_sf<N SF4;i_sf++)

    {

    BIT_bitunpack(&amp;chan->idx_subcpcb[i_sf][0],

                     (UNS_INT16*)packedwords,1,packw_ptr);

    if(chan->idx_subcpcb[i_sf][0]=1)

        {

        /*---------------------------------------------*/

        /*5 pulses CB:3p×4b+2p×3b+3b signs    */

        /*            =21bits                     */

        /*---------------------------------------------*/

        for(i=0;i<3;i++)

            BIT_bitunpack(&amp;chan->idx_cpcbsign[i_sf][i],

                     (UNS_INT16*)packedwords,1,packw_ptr);

            BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][0],

                     (UNS_INT16*)packedwords,4,packw_ptr);

            BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][1],

                     (UNS_INT16*)packedwords,4,packw_ptr);

            BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][2],

                     (UNS_INT16*)packedwords,3,packw_ptr);

            BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][3],

                     (UNS_INT16*)packedwords,4,packw_ptr);

            BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][4],

                     (UNS_INT16*)packedwords,3,packw_ptr);

            }

        else

            {

            BIT_bitunpack(&amp;chan->idx_subcpcb[i_sf][1],

                         (UNS_INT16*)packedwords,1,packw_ptr);

            /*---------------------------------------------*/
				
				<dp n="d225"/>
     /*         5pulses CB:5p×3b+5b signs    */

     /*              =20bits                  */

     /*---------------------------------------------*/

     for(i=0;i<5;i++)

         {

         BIT_bitunpack(&amp;chan->idx_cpcbsign[i_sf][i],

                 (UNS_INT16*)packedwords,1,packw_ptr);

         BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][i],

                 (UNS_INT16*)packedwords,3,packw_ptr);

        }

      }

    }
  }
break;
/*---------------------------------------------*/
/*=======case RATE4_0K=========一*/
/*---------------------------------------------*/
case RATE4_0K:
if(chan->idx_SVS_deci=1)

    {

    /*---------------------------------------------*/

    /*          Stationary voiced speech           */

    /*---------------------------------------------*/

    for(i_sf=0;i_sf<N_SF3;i_sf++)

        {

        BIT_bitunpack(&amp;chan->idx_subcpcb[i_sf][0],

                       (UNS_INT16*)packedwords,1,packw_ptr);

        if(chan->idx_subcpcb[i_sf][0]=1)

            {

            /*---------------------------------------------*/

            /*2pulses CB:2pulses×5bits/pulse+2signs  */

            /*            =12bits                     */

            /*---------------------------------------------*/
				
				<dp n="d226"/>
        for(i=0;i<2;i++)

            {

            BIT_bitunpack(&amp;chan->idx_cpcbsign[i_sf][i],

                     (UNS_INT16*)packedwords,1,packw_ptr);

            BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][i],

                     (UNS_INT16*)packedwotds,5,packw_ptr);

           }

        }

    else

        {

        /*---------------------------------------------*/

        /*   3pulses CB:3pulses×2bits/pulse+   */

        /*   3signs+3bits center=12bits         */

        /*---------------------------------------------*/

        for(i=0;i<3;i++)

            {

            BIT_bitunpack(&amp;chan->idx_cpcbsign[i_sf][i],

                      (UNS_INT16*)packedwords,1,packw_ptr);

            BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][i],

                      (UNS_INT16*)packedwords,2,packw_ptr);

            }

        BIT_bitunpack(&amp;chan->idx_center[i_sf],

                      (UNS_INT16*)packedwords,3,packw_ptr);

        }

      }

    }
else

    {

    /*---------------------------------------------*/

    /*         Non-Stationary voiced speech    */

    /*---------------------------------------------*/

    for(i_sf=0;i_sf<N_SF2;i_sf++)

        {

        BIT_bitunpack(&amp;chan->idx_subcpcb[i_sf][0],

                  (UNS_INT16*)packedwords,1,packw_ptr);
				
				<dp n="d227"/>
if(chan->idx_subcpcb[i_sf][0]=1)

    {

    /*---------------------------------------------*/

    /*     2pulses CB:2pulses×6.5bits/pulse    */

    /*             +1sign=12bits            */

    /*---------------------------------------------*/

    BIT_bitunpack(&amp;chan->idx_cpcbsign[i_sf][0],

                 (UNS_INT16*)packedwords,1,packw_ptr);

    BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][0],

                 (UNS_INT16*)packedwords,13,packw_ptr);

    }
else

    {

    BIT_bitunpack(&amp;chan->idx_subcpcb[i_sf][1],

                 (UNS_INT16*)packedwords,1,packw_ptr);

    if(chan->idx_subcpcb[i_sf][1]=1)

         {

         /*---------------------------------------------*/

         /*  3pulses CB:3pulses×2bits/pulse  */

         /*    3signs+4bits center=13bits      */

         /*---------------------------------------------*/

         for(i=0;i<3;i++)

             {

             BIT_bitunpack(&amp;chan->idx_cpcbsign[i_sf][i],

                (UNS_INT16*)packedwords,1,packw_ptr);

             BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][i],

                (UNS_INT16*)packedwords,2,packw_ptr);

             }

         BIT_bitunpack(&amp;chan->idx_center[i_sf],

                  (UNS_INT16*)packedwords,4,packw_ptr);

         }
   else

        {

        /*---------------------------------------------*/

        /*           Gaussian codebook,13bits          */

        /*---------------------------------------------*/
				
				<dp n="d228"/>
              for(i=0;i<2;i++)

                  BIT_bitunpack(&amp;chan->idx_cpcbsign[i_sg][i],

                     (UNS_INT16*)packedwords,1,packw_ptr);

              BIT_bitunpack(&amp;chan->idx_cpcb[i_sf][0],

                     (UNS_INT16*)packedwords,11,packw_ptr);

            }

            }

         }

       }

       break;
   /*---------------------------------------------*/
   /*============case RATE2_0K=============*/
   /*---------------------------------------------*/
   case RATE2_0K:

        break;
   /*---------------------------------------------*/
   /*===========case RATE0_8K============*/
   /*---------------------------------------------*/
   case RATE0_8K:

        break;
   /*---------------------------------------------*/
   /*==============ERROR=================*/
   /*---------------------------------------------*/
   default:nrerror(″Invalid rate!!);

       break;
   }
/*---------------------------------------------*/
return;
/*---------------------------------------------*/
}
				
				<dp n="d229"/>
/*=============================*/
/*----------------------END---------------------*/
/*=============================*/
				
				<dp n="d230"/>
/*==============================*/
/*==============================*/
/*Conexant System Inc.                                   */
/*4311 Jamboree Road                                      */
/*Newport Beach,CA 92660                                   */
/*---------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                    */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                            */
/*No part of this softwafe may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation*/
/*or adaptation)without the authorisation of Conexant System Inc. */
/*====================================*/
/*LIBRARY:lib_bit.h                                          */
/*====================================*/
/*---------------------------------------------*/
/*----------------------FUNCTIONS----------------------*/
/*---------------------------------------------*/
void BIT_init_lib(void);
void_BIT_bitpack(INT16,UNS_INT16*,INT16,INT16*);
void BIT_bitunpack(INT16*,UNS_INT16*,INT16,INT16*);
void BIT_cdbk_index_to_bits(PARAMETER*,INT16[],INT16[]);
void BIT_bits_to_cdbk_index(INT16[],INT16[],PARAMETER*);
/*===================================*/
/*----------------------END----------------------*/
/*===================================*/
				
				<dp n="d231"/>
/*=====================================*/
/*=====================================*/
/*Conexant System Inc.                                      */
/*4311 Jamboree Road                                       */
/*Newport Beach,CA 92660                                  */
/*---------------------------------------------*/
/*Copyight(C)2000Conexant System Inc.                      */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                               */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation*/
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*==========================================*/
/*LIBRARY:lib_cla.c                                    */
/*==========================================*/
/*---------------------------------------------*/
/*----------------------INCLUDE----------------------*/
/*---------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″gputil.h″
#include″ext_var.h″
#include″lib_cla.h″
#include″lib_lpc.h″
#ifdef DIAGNOSTICS
#include″lib_dia.h″
#endif
/*---------------------------------------------*/
/*----------------------FUNCTIONS----------------------*/
/*---------------------------------------------*/
				
				<dp n="d232"/>
/*====================*/
/*FUNCTION    :CLA_init_lib().                 */
/*---------------------------------------------*/
/*PURPOSE    :This function initialise the global variables  */
/*           of the CLA library.                 */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                              */
/*              _None.                          */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                          */
/*              _None.                          */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                        */
/*                 _None.                               */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                               */
/*           _None.                      */
/*================================*/
void CLA_init_lib(void)

    {

    /*---------------------------------------------*/

    INT16   k;

    FLOAT64x;

    /*---------------------------------------------*/

    VUV=0;

    VUVm=2;

    frame_class=0;

    frame_onset=0;

    energy_m=0.0;

    energy    =0.0;

    /*---------------------------------------------*/

    ini_svector(frame_clas_mem,0,CLA_MEM_SIZE-1,(INT16)0);

    ini_svector(onstplsv_mem,0,CLA_MEM_SIZE-1,(INT16)0);

    ini_svector(voiced_mem,0,CLA_MEM_SIZE-1,(INT16)0);
				
				<dp n="d233"/>
ini_dvector(buffer_cla,0,L_FRM+MEM_CLASS+L_LPCLHD-1,0.0);
ini_dvector(Lp_buffer,0,N_Lp-1,(FLOAT64)MIN_LAG);
MA_avg_wRp=0.0;
MA_min_wtilt=0.0;
ini_dvector(P_w[0],0,SLOPE_MAX_SIZE-1,0.0);
ini_dvector(P_w[1],0,SLOPE_MAX_SIZE-1,0.0);
/*---------------------------------------------*/
/*          Generate Hamming window           */
/*---------------------------------------------*/
for(k=0;k<LPC_WIN1;k++){
  x=cos(2.0*PI*(FLOAT64)k/(FLOAT64)(LPC_WIN1-1));
  windowl[k]=0.54-0.46*x;
}
ini_dvector(buffer_reflO,O,CLA_MEM_SIZE-1,0.0);
E_noi=1.0;
T_noi=0.0;
M_noi=0.0;
R_noi=0.0;
ini_dvector(buffer_wtilt,0,MAX_N_SF-1,0.0);
ini_dvector(buffer_wmax,0,MAX_N_SF-1,0.0);
ini_dvector(buffer_wRp,0,MAX_N_SF-1,0.0);
ini_dvector(buffer_max_cla,0,MAX_N_SF-1,0.0);
/*---------------------------------------------*/
SVS_Count=0;
Vad_0_Count=0;
FlatSp_Flag=0;
Av_value=0.0;
/*---------------------------------------------*/
				
				<dp n="d234"/>
  Rp_m_cla=0.0;
  lpcg_m_cla=0.0;
  /*---------------------------------------------*/

      OnSet=0;

      frame_class_mm=5;
  /*---------------------------------------------*/
  SVS_deci_mem=0;
  /*---------------------------------------------*/
  return;
  /*---------------------------------------------*/
  }
/*---------------------------------------------*/
/*============================*/
/*FUNCTION    :CLA_signal_classifier().                 */
/*---------------------------------------------*/
/*PURPOSE     :This function classify teh input signal frame:*/
/*            file.                              */
/*frame_class 0:silence                                  */
/*frame_class 1:noise-like  (CURRENTLY,NOT ACTIVATED)        */
/*frame_class 2:unvoiced                                  */
/*frame_class 3:onset                                       */
/*frame_class 4:plosive    (CURRENTLY,NOT ACTIVATED)          */
/*frame_class 5:non-stationary voiced                        */
/*frame_class 6:stationary voiced(CURRENTLY,NOT DISTINGUISHED  */

    /*                               FROMCLASS 5)            */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                               */
/*        _(FLOAT64[])signal:input frame.           */
/*        _(FLOAT64) Rp        :Pitch correlation.        */
/*        _(FLOAT64) Lp        :Pitchlags            .*/
/*        _(INT16)Vad          :VAD of current frame.     */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                         */
				
				<dp n="d235"/>
/*           _None.                        */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                             */
/*          _None.                             */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                               */
/*       _(INT16)frame_class:current_farme frame_class.   */
/*=================================*/
INT16    CLA_signal_classifier(FLOAT64signal[],FLOAT64Rp,FLOAT64Lp,

                              INT16 Vad)

    {

    /*---------------------------------------------*/

    INT16 frame_class,i_sf,k,idx;

    /*---------------------------------------------*/

    /*          Parameters for local first order LPC analysis        */

    /*---------------------------------------------*/

    FLOAT64 siglpcl[LPC_WIN1],rxx1[2],pderr;

    /*---------------------------------------------*/

    /*             Pitch lag evolution            */

    /*---------------------------------------------*/

    FLOAT64 Lp_avg,Lp_std;

    /*---------------------------------------------*/

       /*             Maximum Tracking            */

    /*---------------------------------------------*/

    INT16 start,end;

    FLOAT64 val,max,den;

    /*---------------------------------------------*/

      /*         Weighted spectral tilt and weighted maximum    */

    /*---------------------------------------------*/

    FLOAT64E_seg,nsr,min_slope_wtilt,sum_slope_wtilt,max_slope_wmax,

       sum slope_wmax;
				
				<dp n="d236"/>
FLOAT64 num_tilt,num_max,slope_wtilt,slope_wmax;
FLOAT64 min_wtilt,avg_wtilt,max_wRp,avg_wRp;
INT16 onstplsv,voiced;
/*---------------------------------------------*/
/*                  Update signal buffer                 */
/*---------------------------------------------*/
for(k=0;k<MEM_CLASS;k++)

    buffer_cla[k]=buffer_cla[k+L_FRM];
for(k=0;k<L_FRM+L_LPCLHD;k++)

    buffer_cla[k+MEM_CLASS]=signal[k];
/*---------------------------------------------*/
/*==========Calculate evolution of pitch lag=========*/
/*---------------------------------------------*/
/*---------------------------------------------*/
/*            Update buffer with pitch lags           */
/*---------------------------------------------*/
for(k=0;k<N_Lp-1;k++)

    Lp_buffer[k]=Lp_buffer[k+1];
Lp_buffer[N_Lp-1]=Lp;
/*---------------------------------------------*/
/*              Average pitch lag                 */
/*---------------------------------------------*/
for(Lp_avg=0.0,k=0;k<N_Lp;k++)

    Lp_avg+=Lp_bufier[k];
Lp_avg/=(FLOAT64)N_Lp;
/*---------------------------------------------*/
/*           Standard deviation on lag            */
/*---------------------------------------------*/
for(Lp_std=0.0,k=0;k<N_Lp;k++)

    Lp_std+=(Lp_buffer[k]-Lp_avg)*(Lp_bufier[k]-Lp_avg);
				
				<dp n="d237"/>
Lp_std=sqrt(Lp_std/(FLOAT64)N_Lp)/Lp_avg;
/*---------------------------------------------*/
/*          Bufier onset parameters of the previous frame       */
/*---------------------------------------------*/
for(k=0;k<SLOPE_MAX_SIZE;k++)

    P_W[0][k]=P_w[1][k];
/*---------------------------------------------*/
/*============Calculate spectral tilt==========*/
/*---------------------------------------------*/
for(i_sf=0;i_sf<CLA_MEM_SIZE;i_sf++)

     {

     /*---------------------------------------------*/

     /*========Local first order LPC analysis============*/

     /*---------------------------------------------*/

     /*---------------------------------------------*/

     /*              LPC windowing                  */

     /*---------------------------------------------*/

     mul_dvector(signal+sf*L_LPC_SF-OVERLAP,windowl,siglpcl,

                                                      0,LPC_WIN1-1);

     /*---------------------------------------------*/

     /*       Autocorrelation             */

     /*---------------------------------------------*/

     LPC_autocorrelation(siglpcl,LPC_WIN1,rxx1,2);

     /*---------------------------------------------*/

     /*      Leroux-Gueguen recursion             */

     /*---------------------------------------------*/

     LPC_leroux_gueguen(rxx1,&amp;buffer_refl0[i_sf],&amp;pderr,1);

     } 
/*---------------------------------------------*/
/*==============Calculate Maximum=============*/
				
				<dp n="d238"/>
/*=============(the lookahead is utilized)=========*/
/*---------------------------------------------*/
for(i_sf=0;i_sf<MAX_N_SF;i_sf++)

     {

     /*---------------------------------------------*/

     /*          Find max in pitch cycle             */

     /*---------------------------------------------*/

     if(Lp>MAX_L_SF)

         {

         start=MEM_CLASS+MAX_L_SF-(INT16)(1.5*Lp)+

                                            i_sf*MAX_L_SF+L_LPCLHD;

         start=(start<0?0:start);

         }

     else

         start=MEM_CLASS+i_sf*MAX_L_SF+L_LPCLHD;

     end=MEM_CLASS+(i_sf+1)*MAX_L_SF+L_LPCLHD;

     for(max=-MAXFLT,k=start;k<end;k++)

          {

          val=(buffer_cla[k]>0.0?buffer_cla[k]:-buffer_cla[k]);

          if(val>max)

              max=val;

          }

    /*---------------------------------------------*/

    /*              Update buffer of maxima               */

    /*---------------------------------------------*/

    buffer_max_cla[i_sf]=max;

    }
/*---------------------------------------------*/
/*=====Calculate weighted tilt,weighted maximum,and======*/
/*===========weighted pitch correlation==========*/
/*=======the parametric noise component is suppressed=====*/
/*============(the lookahead is utilized)=========*/
/*---------------------------------------------*/
				
				<dp n="d239"/>
min_slope_wtilt=MAXFLT;
sum_slope_wtilt=0.0;
max_slope_wmax=-MAXFLT;
sum_slope_wmax=0.0;
min_wtilt=MAXFLT;
avg_wtilt=0.0;
max_wRp=-MAXFLT;
avg_wRp=0.0;
for(i_sf=0;i_sf<MAX_N_SF;i_sf++)

     {

     /*---------------------------------------------*/

     /*           Find energy in pitch cycle           */

     /*---------------------------------------------*/

     if(Lp>MAX_L_SF)

         {

          start=MEM_CLASS+MAX_L_SF-(INT16)(2.0*Lp)+i_sf*MAX_L_SF;

          start=(start<0?0:start);

         }

      else

          start=MEM_CLASS+i_sf*MAX_L_SF;

      end=MEM_CLASS+(i_sf+1)*MAX_L_SF;

      /*---------------------------------------------*/

      /*         Update segment energy             */

      /*---------------------------------------------*/

      E_seg=0.0;

      for(k=start;k<end;k++)

           E_seg+=bufier_cla[k]*buffer_cla[k];

      /*---------------------------------------------*/

      /*        Normalize energy             */

      /*---------------------------------------------*/

      E_seg=1.0+E_seg/(FLOAT64)(end-start+1);

      /*---------------------------------------------*/

      /*         Update noise level,noise tilt,noise max        */

      /*---------------------------------------------*/
				
				<dp n="d240"/>
if(frm_count<6 &amp;&amp; buffer_refl0[(INT16)((FLOAT64)i_sf/2.0)]<

         -0.4 &amp;&amp; Rp<0.50)

     {

     /*---------------------------------------------*/

     /*        Relaxed update with fast adaptation       */

     /*---------------------------------------------*/

     E_noi=0.80*E_noi+0.20*E_seg;

     idx=(INT16)((FLOAT64)i_sf/2.0);

     T_noi=0.75*T_noi+0.25*buffer_refl0[idx];

     M_noi=0.75*M_noi+0.25*buffer_max_cla[i_sf];

     R_noi=0.75*R_noi+0.25*Rp;

     }
elseif(Vad=0)

     {

     /*---------------------------------------------*/

     /*        Stringent update with slow adaptation       */

     /*---------------------------------------------*/

     E_noi=0.999*E_noi+0.001*E_seg;

     idx=(INT16)((FLOAT64)i_sf/2.0);

     T_noi=0.990*T_noi+0.010*buffer_ref10[idx];

     M_noi=0.990*M_noi+0.010*bufer_max_cla[i_sf];

     R_noi=0.990*R_noi+0.010*Rp;

     }
/*---------------------------------------------*/
/*             Calculate weighting factor    */
/*---------------------------------------------*/
nsr=sqrt(E_noi/E_seg);
/*---------------------------------------------*/
/*              Limit noise suppression to 30dB.            */
/*              nsr_lim=1-10^(-dB_lim/20)             */
/*            10dB:0.684,20dB:0.900,30dB:0.968        */
/*---------------------------------------------*/
nsr=(nsr>0.968?0.968:nsr);
				
				<dp n="d241"/>
/*---------------------------------------------*/
/*   Update buffer of weighted tilt,weighted maximum,and  */
/*           weighted pitch correlation             */
/*---------------------------------------------*/
for(k=0;k<MAX_N_SF-1;k++)

    {

    buffer_wtilt[k]=buffer_wtilt[k+1];

    buffer_wmax[k]=buffer_wmax[k+1];

    buffer_wRp[k]=buffer_wRp[k+1];

    }
/*---------------------------------------------*/
/*   Suppress noise component in tilt,maximum,and pitch   */
/*               correlation                 */
/*---------------------------------------------*/
idx=(INT16)((FLOAT64)i_sf/2.0);
buffer_wtilt[MAX_N_SF-1]=buffer_refl0[idx]-nsr*T_noi;
buffer_wmax[MAX_N_SF-1]=buffer_max_cla[i_sf]-nsr*M_noi;
buffer_wRp[MAX_N_SF-1]=Rp-nsr*R_noi;
/*---------------------------------------------*/
/*    Calculate slope of weighted tilt and weighted maximum   */
/*---------------------------------------------*/
num_tilt=0.0;
num_max=0.0;
den=0.0;
for(k=0;k<MAX_N_SF;k++)

    {

    num_tilt+=(FLOAT64)k*(buffer_wtilt[k]-buffer_wtilt[0]);

    num_max+=(FLOAT64)k*(buffer_wmax[k]-buffer_wmax[0]);

    den+=(FLOAT64)(k*k);

    }
/*---------------------------------------------*/
/*        Update sum,max,min,avg,etc of weighted tilt,    */
/*        weighted maximum,and weighted pitch correlation    */
/*---------------------------------------------*/
slope_wtilt=num_tilt/(den+EPSI);
				
				<dp n="d242"/>
   if(slope_wtilt<min_slope_wtilt)

        min_slope_wtilt=slope_wtilt;
   sum_slope_wtilt+=slope_wtilt;
   slope_wmax=num_max/(den+EPSI);
   if(slope_wmax>max_slope_wmax)

        max_slope_wmax=slope_wmax;
   sum_slope_wmax+=slope_wmax;
   /*---------------------------------------------*/
   /*       Update minimum and average of weighted tilt      */
   /*---------------------------------------------*/
   if(buffer_wtilt[MAX_N_SF-1]<min_wtilt)

        min_wtilt=buffer_wtilt[MAX_N_SF-1];
   avg_wtilt+=buffer_wtilt[MAX_N_SF-1];
   /*---------------------------------------------*/
   /*   Update maximum and average of weighted pitch correlation */
   /*---------------------------------------------*/
   if(buffer_wRp[MAX_N_SF-1]>max_wRp)

        max_wRp=buffer_wRp[MAX_N_SF-1];
   avg_wRp+=buffer_wRp[MAX_N_SF-1];
   /*---------------------------------------------*/
   }
/*---------------------------------------------*/
/*       Normalize average weighted tilt and pitch correlation       */
/*---------------------------------------------*/
avg_wRp/=(FLOAT64)MAX_N_SF;
avg_wtilt/=(FLOAT64)MAX_N_SF;
/*---------------------------------------------*/
/*          Update moving average of weighted spectral tilt        */
/*---------------------------------------------*/
				
				<dp n="d243"/>
MA_min_wtilt=0.75*MA_min_wtilt+0.25*min_wtilt;
/*---------------------------------------------*/
/*             Update moving average ofpitch correlation          */
/*---------------------------------------------*/
MA_avg_wRp=0.75*MA_avg_wRp+0.25*avg_wRp;
/*---------------------------------------------*/
/*    The first reflection coefficient of the last subframe with       */
/*           inverted sign for probability interpretation,         */
/*             i.e.mapped to[-1:1]             */
/*---------------------------------------------*/
P_w[1][4]=-buffer_wtilt[MAX_N_SF-1];
/*---------------------------------------------*/
/*  Limit sum of slopes to min of-1.0,max of 1.0,mapped to[-1:1] */
/*            inverted sign for probability interpretation,         */
/*---------------------------------------------*/
P_w[1][0]=-sum_slope_wtilt;
if(P_w[1][0]>1.0)

    P_w[1][0]=1.0;
else if(P_w[1][0]<-1.0)

    P_w[1][0]=-1.0;
P_w[1][0]*=1.0;
/*---------------------------------------------*/
/*  Limit sum of slopes to min of-0.5,max of0.5,mapped to[-1:1] */
/*          inveted sign for probability interpretation,        */
/*---------------------------------------------*/
P_w[1][1]=-min_slope_wtilt;
if(P_w[1][1]>0.5)

     P_w[1][1]=0.5;
else if(P_w[1][1]<-0.5)

     P_w[1][1]=-0.5;
P_w[1][1]*=2;
				
				<dp n="d244"/>
/*---------------------------------------------*/
/*        Limit sum of slopes to min of-10000,max of 10000,     */
/*                       mapped to[-1∶1]                      */
/*---------------------------------------------*/
P_w[1][2]=sum_slope_wmax;
if(P_w[1][2]>10000.0)

    P_w[1][2]=10000.0;
else_if(P_w[1][2]<-10000.0)

    P_w[1][2]=-10000.0;
P_w[1][2]*=0.0001;
/*---------------------------------------------*/
/*        Limit sum of slopes to min of-1000,max of 1000,      */
/*                        mapped to[-1∶1]                          */
/*---------------------------------------------*/
P_w[1][3]=max_slop_wmax;
if(P_w[1][3]>1000.0)

    P_w[1][3]=1000.0;
else_if(P_w[1][3]<-1000.0)

    P_w[1][3]=-1000.0;
P_w[1][3]*=0.001;
onstplsv=0;
/*---------------------------------------------*/
/*      Rewritten in order to output criterion that triggers onset    */
/*---------------------------------------------*/
if(P_w[1][1]>0.3409 &amp;&amp; P_w[1][2]>0.025 &amp;&amp; P_w[1][4]>-0.075)

    {

    onstplsv=1;

    }
else if(P_w[1][1]>0.2273 &amp;&amp; P_w[1][2]>0.027 &amp;&amp; P_w[1][4]>-0.075)

    {

    onstplsv=1;

    }
else if(P_w[1][1]>0.1818 &amp;&amp; P_w[1][2]>0.031 &amp;&amp; P_w[1][4]>-0.075)

    {

    onstplsv=1;
				
				<dp n="d245"/>
      }
else if(P_w[1][1]>0.0909 &amp;&amp; P_w[1][2]>0.040 &amp;&amp; P_w[1][4]>0.075)

      {

      onstplsv=1;

      }
else if(P_w[1][1]>0.0773 &amp;&amp; P_w[1][2]>0.060 &amp;&amp; P_w[1][4]>0.075)

      {

      onstplsv=1;

      }
else if(P_w[1][1]>0.0591 &amp;&amp; P_w[1][2]>0.080 &amp;&amp; P_w[1][4]>0.100)

      {

      onstplsv=1;

      }
else if(P_w[1][1]>0.03636 &amp;&amp; P_w[1][2]>0.100 &amp;&amp; P_w[1][4]>0.100)

      {

      onstplsv=1;

      }
else if(P_w[1][1]>0.1818 &amp;&amp; P_w[1][2]>0.025 &amp;&amp; P_w[1][3]>0.100 &amp;&amp;
  P_w[1][4]>-0.075)

     {

     onstplsv=1;

     }
else if(P_w[1][1]>0.1364 &amp;&amp; P_w[0][1]>0.1364 &amp;&amp;

     P_w[1][2]>0.015 &amp;&amp; P_w[0][2]>0.015 &amp;&amp; P_w[1][4]>-0.075)

     {

     onstplsv=1;

     }
else if(P_w[1][1]>0.1364 &amp;&amp; P_w[1][3]>0.120 &amp;&amp; P_w[1][4]>0.150)

     {

     onstplsv=1;

     }
else if(P_w[1][1]>0.2273 &amp;&amp; P_w[1][3]>0.070 &amp;&amp; P_w[1][4]>0.150)

    {

    onstplsv=1;

    }
else if(P_w[1][1]>0.2500 &amp;&amp; P_w[1][3]>0.060 &amp;&amp; P_w[1][4]>0.150)

    {

    onstplsv=1;

    }
else if(P_w[1][1]>0.4091 &amp;&amp; P_w[1][3]>0.030 &amp;&amp; P_w[1][4]>0.150)

    {

    onstplsv=1;
				
				<dp n="d246"/>
       }
else if(P_w[1][1]>0.1818 &amp;&amp; P_w[0][3]>0.30 &amp;&amp; P_w[1][4]>0.000)

      {

      onstplsv=1;

      }
voiced=0;
if(avg_wRp>=0.70)

     {

     voiced=1;

     }
else if(avg_wRp>=0.5 &amp;&amp; Lp_std<0.10)

     {

     voiced=1;

     }
else if(MA_avg_wRp>=0.6 &amp;&amp; Lp_std<0.10)

     {

     voiced=1;

     }
else if(avg_wtilt<-0.50 &amp;&amp; avg_wRp>=0.2)

     {

     voiced=1;

     }
else if(min_wtilt<-0.70 &amp;&amp; avg_wRp>=0.2)

     {

     voiced=1;

     }
else if(avg_wtilt<-0.75)

     {

     voiced=1;

     }
else if(MA_avg_wRp>0.50 &amp;&amp; max_wRp>0.40 &amp;&amp; min_wtilt<-0.40)

     {

     voiced=1;

     }
else if(avg_wRp>0.50 &amp;&amp; min_wtilt<-0.35)

     {

     voiced=1;

     }
else if(avg_wRp>0.50 &amp;&amp; min_wtilt<-0.05)

     {

     voiced=1;
				
				<dp n="d247"/>
    }
/*---------------------------------------------*/
/*               Offset handling                */
/*---------------------------------------------*/
else if(voiced_mem[3]=1 &amp;&amp; voiced_mem[2]=1)

      {

      if(MA_avg_wRp>0.55 &amp;&amp; MA_min_wtilt<-0.10 &amp;&amp; Lp_std<0.05)

          {

          voiced=1;

          }

     }
if(Vad=0)

    {

    voiced=0;

    }
/*---------------------------------------------*/
/*============Make frame_class decision===========*/
/*---------------------------------------------*/
frame_class=2;
/*---------------------------------------------*/
/*               Onset frame classification             */
/*---------------------------------------------*/
if((frame_class_mem[3]==0‖frame_class_mem[3]=1‖

    frame_class_mem[3]==2) &amp;&amp; voiced==1)

       frame_class=3;
else if(onstp1sv=1 &amp;&amp;(frame_class_mem[3]!=5‖

          frame_class_mem[3]!=6‖voiced!=1))

               frame_class=3;
/*---------------------------------------------*/
/*                  Voiced frame classification            */
/*---------------------------------------------*/
else if(onstplsv_mem[3]=1 &amp;&amp; voiced=0)

       frame_class=5;
				
				<dp n="d248"/>
   else if(voiced=1)

        frame_class=5;
   if(Vad=0)

        frame_class=0;
   /*---------------------------------------------*/
   /*                Update frame_class buffer               */
   /*---------------------------------------------*/
   for(k=0;k<CLA_MEM_SIZE-1;k++)

       {

       frame_class_mem[k]=frame_class_mem[k+1];

       onstplsv_mem[k]=onstplsv_mem[k+1];

       voiced_mem[k]=voiced_mem[k+1];

       }
   frame_class_mem[CLA_MEM_SIZE-1]=frame_class;
   onstplsv_mem[CLA_MEM_SIZE-1]=onstplsv;
   voiced_mem[CLA_MEM_SIZE-1]=voiced;
   /*---------------------------------------------*/
   /*  frame_class 0:silence                                           */
   /*  frame_class 1:noise-like  (CURRENTLY,NOT ACTIVATED)         */
   /*  frame_class 2:unvoiced                                       */
   /*  frame_class 3:onset                                          */
   /*  frame_class 4:plosive  (CURRENTLY,NOT ACTIVATED)          */
   /*  frame_class 5:non-stationary voiced                              */
   /*  frame_class 6:stationary voiced(CURRENTLY,NOT DISTINGUISHED  */
   /*                      FROM CLASS 5           */
   /*---------------------------------------------*/
   /*---------------------------------------------*/
   return frame_class;
   /*---------------------------------------------*/
   }
/*---------------------------------------------*/
/*===============================*/
				
				<dp n="d249"/>
/*FUNCTION:CLA_NoisUnvoiceDetect().                     */
/*---------------------------------------------*/
/* PURPOSE:This function temporally detects noise-like unvoiced    */
/*        speech to resetthe delay for the LT preprocessing and  */
/*        control the excitation weighting.The decision willbe  */
/*        finalized after pitch-preprocessing.                  */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                           */
/*      _(FLOAT64[])residu:input residual signal.      */
/*      _(FLOAT64[])sig:input speech signal.       */
/*      _(INT16)    1_frm:input frame size.        */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                             */
/*      _(INT16*)frame_class:frame_class frame.   */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*                  _None.                  */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                             */
/*                 _None.                  */
/*=================================*/
void CLA_NoisUnvoiceDetect(FLOAT64 residu[],FLOAT64 sig[],INT16*uv_mode,

                  FLOAT64 *frm_erg,FLOAT64 *frm_sharp,INT16 1_frm)

    {

    /*---------------------------------------------*/

    FLOAT64 P1_SHP,P2 R1,P3_ZC,P4_RE;

    FLOAT64X,X1,X2,Max,M,val;

    INT16    i,N;

    /*---------------------------------------------*/

    /*               Calculate parameter 1∶P1_SHP             */

    /*---------------------------------------------*/

    X=0;

    Max=0;

    for(i=0;i<1_frm;i++)

        {

        M=fabs(residu[i]);

        X+=M;

        if(M>Max)
				
				<dp n="d250"/>
     Max=M;
   }
P1_SHP=X/(1_frm*MAX(1.0,Max));
  (*frm_sharp)=P1_SHP;
/*---------------------------------------------*/
/*                Calculate parameter 2:P2_R1               */
/*---------------------------------------------*/
dot_dvector(sig+1_frm/2,sig+1_frm/2+1,&amp;X,  0,1_frm/2-2);
dot_dvector(sig+1_frm/2,sig+1_frm/2,   &amp;X2,  0,1_frm/2-1);
P2_R1=X/MAX(X2,1.0);
/*---------------------------------------------*/
/*               Calculate parameter 3:P3_ZC             */
/*---------------------------------------------*/
N=0;
for(i=0;i<1_frm/2-1;i++)

    {

    if(sig[i+1__frm/2]*sig[i+1_frm/2+1]<0)

         N++;

    }
P3_ZC=(FLOAT64)N/(1_frm/2-1.0);
/*---------------------------------------------*/
/*             Calculate parameter 4:P4_RE            */
/*---------------------------------------------*/
dot_dvector(residu,residu,frm_erg,0,1_frm/2-1);
dot_dvector(residu+1_frm/2,residu+1_frm/2,frm_erg+1,0,1_frm/2-1);
X1=frm_erg[1];
X1=sqrt(X1/MAX(1.0,X2));
P4_RE=1.0-MIN(1.0,X1);
/*---------------------------------------------*/
/*                Make noise-like decision            */
/*---------------------------------------------*/
				
				<dp n="d251"/>
    N=0;

    for(i=0;i<1_frm;i++)

        {

        if(fabs(sig[i])<0.1)

             N++;

        }

    dot_dvector(sig,sig,&amp;val,0,(INT32)(1_frm*0.75)-1);

    X2=val/(1_frm*0.75);

    if(X2<1000.0‖N*1.0/1_frm>0.5)

        *uv_mode=0;

    if(P1_SHP>0.15)*uv_mode=1;
  if((P2_R1<0.60)&amp;&amp;(P1_SHP>0.20))

      (*uv_mode)=2;
  if((P3_ZC>0.40)&amp;&amp;(P1_SHP>0.18))

      (*uv_mode)=2;
  if((P4_RE<0.40)&amp;&amp;(P1_SHP>0.20))

      (*uv_mode)=2;
  /*---------------------------------------------*/
  return;
  /*---------------------------------------------*/
  }
/*---------------------------------------------*/
/*======================*/
/*FUNCTION:  CLA_Identify_InputSpeech().                    */
/*---------------------------------------------*/
/*PURPOSE:This function identifys input speech as flat speech.   */
/*       The decision needs at least two sentences to update    */
/*       the memory.                                      */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                            */
/*      _(INT16)  pp_mode:=mode 1  or mode 0            */
/*      _(FLOAT64)refl0:first reflection coeff           */
				
				<dp n="d252"/>
/*      _(FLOAT64)lsf0:first lsf                 */
/*      _(FLOAT64)ltp_g  :past LTP gain.            */
/*      _(FLOAT64)lpc_g  :current LPC gain.            */
/*      _(INT16)vad    :  vad decision.                 */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                              */
/*      _(INT16*)  flat_deci: flat speech decision     */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                           */
/*                  _None.                    */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                             */
/*                  _None.                     */
/*===================================*/
void CLA_Identify_Input(INT 16pp_mode,FLOAT64*pdcfq,FLOAT64 lsfO,FLOAT641 ltp_g,

         FLOAT64*lpc_g,INT16 fix_rate,INT16*flat_deci)

    {

    /*---------------------------------------------*/

    INT16 i;

    FLOAT64 sub_refl[NP],x;
  /*---------------------------------------------*/

    LPC_pred2refl(pdcfq,sub_refl,NP);

    (*lpc_g)=1.0;

    for(i=0;i<NP;i++)

      (*lpc_g)*=(1.0-sqr(sub_refl[i]));

    (*lpc_g)=-10.0*log10((*lpc_g)+EPSI);
  /*---------------------------------------------*/
  /*                  Vad counter                   */
  /*---------------------------------------------*/
  if(fix_rate=RATE0_8K)

       Vad_0_Count++;
  else

       Vad_0_Count=0;
				
				<dp n="d253"/>
    if(pp_mode=1){

       x=MIN((*lpc_g)/35.0,1.0)-2.0*sub_refl[0]+MIN(1tp_g,1.0)-lsfO*15;

       x*=2.5;

       if(SVS_Count==0)

          Av_value=0.75*x;

       else{

          if(SVS_Count<10)

             Av_value=0.9*Av_value+0.1*x;

         else{

             if(SVS_Count<100)

                Av_value=0.99*Av_value+0.01*x;

            else Av_value=0.998*Av_value+0.002*x;

            }

        }

     SVS_Count++;

     SVS_Count=MIN(SVS_Count,10000);

    }

    else{

        if((Av_value>5.8)&amp;&amp;((*flat_deci)=0)&amp;&amp;(Vad_0_Count>10)

            &amp;&amp;(SVS_Count>200))

             (*flat_deci)=1;

        if((Av_value<5.3)&amp;&amp;((*flat_deci)=1)&amp;&amp;(Vad_0_Count>10)

            &amp;&amp;(SVS_Count>200))

               (*flat_deci)=0;

       }

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*=========================*/
/*FUNCTION:CLA_Class_Correct().                       */
/*---------------------------------------------*/
/*PURPOSE:This function works for                           */
/*         (1)improving voiced-unvoice decision;     */
/*         (2)improving noise-like unvoiceddecision;      */
				
				<dp n="d254"/>
/*           (3)detecting specific″onset″;           */
/*           (4)making classification for pitch preprocessing; */
/*           (5)improving vad;                         */
/*           (6)detecting voied speech with high prediction gain */
/*                  but noise-like HF excitation.              */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                              */
/*      _(INT16*)frame_class_m:vad decision.       */
/*         class_m,Rp_sub[],NSR,**refl,frm_sharp,        */
/*         energy_m,energy,FrmResEng,lpcgain              */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                             */
/*       *OnSetFlag,*NoisyV_flag                      */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                           */
/*        *class,*class_pp,*Vad,*VUV                   */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                               */
/*       _None                                  */
/*==================================*/
void CLA_Class_Correct(INT16*frame_class,INT16*frame_class_pp,INT16*Vad,

             INT16 * VUV,INT16 * OnSetFlag,

             INT16 frame_class_m,FLOAT64 Rp_sub[],FLOAT64 NSR,

              FLOAT64**refl,FLOAT64f frm_sharp,INT16 smv_mode,FLOAT64 energy_m,

              FLOAT64 energy,FLOAT64 FrmResEng,FLOAT64 lpcgain,

               INT16*NoisyV_flag)

    {

    /*---------------------------------------------*/

    FLOAT64 x,y;

    /*---------------------------------------------*/

    /*             Class correction                  */

    /*---------------------------------------------*/

    /*---------------------------------------------*/

    /*                unvoiced to voiced                */ 

    /*---------------------------------------------*/

    if(((*frame_class)<3) &amp;&amp; (frame_class_m>2) &amp;&amp;

       (Rp_sub[0]>0.43) &amp;&amp; (Rp_sub[1]>0.43))
				
				<dp n="d255"/>
  {
  if((frm_sharp<0.15)&amp;&amp;((Rp_sub[0]+Rp_sub[1])>0.9)&amp;&amp;

       (refl[2][0]>-0.4))

          (*frame_class)=5;
  if((frm_sharp<0.25)&amp;&amp;((Rp_sub[0]+Rp_sub[1])>1.0)&amp;&amp;

       (refl[2][0]>-0.1))

          (*frame_class)=5;
  if((frm_sharp<0.3)&amp;&amp;((Rp_sub[0]+Rp_sub[1])>1.15)&amp;&amp;

       (refl[2][0]>-0.1))

          (*frame_class)=5;
  }
/*---------------------------------------------*/
/*                   voiced to unvoiced                  */
/*---------------------------------------------*/
x=MIN(3*frm_sharp-0.2,0.65);
if((*frame_class>2)&amp;&amp;(Rp_m_cla<x)&amp;&amp;(Rp_sub[0]<x)&amp;&amp;
   (Rp_sub[1]<x)&amp;&amp;(Rp_sub[2]<x))

       (*frame_class)=2;
/*---------------------------------------------*/
/*                     noise-like unvoiced                   */
/*---------------------------------------------*/
if((*VUV=2)&amp;&amp;((Rp_sub[0]>0.75)‖(Rp_sub[1]>0.75)))

    (*VUV)=3;
if((*VUV=2)&amp;&amp;(refl[2][0]>-0.1)&amp;&amp;

    ((Rp_sub[0]>0.55)‖(Rp_sub[1]>0.55)))

         (*VUV)=3;
if((*VUV=2)&amp;&amp;(frm_sharp>0.2)&amp;&amp;((Rp_m_cla>0.75)‖(Rp_sub[2]>0.75)))

       (*VUV)=3;
if((*frame_class<3)&amp;&amp;(*frame_class>0)&amp;&amp;

     (((NSR<0.25)&amp;&amp;(Rp_sub[1]<0.7)&amp;&amp;(frm sharp>0.16))‖

                     ((Rp_sub[1]<0.5)&amp;&amp;((*VUV)=2))))

                       (*frame_class)=1;
/*---------------------------------------------*/
				
				<dp n="d256"/>
/*                   Onset detection                  */
/*---------------------------------------------*/
x=energy/MAX(energy_m,0.1);
y=refl[0][0]-refl[N_SF4-1][0];
(*OnSetFlag)=(*frame_class=3)&amp;&amp;(y+0.2*x-0.6>0)&amp;&amp;(Rp_sub[2]>0.5);
/*---------------------------------------------*/
/*                Classification for pitch preprocessing            */
/*---------------------------------------------*/
  if(*frame_class>=3)

    {

    (*frame_class_pp)=2;

    if(Rp_sub[1]>0.5)

       (*frame_class_pp)=3;

    if(Rp_sub[1]>0.75)

       (*frame_class_pp)=4;

    }
else

    (*frame_class_pp)=0;
 if((*VUV)=0)

    (*frame_class_pp)=0;
 if((frame_class_m<3)&amp;&amp;

    ((*frame_class<2)‖(((*frame_class)==2)&amp;&amp;(Rp_sub[1]<0.5))))

    (*frame_class_pp)=-1;
/*---------------------------------------------*/
/*               Making the VAD more agressive              */
/*---------------------------------------------*/
 if(smv_mode=2)
   {
 if((FrmResEng<400*L_FRM)&amp;&amp;(refl[2][0]<0.125)&amp;&amp;

    (Rp_sub[1]<0.55)&amp;&amp;((*frame_class)<3)&amp;&amp;

         (frm_sharp>0.15))

             {

             (*frame_class)=0;

             (*Vad)=0;

             }

     }
				
				<dp n="d257"/>
    else

        {

        if(((NSR>0.6)‖(FrmResEng<100*L_FRM))&amp;&amp;

               (refl[2][0]<0)&amp;&amp;(Rp_sub[1]<0.4)&amp;&amp;

                     ((*frame_class)<3)&amp;&amp;(frm_sharp>0.18))

                     {

                     (*frame_class)=0;

                     (*Vad)=0;

                     }

            }
   /*---------------------------------------------*/
   /*       Voiced speech with high prediction gain but noise-like     */
   /*            HF excitation             */
   /*---------------------------------------------*/
   x=10*frm_sharp-1.5*refl[2][0]+Rp_sub[1]+lpcgain/20.0;
   *NoisyV_flag=0;
   if((*frame_class)>2)

       {

       if(x>4.5)

           (*NoisyV_flag)=1;

       if((x>5.7)&amp;&amp;(frm_sharp>0.29)&amp;&amp;(refl[2][0]<-0.92))

           (*NoisyV_flag)=2;

       }

    Rp_m_cla=Rp_sub[1];

    lpcg_m_cla=lpcgain;

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*================================*/
/*FUNCTION:CLA_Rate_Select().                           */
/*---------------------------------------------*/
				
				<dp n="d258"/>
/*PURPOSE:This function select the SMV bitrate.              */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                              */
/*        class_m,Rp_sub[],NSR,**refl,frm_sharp,         */
/*        energy_m,energy,FrmResEng,lpcgain             */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                             */
/*       *OnSetFlag,*NoisyV_flag                   */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                       */
/*       *class,*class_pp,*Vad,*VUV                   */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                             */
/*       _None                                      */
/*===============================*/
void CLA_Rate_Select(INT16 smv_mode,INT16 frame_class,INT16 frame_class_m,

             INT16 onsetflag,FLOAT64 Rp[],FLOAT64 NSR,FLOAT64 sharp,

              FLOAT64 refl0,FLOAT64 frm_eng,INT16*codec_rate)

    {

    /*---------------------------------------------*/

    FLOAT64x;

    /*---------------------------------------------*/

    switch(smv_mode)

        {

        /*---------------------------------------------*/

        /*   Mode 0.Note:average rate must be equal to EVRC      */

        /*---------------------------------------------*/

       case 0:(*codec_rate)=RATE8_5K;

               if((frame_class=1) &amp;&amp;(sharp>0.2) &amp;&amp;

                       (Rp[1]<0.32)&amp;&amp;(Rp[2]<0.3))

                         (*codec_rate)=RATE4_0K;

               if((frame_class=1)&amp;&amp;(NSR>0.15)&amp;&amp;

                       (Rp[1]<0.5)&amp;&amp;(Rp[2]<0.5))

                         (*codec_rate)=RATE4_0K;
				
				<dp n="d259"/>
    if((frame_class<3)&amp;&amp;(NSR>0.5)&amp;&amp;(refl0<0.0)

                   &amp;&amp;(Rp[1]<0.5))

                  (*codec_rate)=RATE4_0K;

    if(frame_class=0)

             (*codec_rate)=RATE4_0K;

    if((frame_class=0)&amp;&amp;(frame_class_m=0))

             (*codec_rate)=RATE0_8K;

    break;
/*---------------------------------------------*/
/*  Mode 1.Note:average rate must be equal to 0.7EVRC    */
/*---------------------------------------------*/
case 1:(*codec_rate)=RATE8_5K;

          x=MAX(0.77-NSR,0.7);

          if((frame_class>3)&amp;&amp;(frame_class m>5)&amp;&amp;

                   (Rp[0]>x)&amp;&amp;(Rp[1]>x))

                       (*codec_rate)=RATE4_0K;

          if((frame_class=2)&amp;&amp;(Rp[0]>0.31)&amp;&amp;

                   (Rp[1]>0.31))

                       (*codec_rate)=RATE4_0K;

          if((frame_class=2)&amp;&amp;(sharp>0.18))

             (*codec_rate)=RATE4_0K;

          if((frame_class=2)&amp;&amp;(NSR>0.5))

             (*codec_rate)=RATE4_0K;

          if(frame_class=1)

             (*codec_rate)=RATE4_0K;

          if((frame_class=1)&amp;&amp;(Rp[0]<0.5)&amp;&amp;(Rp[1]<0.5)

                    &amp;&amp;(Rp[2]<0.5)&amp;&amp;

                    (((refl0>0.0)&amp;&amp;(sharp>0.15))‖

                            (sharp>0.25)))

                      (*codec_rate)=RATE2_0K;

          if((NSR>0.08)&amp;&amp;(frame_class=1)&amp;&amp;(sharp>0.15))

             (*codec_rate)=RATE2_0K;
				
				<dp n="d260"/>
         if(frame_class=0)

            (*codec_rate)=RATE0_8K;

    break;
/*---------------------------------------------*/
/*  Mode 2.Note:average rate must be equalto 0.55 EVRC    */
/*---------------------------------------------*/
case 2:(*codec_rate)=RATE4_0K;

          if((OnSet=1)&amp;&amp;(NSR>0.02)&amp;&amp;(frame_class>2))

              (*codec_rate)=RATE8_5K;

          if((OnSet=1)&amp;&amp;(Rp[0]<0.85)&amp;&amp;(frame_class>2))

              (*codec_rate)=RATE8_5K;

          if((onsetflag=1)‖((frame_class_m<3)&amp;&amp;

              (frame_class>=3))‖(frame_class=3))

                  OnSet=1;

          else

                  OnSet=0;

          if(OnSet=1)

              (*codec_rate)=RATE8_5K;

          if((frame_class>3)&amp;&amp;(refl0<-0.8)&amp;&amp;(Rp[1]<0.5)

                    &amp;&amp;(sharp<0.15))

                      (*codec_rate)=RATE8_5K;

          if((NSR>0.025)&amp;&amp;(frame_class>2)&amp;&amp;(Rp[1]<0.57))

                   (*codec_rate)=RATE8_5K;

          if(frame_class<3)

                   (*codec_rate)=RATE4_0K;

          else

              {

              if(frm_eng<2500*L_FRM)

                  (*codec_rate)=RATE4_0K;

              if((frm eng<5000*LFRM)&amp;&amp;(frame_class_m<3)

                        &amp;&amp;(Rp[1]<0.6))

                  (*codec_rate)=RATE4_0K;

              }

    if((frame_class=1)&amp;&amp;(Rp[0]<0.5)&amp;&amp;(Rp[1]<0.5)

              &amp;&amp;(Rp[2]<0.5)&amp;&amp;(((refl0>0.0)&amp;&amp;
				
				<dp n="d261"/>
                  (sharp>0.15))‖(sharp>0.25)))

                     (*codec_rate)=RATE2_0K;

            if((NSR>0.08)&amp;&amp;(frame_class=1)&amp;&amp;(sharp>0.15))

               (*codec_rate)=RATE2_0K;

            if(frame_class=0)

               (*codec_rate)=RATE0_8K;

         break;

    default:
#ifdef VERBOSE

                  printf(″Invalid SMV mode:%d\n″,smv_mode);

                  exit(1);
#endif

         break;

    }

    /*---------------------------------------------*/

    frame_class_mm=frame_class_m;

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*==================================*/
/*-------------------------END-------------------------*/
/*==================================*/
				
				<dp n="d262"/>
/*===============================*/
/*===============================*/
/*Conexant System Inc.                                         */
/*4311 Jamboree Road                                     */
/*Newport Beach,CA 92660                                    */
/*---------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                       */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                              */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*=======================================*/
/*LIBRARY:lib_cla.h                                       */
/*===============================*/
/*---------------------------------------------*/
/*-------------------------FUNCTIONS-------------------------*/
/*---------------------------------------------*/
void CLA_NoisUnvoiceDetect(FLOAT64[],FLOAT64[],INT16*,FLOAT64*,

                             FLOAT64*,INT16);
INT16   CLA_signal_classifler  (FLOAT64*,FLOAT64,FLOAT64,INT16);
void CLA_Class_Correct (INT16*,INT16*,INT16*,INT16*,INT16*,

                          INT16,FLOAT64[],FLOAT64,FLOAT64**,

                             FLOAT64,INT16,FLOAT64,FLOAT64,

                               FLOAT64,FLOAT64,INT16*);
void CLA_Rate_Select  (INT16,INT16,INT16,INT16,FLOAT64[],

                         FLOAT64,FLOAT64,FLOAT64,FLOAT64,INT16*);
void CLA_init_lib              (void);
void CLA_Identify_Input(INT16,FLOAT64*,FLOAT64,FLOAT64,

                                            FLOAT64*,INT16,INT16*);
/*=====================================*/
/*------------------------END-----------------------*/
/*=====================================*/
				
				<dp n="d263"/>
/*==================================*/
/*==================================*/
/*Conexant System Inc.                                     */
/*4311 Jamboree Road                                    */
/*Newport Beach,CA 92660                                */
/*---------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                       */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                             */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*==================================*/
/*LIBRARY:lib_cpr.c                                 */
/*==================================*/
/*---------------------------------------------*/
/*--------------------INCLUDE---------------------*/
/*---------------------------------------------*/
#include″main.h″
/*---------------------------------------------*/
/*-------------------FUNCTIONS--------------------*/
/*---------------------------------------------*/
/*==================================*/
/*FUNCTION  :print_copyright().                           */
/*---------------------------------------------*/
/*PURPOSE   :Print the Copyright Information.                */
/*---------------------------------------------*/
/*ALGORITHM:                                  */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                            */
/*             _None                        */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                               */
/*             _None                          */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                             */
/*             _None                           */
				
				<dp n="d264"/>
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                             */
/*            _None.                        */
/*=============================*/
void print_copyright(void)

    {

    /*---------------------------------------------*/

    printf(″\n  /****************************************************/\n″);

    printf(″  /*                                               */\n″);

    printf(″  /*    SMV Speech Codec Floating Point Simulation   */\n″);

    printf(″  /*                                              */\n″);

    printf(″  /* These executable and sources files are delivered */\n″);

    printf(″  /*  under NDA and are SOLELY to be used for the  */\n″);

    printf(″  /*  purpose of the 3GPP SMV Collaboration Phase.*/\n″);

    printf(″  /*                                        */\n″);

    printf(″  /*     Any other use is STRICTLY prohibited.    */\n″);

    printf(″  /*                                              */\n″);

    printf(″  /*                                              */\n″);

    printf(″  /*     Version 1.0,30 June 2000           */\n″);

    printf(″  /*                                             */\n″);

    printf(″  /*     This executable,all sources,object    */\n″);

    printf(″  /*     and processed files should be deleted by  */\n″);

    printf(″  /*     the and of the collaboration phase or at  */\n″);

    printf(″  /*      any time upon the Conexant′s request.    */\n″);

    printf(″  /*                                                */\n″);

    printf(″  /*    CONEXANT SYSTEMS Inc.      */\n″);

    printf(″  /*                                                */\n″);

    printf(″  /*  All Rights Reserved,November 1999-June 2000*/\n″);

    printf(″  /*                                              */\n″);

    printf(″  /*******************************************************/\n\n″);

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }

    /*---------------------------------------------*/
				
				<dp n="d265"/>
/*====================================*/
/*-----------------------END--------------------*/
/*====================================*/
				
				<dp n="d266"/>
/*=====================================*/
/*=====================================*/
/*Conexant System Inc.                                        */
/*4311Jamboree Road                                  */
/*Newport Beach,CA 92660                                  */
/*---------------------------------------------*/
/*Copyright(C)2000Conexant System Inc.                        */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                               */
/*No part of this software may be reproduced in any form or by any   */
/*means or used to make any derivative work(such as transformation   */
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*=====================================*/
/*PROTOYPE FILE:lib_cpr.h                             */
/*=====================================*/
/*---------------------------------------------*/
/*---------------------FUNCTIONS-------------------*/
/*---------------------------------------------*/
void print_copyright(void);
/*===================================*/
/*-----------------------END-----------------------*/
/*===================================*/
				
				<dp n="d267"/>
/*==============================*/
/*==============================*/
/*Conexant System Inc.                                    */
/*4311 Jamboree Road                                      */
/*Newport Beach,CA 92660                                */
/*---------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                    */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                              */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation*/
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*=====================================*/
/*LIBRARY:lib_dia.c                                       */
/*=====================================*/
#ifdef DIAG_SMV  
/*---------------------------------------------*/
/*------------------INCLUDE-------------------*/
/*---------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″ext_var.h″
#include″mcutil.h″
#include″gputil.h″
#include″lib_dia.h″
#include″lib_swb.h″
/*---------------------------------------------*/
/*----------------FUNCTIONS--------------------*/
/*---------------------------------------------*/
/*===============================*/
/*FUNCTION         :DIA_enc_open_files().                   */
/*---------------------------------------------*/
				
				<dp n="d268"/>
/*PURPOSE             :This function open the diagnostics files.     */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                             */
/*            _None.                         */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                            */
/*            _None.                       */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*            _None.                         */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                              */
/*            _None.                         */
/*===================================*/
void DIA_enc_open_files(void)

    {

    /*---------------------------------------------*/

    /*                   Encoder unquantized                    */

    /*---------------------------------------------*/

    fdia_vad=file_open_wb(″vad.enc″);

    /*---------------------------------------------*/

    /*                Encoder quantized                 */

    /*---------------------------------------------*/

    fdia_sp_enc=file_open_wb(″sp_out.enc″);

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*=================================*/
/*FUNCTION            :DIA_enc_close_files().                     */
/*---------------------------------------------*/
/*PURPOSE             :This function close the diagnostics files.      */
				
				<dp n="d269"/>
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                               */
/*            -None.                      */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                             */
/*            _None.                        */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*            _None.                       */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                          */
/*            _None.                        */
/*================================*/
void DIA_enc_close_files(void)

     {

     /*---------------------------------------------*/

     /*               Encoder unquantized                  */

     /*---------------------------------------------*/

     fclose(fdia_vad);

     /*---------------------------------------------*/

     /*               Encoder quantized                 */

     /*---------------------------------------------*/

     fclose(fdia_sp_enc);

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*---------------------------------------------*/
/*================================*/
/*FUNCTION         :DIA_dec_open_files().                   */
/*---------------------------------------------*/
/*PURPOSE          :This function open the diagnostics files.       */
				
				<dp n="d270"/>
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                             */
/*            _None.                           */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                             */
/*            _None.                         */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*            _None.                        */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                            */
/*           _None.                         */
/*===================================*/
void DIA_dec_open_files(void)

     {

     /*---------------------------------------------*/

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*---------------------------------------------*/
/*==================================*/
/*FUNCTION          :DIA_dec_close_files().                    */
/*---------------------------------------------*/
/*PURPOSE             :This function close the diagnostics files.    */
/*---------------------------------------------*/
/*INPUT ARGUMENTS :                            */
/*             _None.                         */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS :                           */
/*             _None.                        */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*             _None.                           */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                           */
				
				<dp n="d271"/>
/*               _None.                         */
/*================================*/
void DIA_dec_close_files(void)

     {

     /*---------------------------------------------*/

     /*---------------------------------------------*/

     return;

     /*---------------------------------------------*/

     }
/*---------------------------------------------*/
/*=================================*/
/*FUNCTION     :DIA_trace_data().                              */
/*---------------------------------------------*/
/*PURPOSE      :Trace the value of the variable by writing a file    */
/*           with data alined with the input signal.            */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                             */
/*        _(FLOAT64)val:     variable to trace.      */
/*        _(INT 16)data_size: output data size.     */
/*        _(FLOAT64)scale_factor:scale factor for val.      */
/*        _(FILE  *)file_data:output file name.       */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                            */
/*            _None                       */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*            _None                        */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                            */
/*            _None.                      */
/*=====================================*/
void DIA_trace_data(FLOAT64 val,INT16 data_size,FLOAT64 scale_factor,

                      FILE *file_data)

     {
				
				<dp n="d272"/>
    /*---------------------------------------------*/

    INT16*s_val;

    INT16i,wt_samp;

    /*---------------------------------------------*/

    /*                   Memory Allocation                 */

    /*---------------------------------------------*/

    s_val=svector(0,data_size-1);

    /*---------------------------------------------*/

    s_val[0]=(INT16)(scale_factor * val);

    for(i=1;i<data_size;i++)

            s_val[i]=s_val[0];
#ifdef BYTE_SWAP_OUTPUT

     for(i=0;i<data_size;i++)

               s_val[i]=byte_swap_int16(s_val[i]);
#endif

     wt_samp=fwrite(s_val,sizeof(INT16),data_size,file_data);
#ifdef VERBOSE

     if(wt_samp!=data_size)

         nrerror(″Error Writing output Samples!″);
#endif

    /*---------------------------------------------*/

    /*               Memory Free                  */

    /*---------------------------------------------*/

    free_svector(s_val,O,data_size-1);

    /*---------------------------------------------*/
				
				<dp n="d273"/>
    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*======================*/
/*FUNCTION:DIA_trace_sig().                         */
/*---------------------------------------------*/
/*PURPOSE        :Trace a signal by scaling it and writing a file      */
/*              with data alined with the input signal.              */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                              */
/*        _(FLOAT64[])x:     signal to trace.     */
/*        _(INT16)x_size:    output signal size.  */
/*        _(FLOAT64)scale_factor:scale factor for val.*/
/*        _(FILE   *)file_x:  output file name.     */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                            */
/*            _None                        */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*            _None                        */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                         */
/*            _None.                         */
/*=======================*/
void DIA_trace_sig(FLOAT64 x [],INT16 x_size,FLOAT64 scale_factor,

                      FILE*file_x)

     {

     /*---------------------------------------------*/

     INT16*s_x;

     INT16i,wt_samp;

     /*---------------------------------------------*/

     /*               Memory Allocation                */

     /*---------------------------------------------*/

     s_x=svector(0,x_size-1);
				
				<dp n="d274"/>
    /*---------------------------------------------*/

    for(i=0;i<x_size;i++)

        s_x[i]=(short)nint(scale_factor*x[i]);
#ifdefBYTE_SWAP_OUTPUT

      for(i=0;i<x_size;i++)

             s_x[i]=byte_swap_int16(s_x[i]);
#endif

      wt_samp=fwrite(s_x,sizeof(INT16),x_size,file_x);
#ifdef VERBOSE

      if(wt_samp!=x_size)

           nrerror(″Error Writing output Samples!″);
#endif

    /*---------------------------------------------*/

    /*                 Memory Free                */

    /*---------------------------------------------*/

    free_svector(s_x,0,x_size-1);

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
#endif
/*===================================*/
/*-------------------------END----------------------*/
/*===================================*/
				
				<dp n="d275"/>
/*===============================*/
/*===============================*/
/*Conexant System Inc.                                      */
/*4311 Jamboree Road                                  */
/*Newport Beach,CA 92660                                   */
/*---------------------------------------------*/
/*Copyinght(C)2000Conexant System Inc.                      */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                               */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*=====================================*/
/*PROTOYPE FILE:lib_dia.h                         */
/*=====================================*/
/*---------------------------------------------*/
/*------------------FUNCTIONS------------------*/
/*---------------------------------------------*/
void DIA_enc_open_files(void);
void DIA_enc_close_files(void);
void DIA_dec_open_files(void);
void DIA_dec_close_files(void);
void DIA_trace_data(FLOAT64,INT16,FLOAT64,FILE*);
void DIA_trace sig(FLOAT64[],INT16,FLOAT64,FILE*);
/*==================================*/
/*-----------------------END----------------------*/
/*==================================*/
				
				<dp n="d276"/>
/*===============================*/
/*===============================*/
/*Conexant System Inc.                                       */
/*4311 Jamboree Road                                        */
/*Newport Beach,CA 92660                                 */
/*---------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                         */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                                   */
/*No part of this software may be reproduced in any form orby any  */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*================================*/
/*LIBRARY:lib_fcs.c                                      */
/*================================*/
/*---------------------------------------------*/
/*----------------INCLUDE----------------------*/
/*---------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″gputil.h″
#include″mcutil.h″
#include″ext_var.h″
#include″lib_fcs.h″
#include″lib_gcb.h″
#include″lib_flt.h″
#include″lib_lpc.h″
#include″lib_ppp.h″
#include″rtacks.tab″
/*---------------------------------------------*/
/*--------------------FUNCTIONS----------------*/
/*---------------------------------------------*/
/*================================*/
				
				<dp n="d277"/>
/*FUNCTION        :FCS_init_lib().                          */
/*---------------------------------------------*/
/*PURPOSE         :This function performs the initialisation of the */
/*                global variables of the library FCS.            */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                                 */
/*      _None.                                */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                           */
/*      -None.                                  */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                         */
/*      _None.                                 */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                           */
/*      _None.                                    */
/*========================*/
void FCS_init_lib(void)

     {

     /*---------------------------------------------*/

     seed_bfi_exc=(INT64)21845;

     /*---------------------------------------------*/

     lpcg_m        =0.0;

     alpha         =0.0125;

     lag_m         =20;

     SVS_flag_m    =0;

     /*---------------------------------------------*/

     /*             High frequency Noise filter initialisation          */

     /*---------------------------------------------*/

     FCS_Init_HF_Noise(hh_hf,L_HF);

     /*---------------------------------------------*/

     /*                 Pulse code-books initialisation               */

     /*---------------------------------------------*/

     FCS_Init_CPCB();
				
				<dp n="d278"/>
    /*---------------------------------------------*/

    /*                          13bits                      */

    /*---------------------------------------------*/

    Stab_13b_enc=0.0;

    Stab_13b_dec=0.0;

    /*---------------------------------------------*/

    /*                          15bits                      */

    /*---------------------------------------------*/

    Stab_15b_enc=0.0;

    Stab_15b_dec=0.0;

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*============================================================================================*/
/*FUNCTION    :FCS_Init_CPCB().                    */
/*---------------------------------------------*/
/*PURPOSE             :This function performs the initialisation of the*/
/*                    pulse code-books.                             */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                             */
/*      _None.                                  */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                */
/*      _None.                                */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*     _None.                                  */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                            */
				
				<dp n="d279"/>
/*         _None.                                         */
/*====================================*/
void FCS_Init_CPCB(void)

     {

     /*---------------------------------------------*/

     INT16 n,i,ph_mode;

     /*---------------------------------------------*/

     /*---------------------------------------------*/

     /*=============2 pulses CB=============*/

     /*---------------------------------------------*/

     /*---------------------------------------------*/

     /*2pulses CB:2pulses×5bits/pulse+2signs=12bits        */

     /*---------------------------------------------*/

     for(i=0;i<2;i++)

         for(n=0;n<32;n++)

             p_track_2_5_0[i][n]=track_2_5_0[i][n];

     /*---------------------------------------------*/

     /*2pulses CB:2pulses×7bits/pulse+1sign=15bits      */

     /*---------------------------------------------*/

     for(i=0;i<2;i++)

      for(n=0;n<80;n++)

          p_track_2_7_1[i][n]=track_2_7_1[i][n];

     /*---------------------------------------------*/

     /*========3 pulses CB========*/

     /*---------------------------------------------*/

     for(ph_mode=0;ph_mode<16;ph_mode++)

         {

         for(i=0;i<3;i++)

         for(n=0;n<4;n++)

             p_track_3_2_80[ph_mode][i][n]=track_3_2_0[i][n]+
				
				<dp n="d280"/>
                             track_1_4P_0[0][ph_mode];

    for(i=0;i<3;i++)

        for(n=0;n<4;n++)

            p_track_3_2_54[ph_mode][i][n]=track_3_2_0[i][n]+

                                            track_1_3_0[0][ph_mode];

    }
  /*---------------------------------------------*/
  /*=========5 pulses CB==========*/
  /*---------------------------------------------*/
  for(i=0;i<5;i++)

      for(n=0;n<16;n++)

          p_track_5_4_0[i][n]=track_5_4_0[i][n];
  for(i=0;i<5;i++)

      for(n=0;n<8;n++)

          p_track_5_3_1[i][n]=track_5_3_1[i][n];
  for(i=0;i<5;i++)

      for(n=0;n<8;n++)

          p_track_5_3_2[i][n]=track_5_3_2[i][n];
/*---------------------------------------------*/
/*=============8 pulses CB============*/
/*---------------------------------------------*/
for(i=0;i<8;i++)

    for(n=0;n<16;n++)

        p_track_8_4_0[i][n]=track_8_4_0[i][n];
/*---------------------------------------------*/
return;
/*---------------------------------------------*/
}
				
				<dp n="d281"/>
/*---------------------------------------------*/
/*========================*/
/*FUNCTION      :FCS_Sey_CPCB().                       */
/*---------------------------------------------*/
/*PURpOSE       :This function performs the fixed codebook    */
/*              initialisation.                       */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                              */
/*      _(INT16)phas_mode:     initial phase for the pulses.   */
/*      _(INT16)bit_p:      number of bits.              */
/*      _(INT16)n_p:        number ofpulses.             */
/*      _(INT16)Lex:        excitation length.           */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                            */
/*      _None.                             */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*      _None.                                 */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                           */
/*      _None.                                   */
/*==================================*/
void FCS_Set_CPCB(INT16 phas_mode,INT16 bit_p,INT16n_p,INT16 Lex)

     {

     /*---------------------------------------------*/

     INT16 i;

     /*---------------------------------------------*/

     swich(n_p)

        {

        /*---------------------------------------------*/

        /*===========2 pulses CB============*/

        /*---------------------------------------------*/

        case 2:

        /*---------------------------------------------*/
				
				<dp n="d282"/>
/*2 pulses CB:2pulses×5bits/pulse+2signs=12bits  */
/*---------------------------------------------*/
 if(phas_mode=0)

    {

    for(i=0;i<2;i++)

        MaxIdx[i]=32;

    track=p_track_2_5_0;

    }
/*---------------------------------------------*/
/*2 pulses CB:2pulses×6.5bits/pulse+1sign=14bits */
/*---------------------------------------------*/
  if(phas_mode=1)

    {

      for(i=0;i<2;i++)

      MaxIdx[i]=80;

    track=p_track_2_7_1;

    }
 break;
/*---------------------------------------------*/
/*==============3 pulses CB==============*/
/*---------------------------------------------*/
case 3:
if (Lex=L_SF)

    {

    /*---------------------------------------------*/

    /*   3 pulses CB:3pulses×2bits/pulse+            */

    /*                              3 signs=9 bits    */

    /*---------------------------------------------*/

    for(i=0;i<3;i++)

        MaxIdx[i]=4;

    track=p_track_3_2_80[phas_mode];
				
				<dp n="d283"/>
    /*---------------------------------------------*/

    }
 else

    {

    /*---------------------------------------------*/

    /* 3pulses CB:3pulses×2bits/pulse+            */

    /*                                 3signs=9bits*/

    /* 3pulses CB:3pulses×2bits/pulse+3signs */

    /*                                  +3bits center=11bits */

    /*---------------------------------------------*/

    for(i=0;i<3;i++)

        MaxIdx[i]=4;

    track=p_track_3_2_54[phas_mode];

    }

    break;
/*---------------------------------------------*/
/*============5 pulses CB===========*/
/*---------------------------------------------*/
case 5:
/*---------------------------------------------*/
/*   5pulses CB:3p×4b+2p×3b+3b signs=21bits  */
/*---------------------------------------------*/
if(phas_mode=0)
   {
   for(i=0;i<5;i++)

       MaxIdx[i]=16;
   MaxIdx[2]=8;
   MaxIdx[4]=8;
   track=p_track_5_4_0;
   }
/*---------------------------------------------*/
/*   5pulses CB:5p×3b+5b signs=20bits          */
/*---------------------------------------------*/
				
				<dp n="d284"/>
 if(phas_mode=1)

    {

    for(i=0;i<5;i++)

        MaxIdx[i]=8;

    track=p_track_5_3_1;

    }
/*---------------------------------------------*/
/*   5pulses CB:5p×3b+5b signs=20bits           */
/*---------------------------------------------*/
 if(phas_mode=2)

    {

    for(i=0;i<5;i++)

        MaxIdx[i]=8;

    track=p_track_5_3_2;

    }
 break;
/*---------------------------------------------*/
/*=============8 pulses CB============*/
/*---------------------------------------------*/
case 8:
/*---------------------------------------------*/
/*    8pulses CB:6p×3b+2p×4b+4b signs=30bits  */
/*---------------------------------------------*/
 for(i=0;i<8;i++)

    MaxIdx[i]=8;
 MaxIdx[0]=16;
 MaxIdx[4]=16;
 track=p_track_8_4_0;
 break;
/*---------------------------------------------*/
default:
				
				<dp n="d285"/>
 #ifdef VERBOSE

           nrerror(″Error in the definition of track[][]   !!″);
 #endif

           break;

      /*---------------------------------------------*/

      }
   /*---------------------------------------------*/
   return;
   /*---------------------------------------------*/
   }
/*---------------------------------------------*/
/*=========================*/
/*FUNCTION        :FCS_Init_HF_Noise().                     */
/*---------------------------------------------*/
/*PURPOSE         :This function generated a impulse response    */
/*                introducing a random noise in the high          */
/*                frequencies.                               */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                */
/*      _(INT16)1_sf:   sub-frame size.           */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                            */
/*      _(FLOAT64[])hh_hf:   high frequency noise impulse    */
/*                          response.                   */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                         */
/*          _None.                                */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                             */
/*          _None.                               */
/*================================*/
void FCS_Init_HF_Noise(FLOAT64 hh_hf[],INT161_hf)

     {

     /*---------------------------------------------*/
				
				<dp n="d286"/>
 INT64   seed;
 FLOAT64   Z1=0,Z2=0;
 INT16 i;
 FLOAT64 x;
 /*---------------------------------------------*/
 /*                 Initialisation                */
 /*---------------------------------------------*/
 seed=56672;
 Z1=0;
 Z2=0;
 for(i=0;i<l_hf;i++)

     hh_hf[i]=GCB_gauss_noise(&amp;seed);
 for(i=0;i<1_hf;i++)

     {

     x=hh_hf[i]-Z1;

     Z1=hh_hf[i];

     hh_hf[i]=x;

     x=hh_hf[i]-Z2;

     Z2=hh_hf[i];

     hh_hf[i]=x;

     }
for(i=0;i<l_hf;i++)

    {

    x=cos(i*PI*1.0/1_hf);

    hh_hf[i]*=0.03*(0.55+0.45*x);

    }
hh_hf[0]=1.0;
/*---------------------------------------------*/
return;
/*---------------------------------------------*/
}
				
				<dp n="d287"/>
/*---------------------------------------------*/
/*=================================*/
/*FUNCTION      :FCS_DetermPulsLoc().                   */
/*---------------------------------------------*/
/*PURPOSE           :This function determines all pulse positions  */
/*                 and their magnitudes in terms ofthe pitch    */
/*                 function and the main pulse whose position    */
/*                 needs to be coded.                            */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                             */
/*     _(FLOAT64     )PitGain: current pitch gain.       */
/*     _(INT16   )  pitch:  current pitch value.       */
/*     _(FLOAT64  )Mag:        current pulse mgnitude.    */
/*     _(INT16   )Loc:      current pulse position.      */
/*     _(INT16)l_sf:      sub-frame length.        */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                             */
/*     _(FLOAT64[])MagV:       array of pulse magnitudes. */
/*     _(INT16 [])LocV:     array of locations magnitudes.*/
/*     _(INT16*)NumPit:  number of pulses.       */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*     _None.                                                */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                            */
/*     _None.                                             */
/*=================================*/
void FCS_DetermPulsLoc(FLOAT64 PitGain,INT16 pitch,FLOAT64Mag,INT16Loc,

                      FLOAT64  MagV[],INT16 LocV[],INT16*NumPit,

                         INT161_sf)

     {

     /*---------------------------------------------*/

     INT16   i,N,M,max_i;

     /*---------------------------------------------*/

     MagV[0]=Mag;

     LocV[0]=Loc;
				
				<dp n="d288"/>
N=0;
if(PitGain<0.4)

    max_i=3;
else

    max_i=4;
for(i=1;i<max_i;i++)

    {

    if((Loc+pitch*i)<1_sf)

         {

         MagV[i]=MagV[i-1]*PitGain;

         LocV[i]=Loc+pitch*i;

         N=i;

         }

    else

        break;

    }
/*---------------------------------------------*/
M=N;
/*---------------------------------------------*/
if(((Loc-pitch)>=0)&amp;&amp;((N+1)<max_i))

     {

     MagV[1+N]=MagV[0]*PitGain;

     LocV[1+N]=Loc-pitch;

     M=N+1;

     for(i=2;i<max_i-N;i++)

         {

         if((Loc-pitch*i)>=0)

             {

             MagV[i+N]=MagV[i+N-1]*PitGain;

             LocV[i+N]=Loc-pitch*i;

             M=N+i;

             }

        else

           break;

        }
   }
				
				<dp n="d289"/>
    /*---------------------------------------------*/

    (*NumPit)=M+1;

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*==================================*/
/*FUNCTION       :FCS_One_Search_CPCB().                  */
/*---------------------------------------------*/
/*PURPOSE        :This function determines the position of one    */
/*               pulse using the forward pitch enhancement.      */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                             */
/*      _(INT16   )   n_p:       number of pulses.           */
/*      _(INT16 [])   Idx:      array of idexes.               */
/*      _(FLOAT64[])   Mag:       array of current pulse mgnitude.*/
/*      _(FLOAT64[])   ref_sig:target signal.             */
/*      _(INT16[])    IdxOpt:optimized index array.       */
/*      _(INT16[])    PosOpt:optimized pulse postion array. */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                          */
/*     _(FLOAT64*)  Rn_m:    maximized criterion numerator.*/
/*     _(INT16*)  Rd_m:    maximized criterion denominator.*/
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                           */
/*      _(FLOAT64*) MaxCrit:maximized criterion.         */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                            */
/*      _None.                                    */
/*=================================*/
void FCS_One_Search_CPCB(INT16n_p,INT16Idx[],FLOAT64 Mag[],

                     FLOAT64 ref_sig[],INT16 IdxOpt[],

                        INT16 PosOpt[],FLOAT64*MaxCrit,
				
				<dp n="d290"/>
             FLOAT64*Rn_m,FLOAT64*Rd_m)
{
/*---------------------------------------------*/
INT16     n,k,Pos[MAXPN];
FLOAT64         GG,Rn,Rd;
/*---------------------------------------------*/
for(n=0;n<n_p;n++)

    Pos[n]=track[n][Idx[n]];
Rn=0;
for(n=0;n<n_p;n++)

    Rn+=ref_sig[Pos[n]]*Mag[n];
/*---------------------------------------------*/
Rd=0;
for(n=0;n<n_p-1;n++)

    for(k=n+1;k<n_p;k++)

        Rd+=Mag[n]*PHI[Pos[n]][Pos[k]]*Mag[k];
Rd*=2;
for(n=0;n<n_p;n++)

    Rd+=Mag[n]*PHI[Pos[n]][Pos[n]]*Mag[n];
/*---------------------------------------------*/
GG=Rn*Rn/MAX(0.1,Rd);
if(GG>(*MaxCrit))

    {

    (*MaxCrit)=GG;

    for(n=0;n<n_p;n++)

        {

        IdxOpt[n]=Idx[n];

        PosOpt[n]=Pos[n];

       }

    (*Rn_m)=Rn;

    (*Rd_m)=Rd;

    }
				
				<dp n="d291"/>
    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*=================================*/
/*FUNCTION      :FCS_One_Search_4kCB().                  */
/*---------------------------------------------*/
/*PURPOSE       :This function determines the position of one    */
/*              pulse using the forward+backward pitch    */
/*              enhancement.                              */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                               */
/*      _(INT16.  [])  SignTab:array of pulse signs.       */
/*      _(FLOAT64    )   pit_g:  current pitch gain.      */
/*      _(INT16     ) lag:     current pitch value.       */
/*      _(INT16     ) n_p:      number ofpulses.         */
/*      _(INT16     ) no_p:     pulse number.       */
/*      _(INT16   []) Idx:     array of idexes.           */
/*      _(FLOAT64  []) Mag:      array of current pulse mgnitude.*/
/*      _(FLOAT64 [])  ref_sig:target signal.          */
/*      _(INT16    )  1_sf:  sub-frame size.          */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                           */
/*      _(INT16    [])  IdxOpt:optimized index array.       */
/*      _(INT16    [])  PosOpt:optimized pulse postion array.*/
/*      _(FLOAT64    *)  Rn_m:    maximized criterion numerator.*/
/*      _(INT16    *)   Rd_m:    maximized criterion denominator.*/
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                        */
/*      _(FLOAT64   *)  MaxCrit:maximized criterion.       */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                            */
/*      _None.                              */
/*=================================*/
void FCS_One_Search_4kCB(INT16 SignTab[],INT16lag,FLOAT64 pit_g,INT16 no_p,
				
				<dp n="d292"/>
       INT16n_p,INT16Idx[],FLOAT64 Mag[],

           FLOAT64 ref_sig[],INT16 IdxOpt[],

              INT16 PosOpt[],FLOAT64 *MaxCrit,

                  FLOAT64*Rn_m,FLOAT64*Rd_m,INT161_sf)
{
/*---------------------------------------------*/
INT16    n,k,Pos[MAXPN],Num,NumP,LocP[MAX_FB_PULSE_NUM*MAXPN];
FLOAT64 GG,Rn,Rd,Rd1,MagP[MAX_FB_PULSE_NUM*MAXPN];
/*---------------------------------------------*/
/*                Determine pulses positions             */
/*---------------------------------------------*/
NumP=0;
for(n=0;n<n_p;n++)

    {

    Pos[n]=frack[n][Idx[n]];

    FCS_DetermPulsLoc(pit_g,lag,(Mag[n]*SignTab[Pos[n]]),

                         Pos[n],MagP+NumP,LocP+NumP,&amp;Num,1_sf);

    NumP+=Num;

    }
/*---------------------------------------------*/
/*                    Correlation                       */
/*---------------------------------------------*/
Rn=0;
for(n=0;n<NumP;n++)

    Rn+=ref_sig[LocP[n]]*MagP[n];
/*---------------------------------------------*/
/*                     Energy                        */
/*---------------------------------------------*/
Rd=0;
for(n=0;n<NumP-1;n++)

    {

    Rd1=0.0;

    for(k=n+1;k<NumP;k++)

        Rd1+=PHI[LocP[n]][LocP[k]]*MagP[k];
				
				<dp n="d293"/>
    Rd1*=MagP[n];

    Rd +=Rd1;

    }

    Rd*=2;

    for(n=0;n<NumP;n++)

        Rd+=MagP[n]*PHI[LocP[n]][LocP[n]]*MagP[n];

    /*---------------------------------------------*/

    /*            Criterion calculation and maximisation           */

    /*---------------------------------------------*/

    GG=Rn*Rn/MAX(0.1,Rd);

    if(GG>(*MaxCrit))

        {

        (*MaxCrit)=GG;

        IdxOpt[no_p]=Idx[no_p];

        PosOpt[no_p]=Pos[no_p];

        (*Rn_m)=Rn;

        (*Rd_m)=Rd;

        }
   /*---------------------------------------------*/
   return;
   /*---------------------------------------------*/
   }
/*---------------------------------------------*/
/*===========================*/
/*FUNCTION        :FCS_Full_Search_CPCB().                  */
/*---------------------------------------------*/
/*PURPOSE         :This function determines the pulses position  */
/*                using forward pitch enhancement.              */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                           */
				
				<dp n="d294"/>
/*        _(INT16       )phas_mode:initial phase for the pulses.*/
/*        _(FLOAT64     )pmag:    pulse magnitude.           */
/*        _(INT16      )n_p:       number ofpulses.            */
/*        _(INT16    [])SignTab:   array of pulse signs.           */
/*        _(FLOAT64   [])ref_sig:  target signal.                */
/*        _(INT16      )Lex:      excitation size.           */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                             */
/*        _(INT16   [])   SignOpt:optimized array of pulse signs.*/
/*        _(FLOAT64  [])   EXopt:   optimized excitation signal.  */
/*        _(INT16   [])   SignOpt:optimized array of indexes.  */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*        _(FLOAT64    *)   Criterion:maximized criterion.     */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                             */
/*                 _None.                   */
/*==================================*/
void FCS_Full_Search_CPCB(INT16 phas_mode,INT16 SignOpt[],FLOAT64 pmag,

                      INT16 bits_p,INT16n_p,INT16 SignTab[],

                          FLOAT64ref_sig[],FLOAT64*Criterion,

                             FLOAT64 EXopt[],INT16 Lex,

                                INT16 IndexOpt[])

    {

    /*---------------------------------------------*/

    INT16  k,Idx[MAXPN],IdxOpt[MAXPN],PosOpt[MAXPN];

    FLOAT64     GG,Rn_m,Rd_m,MaxCrit,Mag[MAXPN];

    /*---------------------------------------------*/

    /*==============Algorithm initialisation============*/

    /*---------------------------------------------*/

    /*---------------------------------------------*/

    /*                    Set-up the track positions                */

    /*---------------------------------------------*/

    FCS_Set_CPCB(phas_mode,bits_p,n_p,Lex);

    /*---------------------------------------------*/

    /*                Magnotudes of pulses                 */
				
				<dp n="d295"/>
/*---------------------------------------------*/
GG=1.0;
for(k=0;k<n_p;k++)

    {

    Mag[k]=     GG;

    GG      *=  pmag;

    }
/*---------------------------------------------*/
/*==============Close-loop searching===========*/
/*---------------------------------------------*/
MaxCrit=-1;
switch(n_p)

    {

    /*---------------------------------------------*/

    /*               2 pulses CB                  */

    /*---------------------------------------------*/

    case2:

        for(Idx[0]=0;Idx[0]<MaxIdx[0];Idx[0]++)

            for(Idx[1]=0;Idx[1]<MaxIdx[1];Idx[1]++)

                FCS_One_Search_CPCB(n_p,Idx,Mag,ref_sig,IdxOpt,

                                    PosOpt,&amp;MaxCrit,&amp;Rn_m,&amp;Rd_m);

    break;

    /*---------------------------------------------*/

    /*               3 pulses CB                */

    /*---------------------------------------------*/

    case 3:

        for(Idx[0]=0;Idx[0]<MaxIdx[0];Idx[0]++)

            for(Idx[1]=0;Idx[1]<MaxIdx[1];Idx[1]++)

                for(Idx[2]=0;Idx[2]<MaxIdx[2];Idx[2]++)

                     {

                     FCS_One_Search_CPCB(n_p,Idx,Mag,ref_sig,

                                              IdxOpt,PosOpt,

                                              &amp;MaxCrit,&amp;Rn_m,
				
				<dp n="d296"/>
                                         &amp;Rd_m);

                        }

           break;

    /*---------------------------------------------*/

    default:
#ifdef VERBOSE

       nrerror(″Invalid number of pulses!!″);
#endif

       break;

    /*---------------------------------------------*/

    }

    /*---------------------------------------------*/

    /*                        Excitation                       */

    /*---------------------------------------------*/

    if(MaxCrit>(*Criterion))

        {

        (*Criterion)=MaxCrit;

        for(k=0;k<n_p;k++)

            SignOpt[k]=SignTab[PosOpt[k]];

        for(k=0;k<n_p;k++)

            IndexOpt[k]=IdxOpt[k];

        ini_dvector(EXopt,0,Lex-1,0.0);

        for(k=0;k<n_p;k++)

            EXopt[PosOpt[k]]+=SignOpt[k]*Mag[k];

        }

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
				
				<dp n="d297"/>
/*---------------------------------------------*/
/*=================================*/
/*FUNCTION      :FCS_Simp_Search_CPCB().                 */
/*---------------------------------------------*/
/*PURPOSE       :This function determines the pulses position    */
/*              using a simplified algorithm and the forward    */
/*              pitch enhancement.                       */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                               */
/*      _(INT16       )turn0: first tum number.          */
/*      _(INT16       )turn1: last turn number.            */
/*      _(INT16       )phas_mode:initial phase for the pulses.*/
/*      _(FLOAT64      )pmag: pulse magnitude.         */
/*      _(INT16       )n_p:  number ofpulses.          */
/*      _(INT16     [])SignTab: array of pulse signs.        */
/*      _(FLOAT64    [])ref_sig:target signal.              */
/*      _(INT16      )Lex:      excitation size.              */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                              */
/*      _(INT16       [])  SignOpt:optimized array of pulse signs.*/
/*      _(FLOAT64      [])   EXopt:optimized excitation signal.*/
/*      _(INT16       [])  IndexOpt:optimized array of indexes.    */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                        */
/*      _(FLOAT64     *)   Criterion:maximized criterion.      */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                             */
/*                 _None.                     */
/*==================================*/
void FCS_Simp_Search_CPCB(INT16 turn0,INT16 turn1,INT16 phas_mode,

                 INT16SignOpt[],FLOAT64 pmag,INT16 bits_p,INT16 n_p,

                    INT16 SignTab[],FLOAT64 ref_sig[],

                       FLOAT64*Criterion,FLOAT64 EXopt[],INT16 Lex,

                             INT16 IndexOpt[])

    {

    /*---------------------------------------------*/

    INT16 n,flag;
				
				<dp n="d298"/>
INT16     k0,k1,k,i,m,POS,Idx[MAXPN],IdxOpt[MAXPN],PosOpt[MAXPN];
FLOAT64   GG,Rn_m,Rd_m,MaxCrit,Mag[MAXPN];
/*---------------------------------------------*/
/*=============Algorithm initialisation==========*/
/*---------------------------------------------*/
/*---------------------------------------------*/
/*                 Set-up the track positions    */
/*---------------------------------------------*/
FCS_Set_CPCB(phas_mode,bits_p,n_p,Lex);
/*---------------------------------------------*/
/*                  Magnitudes of pulses            */
/*---------------------------------------------*/
GG=1.0;
for(k=0;k<n_p;k++)

    {

    Mag[k]=GG;

    GG    *=pmag;

    }
/*---------------------------------------------*/
/*                Reset for signed pulses        */
/*---------------------------------------------*/
if(turn0=0)

     {

     /*---------------------------------------------*/

     for(k=0;k<n_p;k++)

     Idx[k]=0;

     for(k=0;k<n_p;k++)

     {

     /*---------------------------------------------*/

     MaxCrit=-32767*32767;

     for(i=0;i<MaxIdx[k];i++)

         {
				
				<dp n="d299"/>
          flag=1;

          POS=track[k][i];

          for(n=0;n<k;n++)

              if(POS=PosOpt[n])

                  flag=0;

          if((ref_sig[POS]>MaxCrit)&amp;&amp;(flag=1))

              {

              MaxCrit=ref_sig[POS];

              Idx[k]=i;

              PosOpt[k]=POS;

              }

          }

       IdxOpt[k]=IndexOpt[k];

       /*---------------------------------------------*/

       }

    /*---------------------------------------------*/

    }
else

    for(k=0;k<n_p;k++)

        {

        Idx[k]=IndexOpt[k];

        IdxOpt[k]=IndexOpt[k];

        PosOpt[k]=track[k][Idx[k]];

        }
/*---------------------------------------------*/
/*===========Close-loop searching========*/
/*---------------------------------------------*/
if(((n_p=5)‖(n_p=8))&amp;&amp;(turn0>0))

    {

    /*---------------------------------------------*/

    /*            5 and 8 pulses              */

    /*---------------------------------------------*/

    if(n_p=5)

       {

       /*---------------------------------------------*/

       /*             5 pulses                 */
				
				<dp n="d300"/>
    /*---------------------------------------------*/

    MaxCrit=-1;

    k=0;

    while(k<n_p)

        {

        k0=k;

        k1=k+1;

        if(k1=n_p)

            k1=0;

        for(Idx[k0]=0;Idx[k0]<MaxIdx[k0];Idx[k0]++)

            for(Idx[k1]=0;Idx[k1]<MaxIdx[k1];Idx[k1]++)

                     FCS_One_Search_CPCB(n_p,Idx,Mag,ref_sig,

                        IdxOpt,PosOpt,&amp;MaxCrit,&amp;Rn_m,&amp;Rd_m);

        Idx[k0]=IdxOpt[k0];

        Idx[k1]=IdxOpt[k1];

        if(k=n_p-1)

            k=1;

        else

            k+=2;

       }

    }
if(n_p=8)

    {

    /*---------------------------------------------*/

    /*             8 pulses                */

    /*---------------------------------------------*/

    MaxCrit=-1;

    k=0;

    while(k<MAXPN)

        {

         k0=srchpuls[k];

         k1=srchpuls[k+1];

         for(Idx[k0]=0;Idx[k0]<MaxIdx[k0];Idx[k0]++)

             for(Idx[k1]=0;Idx[k1]<MaxIdx[k1];Idx[k1]++)

                       FCS_One_Search_CPCB(n_p,Idx,Mag,ref_sig,

                          IdxOpt,PosOpt,&amp;MaxCrit,&amp;Rn_m,&amp;Rd_m);
				
				<dp n="d301"/>
          Idx[k0]=IdxOpt[k0];

          Idx[k1]=IdxOpt[k1];

          k+=2;

          }

        }

     }
else

    {

    /*---------------------------------------------*/

    /*          Others pulse configuration           */

    /*---------------------------------------------*/

    for(m=turn0;m<=turn1;m++)

        {

        for(k=0;k<n_p;k++)

            {

            MaxCrit=-1;

            for(Idx[k]=0;Idx[k]<MaxIdx[k];Idx[k]++)

                {

                flag=1;

                POS=track[k][Idx[k]];

                for(i=0;i<k;i++)

                    {

                    if(POS=PosOpt[i])

                        flag=0;

                    }

                for(i=k+1;i<n_p;i++)

                    {

                    if(POS=PosOpt[i])

                        flag=0;

                    }

               if(flag=1)

                    FCS_One_Search_CPCB(n_p,Idx,Mag,ref_sig,

                       IdxOpt,PosOpt,&amp;MaxCrit,&amp;Rn_m,&amp;Rd_m);

               }

           Idx[k]=IdxOpt[k];

           }

       }
				
				<dp n="d302"/>
     /*---------------------------------------------*/

     }

     /*---------------------------------------------*/

     /*=========Criterion calculation and maximisation======*/

     /*---------------------------------------------*/

     if(MaxCrit>(*Criterion))

         {

         (*Criterion)=MaxCrit;

         for(k=0;k<n_p;k++)

             SignOpt[k]=SignTab[PosOpt[k]];

         for(k=0;k<n_p;k++)

             IndexOpt[k]=IdxOpt[k];

         ini_dvector(EXopt,0,Lex-1,0.0);

         for(k=0;k<n_p;k++)

             EXopt[PosOpt[k]]+=SignOpt[k]*Mag[k];

        }
   /*---------------------------------------------*/
   return;
   /*---------------------------------------------*/
   }
/*---------------------------------------------*/
/*==================================*/
/*FUNCTION      :FCS_Simp_Search_4kCB().                  */
/*---------------------------------------------*/
/*PURPOSE       :This function determines the pulses position    */
/*              using a simplified algorithm and the forward+   */
/*              backward pitch enhancement.                   */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                             */
/*      _(INT16  )turn0:first turn number.      */
				
				<dp n="d303"/>
/*       _(INT16  )turn1:  last turn number.           */
/*       _(INT16)phas_mode:initial phase for the pulses.   */
/*       _(FLOAT64)pmag:pulse magnitude.               */
/*       _(INT16)bits_p:bits per pulse.*/
/*       _(INT16)n_p:number ofpulses.*/
/*       _(INT16[])SignTab:array of pulse signs.*/
/*       _(FLOAT64[])ref_sig:tafget signal.             */
/*       _(INT16)Lex:excitation size.*/
/*       _(INT16)lag:current pitch lag.*/
/*       _(FLOAT64)pit_g:pitch gain.*/
/*---------------------------------------------*/
/OUTPUT ARGUMENTS:                          */
/*     _(INT16[])SignOpt:optimized array of pulse signs.*/
/*     _(FLOAT64[])EXopt:optimized excitation signal.*/
/*     _(INT16[])IndexOpt:optimized idex array.*/
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*      _(FLOAT64*)Criterion:maximized criterion.   */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                            */
/              _None.                               */
/*==============================*/
void FCS_Simp_Search_4kCB(INT16 turn0,INT16 turn1,INT16 phas_mode,

               INT16 SignOpt[],FLOAT64 pmag,INT16 bits_p,INT16 n_p,

               INT16 SignTab[],FLOAT64 ref_sig[],

               FLOAT64*Criterion,FLOAT64 EXopt[],

               INT16Lex,INT16IndexOpt[],INT16 lag,

               FLOAT64 pit_g)

    {

    /*---------------------------------------------*/

    INT16  flag;

    INT16  k,i,m,POS,Idx[MAXPN],IdxOpt[MAXPN],PosOpt[MAXPN],LocV[6];

    FLOAT64GG,Rn m,Rd_m,MaxCrit,Mag[MAXPN],MagV[6];

    FLOAT64x;

    /*---------------------------------------------*/

    /*===========Algorithm initialisation==========*/

    /*---------------------------------------------*/

    /*---------------------------------------------*/
				
				<dp n="d304"/>
/*               Set-up the track positions             */
/*---------------------------------------------*/
FCS_Set_CpCB(phas_mode,bits_p,n_p,Lex);
/*---------------------------------------------*/
/*                   Magnitudes of pulses                 */
/*---------------------------------------------*/
GG=1.0;
for(k=0;k<n_p;k++)

    {

    Mag[k]=GG;

    GG    *=pmag;

    }
/*---------------------------------------------*/
/*                    Reset for signed pulses              */
/*---------------------------------------------*/
if(turn0==0)

    {

    /*---------------------------------------------*/

    for(k=0;k<n_p;k++)

        {

        POS=track[k][0];

        MaxCrit=ref_sig[POS];

        Idx[k]=0;

        for(i=1;i<MaxIdx[k];i++)

            {

             POS=track[k][i];

             x=fabs(ref_sig[POS]);

             if(x>MaxCrit)

                {

                MaxCrit=x;

                Idx[k]=i;

                PosOpt[k]=POS;

               }

             }
				
				<dp n="d305"/>
       IdxOpt[k]=Idx[k];

       }

    /*---------------------------------------------*/

    }
else

    for(k=0;k<n_p;k++)

        {

         Idx[k]=IndexOpt[k];

         IdxOpt[k]=IndexOpt[k];

         PosOpt[k]=track[k][Idx[k]];

         }
/*---------------------------------------------*/
/*=============Close-loop searching============*/
/*---------------------------------------------*/
for(m=turn0;m<=turn1;m++)

    {

    for(k=0;k<n_p;k++)

        {

        MaxCrit=-1;

        for(Idx[k]=0;Idx[k]<MaxIdx[k];Idx[k]++)

             {

             flag=1;

             POS=track[k][Idx[k]];

             for(i=0;i<k;i++)

                 {

                 if(POS=PosOpt[i])

                     flag=0;

                 }

             for(i=k+1;i<n_p;i++)

                 {

                 if(POS=PosOpt[i])

                     flag=0;

                 }

            if(flag==1)

                 FCS_One_Search_4kCB(SignTab,lag,pit_g,k,n_p,
				
				<dp n="d306"/>
                      Idx,Mag,ref_sig,IdxOpt,PosOpt,

                           &amp;MaxCrit,&amp;Rn_m,&amp;Rd_m,Lex);

                 }

             Idx[k]=IdxOpt[k];

             }

        }

    /*---------------------------------------------*/

    /*=======Criterion calculation and maximisation======*/

    /*---------------------------------------------*/

    if(MaxCrit>(*Criterion))

        {

        (*Criterion)=MaxCrit;

        for(k=0;k<n_p;k++)

                SignOpt[k]=SignTab[PosOpt[k]];

        for(k=0;k<n_p;k++)

                IndexOpt[k]=IdxOpt[k];

        ini_dvector(EXopt,0,Lex-1,0.0);

        for(k=0;k<n_p;k++)

            {

            FCS_DetermPulsLoc(pit_g,1ag,Mag[k],PosOpt[k],MagV,

                                 LocV,&amp;m,Lex);

            for(i=0;i<m;i++)

                 EXopt[LocV[i]]+=MagV[i]*SignOpt[k];

            }

         }

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*================================*/
/*FUNCTION      :FCS__Decod_CPCB().                    */
				
				<dp n="d307"/>
/*---------------------------------------------*/
/*PURPOSE           :This function decode the fixed codebook.        */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                              */
/*      _(INT16)phas_mode:initial phase for the pulses.*/
/*      _(INT16[])Sign:array of pulse signs.*/
/*      _(FLOAT64)pmag:magnitude ofpulses.*/
/*      _(FLOAT64)bits_p:number ofbits per pulse.*/
/*      _(INT16)n_p:number ofpulses.*/
/*      _(INT16[])Index:optimized array of indexes.*/
/*      _(INT16)Lex:excitation size.        */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                            */
/*      _(FLOAT64[])EXopt:optimized excitation signal.*/
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                           */
/*                  _None.                                      */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                            */
/*                 _None.                    */
/*=================================*/
void FCS_Decod_CPCB(INT16 phas_mode,INT16 Sign[],FLOAT64 pmag,INT16 bits_p,

            INT16n_p,FLOAT64 EXopt[], INT16 Lex,INT16 Index[])

    {

    /*---------------------------------------------*/

    INT16   n,k,Pos[MAXPN];

    FLOAT64 GG;

    /*---------------------------------------------*/

    /*              Set_up the track positions            */

    /*---------------------------------------------*/

    FCS_Set_CPCB(phas_mode,bits_p,n_p,Lex);

    for(n=0;n<n_p;n++)

        Pos[n]=track[n][Index[n]];

    /*---------------------------------------------*/

    /*               Calculate the excitation signal           */
				
				<dp n="d308"/>
    /*---------------------------------------------*/

    ini_dvector(EXopt,0,Lex-1,0.0);

    GG=1.0;

    for(k=0;k<n_p;k++)

        {

        EXopt[Pos[k]]+=Sign[k]*GG;

        GG    *=pmag;

       }

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*=================================*/
/*FUNCTION      :FCS_Decod_PitCB().                    */
/*---------------------------------------------*/
/*PURPOSE       :This function determines decode the fixed    */
/*              codebook and performs the forward and backward  */
/*              pitch enhancement.                       */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                              */
/*       _(INT16    )phas_mode:initial phase for the pulses.*/
/*       _(INT16   [])Sign:array ofpulse signs.       */
/*       _(FLOAT64  )pmag:magnitude of pulses.*/
/*       _(INT16  )bits_p:number ofbits per pulses.*/
/*       _(INT16  )n_p:number of pulses.        */
/*       _(INT16  )Lex:excitation size.           */
/*       _(INT16  [])Index:optimized array of indexes.*/
/*       _(INT16  )lag:pitchlag.*/
/*       _(FLOAT64  )pit_g:pitch gain.           */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                          */
/*       _(FLOAT64[])EXopt:  optimized excitation signal.*/
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
				
				<dp n="d309"/>
/*        _None.          */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                               */
/*       _None.          */
/*=================================*/
void FCS_Decod_PitCB(INT16phas_mode,INT16 Sign[],FLOAT64 pmag,INT16 bits_p,

             INT16n_p,FLOAT64 EXopt[],INT16 Lex,INT16 Index[],

                 INT16lag,FLOAT64 pit_g)

    {

    /*---------------------------------------------*/

    INT16   k,i,Pos[MAXPN],LocP[5],NumP;

    FLOAT64 GG,MagP[5];

    /*---------------------------------------------*/

    /*               Set-up the track positions         */

    /*---------------------------------------------*/

    FCS_Set_CPCB(phas_mode,bits_p,n_p,Lex);

    for(k=0;k<n_p;k++)

        Pos[k]=track[k][Index[k]];

    /*---------------------------------------------*/

    /*               Calculate the excitation signal           */

    /*---------------------------------------------*/

    ini_dvector(EXopt,0,Lex-1,0.0);

    GG=1.0;

    for(k=0;k<n_p;k++)

        {

        FCS_DetermPulsLoc(pit_g,lag,GG,Pos[k],MagP,LocP,&amp;NumP,

                                Lex);

        for(i=0;i<NumP;i++)

            EXopt[LocP[i]]+=Sign[k]*MagP[i];

        GG*=pmag;

       }
  /*---------------------------------------------*/
				
				<dp n="d310"/>
    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*===============================*/
/*FUNCTION        :FCS_Calc_pre_search().                    */
/*---------------------------------------------*/
/*PURPOSE        :This function determines.               */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                           */
/*      _(FLOAT64    [])hh:        impulse sesponse W(z)/A(z).  */
/*      _(INT16       )lag:      pitch lag.                 */
/*      _(FLOAT64      )pgain:    pitch gain.              */
/*      _(FLOAT64    [])target:  target sigral.             */
/*      _(INT16     [])SignTab:  array ofpulse signs.        */
/*      _(INT16     [])res:     ″ideal excitation″signal.    */
/*      _(FLOAT64      )SignWeight:weigthing factor for sign pulse */
/*                             determination(0.0 in all the  */
/*                              calls).                 */
/*      _(INT16         )AppSign:  use of sign table flag.     */
/*      _(INT16         )l_sf:   excitation size.           */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                             */
/*      _(FLOAT64       *)Gp_m: modified pitch gain for harmonic*/
/*                           weighting.                */
/*      _(FLOAT64   [])ref:reversed target signal.      */
/*      _(FLOAT64  [])hh_v:modified impulse sesponse.     */
/*---------------------------------------------*/
/INPUT/OUTPUT ARGUMENTS:                      */
/                 _None.                  */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                         */
/*                _None.                     */
/*================================*/
void FCS_Calc_pre_search(FLOAT64 hh[],FLOAT64 hh_v[],INT16lag,FLOAT64 pgain,

                       FLOAT64*Gp_m,FLOAT64target[],FLOAT64 ref[],

                          INT16 SignTab[],FLOAT64res[],

                              FLOAT64 Sign Weight,INT16 App Sign,
				
				<dp n="d311"/>
                        INT16 1_sf)
{
/*---------------------------------------------*/
INT16   i,j,k;
FLOAT64tmp[L_SF],GG,CC;
FLOAT64*buf;
/*---------------------------------------------*/
buf=dvector(0,1_sf-1);
/*---------------------------------------------*/
/*                Harmonic weighting on hh                 */
/*---------------------------------------------*/
cpy_dvector(hh,hh_v,0,1_sf_1);  
(*Gp_m)=MIN(pgain,PAST_PGAIN_MAX);
(*Gp_m)=MAX(PAST_PGAIN_MIN,(*Gp_m));
if(AppSign=1)

    for(i=lag;i<l_sf;i++)

        hh_v[i]=hh_v[i]+(*Gp_m)*hh_v[i_lag];
/*---------------------------------------------*/
/*                   Backward filtering              */
/*---------------------------------------------*/
for(j=0;j<l_sf;j++)

    ref[]j=target[l_sf-1_j];
filterAZ(hh_v,ref,tmp,buf,(INT16)(1_sf-1),1_sf);
for(j=0;j<1_sf;j++)

    ref[j]=tmp[1_sf-1_j];
/*---------------------------------------------*/
/*               Calculte PHI[][]                */
/*---------------------------------------------*/
for(i=0;i<1_sf;i++)

    PHI[i][1_sf-1]=hh_v[1_sf-1-i]*hh_v[0];
				
				<dp n="d312"/>
for(k=1;k<1_sf;k++)

    for(i=1;i<=k;i++)

        PHI[k-i][1_sf_1-i]=PHI[k-i+1][1_s_i]+

                                                hh_v[1_sf_k+i-1]*hh_v[i];
/*---------------------------------------------*/
/*               Set-up Sign table         */
/*---------------------------------------------*/
if(Sign Weight>0.01)

    {

    dot_dvector(ref,ref,&amp;GG,0,1_sf-1);

    dot_dvector(res,res,&amp;CC,0,1_sf_1);

    CC=sqrt(GG/MAX(CC,0.1));

    CC*=Sign Weight;

    for(i=0;i<1_sf;i++)

        tmp[i]=CC*res[i]+ref[i];

    for(i=0;i<1_sf;i++)

        {

        if(tmp[i]>0)

            SignTab[i]=1;

        else

            SignTab[i]=-1;

        }

    }
else

    {

    for(i=0;i<1_sf;i++)

        {

        if(ref[i]>0)

            SignTab[i]=1;

        else

            SignTab[i]=-1;

        }

    }
/*---------------------------------------------*/
/*                 Apply sign table               */
				
				<dp n="d313"/>
    /*---------------------------------------------*/

    if(AppSign==1)

       {

       for(i=0;i<1_sf,i++)

           ref[i]*=SignTab[i];

       for(i=0;i<1_sf; i++)

           for(j=i;j<1_sf;j++)

                 PHI[i][j]*=SignTab[i]*SignTab[j];

       }
   for(i=1;i<1_sf;i++)

       for(j=0;j<i;j++)

           PHI[i][j]=PHI[j][i];
   /*---------------------------------------------*/
   free_dvector(buf,0,1_sf_1);
   /*---------------------------------------------*/
   return;
   /*---------------------------------------------*/
   }
/*---------------------------------------------*/
/*=================================*/
/*FUNCTION      :FCS_PulseExchange().                 */
/*---------------------------------------------*/
/*PURPOSE       :This function swaps pulse 1and 2 sign and index.*/
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                            */
/*           _None.                              */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                          */
/*          _None.                           */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                       */
/*         _(INT16*)index1:pulse 1 index.       */
				
				<dp n="d314"/>
/*       _(INT16*)sign1:pulse 1 sign.        */
/*       _(INT16*)index2:pulse 2index.        */
/*       _(INT16*)sign2:pulse 2sign.           */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                */
/*         _None.                                         */
/*===================================*/
void FCS_PulseExchange(INT16*index1,INT16*sign1,INT16*index2,INT16*sign2)

    {

    /*---------------------------------------------*/

    INT16i;

    /*---------------------------------------------*/

    i=(*index1);

    (*index1)=(*index2);

    (*index2)=i;

    i=(*sign1);

    (*sign1)=(*sign2);

    (*sign2)=i;

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*================================*/
/*FUNCTION       :FCS_SI_parameter().                    */
/*---------------------------------------------*/
/*PURPOSE        :This function determines the stationary signal  */
/*               coefficient that is comprise between 0.0 and 1.0.*/
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                           */
/*      _(INT16)i_sf:    sub-frame index.         */
/*      _(INT16)rate_m:selected bit-rate.          */
/*      _(INT16)SVS_flag:coding mode(0/1).          */
				
				<dp n="d315"/>
/*     _(FLOAT64[])pdcfq:quantied prediction coeff.*/
/*     _(INT16)lag:pitchlag.             */
/*     _(FLOAT64)lpcg:LPC gain.           */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                              */
/*   _(FLOAT64[])pdcfq_w:weighted quantized predic.coeff*/
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                         */
/*      _(FLOAT64*)Stab:stationary signal evaluation      */
/*                    coefficient(0.0->1.0).          */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                              */
/*          _None.                              */
/*==================================*/
void FCS_ST_parameter(INT16 i_sf,INT16 rate_m,INT16 SVS_flag,FLOAT64 pdcfq[],

                 INT16 lag,FLOAT64*Stab,FLOAT64 pdcfq_w[],

                     FLOAT64 lpcg)

    {

    /*---------------------------------------------*/

    FLOAT64  y,val;

    INT16i;

    /*---------------------------------------------*/

    /*              LPC gain                */

    /*---------------------------------------------*/

    if(i_sf=0)

         {

         y=fabs(lpcg_lpcg_m)/MAX(fabs(1pcg+lpcg_m),EPSI);

         if((SVS_flag!=1)&amp;&amp;(abs(lag_lag_m)>0.25*lag))

                  y=1.0;

         (*Stab)=0.25*(*Stab)+0.75*(1.0-y);

         if(rate_m!=RATE4_0K)

             (*Stab)=0;

         /*---------------------------------------------*/

         /*           Update memory                 */
				
				<dp n="d316"/>
      /*---------------------------------------------*/

      lpcg_m  =lpcg;

      lag_m  =lag;

      /*---------------------------------------------*/

      /*           Update the weighting coefficients         */

      /*---------------------------------------------*/

      if(lpcg<10.0)

             alpha=0.0125;

      else

          {

          if(lpcg<20.0)

              alpha=0.025;

          else

              alpha=0.05;

         }

       }

    /*---------------------------------------------*/

    val=1.0;

    for(i=0;i<NP;i++)

        {

        val*=alpha;

        pdcfq_w[i]=pdcfq[i]*val;

        }

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*===============================*/
/*FUNCTION        :FCS_Search_pastcorr().                   */
/*---------------------------------------------*/
/*PURPOSE         :This function calculate the autocorrelation of  */
				
				<dp n="d317"/>
/*             the past weighted quantized speech.          */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                             */
/*      _(FLOAT64 []) ext:   excitation signal.          */
/*      _(FLOAT64 []) pdcfq: quantized prediction coeff.  */
/*      _(FLOAT64   )Stab:   stationary signal evaluation    */
/*                         coefficient(0.0->1.0).   */
/*      _(INT16  )pitch:pitch value.           */
/*      _(FLOAT64  )ltpg: LTP gain.                  */
/*      _(INT16    )SVS_flag:coding mode(0/1).           */
/*      _(INT16    )i_sf:  sub-frame index.            */
/*      _(INT16    )1_sf:   sub-frame size.             */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                              */
/*      _(FLOAT64[])Rw:    autocorrelation values.*/
/*      _(FLOAT64[])T_Rw:  index of autocorrelation values.*/
/*      _(FLOAT64*)N_Rw:   number ofautocorrelation values.*/
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                           */
/*          _None.                             */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                             */
/*          _None.                                   */
/*================================*/
void FCS_Search_pastcorr(FLOAT64 ext[],FLOAT64 pdcfq[],FLOAT64 Stab,

                       INT16pitch,FLOAT64ltpg,INT16rate_m,

                           INT16 SVS_flag,INT16i_sg,INT16l_sf,

                               FLOAT64Rw[],INT16T_Rw[],INT16*N_Rw)

    {

    /*---------------------------------------------*/

    FLOAT64 x,y,pdcfq_w[NP],wsp[L_WSP],tmpmem[NP],val;

    INT16i,k,m;

    /*---------------------------------------------*/

    /*              Weighting filtering            */

    /*---------------------------------------------*/

    val=1.0;

    for(i=0;i<NP;i++)

    {
				
				<dp n="d318"/>
    val*=0.85;

    pdcfq_w[i]=pdcfq[i]*val;

    }
  ini_dvector(tmpmem,0,NP-1,0.0);
  if(SVS_flag!=1)

      FLT_allsyn(ext+MAX_LAG-L_WSP,L_WSP,pdcfq_w,NP,wsp,tmpmem);
  else

      {

      if(i_sf=0)

         cpy_dvector(ext+MAX_LAG-L_WSP,wsp_m,0,L_WSP-1);

      FLT_allsyn(wsp_m,L_WSP,pdcfq_w,NP,wsp,tmpmem);

     }
  /*---------------------------------------------*/
  /*               Correlation                   */
  /*---------------------------------------------*/
  dot_dvector(wsp+L_WSP-L_CORR,wsp+L_WSP_L_CORR,&amp;x,0,L_CORR-1);
  (*N_Rw)=0;
  ini_dvector(Rw,0,1_sf_1,0.0);
  for(k=3;k<5;k++)

      {

      i=(INT16)(pitch/k+0.5);

      if((i<1_sf)&amp;&amp;(i>min_pit))

          {

               for(m=1;m<6;m++)

                   if(m*i<1_sf&amp;&amp; m*i<pitch-6)

                       {

                       dot_dvector(wsp+L_WSP-L_CORR,

                                        wsp+L_WSP-L_CORR-m*i,

                                        &amp;Rw[*N_Rw],0,L_CORR-1);

                       dot_dvector(wsp+L_WSP-L_CORR-m*i,

                                        wsp+L_WSP-L_CORR-m*i,&amp;y,

                                               0,L_CORR-1);

                       Rw[*N_Rw]=MAX(MIN(Rw[*N_Rw]/
				
				<dp n="d319"/>
                                MAX(0.5*(x+y),0.001),

                                    1.0),0.0);

               T_Rw[*N_Rw]=m*i;

               (*N_Rw)++;

               }

           }

       }

    /*---------------------------------------------*/

    /*           Reduction factor          */

    /*---------------------------------------------*/

    if((SVS_flag=1)&amp;&amp;(SVS_flag_m=1)&amp;&amp;(rate_m=RATE4_0K))

        {

         for(i=0;i<*N_Rw;i++)

             Rw[i]*=Stab*0.5;

         for(i=0;i<*N_Rw;i++)

             Rw[i]*=MIN(1tpg,1.0);

        }

    else

        {

        for(i=0;i<*N_Rw;i++)

            Rw[i]*=Stab*0.25;

        for(i=0;i<*N_Rw;i++)

            Rw[i]*=MIN(ltpg,0.75);

        }

    if(i_sf=0)

        SVS_flag_m=SVS_flag;

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*===================================*/
				
				<dp n="d320"/>
/*FUNCTION       :FCS_cdbk_search_13b_sub54().             */
/*---------------------------------------------*/
/*PURPOSE        :This function estimate the optimal fixed    */
/*               excitation for 4.0 kbps mode 1.              */
/*---------------------------------------------*/
/*INPUT ARGUMENTS :                              */
/*        -(FLOAT64    [])ext:    excitation signal.        */
/*        -(FLOAT64    [])pdcfq:quantized prediction coeff.    */
/*        -(FLOAT64    [])target:target signal.             */
/*        -(FLOAT64    [])res:″ideal excitation″signal after*/
/*                               LTP contribution.          */
/*        -(FLOAT64    [])hh:      W(z)/A(z)impulse response.*/
/*        -(INT16      )1_sf:      sub-frame size.*/
/*        -(INT16      )1_sf:      sub-frame index.*/
/*        -(INT16      )lag:       pitch lag.            */
/*        -(INT16      )VUV:        frame class.             */
/*        -(FLOAT64     )pgain:     pitch preprocessing quantized  */
/*                                pitch gain.                */
/*        _(FLOAT64     )NSR:        noise to signal ratio.         */
/*        -(FLOAT64     )Rp:         pitch preprocessing pitch      */
/*                                  correlation.                 */
/*        -(INT16      )rate_m:  selected bit-rate.           */
/*        -(FLOAT64     )lpcg:  LPC gain.                */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                            */
/*        -(FLOAT64     [])unfcod:unfiltered excitation signal. */
/*        -(PARAMETER *)chan:output data structure.         */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                              */
/*        _None.                                      */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                            */
/*       _None.                                  */
/*===========================*/
void FCS_cdbk_search_13b_sub54(FLOAT64 ext[],FLOAT64 pdcfq[]FLOAT64 target[],

                   FLOAT64 res[],FLOAT64 hh[],FLOAT64 unfcod[],

                   INT16 l_sf,INT16 i_sf,INT16 lag,

                      INT16 VUV,FLOAT64 pgain,FLOAT64 NSR,FLOAT64 Rp,

                          INT16 rate_m,FLOAT64 lpcg,PARAMETER*chan)

    {

    /*---------------------------------------------*/
				
				<dp n="d321"/>
INT16   mode;
INT16   T_Rw[L_SF3],N_Rw,n;
INT16   i,Iopt;
INT16   IdxPuls[MAXPN]={0},Sign[MAXPN]={0};
INT16   SignTab[L_SF3];
FLOAT64 Criter,Criter,m,Gp_m;
FLOAT64 hh_v[L_SF3],ref[L_SF3];
FLOAT64 Rw[L_SF3],tmpmem[NP],pdcfq_w[NP];
/*---------------------------------------------*/
cpy_dvector(hh,hh_v,0,1_sf_1);
FCS_ST_parameter(i_sf,rate_m,1,pdcfq,lag,&amp;Stab_13b_enc,

                 pdcfq_w,lpcg);
FCS_Search_pastcorr(ext,pdcfq,Stab_13b_enc,lag,pgain,rate_m,

                      1,i_sf,1_sf,Rw,T_Rw,&amp;N_Rw);
for(i=0;i<N_Rw;i++)

    for(n=T_Rw[i];n<1_sf;n++)

        hh_v[n]+=Rw[i]*hh[n-T_Rw[i]];
ini_dvector(tmpmem,0,NP-1,0.0);
FLT_allsyn(hh_v,1_sf,pdcfq_w,NP,hh_v,tmpmem);
cpy_dvector(hh_v,ref,0,1_sf_1);
for(i=1;i<L_HF;i++)

    for(n=i;n<1_sf;n++)

        hh_v[n]+=hh_hf[i]*ref[n-i];
FCS_Calc_pre_search(hh_v,hh_v,lag,pgain,&amp;Gp_m,target,ref,

                     SignTab,res,0.0,1,1_sf;
Iopt=0;
Criter=-1;
/*---------------------------------------------*/
/*     2pulses CB:2pulses×5bits/pulse+2signs=12bits  */
/*---------------------------------------------*/
				
				<dp n="d322"/>
FCS_Full_Search_CPCB(0,Sign,1.0,5,2,SignTab,ref,&amp;Criter,

                     unfcod,1_sf,IdxPuls);
mode=3;
Criter_m=Criter;
/*---------------------------------------------*/
/*  3pulses CB:3pulses×(2 or 1)bits/pulse+3signs+3bits   */
/*                center=12bits                   */
/*---------------------------------------------*/
/*---------------------------------------------*/
/*               Determine the center           */
/*---------------------------------------------*/
for(i=0;i<SEG_NUM_M1;i++)

    {

    FCS_Full_Search_CPCB(i,Sign,1.0,2,3,SignTab,ref,&amp;Criter,

                                     unfcod,l_sf,IdxPuls);

    if(Criter>Criter_m)

        {

        Iopt=i;

        mode=2;

        Criter_m=Criter;

        }

    }
/*---------------------------------------------*/
/*                 Save the Index of the cdbk               */
/*---------------------------------------------*/
for(i=0;i<MAXPN;i++)

    chan->idx_cpcb[i_sf][i]=IdxPuls[i];
for(i=0;i<MAXPN;i++)

    chan->idx_cpcbsign[i_sf][i]=(Sign[i]+1)/2;
chan->idx_center[i_sf]=Iopt;
if(mode=3)
				
				<dp n="d323"/>
        chan->idx_subcpcb[i_sf][0]=1;

    else

        chan->idx_subcpcb[i_sf][0]=0;

    /*---------------------------------------------*/

    /*                 Harmonic weighting on unfcod               */

    /*---------------------------------------------*/

    for(i=lag;i<1_sf;i++)

             unfcod[i]+=Gp_m * unfcod[i-lag];

    cpy_dvector(unfcod,hh_v,0,1_sd_1);

    for(i=0;i<N_Rw;i++)

        for(n=T_Rw[i];n<1_sf; n++)

            unfcod[n]+=Rw[i]*hh_v[n-T_Rw[i]];

    ini_dvector(tmpmem,0,NP-1,0.0);

    FLT_allsyn(unfcod,1_sf,pdcfq_w,NP,unfcod,tmpmem);

    cpy_dvector(unfcod,ref,0,1_sf_1);

    for(i=1;i<L_HF;i++)

        for(n=i;n<1_sf;n++)

            unfcod[n]+=hh_hf[i]*ref[n-i];

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*===============================*/
/*FUNCTION        :FCS_cdbk_decod_13b_sub54().               */
/*---------------------------------------------*/
/*PURPOSE         :This function decode the optimal fixed    */
/*                excitation for 4.0kbps mode 1.               */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                             */
/*      _(FLOAT64    [])ext:  excitation signal.         */
				
				<dp n="d324"/>
/*      _(FLOAT64[])pdcfq:quantized prediction coeff. */
/*      _(INT16)1_sf:sub-frame size.          */
/*      _(INT16)i_sf:sub-frame index.          */
/*      _(INT16)lag:pitchlag.              */
/*      _(FLOAT64)pgain:decoded pitch gain.           */
/*      _(INT16)rate_m:current fixedbit-rate.       */
/*      _(FLOAT64)lpcg:decoded LPC gain.        */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                    */
/*      _(FLOAT64[])unfcod:unfiltered excitation signal.*/
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                              */
/*      _(PARAMETER*)chan:output data structure.      */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                  */
/*      _None.                                                  */
/*===============================*/
void FCS_cdbk_decod_13b_sub54(FLOAT64ext[],FLOAT64pdcfq[],

                      FLOAT64 unfcod[],INT16 l_sf,INT16 i_sf,

                         INT16 lag,FLOAT64 pgain,

                             INT16 rate_m,FLOAT64 lpcg,

                                 PARAMETER*chan)

    {

    /*---------------------------------------------*/

    INT16 T_Rw[L_SF3],N_Rw,n;

    INT16  i,Iopt,IdxPuls[MAXPN],Sign[MAXPN];

    FLOAT64 Gp_m;

    FLOAT64 Rw[L_SF3],hh_v[L_SF3],tmpmem[NP],pdcfq_w[NP];

    /*---------------------------------------------*/

    for(i=0;i<MAXPN;i++)

        IdxPuls[i]=chan->idx_cpcb[i_sf][i];

    for(i=0;i<MAXPN;i++)

        Sign[i]=2*chan->idx_cpcbsign[i_sf][i]-1;

    if(chan->idx_subcpcb[i_sf][0]=1)

        {

        /*---------------------------------------------*/

       /*2pulses CB:2pulses×5bits/pulse+2signs=12bits    */
				
				<dp n="d325"/>
    /*---------------------------------------------*/

    FCS_Decod_CPCB(0,Sign,1.0,5,2,unfcod,1-sf,IdxPuls);

    }
else

    {

    /*---------------------------------------------*/

    /*3pulses CB:3pulses×(2orl)bits/pulse+           */

    /*            3signs+3bits center=11bits          */

    /*---------------------------------------------*/

    Iopt=chan->idx_center[i_sf];

    FCS_Decod_CPCB(Iopt,Sign,1.0,2,3,unfcod,1_sf,IdxPuls);

    }
/*---------------------------------------------*/
/*                     Pitch enhancement                  */
/*---------------------------------------------*/
Gp_m=MIN(pgain,PAST_PGAIN_MAX);
Gp_m=MAX(PAST_PGAIN_MIN,Gp_m);
for(i=lag;i<1_sf;i++)

    unfcod[i]=unfcod[i]+Gp_m*unfcod[i-lag];
FCS_ST_parameter(i_sf,rate_m,1,pdcfq,lag,&amp;Stab_13b_dec,

                 pdcfq_w,lpcg);
FCS_Search_pastcorr(ext,pdcfq,Stab_13b_dec,lag,pgain,rate_m,1,

                 i_sf,1_sf,Rw,T_Rw,&amp;N_Rw);
cpy_dvector(unfcod,hh_v,0,1_sf_1);
for(i=0;i<N_Rw;i++)

    for(n=T_Rw[i];n<1_sf; n++)

        unfcod[n]+=Rw[i]*hh_v[n-T_Rw[i]];
ini_dvector(tmpmem,0,NP-1,0.0);
FLT_allsyn(unfcod,1_sf,pdcfq_w,NP,unfcod,tmpmem);
cpy_dvector(unfco d,hh_v,0,1_sf_1);
for(i=1;i<L_HF;i++)
				
				<dp n="d326"/>
     for(n=i;n<l_sf;n++)

         unfcod[n]+=hh_hf[i]*hh_v[n-i];
  /*---------------------------------------------*/
  return;
  /*---------------------------------------------*/
  }
/*---------------------------------------------*/
/*================================*/
/*FUNCTION    :FCS_cdbk_search_15b_sub80().            */
/*---------------------------------------------*/
/*PURPOSE     :This function estimate the optimal fixed      */
/*            excitation for 4.0kbps mode 0.              */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                            */
/*      _(FLOAT64  [])ext:   excitation signal.        */
/*      _(FLOAT64  [])pdcfq: quantized prediction coeff.   */
/*      _(FLOAT64  [])target:target signal.             */
/*      _(FLOAT64  [])res:   ″ideal excitation″signal after   */
/*                           LTP contribution.            */
/*      _(FLOAT64   [])hh:    W(z)/A(z)impulse response.  */
/*      _(INT16     )1_sf:  sub-frame size.         */
/*      _(INT16     )i_sf:  sub-frame index.          */
/*      _(INT16     )lag:   pitchlag.              */
/*      _(INT16     )VUV:   frame class.          */
/*      _(FLOAT64    )pgain:quantized pitch gain.       */
/*      _(FLOAT64    )NSR:   noise to signal ratio.       */
/*      _(FLOAT64    )Rp:    pitch preprocessing pitch   */
/*                         correlation.        */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                              */
/*      _(FLOAT64  [])unfcod:  unfiltered excitation signal.*/
/*      _(PARAMETER  *)chan:   output data structure.    */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                              */
/*      _None.                                */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                            */
				
				<dp n="d327"/>
/*         _None.                                            */
/*=================================*/
void FCS_cdbk search_15b_sub80(FLOAT64 ext[],FLOAT64 pdcfq[],FLOAT64 target[],

                  FLOAT64 res[],FLOAT64 hh[],FLOAT64 unfcod[],

                  INT16 1_sf,INT16 i_sf,INT16lag,

                  INT16 VUV,FLOAT64 pgain,FLOAT64 NSR,FLOAT64 Rp,

                  INT16 rate_m,FLOAT64l pcg,PARAMETER*chan)

    {

    /*---------------------------------------------*/

    INT16    mode;

    INT16    T_Rw[L_SF],N_Rw;

    INT16    IdxPuls[MAXPN]={0},Sign[MAXPN]={0};

    INT16    i,n,Iopt;

    INT16    IdxPuls_tmp[MAXPN],

        Sign_tmp[MAXPN],SignTab[L_SF];

    FLOAT64     P1_SHP,Criter,Criter_m,Criter_tmp,Gp_m,gp;

    FLOAT64 hh_v[L_SF],ref[L_SF];

    FLOAT64 Rw[L_SF],tmpmem[NP],pdcfq_w[NP];

    /*---------------------------------------------*/

    cpy_dvector(hh,hh_v,0,1_sf_1);

    FCS_ST_parameter(i_sf,rate_m,1,pdcfq,lag,&amp;Stab_15b_enc,

                     pdcfq_w,lpcg);

    FCS_Search_pastcorr(ext,pdcfq,Stab_15b_enc,lag,pgain,rate_m,0,

                            i_sf,1_sf,Rw,TRw,&amp;N_Rw);

    for(i=0;i<N_Rw;i++)

        for(n=T_Rw[i];n<1_sf;n++)

            hh_v[n]+=Rw[i]*hh[n-T_Rw[i]];

    ini_dvector(tmpmem,0,NP-1,0.0);

    FLT_allsyn(hh_v,l_sf,pdcfq_w,NP,hh_v,tmpmem);

    cpy_dvector(hh_v,ref,0,1_sf_1);

    for(i=1;i<L_HF;i++)

        for(n=i;n<l_sf;n++)

            hh_v[n]+=hh_hf[i]*ref[n-i];
				
				<dp n="d328"/>
/*---------------------------------------------*/
/*2pulses CB:  2pulses×6bits/pulse+2signs=14bits    */
/*---------------------------------------------*/
FCS_Calc_pre_search(hh_v,hh_v,lag,pgain,&amp;Gp_m,target,ref,

                    SignTab,res,0.0,0,1_sf;
Criter=-1;
gp=0.75;
  FCS_Simp_Search_4kCB(0,1,1,Sign,1.0,7,2,SignTab,ref,&amp;Criter,

                     unfcod,1_sf,IdxPuls,lag,gp);
mode=3;
Critet_m=Criter;
/*---------------------------------------------*/
/*              Sign check                */
/*---------------------------------------------*/
  if(IdxPuls[0]<=IdxPuls[1])

    {

    if(Sign[0]!=Sign[1])

              FCS_PulseExchange(IdxPuls,Sign,IdxPuls+1,Sign+1);

    }
  else

    {

    if(Sign[0]=Sign[1])

        FCS_PulseExchange(IdxPuls,Sign,IdxPuls+1,Sign+1);

    }
  IdxPuls[0]=IdxPuls[0]*L_SF+IdxPuls[1];
/*---------------------------------------------*/
/*3pulses CB:3pulses×2bits/pulse+3signs+4bits center=*/
/*            13bits                                 */
/*---------------------------------------------*/
/*---------------------------------------------*/
/*               Reference signal                  */
				
				<dp n="d329"/>
/*---------------------------------------------*/
FCS Calc_pre_search(hh_v,hh_v,lag,0.25,&amp;Gp_m,target,ref,

                     SignTab,res,0.0,1,1_sf;
/*---------------------------------------------*/
/*                 Determine the center              */
/*---------------------------------------------*/
Iopt=0;
Criter=-1;
Criter tmp=Criter;
for(i=0;i<SEG_NUM_M0;i++)

    {

    FCS_Simp_Search_CPCB(0,0,i,Sign_tmp,1.0,2,3,SignTab,ref,

                &amp;Criter,hh_v,l_sf,IdxPuls_tmp);

    if(Criter>Criter_tmp)

         Iopt=i;

    Criter_tmp=Criter;

    }
/*---------------------------------------------*/
/*                    Determine the shape              */
/*---------------------------------------------*/
Criter=Criter_m;
if((lag<35)&amp;&amp;(Rp<0.6))

    Criter*=MIN(0.6+0.4*(lag-MIN_LAG)/(35.0-MIN_LAG),1.0);
Criter_tmp=Criter;
FCS_Full_Search_CPCB(Iopt,Sign,1.0,2,3,SignTab,ref,&amp;Criter,

                     unfcod,1_sf,IdxPuls);
if(Criter>Criter_tmp)

    mode=2;
else

    Criter=Criter_m;
				
				<dp n="d330"/>
/*---------------------------------------------*/
/*         Perceptual Wheighted decison    */
/*---------------------------------------------*/
Pl_SHP=PPP_sharpness(1_sf,res);
if((VUV>=3)&amp;&amp;(Rp<0.75))
   Criter*=MIN(MAX(1.5_4.0*P1_SHP,0.5),1.0);
if(VUV=2)
   Criter*=MIN(MAX(1.5-5.0*P1_SHP,0.25),1.0);
if(VUV<=1)
   Criter*=0.75*MIN(MAX(1.5-5.0*P1_SHP,0.0),1.0);
if((VUV=1)&amp;&amp;(mode=3)&amp;&amp;(lag<50))
   Criter*=0.5;
if(VUV>=2)
   Criter*=1.0-0.5*NSR*MIN(P1_SHP+0.5,1.0);
Criter_m=Criter;
/*---------------------------------------------*/
/*                 Gaussian codebook,13bits                */
/*---------------------------------------------*/
GCB_gauss_cb_itu4k(target,res,hh,&amp;Criter,unfcod,IdxPuls,Sign,

                                             N_GAUSS_13b,N_GAUSS_13b);
if(Criter>Criter_m)

    {

    mode=1;

    IdxPuls[0]=IdxPuls[0]*N_GAUSS_13b+IdxPuls[1];

    }

         /
/*---------------------------------------------*/
/*                   Index of the cdbk                  */
/*---------------------------------------------*/
for(i=0;i<MAXPN;i++)

    chan->idx_cpcb[i_sf][i]=IdxPuls[i];
for(i=0;i<MAXPN;i++)

    chan->idx_cpcbsign[i_sf][i]=(Sign[i]+1)/2;
chan->idx_center[i_sf]=Iopt;
				
				<dp n="d331"/>
if(mode=3)

    chan->idx_subcpcb[i_sf][0]=1;
else

    {

    chan->idx_subcpcb[i_sf][0]=0;

    if(mode=2)

        chan->idx_subcpcb[i_sf][1]=1;

    else

        chan->idx_subcpcb[i_sf][1]=0;

    }
/*---------------------------------------------*/
/*                Harmonic weighting on unfcod           */
/*---------------------------------------------*/
if(mode>=2)

    {

    if(mode=2)

        for(i=lag;i<1_sf;i++)

            unfcod[i]+=Gp_m*unfcod[i-lag];

    cpy_dvector(unfcod,hh_v,0,1_sf_1);

    for(i=0;i<N_Rw;i++)

        for(n=T_Rw[i];n<1_sf;n++)

            unfcod[n]+=Rw[i]*hh_v[n-T_Rw[i]];

    ini_dvector(tmpmeem,0,NP-1,0.0);

    FLT_allsyn(unfcod,1_sf,pdcfq__w,NP,unfcod,tmpmem);

    cpy_dvector(unfcod,ref,0,1_sf_1);

    for(i=1;i<L_HF;i++)

        for(n=i;n<1_sf;n++)

            unfcod[n]+=hh_hf[i]*ref[n-i];

    }
/*---------------------------------------------*/
return;
/*---------------------------------------------*/
}
				
				<dp n="d332"/>
/*---------------------------------------------*/
/*================================*/
/*FUNCTION        :FCS_cdbk_decod_15b_sub80 ().               */
/*---------------------------------------------*/
/*PURPOSE         :This function decode the fixed excitation vector*/
/*                for 4.0kbps mode 0.                   */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                */
/*      _(FLOAT64 [])ext:   excitation signal.        */
/*      _(FLOAT64 [])pdcfq: quantized prediction coeff.    */
/*      _(INT16    )1_sf: sub-frame size.          */
/*      _(INT16    )1_sf: sub-frame index.          */
/*      _(INT16    )lag:  pitch lag.             */
/*      _(FLOAT64   )pgain:decoded pitch gain.          */
/*      _(INT16    )rate_m:decoded fix bit-rate.         */
/*      _(FLOAT64   )lpcg:  decoded LPC gain.         */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                             */
/*      _(FLOAT64 [])unfcod: unfiltered excitation signal.   */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*      _(PARAMETER   *)chan:  output data structure.     */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                   */
/*      _None.                                    */
/*=================================*/

                      \
void FCS_cdbk_decod_15b_sub80(FLOAT64 ext[],FLOAT64 pdcfq[],

                      FLOAT64 unfcod[],INT161_sf,INT16 i_sf,

                      INT16 lag,FLOAT64pgain,

                      INT16 rate_m,FLOAT64lpcg,PARAMETER*chan)

    {

    /*---------------------------------------------*/

    INT16  mode;

    INT16  T_Rw[L_SF],N_Rw;

    INT16  i,n,Iopt,IdxPuls[MAXPN],Sign[MAXPN],IdxGauss[2];

    FLOAT64 gp,tmp[L_SF];

    FLOAT64 Rw[L_SF],tmpmem[NP],pdcfq w[NP];
				
				<dp n="d333"/>
/*---------------------------------------------*/
for(i=0;i<MAXPN;i++)

    IdxPuls[i]=chan->idx_cpcb[i_sf][i];
for(i=0;i<MAXPN;i++)

    Sign[i]=2*chan->idx_cpcbsign[i_sf][i]-1;
if(chan->idx_subcpcb[i_sf][0]=1)

    {

    /*---------------------------------------------*/

    /*2pulses CB:2pulses×6bits/pulse+2signs=14bits    */

    /*---------------------------------------------*/

    mode=3;

    gp=0.75;

    i=IdxPuls[0]/L_SF;

         IdxPuls[1]=IdxPuls[0]-i*L_SF;

         IdxPuls[0]=i;

    /*---------------------------------------------*/

         /*             Sign check               */

    /*---------------------------------------------*/

         if(IdxPuls[0]<=IdxPuls[1])

             Sign[1]=Sign[0];

         else

             Sign[1]=-Sign[0];

         FCS_Decod_PitCB(1,Sign,1.0,7,2,unfcod,1_sf,IdxPuls,

                              lag,gp);

    }
else

    {

    if(chan->idx_subcpcb[i_sf][1]=1)

        {

        /*---------------------------------------------*/

        /*3pulses CB:3pulses×2bits/pulse+3signs+   */

        /*         4bits center=13bits          */

        /*---------------------------------------------*/
				
				<dp n="d334"/>
        mode=2;

        Iopt=chan->idx_center[i_sf];

        FCS_Deco_CPCB(Iopt,Sign,1.0,2,3,unfcod,1_sf,

                            IdxPuls);

        }
   else

       {

       /*---------------------------------------------*/

       /*              Gaussian codebook,13bits      */

       /*---------------------------------------------*/

       mode=1;
#ifdef VERBOSE

            if(1_sf!=40+40)

               nrerror(″ERROR:dimension mismatch decoding gaussian excitation\n″);
#endif

           /*---------------------------------------------*/

           /*  Decode the 11 bits index into the two 45-entry  */

           /*           codebooks              */

           /*---------------------------------------------*/

           IdxGauss[0]=IdxPuls[0]/N_GAUSS_13b;

           IdxGauss[1]=IdxPuls[0]-N_GAUSS_13b*IdxGauss[0];

           GCB_decode_gauss_cb_itu4k(N_GAUSS_13b,40,IdxGauss[0],

                                                      Sign[0],unfcod);

           GCB_decode_gauss_cb_itu4k(N_GAUSS_13b,40,IdxGauss[1],

                \                                     Sign[1],unfcod+1);

          }

       }

    FCS_ST_parameter(i_sf,rate_m,1,pdcfq,lag,&amp;Stab_15b_dec,

                     pdcfq_w,lpcg);

    FCS_Search_pastcorr(ext,pdcfq,Stab_15b_dec,lag,pgain,rate_m,0,

                           i_sf,1_sf,Rw,T_Rw,&amp;N_Rw);

    if(mode>=2)

        {

        if(mode==2)
				
				<dp n="d335"/>
           for(i=lag;i<1_sf;i++)

                unfcod[i]=unfcod[i]+0.25*unfcod[i_lag];

       cpy_dvector(unfcod,tmp,0,1_sf-1);

       for(i=0;i<N Rw;i++)

           for(n=T_Rw[i];n<l_sf;n++)

               unfcod[n]+=Rw[i]*tmp[n-T_Rw[i]];

       ini_dvector(tmpmem,0,NP-1,0.0);

       FLT_allsyn(unfcod,1_sf,pdcfq_w,NP,unfcod,tmpmem);

       cpy_dvector(unfcod,tmp,0,1_sf-1);

       for(i=1;i<L_HF;i++)

           for(n=i;n<1_sf;n++)

               unfcod[n]+=hh_hf[i]*tmp[n-i];

       }

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*===============================*/
/*FUNCTION       :FCS_cdbk search_22b_sub40().             */
/*---------------------------------------------*/
/*PURPOSE        :This function estimate the optimal fixed        */
/*               excitation for 8.5kbps mode 0.               */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                 */
/*      _(FLOAT64 [])ext:      excitation signal.         */
/*      _(FLOAT64 [])pdcfq:    quantized prediction coeff.    */
/*      _(FLOAT64 [])target:  target signal.           */
/*      _(FLOAT64 [])res:     ″ideal excitation″signal after  */
/*                             LTP contribution.           */
/*      _(FLOAT64  [])hh:       W(z)/A(z)impulse response.*/
/*      _(INT16   )1_sf        sub-frame size.      */
/*      _(INT16   )1_sf:      sub-frame index.     */
/*      _(INT16   )lag:       pitchlag.            */
				
				<dp n="d336"/>
/*      _(INT16    )VUV:   frame class.             */
/*      _(FLOAT64   )pgain:quantized pitch gain.        */
/*      _(FLOAT64   )NSR:   noise to signal ratio.       */
/*      _(FLOAT64   )Rp:    pitch preprocessing pitch     */
/*                          correlation.                */
/*---------------------------------------------*/
/OUTPUT ARGUMENTS:                                   */
/*      _(FLOAT64   [])unfcod:   unfiltered excitation signal.  */
/*      _(PARAMETER    *)chan:     output data structure.       */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                       */
/       _None.                                 */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                            */
/       _None.                                   */
/*===============================*/
void FCS_cdbk_search_22b_sub40(FLOAT64ext[],FLOAT64pdcfq[],

                  FLOAT64 target[],FLOAT64res[],FLOAT64hh[],

                     FLOAT64 unfcod[],INT161_sf,INT16i_sf,

                       INT16lag,INT16VUV,FLOAT64pgain,

                           FLOAT64NSR,FLOAT64Rp,PARAMETER*chan)

    {

    /*---------------------------------------------*/

    INT16i,mode;

    INT16IdxPuls[MAXPN],Sign[MAXPN],SignTab[L_SF4];

    FLOAT64P1_SHP,Criter,Criter_m,Criter_m3,Criter_m2,Gp_m,Gp;

    FLOAT64hh_v[L_SF4],ref[L_SF4];

    /*---------------------------------------------*/

    if((lag<20)&amp;&amp;(pgain>0.5))

        Gp=MIN(pgain,1.0)*0.75;

    else

        Gp=pgain;

    Gp=MIN(Gp,PAST_PGAIN_MAX2);

    /*---------------------------------------------*/

    /*            Reference signal                */

    /*---------------------------------------------*/
				
				<dp n="d337"/>
FCS_Calc_pre_search(hh,hh_v,lag,Gp,&amp;Gp_m,target,ref,SignTab,

                      res,0.5,1,1_sf;
/*---------------------------------------------*/
/*    5pulses CB:3p×4b+2p×3b+3b signs=21bits       */
/*---------------------------------------------*/
Criter=-1;
FCS_Simp_Search_CPCB(0,1,0,Sign,1.0,4,5,SignTab,ref,&amp;Criter,

                   unfcod,1_sf,IdxPuls);
mode=3;
Criter_m=Criter;
Criter_m3=Criter;
/*---------------------------------------------*/
/*   5pulses CB:5p×3b+5b signs=20bits             */
/*---------------------------------------------*/
FCS_Simp_Search_CPCB(0,0,2,Sign,1.0,3,5,SignTab,ref,&amp;Criter,

                         unfcod,1_sf,IdxPuls);
if(Criter>Criter_m)

    {

    mode=2;

    Criter_m2=Criter;

    }
/*---------------------------------------------*/
/*                Perceptual Wheighted decison           */
/*---------------------------------------------*/
P1_SHP=PPP_sharpness(l_sf,res);
if(VUV<=0)

    Criter*=0.9*MIN(MAX(1.5-5.0*P1_SHP,0.7),1.0);
if(VUV=1)

    Criter*=0.9;
if(VUV>=1)

    Criter*=1.0-0.25*NSR*MIN(P1_SHP+0.5,1.0);
Criter_m=Criter;
/*---------------------------------------------*/
/*   5pulsesCB:5p×3b+5b signs=20bits           */
/*---------------------------------------------*/
				
				<dp n="d338"/>
FCS_Simp_Search_CPCB(0,1,1,Sign,1.0,3,5,SignTab,ref,&amp;Criter,

                        unfcod,1_sf,IdxPuls);
if(Criter>Crite_m)

     mode=1;
/*---------------------------------------------*/
/*               Fine serach                    */
/*---------------------------------------------*/
switch(mode)

    {

    /*---------------------------------------------*/

    /*  5pulsesCB:3p×4b+2p×3b+3b signs=21bits   */

    /*---------------------------------------------*/

    case 3:Criter=Criter_m3;

                    FCS_Simp_Search_CPCB(2,2,0,Sign,1.0,4,5,SignTab,

                                 ref,&amp;Criter,unfcod,1_sf,IdxPuls);

            /*---------------------------------------------*/

            /*   Sign check on the same track         */

            /*---------------------------------------------*/

            for(i=1;i<3;i++)/

                {

                if(IdxPuls[i]<=IdxPuls[i+2])

                    {

                    if(Sign[i]!=Sign[i+2])

                        FCS_PulseExchange(IdxPuls+i,Sign+i,

                            IdxPuls+i+2,Sign+i+2);

                    }

                else

                    {

                    if(Sign[i]=Sign[i+2])

                       FCS_PulseExchange(IdxPuls+i,Sign+i,

                           IdxPuls+i+2,Sign+i+2);

                    }

                }
				
				<dp n="d339"/>
       break;
   /*---------------------------------------------*/
   /*   5pulses CB:5p×3b+5b signs=20bits       */
   /*---------------------------------------------*/
   case 2:Criter=Criter_m2;

                   FCS_Simp_Search_CPCB(1,1,2,Sign,1.0,3,5,SignTab,

                                ref,&amp;Criter,unfcod,1_sf,IdxPuls);

        break;
   /*---------------------------------------------*/
   /*   5pulsesCB:5p×3b+5b signs=20bits      */
   /*---------------------------------------------*/
   case 1:FCS_Simp_Search_CPCB(2,2,1,Sign,1.0,3,5,SignTab,

                          ref,&amp;Criter,unfcod,l_sf,IdxPuls);

        break;
   default:nrerror(″Wrong mode!!″);

        break;
   }
/*---------------------------------------------*/
/*                  Index of the cdbk                  */
/*---------------------------------------------*/
for(i=0;i<MAXPN;i++)

    chan->idx_cpcb[i_sf][i]=IdxPuls[i];
for(i=0;i<MAXPN;i++)

    chan->idx_cpcbsign[i_sf][i]=(Sign[i]+1)/2;
if(mode=3)

    chan->idx_subcpcb[i_sf][0]=1;
else

    {

    chan->idx_subcpcb[i_sf][0]=0;
				
				<dp n="d340"/>
       if(mode=2)

           chan->idx_subcpcb[i_sf][1]=1;

       else

           chan->idx_subcpcb[i_sf][1]=0;

      }
   /*---------------------------------------------*/
   /*              Harmonic weighting on unfcod             */
   /*---------------------------------------------*/
   for(i=lag;i<1_sf; i++)

       unfcod[i]+=Gp_m * unfcod[i-lag];
   /*---------------------------------------------*/
   return;
   /*---------------------------------------------*/
   }
/*---------------------------------------------*/
/*====================================*/
/*FUNCTION       :FCS_cdbk_decod_22b_sub40().             */
/*---------------------------------------------*/
/*PURPOSE        :This function decode the fixed excitation vector */
/*               for 8.5kbps mode 0.                    */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                            */
/*      _(INT16   )1_sf:   sub-frame size.              */
/*      _(INT16   )1_sf:   sub-frame index.             */
/*      _(INT16   )lag:    pitchlag.                   */
/*      _(FLOAT64   )pgain:  decoded pitch gain.          */
/*      _(INT16    )rate_m:decoded fix bit-rate.         */
/*      _(FLOAT64   )lpcg:  decoded LPC gain.            */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                     */
/*      _(FLOAT64   [])unfcod:     unfiltered excitation signal.  */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                               */
/*      _(PARAMETER  *)chan: output data stucture.   */
/*---------------------------------------------*/
				
				<dp n="d341"/>
/*RETURN ARGUMENTS:                            */
/*     _None.                             */
/*================================*/
void FCS_cdbk_decod_22b_sub40(FLOAT64 unfcod[],INT16 1_sf,INT16 i_sf,

           INT16 lag,FLOAT64 pgain,PARAMETER *chan)

    {

    /*---------------------------------------------*/

    INT16  i,IdxPuls[MAXPN],Sign[MAXPN];

    FLOAT64Gp_m;

    /*---------------------------------------------*/

    for(i=0;i<MAXPN;i++)

        IdxPuls[i]=chan->idx_cpcb[i_sf][i];

    for(i=0;i<MAXPN;i++)

        Sign[i]=2*chan->idx_cpcbsign[i_sf][i]-1;

    if(chan->idx_subcpcb[i_sf][0]=1)

        {

        /*---------------------------------------------*/

        /*5pulses CB:3p×4b+2p×3b+3b signs=21bits    */

        /*---------------------------------------------*/

        for(i=1;i<3;i++)

            {

            if(IdxPuls[i]<=IdxPuls[i+2])

                 Sign[i+2]=Sign[i];

            else

                 Sign[i+2]=-Sign[i];

           }

        FCS_Decod_CPCB(0,Sign,1.0,4,5,unfcod,1_sf,IdxPuls);

        }
   else

       {

       if(chan->idx_subcpcb[i_sf][1]=1)

            {

            /*---------------------------------------------*/
				
				<dp n="d342"/>
       /*5pulses CB:3p×4b+2p×3b+3bsigns=21bits  */

       /*---------------------------------------------*/

       FCS_Decod_CPCB(2,Sign,1.0,3,5,unfcod,1_sf,IdxPuls);

       }
   else

       {

       /*---------------------------------------------*/

       /*5pulses CB:5p×3b+5b signs=20bits        */

       /*---------------------------------------------*/

       FCS_Deco_CPCB(1,Sign,1.0,3,5,unfcod,1_sf,IdxPuls);

       }

     }
   /*---------------------------------------------*/
   /*                  Pitch enhancement               */
   /*---------------------------------------------*/
   if((lag<20)&amp;&amp;(pgain>0.5))

        Gp_m=MIN(pgain,1.0)*0.75;
   else

        Gp_m=pgain;
   Gp_m=MIN(Gp_m,PAST_PGAIN_MAX2);
   Gp_m=MAX(PAST_PGAIN_MIN,Gp_m);
   for(i=lag;i<1_sf; i++)

       unfcod[i]=unfcod[i]+Gp_m*unfcod[i-lag];
   /*---------------------------------------------*/
   return;
   /*---------------------------------------------*/
   }
/*---------------------------------------------*/
/*===============================*/
/*FUNCTION       :FCS_cdbk_search_30b_sub40().               */
				
				<dp n="d343"/>
/*---------------------------------------------*/
/*PURPOSE            :This function estimate the optimal fixed       */
/*                   excitation for 8.5kbps mode 1.                 */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                                 */
/*      _(FLOAT64[])ext:    excitation signal.           */
/*      _(FLOAT64[])pdcfq:  quantized prediction coeff    */
/*      _(FLOAT64[])target:target signal.               */
/*      _(FLOAT64[])res:    ″ideal excitation″signal after     */
/*                         LTP contribution.               */
/*      _(FLOAT64 [])hh:    W(z)/A(z)impulse response.     */
/*      _(INT16   )1_sf:  sub-frame size.         */
/*      _(INT16   )1_sf:  sub-frame index.        */
/*      _(INT16   )lag:   pitchlag.           */
/*      _(INT16   )VUV:    frame class.          */
/*      _(FLOAT64  )pgain: quantized pitch gain.       */
/*      _(FLOAT64  )NSR:    noise to signal ratio.       */
/*      _(FLOAT64  )Rp:    pitch preprocessing pitch     */
/*                     correlation.          */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                 */
/*      _(FLOAT64  [])unfcod: unfiltered excitation signal.*/
/*      _(PARAMETER *)chan:   output data structure.        */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                 */
/*      _None.                                           */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                               */
/*      _None.                                */
/*=================================*/
void FCS_cdbk_search_30b_sub40(FLOAT64 ext[],FLOAT64 pdcfq[],FLOAT64 target[],

                            FLOAT64res[],FLOAT64hh[],FLOAT64unfcod[],

                              INT16 1_sf,INT16i_sf,INT16lag,INT16VUV,
                           FLOAT64pgain,FLOAT64NSR,FLOAT64Rp,

                                 PARAMETER*chan)

    {

    /*---------------------------------------------*/

    INT16i;

    INT16IdxPuls[MAXPN],Sign[MAXPN],SignTab[L_SF4];

    FLOAT64 Criter,Gp_m,Gp;
				
				<dp n="d344"/>
FLOAT64hh_v[L_SF4],ref[L_SF4];
/*---------------------------------------------*/
if((lag<20)&amp;&amp;(pgain>0.5))

    Gp=MIN(pgain,1.0)*0.75;
else

    Gp=pgain;
/*---------------------------------------------*/
FCS_Calc_pre_search(hh,hh_v,lag,Gp,&amp;Gp_m,target,ref,SignTab,

                    res,0.5,1,1_sf;
/*---------------------------------------------*/
/*   8pulsesCB:6p×3b+2p×4b+4b signs=30bits    */
/*---------------------------------------------*/
Criter=-1;
FCS_Simp_Search_CPCB(0,0,0,Sign,1.0,4,8,SignTab,ref,&amp;Criter,

                       unfcod,1_sf,IdxPuls);
FCS_Simp_Search_CPCB(1,1,0,Sign,1.0,4,8,SignTab,ref,&amp;Criter,

                       unfcod,1_sf,IdxPuls);
/*---------------------------------------------*/
/*                  Sign check on the same track              */
/*---------------------------------------------*/
for(i=0;i<4;i++)

    {

    if(IdxPuls[i]<=IdxPuls[i+4])

         {

         if(Sign[i]!=Sign[i+4])

            FCS_PulseExchange(IdxPuls+i,Sign+i,IdxPuls+i+4,

                                  Sign+i+4);

         }

         else if(Sign[i]=Sign[i+4])

              FCS_PulseExchange(IdxPuls+i,Sign+i,IdxPuls+i+4,

                                    Sign+i+4);
   }
				
				<dp n="d345"/>
    /*---------------------------------------------*/

    /*                Index of the cdbk                 */

    /*---------------------------------------------*/

    for(i=0;i<MAXPN;i++)

        chan->idx_cpcb[i_sf][i]=IdxPuls[i];

    for(i=0;i<MAXPN;i++)

        chan->idx_cpcbsign[i_sf][i]=(Sign[i]+1)/2;

    chan->idx_subcpcb[i_sf][0]1;

    /*---------------------------------------------*/

    /*                  Harmonic weighting on unfcod             */

    /*---------------------------------------------*/

    for(i=lag;i<1_sf; i++)

        unfcod[i]+=Gp_m* unfcod[i-lag];

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*===============================*/
/*FUNCTION       :FCS_cdbk_decod_30b_sub40().                */
/*---------------------------------------------*/
/*PURPOSE        :This function decode the fixed excitation vector */
/*               for 8.5kbps mode1.                     */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                            */
/*      _(INT16  )1_sf;    sub-frame size.              */
/*      _(INT16  )1_sg;    sub-frame index.             */
/*      _(INT16  )lag:     pitch lag.                 */
/*      _(FLOAT64 )pgain:   decoded pitch gain.         */
/*      _(INT16  )rate_m:  decoded fix bit-rate.       */
/*      _(FLOAT64 )lpcg:    decoded LPC gain.           */
				
				<dp n="d346"/>
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                              */
/*     _(FLOAT64  [])unfcod:  unfiltered excitation signal.  */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                           */
/*     _(PARAMETER  *)chan:  output data structure.    */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                */
/*     _None.                                */
/*===============================*/
void FCS_cdbk_decod_30b_sub40(FLOAT64 unfcod[],INT16l_sf,

                      INT16i_sf, INT16 lag,FLOAT64 pgain,

                          PARAMETER*chan)

    {

    /*---------------------------------------------*/

    INT16i,IdxPuls[MAXPN],Sign[MAXPN];

    FLOAT64Gp_m;

    /*---------------------------------------------*/

    for(i=0;i<MAXPN;i++)

        IdxPuls[i]=chan->idx_cpcb[i_sf][i];

    for(i=0;i<MAXPN;i++)

        Sign[i]=2*chan->idx_cpcbsign[i_sf][i]-1;

    /*---------------------------------------------*/

    /*   8pulsesCB:6p×3b+2p×4b+4b signs=30bits       */

    /*---------------------------------------------*/

    for(i=0;i<4;i++)

        {

        if(IdxPuls[i]<=IdxPuls[i+4])

            Sign[i+4]=Sign[i];

        else

            Sign[i+4]=-Sign[i];

        }

    FCS_Decod_CPCB(0,Sign,1.0,4,8,unfcod,1_sf,IdxPuls);
				
				<dp n="d347"/>
    /*---------------------------------------------*/

    /*                 Pitch enhancement                */

    /*---------------------------------------------*/

    if((lag<20)&amp;&amp;(pgain>0.5))

         Gp_m=MIN(pgain,1.0)*0.75;

    else

         Gp_m=pgain;

    Gp_m=MIN(Gp_m,PAST_PGAIN_MAX);

    Gp_m=MAX(PAST_PGAIN_MIN,Gp_m);

    for(i=lag;i<1_sf;i++)

        unfcod[i]=unfcod[i]+Gp_m* unfcod[i-lag];

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*=================================*/
/*FUNCTION        :FCS_ChangeSign().                        */
/*---------------------------------------------*/
/*PURPOSE         :This function modify the sign of the excitation  */
/*                gain.                               */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                */
/*      _(PARAMETER   *)chan:   output data structure.   */
/*      _(INT16    )i_sf;    sub-frame index.            */
/*      _(INT16    )i_sf;    sub-frame size.             */
/*      _(FLOAT64  [])unfcod:  unfiltered excitation signal.  */
/*      _(FLOAT64  [])fcod:    filtered excitation signal.     */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                            */
/*      _None.                                    */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                            */
/*      _(FLOAT64    *)gain:    unquntized excitation gain.   */
				
				<dp n="d348"/>
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                           */
/*     _None.                               */
/*=================================*/
void FCS_ChangeSign(PARAMETER*chan,INT16 i_sf,INT16 1_sf,

          FLOAT64 unfcod[],FLOAT64 fcod[],FLOAT64*gain)

    {

    /*---------------------------------------------*/

    INT16i;

    /*---------------------------------------------*/

    for(i=0;i<MAXPN;i++)

        chan->idx_cpcbsign[i_sf][i]*=-1;

    for(i=0;i<MAXPN;i++)

        chan->idx_cpcbsign[i_sf][i]+=1;

    for(i=0;i<1_sf;i++)

        unfcod[i]*=-1.0;

    for(i=0;i<l_sf;i++)

        fcod[i]*=-1.0;

    (*gain)=-(*gain);

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/    
/*=================================*/
/*-------------------------END-----------------------*/
/*=================================*/
				
				<dp n="d349"/>
/*===============================*/
/*===============================*/
/*Conexant System Inc.                                             */
/*4311 Jamboree Road                                              */
/*Newport Beach,CA 92660                                       */
/*---------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                          */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                                           */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc.    */
/*==================================*/
/*PROTOTYPE FILE:lib_fcs.h                                */
/*==================================*/
/*---------------------------------------------*/
/*-------------------FUNCTIONS--------------------*/
/*---------------------------------------------*/
void FCS_init_lib             (void);
void FCS_Init_CPCB                (void);
void FCS_Set_CPCB                 (INT16,INT16,INT16,INT16);
void FCS_Init HF_Noise      (FLOAT64[],INT16);
void FCS_DetermPulsLoc      (FLOAT64,INT16,FLOAT64,INT16,FLOAT64[],

                            INT16[],INT16*,INT16);
void FCS_One_Search_CPCB    (INT16,INT16[],FLOAT64[],FLOAT64[],INT16[],

                            INT16[],FLOAT64*,FLOAT64*,FLOAT64*);
void FCS_One_Search_4kCB    (INT16[],INT16,FLOAT64,INT16,INT16,INT16[],

                             FLOAT64[],FLOAT64[],INT16[],INT16[],
				
				<dp n="d350"/>
                                 FLOAT64*,FLOAT64*,FLOAT64*,INT16);
  void FCS_Full_Search_CPCB      (INT16,INT16[],FLOAT64,INT16,INT16,INT16[],

                           FLOAT64[],FLOAT64*,FLOAT64[],

                              INT16,INT16[]);
  void FCS_Simp_Search_CPCB(INT16,INT16,INT16,INT16[],FLOAT64,INT16,

                        INT16,INT16[],FLOAT64[],FLOAT64*,

                            FLOAT64[],INT16,INT16[]);
  void FCS_Simp_Search_4kCB(INT16,INT16,INT16,INT16[],FLOAT64,INT16,INT16,

                 INT16[],FLOAT64[],FLOAT64*,FLOAT64[],

                 INT16,INT16[],INT16,FLOAT64);
  void FCS_Decod_CPCB(INT16,INT16[],FLOAT64,INT16,INT16,FLOAT64[],

                                                       INT16,INT16[]);
  void FCS_Decod_PitCB(INT16,INT16[],FLOAT64,INT16,INT16,FLOAT64[],INT16,

                                                 INT16[],INT16,FLOAT64);
  void FCS_Calc_pre_search(FLOAT64[],FLOAT64[],INT16,FLOAT64,FLOAT64*,

                         FLOAT64[],FLOAT64[],INT16[],FLOAT64[],FLOAT64,

                            INT16,INT16);
  void FCS_cdbk_search_13b_sub54(FLOAT64[],FLOAT64[],FLOAT64[],FLOAT64[],

                                 FLOAT64[],FLOAT64[],INT16,INT16,INT16,

                                    INT16,FLOAT64,FLOAT64,FLOAT64,

                                       INT16,FLOAT64,PARAMETER*);
  void FCS_cdbk_decod_13b_sub54(FLOAT64[],FLOAT64[],FLOAT64[],

                             INT16,INT16,INT16,FLOAT64,INT16,

                                 FLOAT64,PARAMETER*);
  void FCS_cdbk_search_15b_sub80(FLOAT64[],FLOAT64[],FLOAT64[],FLOAT64[],

                         FLOAT64[],FLOAT64[],INT16,INT16,

                            INT16,INT16,FLOAT64,FLOAT64,FLOAT64,
				
				<dp n="d351"/>
                             INT16,FLOAT64,PARAMETER*);
void FCS_cdbk_decod_15b_sub80(FLOAT64[],FLOAT64[],FLOAT64[],

                           INT16,INT16,INT16,FLOAT64,

                              INT16,FLOAT64,PARAMETER*);
void FCS_cdbk_search_22b_sub40(FLOAT64[],FLOAT64[],FLOAT64[],FLOAT64[],

                               FLOAT64[],FLOAT64[],INT16,INT16,

                                  INT16,INT16,FLOAT64,

                                      FLOAT64,FLOAT64,PARAMETER*);
void FCS_cdbk_decod_22b_sub40(FLOAT64[],INT16,INT16,

                                 INT16,FLOAT64,PARAMETER*);
void FCS_cdbk_search_30b_sub40(FLOAT64[],FLOAT64[],FLOAT64[],FLOAT64[],

                               FLOAT64[],FLOAT64[],INT16,INT16,

                                  INT16,INT16,FLOAT64,FLOAT64,FLOAT64,

                                      PARAMETER*);
void FCS_cdbk_deco_30b_sub40(FLOAT64[],INT16,INT16,INT16,

                         FLOAT64,PARAMETER*chan);
void FCS_PulseExchange(INT16*,INT16*,INT16*,INT16*);
void FCS_ChangeSign(PARAMETER*,INT16,INT16,FLOAT64[],FLOAT64[],FLOAT64*);
void FCS_Search_pastcorr(FLOAT64[],FLOAT64[],FLOAT64,INT16,FLOAT64,INT16,

                   INT16,INT16,INT16,FLOAT64[],INT16[],INT16*);
void FCS_ST_parameter(INT16,INT16,INT16,FLOAT64[],INT16,FLOAT64*,

                      FLOAT64[],FLOAT64);
/*================================*/
/*-----------------------END----------------------*/
/*================================*/
				
				<dp n="d352"/>
/*=============================*/
/*=============================*/
/*Conexant System Inc.                                       */
/*4311 Jamboree Road                                     */
/*Newport Beach,CA 92660                                  */
/*---------------------------------------------*/
/*Copyright(C)2000 Conexant System Iac.                         */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                              */
/*No part ofthis software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*================================*/
/*LIBRARY:lib_flt.c                                         */
/*================================*/
/*---------------------------------------------*/
/*-------------------INCLUDE-------------------*/
/*---------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″mcutil.b″
#include″gputil.h″
 #include″lib_flt.h″
/*---------------------------------------------*/
/*-----------------FUNCTIONS-------------------*/
/*---------------------------------------------*/
/*===============================*/
/*FUNCTION       :filterAP().                          */
/*---------------------------------------------*/
/*PURPOSE        :Frame data all poles filtering.               */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                          */
/*                                              */
/*  _(FLOAT64 [])a  :filter coefficients.                     */
/*  _(FLOAT64 [])x  :input signal frame.                     */
/*  _(INT16)     P  :filter order.                          */
				
				<dp n="d353"/>
/*  _(INT16)  N  :number of input samples.             */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                           */
/*---------------------------------------------*/
/*  _(FLOAT64[])y:output signal frame.                */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                           */
/*                                                      */
/*  _(FLOAT64[])buf:input/output memory array.           */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                       */
/*=================================*/
void filterAP(FLOAT64a[],FLOAT64x[],FLOAT64y[],FLOAT64 buf[],

                                                      INT16P,INT16(N)

    {

    /*---------------------------------------------*/

    INT16     i,j;

    /*---------------------------------------------*/

    for(i=0;i<N;i++)

        {

        buf[0]=x[i];

        for(j=P;j>0;j--)

            {

            buf[0]-=(a[j]*buf[j]);

            buf[j]=buf[j-1];

            }

        y[i]=buf[0];

        }

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
				
				<dp n="d354"/>
/*---------------------------------------------*/
/*============================*/
/*FUNCTION       :filterAZ().                          */
/*---------------------------------------------*/
/*PURPOSE        :Frame data all zeros filtering.              */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                            */
/*                                                   */
/*  _(FLOAT64[])b  :filter coefficients.                    */
/*  _(FLOAT64[])x  :input signal frame.                    */
/*  _(INT16)    P  :filter order.                           */
/*  _(INT16)    N  :number of input samples.               */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                               */
/*                                                    */
/*  _(FLOAT64[])y:output signal frame.              */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*                                            */
/* _(FLOAT64[])buf:input/output memory array.       */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                       */
/*==============================*/
void filterAZ(FLOAT64 b[],FLOAT64 x[],FLOAT64y [],FLOAT64 buf[],

                                                INT16P,INT16N)

    {

    /*---------------------------------------------*/

    INT16    i,j;

    /*---------------------------------------------*/

    for(i=0;i<N;i++)

        {

        buf[0]=x[i];

        y  [i]=0.0;

        for(j=P;j>0;j--)

            {

            y  [i]+=buf[j]*b[j];
				
				<dp n="d355"/>
              buf[j]=buf[j-1];

             }

         y[i]+=(buf[0]*b[0]);

        }

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*=============================*/
/*FUNCTION           :filterPZ ().                                   */
/*---------------------------------------------*/
/*PURPOSE            :Frame data all poles-zeros filtering.         */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                            */
/*                                                     */
/*  _(FLOAT64[])b  :numerator filter coefficients.            */
/*  _(FLOAT64[])a  :denominator filter coefficients.         */
/*  _(FLOAT64[])x  :input signal frame.                      */
/*  _(INT16)    P  :filter order.                          */
/*  _(INT16)    N  :number of input samples.               */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                               */
/*                                                   */
/*  _(FLOAT64 []) y:output signal frame.                         */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                             */
/*                                                    */
/*  _(FLOAT64[])buf:input/output memory array.              */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:_None.                             */
/*=============================*/
void filterPZ(FLOAT64b[],FLOAT64a[],FLOAT64x[],FLOAT64y[],\

                                      FLOAT64 buf[],INT16P,INT16N)

    {
				
				<dp n="d356"/>
    /*---------------------------------------------*/

    INT16i,j;

    /*---------------------------------------------*/

    for(i=0;i<N;i++)

        {

        buf[0]=x[i];

        y[i]=0.0;

        for(j=P;j>0;j--)

            {

            y[i]+=(buf[j]*b[j]);

            buf[0]-=(a[j]*buf[j]);

            buf[j]=buf[j-1];

            }

        y[i]+=(buf[0]*b[0]);

       }

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*---------------------------------------------*/
/*==============================*/
/*FUNCTION    :FLT_conv().                      */
/*---------------------------------------------*/
/*PURPOSE     :This function perform a filtering operation      */
/*                                          */
/*      The input array,x,is assumed to include past input values    */
/*     (NCOFS-1 values)for the filter memory,as well as new input  */
/*     values.The array is set up as follows:                   */
/*                                               */
/*            Xin(NCOFS)             Xin(N+NCOFS-1)    */
/*              |       new data         |        */
/*        I-------II--------------------I          */
				
				<dp n="d357"/>
/*         |   old   |                                         */
/*       Xin(1)  Xin(NCOFS-1)                                */
/*                                                             */
/*      The first NCOFS-1 points of array Xin are assumed to be the   */
/*     ″warm-up″points for the first output point,Xout(1).         */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                          */
/*                                            */
/*  _(FLOAT64[])x  :input signal frame.                    */
/*  _(FLOAT64[])a  :denominator filter coefficients.         */
/*  _(INT16)    P  :filter order.                          */
/*  _(INT16)    N :number of input samples to be filtered.   */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                          */
/*  _(FLOAT64[])y :output signal frame.                 */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                          */
/*  _(FLOAT64[])buf:input/output memory array.               */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                             */
/*  _None.                                                */
/*===============================*/
void FLT_conv(FLOAT64x[],FLOAT64a[],INT16P,INT16N,FLOAT64y[])

    {

    /*---------------------------------------------*/

    INT16i,1,k;

    FLOAT64 sum;

    /*---------------------------------------------*/

    for(i=0;i<N;i++)

        {

        sum=0.0;

        1=P+i;

        for(k=0;k<P;k++)

            {

            1-=1;

            sum+=a[k]*x[1];

            }
				
				<dp n="d358"/>
        y[i]=sum;

        }

    /*----------------------------------------------*/

    return;

    /*----------------------------------------------*/

    }
/*--------------------------------------------------*/
/*=================================*/
/*FUNCTION    :FLT_allsyn().                         */
/*---------------------------------------------*/
/*PURPOSE    :This function filter asignal using an all-pole  */
/*           filter                                          */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*                                                          */
/*  _(FLOAT64[])x    :input signal frame.                     */
/*  _(FLOAT64[])a    :denominator filter coefficients.       */
/*  _(INT16)    P    :filter order.                         */
/*  _(INT16)    N    :number of input samples to be filtered.*/
/*----------------------------------------------*/
/*OUTPUT ARGUMENTS:                                          */
/*  _(FLOAT64[])y    :output signal frame.               */
/*----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                     */
/*  _(FLOAT64[])buf:input/output memory array.             */
/*----------------------------------------------*/
/*RETURN ARGUMENTS:                                          */
/*  _None.                                               */
/*==================================*/
void FLT_allsyn(FLOAT64x[],INT16N,FLOAT64a[],INT16P,FLOAT64y[],

                                                          FLOAT64buff[])

    {

    /*--------------------------------------------*/
				
				<dp n="d359"/>
    INT16 i,k;

    FLOAT64 sum;

    /*--------------------------------------------*/

    for(i=0;i<N;i++)

         {

         sum=x[i];

         for(k=P-1;k>=1;k--)

             {

             sum=sum+a[k]*buff[k];

             buff[k]=buff[k-1];

             }

         if(P>0)

             sum=sum+a[0]*buff[0];

         buff[0]=sum;

         y[i]=sum;

         }

    /*------------------------------------------*/

    return:

    /*------------------------------------------*/

    }
/*----------------------------------------------*/
/*==================================*/
/*--------------------END-------------------------*/
/*==================================*/
				
				<dp n="d360"/>
/*===========================================*/
/*======================================*/
/*Conexant System Inc.                                                 */
/*4311 Jamboree Road                                                    */
/*Newport Beach,CA 92660                                                */
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                                 */
/*-----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                      */
/*No part of this software may be reproduced in any form or by any    */
/*means or used to make any derivative work(such as transformation     */
/*oradaptation)without the authorisation of Conexant System Inc.    */
/*=====================================*/
/*PROTOTYPE FILE:lib_flt.h                                        */
/*=====================================*/
/*--------------------------------------------------------------*/
/*------------------------------FUNCTIONS----------------------------*/
/*--------------------------------------------------------------*/
void filterAP(FLOAT64[],FLOAT64[],FLOAT64[],FLOAT64[],INT16,INT16);
void filterAZ(FLOAT64[],FLOAT64[],FLOAT64[],FLOAT64[],INT16,INT16);
void filterPZ(FLOAT64[],FLOAT64[],FLOAT64[],FLOAT64[],FLOAT64[],

                                                            INT16,INT16);
void FLT_conv(FLOAT64[],FLOAT64[],INT16,INT16,FLOAT64[]);
void FLT_allsyn (FLOAT64[],INT16,FLOAT64[],INT16,FLOAT64[],FLOAT64[]);
/*====================================================*/
/*--------------------------------END-----------------------------*/
/*====================================================*/
				
				<dp n="d361"/>
/*============================================*/
/*========================================*/
/*Conexant System Inc.                                         */
/*4311 Jamboree Road                                             */
/*Newport Beach,CA 92660                                          */
/*----------------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                            */
/*----------------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                  */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*===========================================*/
/*LIBRARY:lib_gcb.c                                                 */
/*===========================================*/
/*----------------------------------------------------------------*/
/*--------------------INCLUDE------------------------------------------*/
/*----------------------------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″gputil.h″
#include″mcutil.h″
#include″ext_var.h″
#include″lib_gcb.h″
#include″lib_flt.h″
#include″gauss_bv.tab″
/*--------------------------------------------------------------------------*/
/*-------------------------------------DEFINE------------------------------------*/
/*--------------------------------------------------------------------------*/
#define TABLE_SIZE   32.0
#define INV_TABLE_SIZE 1.0/32.0
				
				<dp n="d362"/>
#define  a  25173
#define c 13849
#define m 65536
#define  UNIF_VAR_NUM   12
#define  GAUSS_VEC_SIZE 40
#define  MAX_VEC_NUM        2
/*--------------------------------------------------------------*/
/*-------------------------------FUNCTIONS----------------------------*/
/*--------------------------------------------------------------*/
/*=========================================*/
/*FUNCTION    :GCB_init_lib().                                     */
/*-----------------------------------------------------*/
/*PURPOSE    :This function initialise the global variable of */
/*           the library GCB.                                   */
/*-----------------------------------------------------*/
/*INPUT ARGUMENTS:                                                 */
/*             _None.                                          */
/*-----------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                  */
/*             _None.                                           */
/*-----------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                             */
/*             _None.                                           */
/*-----------------------------------------------------*/
/*RETURN ARGUMENTS:                                                  */
/*            _None.                                           */
/*=========================================*/
void GCB_init_lib(void)

     {

     /*------------------------------------------------*/

     /*                GCB_decode_gauss_cb_itu4k               */

     /*------------------------------------------------*/

     seed_ekc=21845;

     /*------------------------------------------------*/

     /*GCB_gauss_excit_dec                                   */

     /*------------------------------------------------*/
				
				<dp n="d363"/>
    Z1_gcb=0;

    /*--------------------------------------*/

    /*               GCB_gauss_excit            */

    /*--------------------------------------*/

    ref_eng_gcb=0;

    rate_mem   =RATE8_5K;

    /*-------------------------------------*/

    /*               GCB_gauss_excit_dec                       */

    /*-------------------------------------*/

    seed_dec=0;

    /*-------------------------------------*/

    return;

    /*-------------------------------------*/

    }
/*-----------------------------------------*/
/*=====================================*/
/*FUNCTION    :GCB_decode_gauss_cb_itu4k().                      */
/*-----------------------------------------*/
/*PURPOSE    :This function extract the gaussina vector from  */
/*           the codebook                                    */
/*-----------------------------------------*/
/*INPUT ARGUMENTS:                                                  */
/*        _(INT16)N_gauss;gaussian codebook size.                */
/*        _(INT16)L_vec:gaussian vector size.                   */
/*        _(INT16)index:codebook index.                           */
/*        _(INT16)sign:sign.                                     */
/*-----------------------------------------*/
/*OUTPUT ARGUMENTS:                                                   */
/*        _(FLOAT64[])unfcod:unfiltered excitation                */
/*                          vector.                              */
/*-----------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                             */
				
				<dp n="d364"/>
/*                 _None.                            */
/*---------------------------------------*/
/*RETURN ARGUMENTS:                                        */
/*                 _None.                            */
/*=======================================*/
void GCB_decode_gauss_cb_itu4k(INT16 N_gauss,INT16 L_vec,INT16 index,

                                                 INT16 sign,FLOAT64 unfcod[])

    {

    /*----------------------------------------------*/

    INT16k,delay,table_entry;

    FLOAT64x,*unfcod_p;

    /*----------------------------------------------*/

    if(index>=N_gauss)

         {

         index=(INT16)(N_gauss*GCB_quickuran(&amp;seed_exc));

         x=GCB_quickuran(&amp;seed_exc);

         if(x<0.5)

             sign=1;

         else

             sign=-1;

         }

    /*------------------------------------------*/

    if(index<N_gauss)

         {

         delay=(INT16)(index*INV_TABLE_SIZE);

         table_entry=(INT16)(index-delay*TABLE_SIZE);

         if(sign==1)

              {

              unfcod_p=unfcod-2*delay;

              for(k=delay;k<L_vec;k++)

                  unfcod_p[2*k]=bv[table_entry][k];

              unfcod_p=unfcod+2*(L_vec-delay);

              for(k=0;k<delay;k++)

                  unfcod_p[2*k]=bv[table_entry][k];
				
				<dp n="d365"/>
           }

      else

           {

           unfcod_p=unfcod-2*delay;

           for(k=delay;k<L_vec;k++)

               unfcod_p[2*k]=-bv[table_entry][k];

           unfcod_p=unfcod+2*(L_vec-delay);

           for(k=0;k<delay;k++)

               unfcod_p[2*k]=-bv[table_entry][k];

           }

      }
  else

      {
#ifdef VERBOSE

      printf(″FATAL ERROR:cb index(%d)out of range\n″,index);

      exit(0);
#endif

      }

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*====================================*/
/*FUNCTION    :GCB_gauss_cb_itu4k().                       */
/*---------------------------------------------*/
/*PURPOSE     :This function select the MAX_VEC_NUM gaussian   */
/*            vectors in the codebooks.               */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                           */
/*        _(FLOAT64[])target:target vector.             */
/*        _(FLOAT64[])res:residual vector.               */
/*        _(INT16)i_sf:sub-frame index.                  */
/*        _(INT16)1_sf:sub-frame index size.            */
/*        _(FLOAT64[])hh:impulse response.               */
/*        _(FLOAT64*)Criter:maximazed criterium.          */
/*        _(INT16)N_gauss_1:1st gaussian codebook size.  */
/*        _(INT16)N_gauss_2:2nd gaussian codebook size. */
				
				<dp n="d366"/>
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                         */
/*       _(FLOAT64[])unfcod:unfiltered excitation   */
/*                   vector.                        */
/*       _(INT16[])index:selected codebook indexes.  */
/*       _(INT16[])sign:selected vectors sign.     */
/*---------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                   */
/*       _None.                                    */
/*---------------------------------------*/
/*RETURN ARGUMENTS:                                       */
/*       _None.                                   */
/*=======================================*/
void GCB_gauss_cb_itu4k(FLOAT64target[],FLOAT64res[],

                          FLOAT64hh[],FLOAT64*Criter,

                             FLOAT64 unfcod[],INT16*index,INT16sign [],

                                INT16N_gaus_1,INT16N_gauss_2)

    {

    /*------------------------------------------*/

    INT16  index1_buf[NUM_PRESELECT],sign1_buf[NUM_PRESELECT];

    INT16  index2_buf[NUM_PRESELECT],sign2_buf[NUM_PRESELECT];

    INT16  index_tmp[MAX_VEC_NUM],sign_tmp[MAX_VEC_NUM];

    FLOAT64 match;

    /*------------------------------------------*/

    /*==============Preselection==================*/

    /*------------------------------------------*/

    /*------------------------------------------*/

    /*                 First basis vector              */

    /*------------------------------------------*/

    GCB_asis_preselect_itu4k(res,N_gauss_1,GAUSS_VEC_SIZE,index1_buf,

                                                    sign1_buf,NUM_PRESELECT);

    /*------------------------------------------*/

    /*                 Second basis vector             */

    /*------------------------------------------*/
				
				<dp n="d367"/>
    GCB_basis_preselect_itu4k(res+1,N_gauss_2,GAUSS_VEC_SIZE,index2_buf,

                                                     sign2_buf,NUM_PRESELECT);

    /*-------------------------------------------------*/

    /*=============Fine search=================*/

    /*-------------------------------------------------*/

    match=GCB_fine_search_itu4k(target,hh,index1_buf,sign1_buf,

                                    GAUSS_VEC_SIZE,N_gauss_1,index2_buf,

                                     sign2_buf,GAUSS_VEC_SIZE,

                                      N_gauss_2,NUM_PRESELECT,index_tmp,

                                       sign_tmp);

    /*-------------------------------------------------*/

    /*=============Compare match================*/

    /*-------------------------------------------------*/

    if(match>(*Criter))

         {

         (*Criter)=match;

         index[0]=index_tmp[0];

         index[1]=index_tmp[1];

         sign[0]=sign_tmp[0];

         sign[1]sign_tmp[1];

         GCB_decode_gauss_cb_itu4k(N_gauss_1,GAUSS_VEC_SIZE,

                                       index[0],sign[0],unfcod);

         GCB_decodde_gauss_cb_itu4k(N_gauss_2,GAUSS_VEC_SIZE,

                                  index[1],sign[1],unfcod+1);

         }

    /*-----------------------------------------------*/

    return:

    /*-----------------------------------------------*/

    }
/*-----------------------------------------------*/
/*=======================================*/
/*FUNCTION    :GCB_basis_preselect_itu4k().               */
/*---------------------------------------------*/
				
				<dp n="d368"/>
/*PURPOSE    :This function pre-select the 2 gaussian vectors*/
/*           in the codebooks.                              */
/*------------------------------------------------*/
/*INPUT ARGUMENTS:                                             */
/*        _(FLOAT64[])res:residual vector.               */
/*        _(INT16)N_gauss:gaussian codebook size.          */
/*        _(INT16)L_vec:gaussian vector size.             */
/*        _(INT16)skip_fac:skip factor.                  */
/*        _(INT16)num_preselect:number of pre-selected      */
/*                             candidates.               */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                         */
/*        _(INT16[])index_buf:codebook index buffer.   */
/*        _(INT16[])sign_buf: codebook sign buffer.    */
/*------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*             _None.                                      */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*             _None.                                     */
/*========================================*/
void GCB_basis_preselect_itu4k(FLOAT64res[],INT16N_gauss,INT16L_vec,

                                 INT16 index_buf[],INT16 sign_buf[],

                                     INT16 num_preselect)

    {

    /*--------------------------------------------------*/

    INT16 i,j,k,table_entry,delay,sign;

    FLOAT64     numer[NUM_PRESELECT],tstnum,x,*res_p;

    /*--------------------------------------------*/

    for(i=0;i<num_preselect;i++)

        {

        numer[i]      =-1.0;

        index_buf[i]  =0;

        sign_buf[i]=1;

        }

    /*--------------------------------------------*/

    /*         Preselection of the basis vectors              */
				
				<dp n="d369"/>
/*--------------------------------------------------*/
for(i=0;i<N_gauss;i++)

    {

    delay=(INT16)(i*INV_TABLE_SIZE);

    table_entry=(INT16)(i-delay*TABLE_SIZE);

    /*----------------------------------------------*/

    /*       Correlation between target and codebook vector    */

    /*----------------------------------------------*/

    res_p=res-2*delay;

    for(tstnum=0.0,j=delay;j<L_vec;j++)

         tstnum+=res_p[2*j]*bv[table_entry][j];

    res_p=res+2*(L_vec-delay);

    for(j=0;j<delay;j++)

        tstnum+=res_p[2*j]*bv[table_entry][j];

    /*---------------------------------------------*/

    if(tstnum>=0.0)

          sign=1;

    else

          {

          sign=-1;

          tstnum=-tstnum;

          }
  /*------------------------------------------------*/
  /*        NOTE:see AMR fixed-point code for low complexity    */
  /*   (and bit-exact)approachCorrelation between target and  */
  /*                       codebook vector                     */
  /*------------------------------------------------*/
  if(tstnum>numer[0])

       {

       /*-------------------------------------------*/

       numer[0]=tstnum;

       index_buf[0]=i;
				
				<dp n="d370"/>
            sign_buf[0]=sign;

                for(j=0;j<num_preselect-1;j++)

                    {

                if(numer[j]>numer[j+1])

                    {

                    x=numer[j];

                    numer[j]=numer[j+1];

                    numer[j+1]=x;

                    k=index_buf[j];

                    index_buf[j]=index_buf[j+1];

                    index_buf[j+1]=k;

                    k=sign_buf[j];

                    sign_buf[j]=sign_buf[j+1];

                    sign_buf[j+1]=k;

                    }

                }

            /*----------------------------------------------*/

            }

        }

    /*------------------------------------------------------*/

    return:

    /*------------------------------------------------------*/

    }
/*----------------------------------------------------------*/
/*========================================*/
/*FUNCTION    :GCB_fine_search_itu4k().                         */
/*------------------------------------------------------*/
/*PURPOSE     :This function pre-select the 2 gaussian vectors*/
/*            in the codebooks.                              */
/*------------------------------------------------------*/
/*INPUT ARGUMENTS  :                                              */
/*        _(FLOAT64[])target:    taget vector.                */
/*        _(FLOAT64[])hh:        impulse response.              */
/*        _(INT16[])index1:    1st codebook vector             */
/*                             indexes.                        */
/*        _(INT16[])sign1:    1st codebook vector signs.       */
				
				<dp n="d371"/>
/*       _(INT16)11:          1st gaussian vector size.*/
/*       _(INT16)N1:           1st gaussian codebook      */
/*                            size.                     */
/*       _(INT16[])index2:    2nd codebook vector         */
/*                            indexes.                   */
/*       _(INT16[])sign2:     2nd codebook vector signs. */
/*       _(INT16)12:           2nd gaussian vector size.*/
/*       _(INT16)N2:             2nd gaussian codebook     */
/*                              size.                    */
/*       _(INT16)num_preselect:number of pre-selected      */
/*                              vectors.                 */
/*----------------------------------------------*/
/*OUTPUT ARGUMENTS:                                          */
/*       _(INT16[])index_tmp:selected codebook vector   */
/*                          indexes.                    */
/*       _(INT16[])sign_tmp:selected codebook vector     */
/*                          signs.                      */
/*----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*              _None.                                  */
/*----------------------------------------------*/
/*RETURN ARGUMENTS:                                          */
/*       _(FLOAT64)tmax:           maximized criterion.  */
/*====================================*/
FLOAT64GCB_fine_search_itu4k(FLOAT64 target[],FLOAT64 hh[],

              INT16*index1,INT16*sign1,INT16 11,INT16 N1,

              INT16*index2,INT16*sign2,INT16 12,INT16 N2,

              INT16 num_preselect,INT16*index_tmp,

              INT16*sign_tmp)

    {

    /*-------------------------------------------*/

    INT16 i1,i2,l_sf;

    FLOAT64 unfcod_tmp[L_SF],fcod_tmp[L_SF],tstden,tstnum,x,tmax;

    FLOAT64     *buf;

    /*-------------------------------------------*/

    l_sf=11+12;
				
				<dp n="d372"/>
/*---------------------------------------------*/
buf=dvector(0,l_sf-1);
/*---------------------------------------------*/
tmax=-1.0;
for(i1=0;i1<num_preselect;i1++)

     {

     GCB_decode_gauss_cb_itu4k(N1,11,index1[i1],sign1[i1],

                                                                   unfcod_tmp);

     for(i2=0;i2<num_preselect;i2++)

          {

          GCB_decode_gauss_cb_itu4k(N2,12,index2[i2],sign2[i2],

                                                               unfcod_tmp+1);

          /*----------------------------------------*/

          /*       Compute the filtered random vector          */

          /*----------------------------------------*/

          ini_dvector(buf,0,l_sf-1,0.0);

          filterAZ(hh,unfcod_tmp,fcod_tmp,buf,(INT16)(l_sf-1),

                                                                      l_sf);

          /*----------------------------------------*/

          /*               Compute the error                        */

          /*----------------------------------------*/

          dot_dvector(target,fcod_tmp,&amp;tstnum,0,l_sf-1);

          dot_dvector(fcod_tmp,fcod_tmp,&amp;tstden,0,l_sf-1);

          tstden+=EPSI;

          x=tstnum*tstnum/tstden;

          /*----------------------------------------*/

          /*          Maximisation of the criterium          */

          /*----------------------------------------*/

          if(x>tmax)

              {
				
				<dp n="d373"/>
                tmax=x;

                index_tmp[0]=index1[i1];

                index_tmp[1]=index2[i2];

                sign_tmp[0]=sign1[i1];

                sign_tmp[1]=sign2[i2];

               }

            /*--------------------------------------------*/

            }

        /*--------------------------------------------*/

        }

    /*-------------------------------------------------*/

    free_dvector(buf,0,l_sf-1);

    /*-------------------------------------------------*/

    return tmax;

    /*-------------------------------------------------*/

    }
/*-----------------------------------------------------*/
/*=======================================*/
/*FUNCTION    :GCB_quickuran().                                  */
/*--------------------------------------------------*/
/*PURPOSE     :This function generate Gaussian random values    */
/*            with mean zero and the variance is 1.           */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS  :                                             */
/*             _None.                                         */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
/*             _None.                                        */
/*--------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                           */
/*        _(INT64*)seed:              random generetor seed.*/
/*--------------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
				
				<dp n="d374"/>
/*        _(INT64*)val:      random gaussian value.        */
/*========================================*/
FLOAT64 GCB_quickuran(INT64*seed)

    {

    /*-------------------------------------------------*/

    FLOAT64 val:

    /*-------------------------------------------------*/

       *seed=(a*(*seed)+c)%m;

       val=(FLOAT64)(*seed)/(FLOAT64)m;

    /*-------------------------------------------------*/

       return val;

    /*-------------------------------------------------*/

    }
/*-----------------------------------------------------*/
/*===========================================*/
/*FUNCTION    :GCB_gauss_noise().                                */
/*-----------------------------------------------------*/
/*PURPOSE     :This function generate Gaussian random values   */
/*            with mean zero and variance 1.                */
/*-----------------------------------------------------*/
/*INPUT ARGUMENTS  :                                                 */
/*            _None.                                        */
/*-----------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                  */
/*            _None.                                           */
/*-----------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                              */
/*        _(INT64 *)seed:                 random generetor seed. */
/*-----------------------------------------------------*/
/*RETURN ARGUMENTS:                                                   */
/*        _(INT64 *)val:                  random gaussian value. */
/*===========================================*/
				
				<dp n="d375"/>
FLOAT64 GCB_gauss_noise(INT64*seed)

    {

    /*-------------------------------------------*/

    INT16   i;

    FLOAT64     sum,val;

    /*-------------------------------------------*/

    sum=0.0;

    for(i=0;i<UNIF_VAR_NUM;i++)

        sum+=GCB_quickuran(seed);

    /*-------------------------------------------*/

    val=sum-(FLOAT64)UNIF_VAR_NUM/2.0;

    /*-------------------------------------------*/

    return val;

    /*-------------------------------------------*/

    }
/*-----------------------------------------------*/
/*=======================================*/
/*FUNCTION      :GCB_gauss_excit_dec().                              */
/*----------------------------------------------------*/
/*PURPOSE       :This function generate Gaussian noise for the    */
/*              decoder at very low bit-rate coding.          */
/*----------------------------------------------------*/
/*INPUT ARGUMENTS:                                                  */
/*        _(INT16)rate:fixed bit-rate.                       */
/*----------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                   */
/*        _(FLOAT64[])ext:gaussian excitation signal.      */
/*----------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                               */
/*        _(INT64 *)seed:random generetor seed.              */
/*----------------------------------------------------*/
				
				<dp n="d376"/>
/*RETURN ARGUMENTS:                                              */
/*            _None.                                       */
/*=======================================*/
void GCB_gauss_excit_dec(INT64*seed,INT16 rate,FLOAT64 ext[])

     {

     /*-----------------------------------------------*/

     INT16i;

     FLOAT64 C;

     /*-----------------------------------------------*/

     C=0.0:

     for(i=0;i<L_FRM;i++)

         {

         ext[i]=GCB_gauss_noise(seed)+C*Z1_gcb;

         Z1_gcb=ext[i];

         }

     /*------------------------------------------------*/

     return;

     /*------------------------------------------------*/

     }
/*-----------------------------------------------------*/
/*=======================================*/
/*FUNCTION    :GCB_gauss_excit().                                */
/*------------------------------------------------*/
/*PURPOSE     :This function generate Gaussian noise for the  */
/*            encoder at very low bit-rate coding.          */
/*------------------------------------------------*/
/*INPUT ARGUMENTS  :                                             */
/*       _(INT16)rate:fixed bit-rate.                      */
/*       _(INT16)rate_m:past fixed bit-rate.               */
/*       _(FLOAT64)NSR:estimated noise to signal ratio.        */
/*       _(FLOAT64[])ResEng:estimated residual energy.        */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                   */
				
				<dp n="d377"/>
/*        _(FLOAT64[])ext:    gaussian excitation signal.*/
/*        _(FLOAT64[])gc :    gain scaling factor.        */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                           */
/*        _(INT64*)seed:   random generetor seed.         */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                             */
/*           _None.                                   */
/*=======================================*/
void GCB_gauss_excit(INT64*seed,INT16 rate,INT16 rate_m,FLOAT64 NSR,

                 FLOAT64 ResEng[],FLOAT64 ext[],FLOAT64 gc[])

     {

     /*-----------------------------------------*/

     FLOAT64 x:

     /*-----------------------------------------*/

     GCB_gauss_excit_dec(seed,rate,ext);

     if(rate==RATE2_0K)

          {

          re_eng_gcb=ResEng[0];

          dot_dvector(ext,ext,&amp;x,0,L_FRM/2-1);

          gc[0]=0.7*sqrt(MAX(ref_eng_gcb-80*4,0)/MAX(x,0.0001));

          ref_eng_gcb=ResEng[1];

          dot_dvector(ext+L_FRM/2,ext+L_FRM/2,&amp;x,0,L_FRM/2-1);

          gc[2]=0.7*sqrt(MAX(ref_eng_gcb-80*4,0)/MAX(x,0.0001));

          }

    else

          {

          if((rate_mem!=RATE0_8K)‖(rate_m!=RATE0_8K))

               ref_eng_gcb=ResEng[0]+ResEng[1];

          else

               ref_eng_gcb=0.5*ref_eng_gcb+0.5*(ResEng[0]+ResEng[1]);
				
				<dp n="d378"/>
        dot_dvector(ext,ext,&amp;x,0,L_FRM-1);

        gc[0]=0.7*sqrt(MAX(ref_eng_gcb-160*6,0)/MAX(x,0.0001));

        }

    /*---------------------------------------------*/

    /*                      Memory Up-date                    */

    /*---------------------------------------------*/

    rate_mem=rate_m;

    /*---------------------------------------------*/

    return:

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*=======================================*/
/*------------------------END-----------------------*/
/*=======================================*/
				
				<dp n="d379"/>
/*=======================================*/
/*==================================*/
/*Conexant System Inc.                                   */
/*4311 Jamboree Road                                       */
/*Newport Beach,CA 92660                                   */
/*----------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                    */
/*----------------------------------------------*/
/*ALL RIGHTS RESERVED:                                               */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*=======================================*/
/*PROTOTYPE FILE:lib_gcb.h                                             */
/*=======================================*/
/*-------------------------------------------------------*/
/*-------------------------FUNCTIONS---------------------------*/
/*-------------------------------------------------------*/
void GCB_init_lib             (void);
void GCB_decode_gauss_cb_itu4k(INT16,INT16,INT16,INT16,FLOAT64[]);
void GCB_gauss_cb_itu4k              (FLOAT64[],FLOAT64[],FLOAT64[],

                                     FLOAT64*,FLOAT64[],INT16*,

                                        INT16[],INT16,INT16);
void GCB_basis_preselect_itu4k  (FLOAT64[],INT16,INT16,INT16[],

                                    INT16[],INT16);
FLOAT64GCB_fine_search_itu4k    (FLOAT64[],FLOAT64[],

                                INT16*,INT16*,INT16,INT16,INT16*,

                                    INT16*,INT16,INT16,INT16,

                                          INT16*,INT16*);
FLOAT64GCB quickuran                  (INT64*);
				
				<dp n="d380"/>
FLOAT64GCB_gauss_noise               (INT64*);
void GCB_gauss_excit_dec    (INT64*,INT16,FLOAT64[]);
void GCB_gauss_excit        (INT64*,INT16,INT16,FLOAT64,FLOAT64[],

                            FLOAT64[],FLOAT64[]);
/*=======================================*/
/*---------------------END--------------------*/
/*=======================================*/
				
				<dp n="d381"/>
/*===================================================*/
/*============================================*/
/*Conexant System Inc.                                                */
/*4311 Jamboree Road                                                   */
/*Newport Beach,CA 92660                                               */
/*------------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                                 */
/*------------------------------------------------------*/
/*ALL RIGHTS RESER VED:                                                   */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation*/
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*============================================*/
/*LIBRARY:lib_geq.c                                               */
/*============================================*/
/*--------------------------------------------------------*/
/*---------------------------INCLUDE----------------------------*/
/*--------------------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″gputil.h″
#include″ext_var.h″
#include″lib_geq.h″
/*--------------------------------------------------------*/
/*--------------------------FUNCTIONS--------------------------*/
/*--------------------------------------------------------*/
/*============================================*/
/*FUNCTION  :GEQ_init_lib().                                      */
/*--------------------------------------------------------*/
/*PURPOSE   :This function initilise the global variables of  */
/*          the GEQ library.                                   */
/*--------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                   */
				
				<dp n="d382"/>
/*                  _None.                                 */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
/*                  _None.                                 */
/*--------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                         */
/*                  _None.                                 */
/*--------------------------------------------------*/
/*RETURN ARGUMENTS:                                             */
/*                  _None.                                 */
/*==============================================*/
void GEQ_init_lib(void)

     {

     /*------------------------------------------------*/

         INT16 i,j;

     /*------------------------------------------------*/

     ini_dvector(past_energyq_2d,0,GVQ_VEC_SIZE_2D-1,-20.0);

     ini_dvector(past_energyq_3d,0,GVQ_VEC_SIZE_3D-1,-20.0);

     ini_dvector(past_energyq_4d,0,GVQ_VEC_SIZE_4D-1,-20.0);

     ini_dvector(gp_buf,0,GP_BUF_SIZE-1,0.0);

     past_fixed_energy   =0.0;

     pgain_past                =PAST_PGAIN_MIN;

     pgain_past_dec            =PAST_PGAIN_MIN;

     ini_dvector(Prev_Beta_Pitch,0,BETA_BUF_SIZE-1,0.0);

     GainNormDeci=0;

     GainModiDeci=0;

     /*------------------------------------------------*/

     energy_pred_coeff_1[0]=0.6;

     energy_pred_coeff_1[1]=0.3;

     energy_pred_coeff_1[2]=0.1;

     energy_pred_coeff_2[0]=0.40;
				
				<dp n="d383"/>
energy_pred_coeff_2[1]=0.25;
energy_pred_coeff_2[2]=0.10;
energy_pred_coeff_3[0]=0.300;
energy_pred_coeff_3[1]=0.150;
energy_pred_coeff_3[2]=0.075;
energy_pred_coeff4d_1[0]=0.7;
energy_pred_coeff4d_1[1]=0.6;
energy_pred_coeff4d_1[2]=0.4;
energy_pred_coeff4d_1[3]=0.2;
energy_pred_coeff4d_2[0]=0.40;
energy_pred_coeff4d_2[1]=0.20;
energy_pred_coeff4d_2[2]=0.10;
energy_pred_coeff4d_2[3]=0.05;
energy_pred_coeff4d_3[0]=0.300;
energy_pred_coeff4d_3[1]=0.20;
energy_pred_coeff4d_3[2]=0.075;
energy_pred_coeff4d_3[3]=0.025;
energy_pred_coeff4d_4[0]=0.20;
energy_pred_coeff4d_4[1]=0.075;
energy_pred_coeff4d_4[2]=0.025;
energy_pred_coeff4d_4[3]=0.0;
/*-------------------------------------------------------*/
  /*                                      VQ Tables                        */
/*-------------------------------------------------------*/
for(i=0;i<MSMAX_2_128;i++)

    for(j=0;j<GVQ_VEC_SIZE_2D;j++)

         {

              gain_cb_2_128[i][j]=gainVQ_2_128[i][j];

              gain_cb_2_128_8_5[i][j]=gainVQ_2_128_8_5[i][j];

         }
/*-------------------------------------------------------*/
return;
				
				<dp n="d384"/>
    /*-----------------------------------------------*/

    }
/*---------------------------------------------------*/
/*========================================*/
/*FUNCTION    :GEQ_gainVQMA_2().                                */
/*-----------------------------------------------*/
/*PURPOSE    :This function performs 2-D VQ of Gp and Gc with  */
/*           7 bits.                                    */
/*-----------------------------------------------*/
/*INPUT ARGUMENTS:                                                 */
/*      _(FLOAT64[])        Tgs:  target signal.              */
/*      _(FLOAT64[])        unfcod:adaptive and fixed codebook  */
/*                               excitation.                 */
/*      _(FLOAT64[])        fcod:filtered adaptive and fixed  */
/*                               codebook excitation.         */
/*      _(INT16)          l_sf: length of subframe.         */
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
/*      _(FLOAT64[])      gainQ:Quantized adaptive and    */
/*                            fixed codebook gains.     */
/*      _(INT16 *)        idx:codebook index.            */
/*-----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*                  _None.                               */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS:                                               */
/*                  _None.                              */
/*========================================*/
void GEQ_gainVQMA_2(FLOAT64 Tgs[],FLOAT64**unfcod,FLOAT64**fcod,

             FLOAT64 gainQ[],INT16*idx,INT16 l_sf,INT16 rate)

     {

     /*-----------------------------------------------*/

     FLOAT64 energy,pred_gain,dist,dist_min,g_pitch,g_cdbk,

        corr[CORR_SIZE];

    INT16  i;

    INT16 num_candidate;

    FLOAT64 Renergy;

    FLOAT64 unq_Renergy;
				
				<dp n="d385"/>
FLOAT64 pred_energy,err_energy;

    FLOAT64**ptr;
/*--------------------------------------------------*/
/*============Compute the predicted cdbk gain============*/
/*--------------------------------------------------*/
/*--------------------------------------------------*/
/*Note:compute the cdbk energy with mean removed(i.e.,-30dB)*/
/*--------------------------------------------------*/
if(rate==RATE4_OK)

     {

     dot_dvector(past_energyq_2d,energy_pred_coeff_1,

                        &amp;pred_energy,0,GVQ_VEC_SIZE_2D-1);

     ptr=gain_cb_2_128;

     }
  else

     {

     dot_dvector(past_energyq_4d,energy_pred_coeff4d_1,

                        &amp;pred_energy,0,GVQ_VEC_SIZE_4D-1);

     ptr=gain_cb_2_128_8_5;

     }
pred_energy=MAX(pred_energy,-20.0);
dot_dvector(unfcod[1],unfcod[1],&amp;energy,0,l_sf-1);
Renergy=energy;
energy=30.0-10.0*log10(energy/(FLOAT64)l_sf+EPSI);
/*--------------------------------------------------*/
/*                  Compute the predicted energy             */
/*--------------------------------------------------*/
energy+=pred_energy;
/*--------------------------------------------------*/
/*                  compute the predicted gain               */
/*--------------------------------------------------*/
pred_gain=pow(10.0,energy/20.0);
				
				<dp n="d386"/>
err_energy=-energy+20*log10(fabs(gainQ[1])+EPSI);
err_energy=pow(10.0,err_energy/20.0);
unq_Renergy=10.*log10(sqr(gainQ[1])*Renergy+EPSI);
/*------------------------------------------------*/
/*==============Optimal gainVQ search=============*/
/*------------------------------------------------*/
dist_min=MAXFLT;
num_candidate=128;
dot_dvector(fcod[0],fcod[0],&amp;corr[0],0,l_sf-1);
dot_dvector(fcod[0],Tgs,&amp;corr[1],0,l_sf-1);
corr[1]*=-2.0;
dot_dvector(fcod[1],fcod[1],&amp;corr[2],0,l_sf-1);
dot_dvector(fcod[1],Tgs,&amp;corr[3],0,l_sf-1);
corr[3]*=-2.0;
dot_dvector(fcod[0],fcod[1],&amp;corr[4],0,l_sf-1);
corr[4]*=2.0;
for(i=0;i<num_candidate;i++)

    {

    g_pitch=ptr[i][0];

    g_cdbk=pred_gain*ptr[i][1];

    dist=sqr(g_pitch)*corr[0]+g_pitch*corr[1]+

                   sqr(g_cdbk)*corr[2]+g_cdbk*corr[3]+

                       g_pitch*g_cdbk*corr[4];

    if(dist<dist_min)

         {

         dist_min=dist;

         (*idx)=i;

         }

    }
/*------------------------------------------------*/
/*                  get the quantized gains                */
				
				<dp n="d387"/>
    /*------------------------------------------------*/

        gainQ[0]=ptr[*idx][0];

        gainQ[1]=pred_gain*ptr[*idx][1];

    /*------------------------------------------------*/

    /*         update past quantized energies               */

    /*------------------------------------------------*/

    if(rate==RATE4_0K)

         {

         for(i=GVQ_VEC_SIZE_2D-1;i>0;i--)

             past_energyq_2d[i]=past_energyq_2d[i-1];

         past_energyq_2d[0]=20.0*log10(gainVQ_2_128[*idx][1]);

         }

    else

         {

         for(i=GVQ_VEC_SIZE_4D-1;i>0;i--)

             past_energyq_4d[i]=past_energyq_4d[i-1];

         pa_energyq_4d[0]=20.0*log10(gainVQ_2_128_8_5[*idx][1]);

         }

    /*------------------------------------------------*/

    return;

    /*------------------------------------------------*/

    }
/*----------------------------------------------------*/
/*====================================*/
/*FUNCTION    :GEQ_dec_gains_2_7().                            */
/*----------------------------------------------------*/
/*PURPOSE     :This function decodes the 7 bit 2-D VQ of Gp   */
/*            and Gc.                                       */
/*----------------------------------------------------*/
/*INPUT ARGUMENTS  :                                            */
/*       _(INT16)         Lag:       current pitch lag.    */
				
				<dp n="d388"/>
/*        _(INT16)        index:        codebook index.           */
/*        _(INT16)        N_bfi:        duration of bad frame    */
/*                                      seq.(0=good frame)      */
/*        _(FLOAT64[])     unfcod:       adaptive and fixed         */
/*                                    codebook excitation.       */
/*        _(INT16)      i_sf:        subframe number.            */
/*        _(INT16)      i_sf          length of subframe.      */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                 */
/*      _(FLOAT64[])    gainQ:         Quantized adaptive and    */
/*                                   fixed codebook gains.      */
/*--------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*                  _None.                                     */
/*--------------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
/*                  _None.                                   */
/*=========================================*/
void GEQ_dec_gains_2_7(INT16 rate,INT16 Lag,INT16 index,FLOAT64 gainQ[],

           INT16N_bfi,FLOAT64 unfcod[],INT16 i_sf,INT16 l_sf)

     {

     /*----------------------------------------------*/

    INT16 i,num_count;

    FLOAT64 current_fixed_energy;

    FLOAT64 energy,pred_gain;

    FLOAT64 pdown,cdown;

    FLOAT64 val;

    FLOAT64 min_erg_27;

    /*----------------------------------------------*/

    /*      Compute the cdbk energy with mean removed(i.e.,-30dB)*/

    /*----------------------------------------------*/

    dot_dvector(unfcod,unfcod,&amp;energy,0,l_sf-1);

    current_fixed_energy=energy;

    energy/=(FLOAT64)l_sf;

    energy=30.0-10.0*log10(energy+EPSI);
				
				<dp n="d389"/>
/*--------------------------------------------------*/
/*                  Compute the predicted energy              */
/*--------------------------------------------------*/

    if(rate==RATE4_0K)

    dot_dvector(past_energyq_2d,energy_pred_coeff_1,&amp;val,0,

          GVQ_VEC_SIZE_2D-1);

    else

       dot_dvector(past_energyq_4d,energy_pred_coeff4d_1,&amp;val,0,

              GVQ_VEC_SIZE_4D-1);
val=MAX(val,-20.0);
energy+=val;
/*--------------------------------------------------*/
/*                     Compute the predicted gain              */
/*--------------------------------------------------*/
pred_gain=pow(10.0,(energy/20.0));
if(N_bfi==0)

    {

    /*----------------------------------------------*/

    /*===============good frame===============*/

    /*----------------------------------------------*/

    if(rate==RATE4_OK)

         {

         gainQ[0]=gainVQ_2_128[index][0];

         gainQ[1]=pred_gain*gainVQ_2_128[index][1];

    /*----------------------------------------------*/

    /*               update past quantized energies         */

    /*----------------------------------------------*/

    for(i=GVQ_VEC_SIZE_2D-1;i>0;i--)

        past_energyq_2d[i]=past_energyq_2d[i-1];

    past_energyq_2d[0]=20.0*log10(gainVQ_2_128[index][1]);

    }
				
				<dp n="d390"/>
    else

          {

          gainQ[0]=gainVQ_2_128_8_5[index][0];

          gainQ[1]=pred_gain*gainVQ_2_128_8_5[index][1];

          for(i=GVQ_VEC_SIZE_4D-1;i>0;i--)

              past_energyq_4d[i]=past_energyq_4d[i-1];

          past_energyq_4d[0]=20.0*log10(gainVQ_2_128_8_5[index][1]);

          }

    }
else

    {

    /*=======================================*/

    /*---------------------------------------------*/

    /*================bad frame================*/

    /*---------------------------------------------*/

    /*---------------------------------------------*/

    /*    set down-scaling according to number of bad frames   */

    /*---------------------------------------------*/

    switch(N_bfi)

         {

         case 1:

                  pdown=0.95;

                  cdown=0.75;

                  break;

         case 2:

                  pdown=0.95;

                  cdown=0.75:

                  break;

         case 3:

                  pdown=0.90;

                  cdown=0.75;

                  break;

         case 4:

                  pdown=0.90;

                  cdown=0.40;

                  break;

         case 5:
				
				<dp n="d391"/>
              pdown=0.90;

              cdown=0.30;

              break;

    case 6:

              pdown=0.90;

              cdown=0.20;

              break;

    default:

              pdown=0.70;

              cdown=0.20;

              break;

    }
/*-----------------------------------------------*/
/*===============pitch gain===============*/
/*-----------------------------------------------*/
if(N_bfi==1)

    {

    if(i_sf==0)

        {

        if(Lag<=40)

            gp_mean=0.5*(gp_buf[6]+gp_buf[7]);

        else if(Lag<=80)

            {

            gp_mean=0.0;

            num_count=0;

            for(i=4;i<8;i++)

                {

                if(gp_buf[i]>=0.5)

                    {

                    gp_mean+=gp_buf[i];

                    num_count++;

                    }

                }

            if(num_count>0)

                gp_mean/=(FLOAT64)num_count;

            else

                gp_mean=MAX(MAX(gp_buf[6],gp_buf[7]),

                                      gp_buf[5]);

            }
				
				<dp n="d392"/>
                 else if(Lag <=120)

                     {

                     gp_mean =0.0;

                     num_count =0;

                     for (i=2;i <8;i++)

                         {

                         if(gp_buf[i]>=0.5)

                             {

                             gp_mean+=gp_buf[i];

                             num_count++;

                             }

                         }

                     if(num_count>0)

                         gp_mean/=(FLOAT64)num_count;

                     else

                         gp_mean=MAX(MAX(MAX(gp_buf[6],gp_buf[7]),

                                       gp_buf[5]),gp_buf[4]);

                     }

                 else

                     {

                     gp_mean=0.0;

                     num_count=0;

                     for(i=0;i<8;i++)

                          {

                          if(gp_buf[i]>=0.5)

                              {

                              gp_mean+=gp_buf[i];

                              num_count++;

                              }

                          }

                     if(num_count>0)

                          gp_mean/=(FLOAT64)num_count;

                     else

                          gp_mean=MAX(MAX(MAX(MAX(gp_buf[6],gp_buf[7]),

                                     gp_buf[5]),gp_buf[4]),gp_buf[3]);

                     }
#ifdefALGO_BUG_FIX

               if(rate==RATE4_OK)

                     {

                     if(MAX(Prev_Beta_Pitch[0],Prev_Beta_Pitch[1])>0.70)
				
				<dp n="d393"/>
                     gainQ[0]=0.95;

                else

                     gainQ[0]=MIN(0.95,gp_mean);

                }

            else

                {

                if(MAX(Prev_Beta_Pitch[0],MAX(Prev_Beta_Pitch[1],

                       MAX(Prev_Beta_Pitch[2],

                          Prev_Beta_Pitch[3])))>0.70)

                              gainQ[0]=0.95;

                else

                     gainQ[0]=MIN(0.95,gp_mean);

                }
#else

            if(MAX(Prev_Beta_Pitch[0],Prev_Beta_Pitch[1])>0.70)

               {

               gainQ[0]=0.95;

               cdown=0.0:

               }

            else

               gainQ[0]=MIN(0.95,gp_mean);
#endif

            }

        else

               gainQ[0]=gp_fec;

        }

    else

        {

        gainQ[0]=gp_fec;

        gainQ[0]*=pdown;

        }

    gp_fec=gainQ[0];

    gainQ[1]=sqrt(past_fixed_energy/current_fixed_energy);

    gainQ[1]*=cdown;

    /*----------------------------------------------*/

    /*              update past quantized energies            */

    /*----------------------------------------------*/

    if(rate==RATE4_OK)
				
				<dp n="d394"/>
            {

            min_erg_27=MIN(past_energyq_2d[0],past_energyq_2d[1]);

            for(i=GVQ_VEC_SIZE_2D-1;i>0;i--)

                past_energyq_2d[i]=past_energyq_2d[i-1];

            past_energyq_2d[0]=MIN(min_erg_27,-energy+

                      20*log10(fabs(0.6*gainQ[1])+EPSI));

            }

        else

            {

            min_erg_27=MIN(past_energyq_4d[0],past_energyq_4d[1]);

            min_erg_27=MIN(min_erg_27,past_energyq_4d[2]);

            min_erg_27=MIN(min_erg_27,past_energyq_4d[3]);

            for(i=GVQ_VEC_SIZE_4D-1;i>0;i--)

                past_energyq_4d[i]=past_energyq_4d[i-1];

            past_energyq_4d[0]=MIN(min_erg_27,-energy+

                         20*log10(fabs(0.6*gainQ[1])+EPSI));

            }

        /*======================================*/

        }

    /*-----------------------------------------------*/

    /*           Update the past fixed codebook energy          */

    /*-----------------------------------------------*/

    past_fixed_energy=current_fixed_energy*sqr(gainQ[1]);

    /*-----------------------------------------------*/

    return;

    /*-----------------------------------------------*/

    }
/*-----------------------------------------------*/
/*-----------------------------------------------*/
				
				<dp n="d395"/>
/*=====================================*/
/*FUNCTION  :GEQ_Quant_PitchGain_3D().                         */
/*--------------------------------------------------*/
/*PURPOSE   :This function performs 3-D VQ of Ga1,Ga2,and  */
/*     Ga3 with 4 bits.                             */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS:                                            */
/*                _None.                                 */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*      _(INT16)        idx:codebook index.                 */
/*--------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*      _(FLOAT64[])   Gp:unquantized/quantized pitch        */
/*                     gains.                            */
/*--------------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*                _None.                                  */
/*=====================================*/
void GEQ_Quant_PitchGain_3D(FLOAT64*Gp,INT16*idx)

    {

    /*----------------------------------------------*/

    INT16 i;

    FLOAT64 min_dist;

    FLOAT64 dist;

    FLOAT64 err[GVQ_VEC_SIZE_3D];

    /*----------------------------------------------*/

    min_dist=MAXFLT;

    for(i=0;i<TAB_SIZE_GVQ_3D;i++)

        {

        dif_dvector(Gp,   gp3_tab[i],err,0,GVQ_VEC_SIZE_3D-1);

        dot_dvector(err,  err,&amp;dist,0.GVQ_VEC_SIZE_3D-1);

        if(dist<min_dist)

             {

             min_dist=dist;
				
				<dp n="d396"/>
            (*idx)        =i;

            }

        }

    for(i=0;i<GVQ_VEC_SIZE_3D;i++)

        Gp[i]=gp3_tab[(*idx)][i];

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*======================================*/
/*FUNCTION    :Dec_PitchGain_3D().                                */
/*-------------------------------------------------*/
/*PURPOSE     :This function decodes the 4 bit 3-D VQ of Ga1, */
/*            Ga2,andGa3.                                  */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*       _(INT16)       N_bfi:       duration of bad frame    */
/*                                  seq.(0=good frame)       */
/*       _(INT16)       i_sf:      subframe number.           */
/*       _(INT16)       index:     codebook index.             */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                */
/*       _(FLOAT64[])   gainQ:     Quantized adaptive          */
/*                               codebook gains.             */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS  :                                            */
/*                 _None.                                   */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                            */
/*                 _None.                                   */
/*=======================================*/
void GEQ_Dec_PitchGain_3D(INT16 N_bfi,INT16 i_sf,INT16 index,FLOAT64*gainQ)

       {

       /*------------------------------------------*/
				
				<dp n="d397"/>
FLOAT64 pdown;
/*----------------------------------------------*/
if(N_bfi==0)

      {

      /*----------------------------------------*/

      /*=============good frame==============*/

      /*----------------------------------------*/

      gainQ[0]=gp3_tab[index][i_sf];

      }
else

     {

     /*=======================================*/

     /*-----------------------------------------*/

     /*==============bad frame==============*/

     /*-----------------------------------------*/

     /*-----------------------------------------*/

     /*      set down-scaling according to number of bad frames  */

     /*-----------------------------------------*/

     switch(N_bfi)

            {

           case 1:

                     pdown=0.99;

                     break;

           case 2:

                     pdown=0.98;

                     break;

           case 3:

                     pdown=0.96;

                     break;

           case 4:

                     pdown=0.96;

                     break;

           case 5:

                     pdown=0.96;

                     break;
				
				<dp n="d398"/>
                case 6:

                         pdown=0.96;

                         break;

                default:

                         pdown=0.70;

                         break;

              }

        /*----------------------------------------------*/

            /*==========Pitch Gain==================*/

        /*----------------------------------------------*/

        if(N_bfi==1)

                gainQ[0]=0.95;

        else

            {

            gainQ[0]=gp_buf[7];

            gainQ[0]*=pdown;

               }

        }

    /*----------------------------------------------*/

        return:

    /*----------------------------------------------*/

      }
/*--------------------------------------------------*/
/*=======================================*/
/*FUNCTION    :GEQ_Quant_PitchGain_4D().                          */
/*--------------------------------------------------*/
/*PURPOSE     :This function performs 4-D VQ of Ga1,Ga2,Ga3   */
/*            and Ga4 with 6 bits.                         */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS  :                                            */
/*                 _None.                                  */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
				
				<dp n="d399"/>
/*          _(INT16)        idx:codebook index.             */
/*-------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*          _(FLOAT64[])      Gp:unquantized/quantized pitch  */
/*                             gains.                      */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                                */
/*                _None.                                     */
/*========================================*/
void GEQ_Quant_PitchGain_4D(FLOAT64*Gp,INT16*idx)

    {

    /*---------------------------------------------*/

    INT16 i;

    FLOAT64 min_dist;

    FLOAT64 dist;

    FLOAT64 err[GVQ_VEC_SIZE_4D];

    /*---------------------------------------------*/

    min_dist=MAXFLT;

    for(i=0;i<TAB_SIZE_GVQ_4D;i++)

         {

         dif_dvector(Gp,gp4_tab[i],err,0,GVQ_VEC_SIZE_4D-1);

         dot_dvector(err,err,&amp;dist,0,GVQ_VEC_SIZE_4D-1);

         if(dist<min_dist)

              {

              min_dist=dist;

              (*idx)    =i;

              }

          }

    for(i=0;i<GVQ_VEC_SIZE_4D;i++)

        Gp[i]=gp4_tab[(*idx)][i];

    /*---------------------------------------------*/

    return;
				
				<dp n="d400"/>
    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*===================================*/
/*FUNCTION    :GEQ_Dec_PitchGain_4D().                           */
/*-------------------------------------------------*/
/*PURPOSE     :This function decodes the 6 bit 4-D VQ of Ga1,*/
/*            Ga2,Ga3,and Ga4.                             */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS  :                                             */
/*      _(INT16)           N_bfi:      duration of bad frame  */
/*                                     seq.(0=good frame)    */
/*      _(INT16)           i_sf:      subframe number.        */
/*      _(INT16)          index:     codebook index.         */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*      _(FLOAT64[])       gainQ:      Quantized adaptive     */
/*                                   codebook gains.         */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS  :                                             */
/*                 _None.                                     */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                                */
/*                 _None.                                     */
/*========================================*/
void GEQ_Dec_PitchGain_4D(INT16N_bfi,INT16i_sf,INT16 index,FLOAT64*gainQ)

       {

       /*------------------------------------------*/

       FLOAT64 pdown;

       /*------------------------------------------*/

       if(N_bfi==0)

             {

             /*------------------------------------*/

             /*==========good frame==================*/

             /*------------------------------------*/
				
				<dp n="d401"/>
    gainQ[0]=gp4_tab[index][i_sf];

    }
else

    {

    /*==================================*/

    /*-----------------------------------------*/

    /*==============bad frame==============*/

    /*-----------------------------------------*/

    /*-----------------------------------------*/

    /*set down-scaling according to number of bad frames  */

    /*-----------------------------------------*/

    switch(N_bfi)

           {

          case 1:

                    pdown=0.99;

                    break;

          case 2:

                    pdown=0.98;

                    break;

          case 3:

                    pdown=0.96;

                    break;

          case 4:

                    pdown=0.96;

                    break;

          case 5:

                    pdown=0.96;

                    break;

          case 6:

                    pdown=0.96;

                    break;

          default:

                    pdown=0.70;

                    break;

         }
/*----------------------------------------------*/
  /*==============Pitch Gain==============*/
				
				<dp n="d402"/>
    /*-----------------------------------------*/

    if(N_bfi==1)

            gainQ[0]=0.95;

    else

        {

        gainQ[0]=gp_buf[7];

        gainQ[0]*=pdown;

           }

       }

    /*-----------------------------------------*/

        return;

    /*-----------------------------------------*/

        }
/*---------------------------------------------*/
/*=====================================*/
/*FUNCTION    :GEQ_gainVQMA_3().                                */
/*---------------------------------------------*/
/*PURPOSE     :This function performs 3-D VQ of Gc1,Gc2,and */
/*            Gc3 with 8 bits.                             */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                              */
/*      _(FLOAT64[])          Tgs:target signal.             */
/*      _(FLOAT64[])          unfcod:fixed codebook excitation.*/
/*      _(FLOAT64[])          fcod:  filtered fixed codebook  */
/*                                   excitation.             */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                */
/*      _(FLOAT64[])          gainQ: Quantized fixed codebook   */
/*                                 gains.                   */
/*      _(INT16)            idx:codebook index.              */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*                 _None.                                    */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
				
				<dp n="d403"/>
/*                        _None.                       */
/*========================================*/
void GEQ_gainVQMA_3(FLOAT64Tgs[],FLOAT64**unfcod,FLOAT64**fcod,

             FLOAT64**gainQ,INT16*idx)

    {

    /*-----------------------------------------*/

    INT16 i;

    INT16 num_candidate;

    INT16 i_s,i_sf;

    INT16 LL_SF[N_SF3]={L_SF0,L_SF0,L_SF3};

    FLOAT64 erg_ratio[N_SF3];

    FLOAT64 pred_energy[N_SF3];

    FLOAT64 err_energy[N_SF3];

    FLOAT64 lin_err_energy[N_SF3];

    FLOAT64 energy[N_SF3],pred_gain[N_SF3],dist,dist_min,

       corr[CORR_SIZE][N_SF3];

    FLOAT64 val;

    FLOAT64corr_coeff_a[3],corr_coeff_b[3],corr_coeff_c;

    /*-----------------------------------------*/

    /*=========Compute the predicted cdbk gain===========*/

    /*-----------------------------------------*/

    /*-----------------------------------------*/

    /*                      MA Prediction                  */

    /*-----------------------------------------*/

    dot_dvector(past_energyq_3d,energy_pred_coeff_1,

      &amp;pred_energy[0],0,GVQ_VEC_SIZE_3D-1);

    pred_energy[0]=MAX(pred_energy[0],-20.0);

    dot_dvector(past_energyq_3d,energy_pred_coeff_2,

    &amp;pred_energy[1],0,GVQ_VEC_SIZE_3D-1);

    pred_energy[1]=MAX(pred_energy[1],-20.0);
				
				<dp n="d404"/>
dot_dvector(past_energyq_3d,energy_pred_coeff_3,
  &amp;pred_energy[2],0,GVQ_VEC_SIZE_3D-1);
pred_energy[2]=MAX(pred_energy[2],-20.0);
/*-------------------------------------------------*/
/*=============Process all subframe==============*/
/*-------------------------------------------------*/
i_s=0;
for(i_sf=0;i_sf<N_SF3;i_sf++)

     {

     /*--------------------------------------------*/

     /*compute the cdbk energy with mean removed(i.e.,-34dB)*/

     /*--------------------------------------------*/

     dot_dvector(unfcod[1]+i_s,unfcod[1]+i_s,&amp;energy[i_sf],

                                           0,LL_SF[i_sf]-1);

     energy[i_sf]=34.0-10.0*log10(energy[i_sf]/

                                                  (FLOAT64)LL_SF[i_sf]+EPSI);

     /*-------------------------------------------*/

     /*              compute the predicted energy            */

     /*-------------------------------------------*/

     energy[i_sf]+=pred_energy[i_sf];

     /*-------------------------------------------*/

     /*              compute the predicted gain               */

     /*------------------------------------------*/

     pred_gain[i_sf]=pow(10.0,energy[i_sf]/20.0);

     err_energy[i_sf]=-energy[i_sf]+20*log10(fabs(gainQ[1][i_sf])

                                                                +EPSI);

     lin_err_energy[i_sf]=pow(10.0,err_energy[i_sf]/20.0);

     i_s+=LL_SF[i_sf];

     }
				
				<dp n="d405"/>
/*-----------------------------------------------*/
/*==============Optinal gainVQ search==============*/
/*-----------------------------------------------*/
dist_min=MAXFLT;
num_candidate=256;
i_s=0;
for(i_sf=0;i_sf<N_SF3;i_sf++)

    {

    dot_dvector(fcod[0]+i_s,fcod[0]+i_s,&amp;val,0,LL_SF[i_sf]-1);

    corr[0][i_sf]=val;

    dot_dvector(fcod[0]+i_s,Tgs+i_s,&amp;val,0,LL_SF[i_sf]-1);

    corr[1][i_sf]=-2.0*val;

    dot_dvector(fcod[1]+i_s,fcod[1]+i_s,&amp;val,0,LL_SF[i_sf]-1);

    corr[2][i_sf]=val;

    dot_dvector(fcod[1]+i_s,Tgs+i_s,&amp;val,0,LL_SF[i_sf]-1);

    corr[3][i_sf]=-2.0*val;

    dot_dvector(fcod[0]+i_s,fcod[1]+i_s,&amp;val,0,LL_SF[i_sf]-1);

    corr[4][i_sf]=2.0*val;

    dot_dvector(Tgs+i_s,Tgs+i_s,&amp;val,0,LL_SF[i_sf]-1);

    corr[5]i_sf]=val;

    i_s+=LL_SF[i_sf];

    }
erg_ratio[0]=corr[5][0]/(corr[5][0]+corr[5][1]+corr[5][2]+EPSI);
erg_ratio[1]=corr[5][1]/(corr[5][0]+corr[5][1]+corr[5][2]+EPSI);
erg_ratio[2]=corr[5][2]/(corr[5][0]+corr[5][1]+corr[5][2]+EPSI);
  corr_coeff_a[0]=erg_ratio[0]*corr[2][0]*pred_gain[0]*pred_gain[0];
  corr_coeff_b[0]=erg_ratio[0]*(corr[3][0]+gainQ[0][0]*corr[4][0])*pred_gain[0];
  corr_coeff_a[1]=erg_ratio[1]*corr[2][1]*pred_gain[1]*pred_gain[1];
  corr_coeff_b[1]=erg_ratio[1]*(corr[3][1]+gainQ[0][1]*corr[4][1])*pred_gain[1];
				
				<dp n="d406"/>
    corr_coeff_a[2]=erg_ratio[2]*corr[2][2]*pred_gain[2]*pred_gain[2];

    corr_coeff_b[2]=erg_ratio[2]*(corr[3][2]+gainQ[0][2]*corr[4][2])*pred_gain[2];

    corr_coeff_c=erg_ratio[0]*(corr[5][0]+sqr(gainQ[0][0])*corr[0][0]+gainQ[0][0]*corr[1][0])+
erg_ratio[1]*(corr[5][1]+sqr(gainQ[0][1])*corr[0][1]*gainQ[0][1]*corr[1][1])*
erg_ratio[2]*(corr[5][2]+sqr(gainQ[0][2])*corr[0][2]+gainQ[0][2]*corr[1][2]);

    for(i=0;i<num_candidate;i++)

        {

              dist=corr_coeff_a[0]*sqr(gainVQ_3_256[i][0])+

                    corr_coeff_b[0]*gainVQ_3_256[i][0]+

                    corr_coeff_a[1]*sqr(gainVQ_3_256[i][1])+

                    corr_coeff_b[1]*gainVQ_3_256[i][1]+

                    corr_coeff_a[2]*sqr(gainVQ_3_256[i][2])+

                    corr_coeff_b[2]*gainVQ_3_256[i][2]+corr_coeff_c;

            if(dist<dist_min)

                  {

                  dist_min=dist;

                  (*idx)=i;

                   }

            }

    /*------------------------------------------------------*/

    /*                           Get the quantized gains                 */

    /*-----------------------------------------------------*/

    gainQ[1][0]=pred_gain[0]*gainVQ_3_256[*idx][0];

    gainQ[1][1]=pred_gain[1]*gainVQ_3_256[*idx][1];

    gainQ[1][2]=pred_gain[2]*gainVQ_3_256[*idx][2];

    /*----------------------------------------------------*/

    /*                    Update past quantized energies                */

    /*---------------------------------------------------*/

    for(i_sf=0;i_sf<N_SF3;i_sf++)

         {

         val=gainVQ_3_256[*idx][i_sf];

         past_energyq_3d[N_SF3-1-i_sf]=20.0*log10(val);

         }
				
				<dp n="d407"/>
    /*----------------------------------------------*/

    return;

    /*----------------------------------------------*/

    }
/*--------------------------------------------------*/
/*=======================================*/
/*FUNCTION    :GEQ_dec_gc_3_8().                                  */
/*--------------------------------------------------*/
/*PURPOSE     :This function decodes the 8 bit 3-D VQ of Gc1, */
/*            Gc2,and Gc3.Note that the gains are decoded   */
/*            one-by-one on a subframe basis.               */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS  :                                           */
/*      _(INT16)         index:      codebook index.       */
/*      _(INT16)         N_bfi:      duration of bad frame */
/*                                 seq.(0=good frame)    */
/*      _(FLOAT64[])     unfcod:fixed codebook excitation.*/
/*      _(INT16)         i_sf:subframe number.           */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                           */
/*      _(FLOAT64*)      gainQ:  Quantized fixed codebook  */
/*                              gains.                 */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS  :                                       */
/*                   _None.                            */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                       */
/*                   _None.                           */
/*==========================================*/
void GEQ_dec_gc_3_8(INT16 index,FLOAT64*gainQ,INT16N_bfi,FLOAT64**unfcod,

        INT16 i_sf)

    {

    /*--------------------------------------------*/

    INT16 i_sf_local;
				
				<dp n="d408"/>
INT16 LL_SF[N_SF3]={L_SF0,L_SF0,L_SF3};
FLOAT64 cdown,current_fixed_energy,energy,pred_gain;
  FLOAT64 min_erg_38;
/*----------------------------------------------------*/
/*   Note:the gains are decoded one-by-one on a subframe basis     */
/*----------------------------------------------------*/
/*----------------------------------------------------*/
/*       Compute the cdbk energy with mean removed(i.e,-34dB)       */
/*----------------------------------------------------*/
/*----------------------------------------------------*/
/*        Predict energy for all subframes at first subframe     */
/*----------------------------------------------------*/
if(i_sf==0)

    {

    dot_dvector(past_energyq_3d,energy_pred_coeff_1,

          pred_energy_d38,0,3-1);

    pred_energy_d38[0]=MAX(pred_energy_d38[0],-20.0);

    dot_dvector(past_energyq_3d,energy_pred_coeff_2,

          pred_energy_d38+1,0,3-1);

    pred_energy_d38[1]=MAX(pred_energy_d38[1],-20.0);

    dot_dvector(past_energyq_3d,energy_pred_coeff_3,

          pred_energy_d38+2,0,3-1);

    pred_energy_d38[2]=MAX(pred_energy_d38[2],-20.0);

    }
dot_dvector(unfcod[1],unfcod[1],&amp;energy,0,LL_SF[i_sf]-1);
current_fixed_energy=energy;
energy=34.0-10.0*log10(energy/(FLOAT64)LL_SF[i_sf]+EPSI);
/*--------------------------------------------------------*/
/*                    Compute the predicted energy                    */
/*--------------------------------------------------------*/
energy+=pred_energy_d38[i_sf];
				
				<dp n="d409"/>
/*-------------------------------------------------*/
/*                   Compute the predicted gain            */
/*-------------------------------------------------*/
pred_gain=pow(10.0,energy/20.0);
if(N_bfi==0)

    {

    /*---------------------------------------------*/

    /*=============Good frame=================*/

    /*---------------------------------------------*/

    /*---------------------------------------------*/

    /*                Get the quantized gain                 */

    /*---------------------------------------------*/

    (*gainQ)=pred_gain*gainVQ_3_256[index][i_sf];

    past_fixed_energy=current_fixed_energy*sqr((*gainQ));

    if(i_sf==N_SF3-1)

        {

        /*-----------------------------------------*/

        /*           Update past quantized energies           */

        /*-----------------------------------------*/

        for(i_sf_local=0;i_sf_local<N_SF3;i_sf_local++)

            {

            past_energyq_3d[N_SF3-1-i_sf_local]=

                      20.0*log10(gainVQ_3_256[index][i_sf_local]);

            }

        }

    }
else

    {

    /*---------------------------------------------*/

    /*=================Bad frame================*/

    /*---------------------------------------------*/

    /*---------------------------------------------*/

    /*     set down-scaling according to number of bad frames      */
				
				<dp n="d410"/>
  /*---------------------------------------------*/
  switch(N_bfi)

      {

      case 1:

               cdown=0.75:

               break;

      case 2:

               cdown=0.75;

               break;

      case 3:

               cdown=0.75;

               break;

      case 4:

               cdown=0.40;

               break;

      case 5:

               cdown=0.30;

               break;

      case 6:

               cdown=0.20;

               break;

      default:

               cdown=0.20;

               break:

      }
  /*---------------------------------------------*/
  /*===============Fixed Codebook===============*/
  /*---------------------------------------------*/
  (*gainQ)=sqrt(past_fixed_energy/current_fixed_energy);
  (*gainQ)*=cdown;
  past_fixed_energy=current_fixed_energy*sqr((*gainQ));
  /*---------------------------------------------*/
  /*  Buffer data for update after the last subframe     */
  /*---------------------------------------------*/
  min_erg_38=MIN(past_energyq_3d[0],past_energyq_3d[1]);
				
				<dp n="d411"/>
        min_erg_38=MIN(min_erg_38,past_energyq_3d[2]);

        past_energyq_3d[GVQ_VEC_SIZE_3D-1-i_sf]=MIN(min_erg_38,

                        -energy+20*log10(fabs(0.6*(*gainQ))+EPSI));

        /*------------------------------------------*/

        /*        Set GC to zero for this mode under FER       */

        /*------------------------------------------*/

        (*gainQ)=0.0;

        }

    /*------------------------------------------*/

    return;

    /*------------------------------------------*/

    }
/*----------------------------------------------*/
/*=======================================*/
/*FUNCTION    :GEQ_gainVQMA_4().                                 */
/*----------------------------------------------*/
/*PURPOSE     :This function performs 4-D VQ of Gc1,Gc2,Gc3  */
/*            and Gc4 with 10 bits.                         */
/*----------------------------------------------*/
/*INPUT ARGUMENTS:                                            */
/*      _(FLOAT64[])       Tgs:   target signal.         */
/*      _(FLOAT64[])       unfcod:fixed codebook excitation.*/
/*      _(FLOAT64[])       fcod:filtered fixed codebook    */
/*                              excitation.               */
/*----------------------------------------------*/
/*OUTPUT ARGUMENTS:                                            */
/*      _(FLOAT64[])       gainQ:  Quantized fixed codebook  */
/*                               gains.                   */
/*      _(INT16)           idx: codebook index.             */
/*----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                      */
/*                   _None.                            */
/*----------------------------------------------*/
/*RETURN ARGUMENTS:                                 */
				
				<dp n="d412"/>
/*                   _None.                      */
/*===================================*/
void GEQ_gainVQMA_4(FLOAT64 Tgs[],FLOAT64**unfcod,FLOAT64**fcod,

             FLOAT64**gainQ,INT16*idx)

    {

    /*-----------------------------------------*/

    INT16 i;

    INT16 num_candidate;

    INT16 i_s,i_sf;

    FLOAT64 pred_energy[N_SF4];

    FLOAT64 err_energy[N_SF4];

    FLOAT64 lin_err_energy[N_SF4];

    FLOAT64 energy[N_SF4],pred_gain[N_SF4],dist,dist_min,

       corr[CORR_SIZE][N_SF4];

    FLOAT64 val;

       FLOAT64 corr_coeff_a[4],corr_coeff_b[4],corr_coeff__c;

    /*-----------------------------------------*/

    /*========Compute the predicted cdbk gain========*/

    /*-----------------------------------------*/

    /*-----------------------------------------*/

    /*                     MA Prediction                    */

    /*-----------------------------------------*/

    dot_dvector(past_energyq_4d,energy_pred_coeff4d_1,

      &amp;pred_energy[0]0,GVQ_VEC_SIZE_4D-1);

    pred_energy[0]=MAX(pred_energy[0],-20.0);

    dot_dvector(past_energyq_4d,energy_pred_coeff4d_2.

      &amp;pred_energy[1],0,GVQ_VEC_SIZE_4D-1);

    pred_energy[1]=MAX(pred_energy[1],-20.0);

    dot_dvector(past_energyq_4d,energy_pred_coeff4d_3,

      &amp;pred_energy[2],0,GVQ_VEC_SIZE_4D-1);
				
				<dp n="d413"/>
pred_energy[2]=MAX(pred_energy[2],-20.0);
dot_dvector(past_energyq_4d,energy_pred_coeff4d_4,
  &amp;pred_energy[3],0,GVQ_VEC_SIZE_4D-1);
pred_energy[3]=MAX(pred_energy[3],-20.0);
/*-----------------------------------------------*/
/*=============Process all subframe=============*/
/*-----------------------------------------------*/
i_s=0:
for(i_sf=0;i_sf<N_SF4;i_sf++)

    {

    /*-------------------------------------------*/

    /*compute the cdbk energy with mean removed(i.e.,-34dB)*/

    /*-------------------------------------------*/

    dot_dvector(unfcod[1]+i_s,unfcod[1]+i_s,&amp;energy[i_sf],

                                                           0,L_SF4-1);

    energy[i_sf]=34.0-10.0*log10(energy[i_sf]/

                                                   (FLOAT64)L_SF4+EPSI);

    /*-------------------------------------------*/

    /*              compute the predicted energy           */

    /*-------------------------------------------*/

    energy[i_sf]+=pred_energy[i_sf];

    /*-------------------------------------------*/

    /*               compute the predicted gain             */

    /*-------------------------------------------*/

    pred_gain[i_sf]=pow(10.0,energy[i_sf]/20.0);

    err_energy[i_sf]=-energy[i_sf]+20*log10(fabs(gainQ[1][i_sf])

                                                                +EPSI);

    lin_err_energy[i_sf]=pow(10.0,err_energy[i_sf]/20.0);

    i_s+=L_SF4;
				
				<dp n="d414"/>
    }
/*---------------------------------------------*/
/*=============Optimal gainVQ search============*/
/*---------------------------------------------*/
dist_min=MAXFLT;
num_candidate=1024;
i_s=0;
for(i_sf=0;i_sf<N_SF4:i_sf++)

     {

     dot_dvector(fcod[0]+i_s,fcod[0]+i_s,&amp;val,0,L_SF4-1);

     corr[0][i_sf]=val;

     dot_dvector(fcod[0]+i_s,Tgs+i_s,&amp;val,0,L_SF4-1);

     corr[1][i_sf]=-2.0*val;

     dot_dvector(fcod[1]+i_s,fcod[1]+i_s,&amp;val,0,L_SF4-1);

     corr[2][i_sf]=val;

     dot_dvector(fcod[1]+i_s,Tgs+i_s,&amp;val,0,L_SF4-1);

     corr[3][i_sf]=-2.0*val;

     dot_dvector(fcod[0]+i_s,fcod[1]+i_s,&amp;val,0,L_SF4-1);

     corr[4][i_sf]=2.0*val;

     dot_dvector(Tgs+i_s,Tgs+i_s,&amp;val,0,L_SF4-1);

     corr[5][i_sf]=val;

     i_s+=L_SF4;

     }

     corr_coeff_a[0]=corr[2][0]*pred_gain[0]*pred_gain[0];
corr_coeff_b[0]=(corr[3][0]+gainQ[0][0]*corr[4][0])*pred_gain[0];
corr_coeff_a[1]=corr[2][1]*pred_gain[1]*pred_gain[1];
corr coeff_b[1]=(corr[3][1]+gainQ[0][1]*corr[4][1])*pred_gain[1];
corr_coeff_a[2]=corr[2][2]*pred_gain[2]*pred_gain[2];
corr_coeff_b[2]=(corr[3][2]+gainQ[0][2]*corr[4][2])*pred_gain[2];
				
				<dp n="d415"/>
    corr_coeff_a[3]=corr[2][3]*pred_gain[3]*pred_gain[3];

    corr_coeff_b[3]=(corr[3][3]+gainQ[0][3]*corr[4][3])*pred_gain[3];

    corr_coeff_c=corr[5][0]+sqr(gainQ[0][0])*corr[0][0]+gainQ[0][0]*corr[1][0]+
corr[5][1]+sqr(gainQ[0][1])*corr[0][1]+gainQ[0][1]*corr[1][1]+

         corr[5][2]+sqr(gainQ[0][2])*corr[0][2]+gainQ[0][2]*corr[1][2]+
corr[5][3]+sqr(gainQ[0][3])*corr[0][3]+gainQ[0][3]*corr[1][3];

      for(i=0;i<num_candidate;i++)

          {

                dist=
corr_coeff_a[0]*sqr(gainVQ_4_1024[i][0])+corr_coeff_b[0]*gainVQ_4_1024[i][0]
+
corr_coeff_a[1]*sqr(gainVQ_4_1024[i][1])+corr_coeff_b[1]*gainVQ_4_1024[i][1]
+
corr_coeff_a[2]*sqr(gainVQ_4_024[i][2])+corr_coeff_b[2]*gainVQ_4_1024[i][2]
+
corr_coeff_a[3]*sqr(gainVQ_4_024[i][3])+corr_coeff_b[3]*gainVQ_4_1024[i][3]
+

          corr_coeff_c;

          if(dist<dist_min)

                {

                dist_min=dist;

                (*idx)=i;

                }

           }

    /*----------------------------------------------------*/

    /*                     Get the quantized gains                  */

    /*----------------------------------------------------*/

      gainQ[1][0]=pred_gain[0]*gainVQ_4_1024[*idx][0];

      gainQ[1][1]=pred_gain[1]*gainVQ_4_1024[*idx][1];

      gainQ[1][2]=pred_gain[2]*gainVQ_4_1024[*idx][2];

      gainQ[1][3]=pred_gain[3]*gainVQ_4_1024[*idx][3];
				
				<dp n="d416"/>
    /*---------------------------------------------*/

    /*              Update past quantized energies            */

    /*---------------------------------------------*/

    for(i_sf=0;i_sf<N_SF4;i_sf++)

        {

        val=gainVQ_4_1024[*idx][i_sf];

        past_energyq_4d[N_SF4-1-i_sf]=20.0*log10(val);

        }

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*=======================================*/
/*FUNCTION    :GEQ_dec_gc_4_10().                               */
/*-------------------------------------------------*/
/*PURPOSE     :This function decodes the 10 bit 4-D VQ of Gc1,*/
/*            Gc2,Gc3,and Gc4.Note that the gains are     */
/*            decoded one-by-one on a subframe basis.        */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*      _(INT16)      index:        codebook index.        */
/*      _(INT16)      N_bfi:        duration of bad frame */
/*                                 seq.(0=good frame)    */
/*      _(FLOAT64[])  unfcod:      fixed codebook excitation.*/
/*      _(INT16)      i_sf:       subframe number.          */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*      _(FLOAT64*)   gainQ:      Quantized fixed codebook    */
/*                              gains.                 */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:                                           */
/*                _None.                               */
/*-------------------------------------------------*/
/*RETU RN ARGUMENTS:                                        */
				
				<dp n="d417"/>
/*                         _None.                            */
/*====================================*/
void GEQ_dec_gc_4_10(INT16 index,FLOAT64*gainQ,INT16 N_bfi,FLOAT64**unfcod,

        INT16 i_sf)

    {

    /*---------------------------------------------------*/

    INT16 i_sf_local;

    FLOAT64 cdown,current_fixed_energy,energy,pred_gain;

    FLOAT64 min_erg_410;

    /*---------------------------------------------------*/

    /*  Note:the gains are decoded one-by-one on a subframe basis   */

    /*----------------------------------------------------*/

    /*----------------------------------------------------*/

    /*     Compute the cdbk energy with mean removed(i.e.,-34dB)    */

    /*----------------------------------------------------*/

    /*----------------------------------------------------*/

    /*     Predict energy for all subframes at first subframe        */

    /*----------------------------------------------------*/

    if(i_sf==0)

        {

        dot_dvector(past_energyq_4d,energy_pred_coeff4d_1,

        pred_energy_d410,0,4-1);

        pred_energy_d410[0]=MAX(pred_energy_d410[0],-20.0);

        dot_dvector(past_energyq_4d,energy_pred_coeff4d_2,

             pred_energy_d410+1,0,4-1);

        pred_energy_d410[1]=MAX(pred_energy_d410[1],-20.0);

        dot_dvector(past_energyq_4d,energy_pred_coeff4d_3,

             pred_energy_d410+2,0,4-1);

        pred_energy_d410[2]=MAX(pred_energy_d410[2],-20.0);

        dot_dvector(past_energyq_4d,energy_pred_coeff4d_4,
				
				<dp n="d418"/>
          pred_energy_d410+3,0,4-1);

    pred_energy_d410[3]=MAX(pred_energy_d410[3],-20.0);

    }
dot_dvector(unfcod[1],unfcod[1],&amp;energy,0,L_SF4-1);
current_fixed_energy=energy;
energy=34.0-10.0*log10(energy/(FLOAT64)L_SF4+EPSI);
/*---------------------------------------------*/
/*               Compute the predicted energy           */
/*---------------------------------------------*/
energy+=pred_energy_d410[i_sf];
/*---------------------------------------------*/
/*               Compute the predicted gain              */
/*---------------------------------------------*/
pred_gain=pow(10.0,energy/20.0);
if(N_bfi==0)

    {

    /*-----------------------------------------*/

    /*===============Good frame==============*/

    /*-----------------------------------------*/

    /*-----------------------------------------*/

    /*               Get the quantized gain             */

    /*-----------------------------------------*/

    (*gainQ)=pred_gain*gainVQ_4_1024[index][i_sf];

    past_fixed_energy=current_fixed_energy*sqr((*gainQ));

    if(i_sf==N_SF4-1)

        {

        /*-------------------------------------*/

        /*     Update past quantized energies           */

        /*-------------------------------------*/

        for(i_sf_local=0;i_sf_local<N_SF4;i_sf_local++)
				
				<dp n="d419"/>
            {

            past_energyq_4d[N_SF4-1-i_sf_local]=

                      20.0*log10(gainVQ_4_1024[index][i_sf_local]);

            }

        }

    }
else

    {

    /*---------------------------------------------*/

    /*================Bad frame=============*/

    /*---------------------------------------------*/

    /*---------------------------------------------*/

    /*    set down-scaling according to number of bad frames  */

    /*---------------------------------------------*/

    switch(N_bfi)

         {

         case 1:

                  cdown=0.75;

                  break;

         case 2:

                  cdown=0.75:

                  break;

         case 3:

                  cdown=0.75;

                  break;

         case 4:

                  cdown=0.40;

                  break;

         case 5:

                  cdown=0.30;

                  break;

         case 6:

                  cdown=0.20;

                  break;

         default:

                  cdown=0.20;

                  break;

         }
				
				<dp n="d420"/>
       /*--------------------------------------------*/

       /*===============Pitch gain==============*/

       /*--------------------------------------------*/

       (*gainQ)=sqrt(past_fixed_energy/current_fixed_energy);

       (*gainQ)*=cdown;

       past_fixed_energy=current_fixed_energy*sqr((*gainQ));

       /*--------------------------------------------*/

       /*    Buffer data for update after the last subframe       */

       /*--------------------------------------------*/

           min_erg_410=MIN(past_energyq_4d[0],past_energyq_4d[1]);

           min_erg_410=MIN(min_erg_410,past_energyq_4d[2]);

           min_erg_410=MIN(min_erg_410,past_energyq_4d[3]);

           past_energyq_4d[GVQ_VEC_SIZE_4D-1-i_sf]=MIN(min_erg_410,

                      -energy+20*log10(fabs(0.6*(*gainQ))+EPSI));

       /*--------------------------------------------*/

       /*         Set GC to zero for this mode under FER         */

       /*--------------------------------------------*/

       (*gainQ)=0.0;

       }

    /*-----------------------------------------------*/

    return;

    /*-----------------------------------------------*/

    }
/*------------------------------------------------*/
/*========================================*/
/*FUNCTION    :GEQ_gainNSQMA_1_5().                           */
/*------------------------------------------------*/
/*PURPOSE     :This function performs 1-D VQ of Gc with    */
/*            5 bits.                                     */
/*------------------------------------------------*/
/*INPUT ARGUMENTS:                                           */
/*      _(FLOAT64[])    unfcod:fixed codebook             */
				
				<dp n="d421"/>
/*                           excitation.                   */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                        */
/*       _(FLOAT64[])    gainQ: Quantized adaptive and  */
/*                            fixed codebook gains.    */
/*       _(INT16 *)      idx:  codebook index.          */
/*------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                    */
/*                  _None.                             */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:                                        */
/*                  _None.                            */
/*=====================================*/
void GEQ_gainNSQMA_1_5(FLOAT64*unfcod,FLOAT64**gainQ,INT16*idx)

    {

    /*--------------------------------------------*/

    FLOAT64 energy,pred_gain,dist,dist_min,g_cdbk;

    INT16 i;

    INT16 num_candidate;

    FLOAT64 pred_energy;

    /*--------------------------------------------*/

    /*=========Compute the predicted cdbk gain============*/

    /*--------------------------------------------*/

    /*--------------------------------------------*/

    /*Note:compute the cdbk energy with mean removed(i.e.,-30dB)*/

    /*--------------------------------------------*/

    dot_dvector(past_energyq_4d,energy_pred_coeff4d_1,&amp;pred_energy,0,

              GVQ_VEC_SIZE_4D-1);

    pred_energy=MAX(pred_energy,-20.0);

    dot_dvector(unfcod,unfcod,&amp;energy,0,L_FRM-1);

    energy=30.0-10.0*log10(energy/(FLOAT64)L_FRM+EPSI);
  /*--------------------------------------------*/
  /*             Compute the predicted energy                 */
  /*--------------------------------------------*/
				
				<dp n="d422"/>
energy+=pred_energy;
/*--------------------------------------------*/
/*              compute the predicted gain            */
/*--------------------------------------------*/
pred_gain=pow(10.0,energy/20.0);
/*--------------------------------------------*/
/*============Optimal gainVQ search=============*/
/*--------------------------------------------*/
dist_min=MAXFLT;
num_candidate=32;
for(i=0;i<num_candidate;i++)

    {

    g_cdbk=pred_gain*gainSQ_1_32[i];

    dist=sqr(g_cdbk-gainQ[1][0]);

    if(dist<dist_min)

         {

         dist_min=dist;

         (*idx)=i;

         }

    }
/*--------------------------------------------*/
/*                get the quantized gains             */
/*--------------------------------------------*/
gainQ[1][0]=pred_gain*gainSQ_1_32[*idx];
/*--------------------------------------------*/
/*            update past quantized energies           */
/*--------------------------------------------*/
for(i=GVQ_VEC_SIZE_4D-1;i>0;i--)
				
				<dp n="d423"/>
        past_energyq_4d[i]=past_energyq_4d[i-1];

    past_energyq_4d[0]=20.0*log10(gainSQ_1_32[*idx]);

    /*----------------------------------------------------*/

    return;

    /*----------------------------------------------------*/

    }
/*--------------------------------------------------------*/
/*===========================================*/
/*FUNCTION    :GEQ_dec_gains_1_5().                                  */
/*--------------------------------------------------------*/
/*PURPOSE     :This function decodes the 5 bit 1-D VQ of Gc       */
/*--------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                       */
/*      _(INT16)                index:         codebook index.         */
/*      _(INT16)                N_bfi:         duration of bad frame  */
/*                                              seq.(0=good frame)   */
/*      _(FLOAT64[])            unfcod:        adaptive and fixed      */
/*                                              codebook excitation. */
/*--------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                     */
/*      _(FLOAT64[][])          gainQ:Quantized adaptive and         */
/*                                   fixed codebook gains.         */
/*--------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                                */
/*                   _None.                                        */
/*--------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                     */
/*                   _None.                                       */
/*===========================================*/
void GEQ_dec_gains_1_5(INT16 index,FLOAT64**gainQ,FLOAT64*unfcod,

                     INT16 N_bfi)

    {

    /*-----------------------------------------------------*/

    INT16 i;
				
				<dp n="d424"/>
FLOAT64 current_fixed_energy;
FLOAT64 energy,pred_gain;
FLOAT64 cdown;
FLOAT64 val;
FLOAT64 min_erg_5;
/*----------------------------------------------*/
/*   Compute the cdbk energy with mean removed(i.e,-30dB)   */
/*----------------------------------------------*/
dot_dvector(unfcod,unfcod,&amp;energy,0,L_FRM-1);
current_fixed_energy=energy;
energy/=(FLOAT64)L_FRM;
energy=30.0-10.0*log10(energy+EPSI);
/*----------------------------------------------*/
/*                Compute the predicted energy               */
/*----------------------------------------------*/
dot_dvector(past_energyq_4d,energy_pred_coeff4d_1,&amp;val,0,

          GVQ_VEC_SIZE_4D-1);
val=MAX(val,-20.0);
energy+=val;
/*----------------------------------------------*/
/*                 Compute the predicted gain                 */
/*----------------------------------------------*/
pred_gain=pow(10.0,energy/20.0);
if(N_bfi==0)

    {

    /*------------------------------------------*/

    /*================good frame===============*/

    /*------------------------------------------*/

    /*------------------------------------------*/

    /*                  get the quantized gains                 */
				
				<dp n="d425"/>
    /*------------------------------------------*/

           gainQ[1][0]=pred_gain*gainSQ_1_32[index];

    /*------------------------------------------*/

    /*           update past quantized energies            */

    /*------------------------------------------*/

    for(i=GVQ_VEC_SIZE_4D-1;i>0;i--)

         past_energyq_4d[i]=past_energyq_4d[i-1];

    past_energyq_4d[0]=20.0*log10(gainSQ_1_32[index]);

    }
else

    {

    /*====================================*/

    /*------------------------------------------*/

    /*===============bad frame==============*/

    /*------------------------------------------*/

    /*------------------------------------------*/

    /*   set down-scaling according to number of bad frames  */

    /*------------------------------------------*/

    switch(N_bfi)

        {

        case 1:

                cdown=0.98;

                break;

        case 2:

                cdown=0.94;

                break;

        case 3:

                cdown=0.88;

                break;

        case 4:

                cdown=0.80;

                break;

      case 5:

          cdown=0.30;
				
				<dp n="d426"/>
             break:

            case 6:

             cdown=0.20;

             break;

            default:

                  cdown=0.20;

                  break;

            }

            gainQ[1][0]=sqrt(past_fixed_energy/current_fixed_energy);

            gainQ[1][0]*=cdown;

        /*-----------------------------------------*/

        /*        update past quantized energies           */

        /*-----------------------------------------*/

             min_erg_15=MIN(past_energyq_4d[0],past_energyq_4d[1]);

             min_erg_15=MIN(min_erg_15,past_energyq_4d[2]);

             min_erg_15=MIN(min_erg_15,past_energyq_4d[3]);

             for(i=GVQ_VEC_SIZE_4D-1;i>0;i--)

               past_energyq_4d[i]=past_energyq_4d[i-1];

             past_energyq_4d[0]=MIN(min_erg_15,-energy+

                               20*log10(fabs(0.6*gainQ[1][0])+EPSI));

        }

    /*-----------------------------------------*/

    /*     Update the past fixed codebook energy         */

    /*-----------------------------------------*/

      past_fixed_energy=current_fixed_energy*sqr(gainQ[1][0]);

    /*-----------------------------------------*/

    return;

    /*-----------------------------------------*/

    }
/*=====================================*/
				
				<dp n="d427"/>
/*FUNCTION    :GEQ_gainNSQMA_1_6().              */
/*-----------------------------------------*/
/*PURPOSE    :This function performs 1-D VQ of Gc with  */
/*      6 bits.                  */
/*-----------------------------------------*/
/*INPUT ARGUMENTS:                     */
/*   _(FLOAT64[])  unfcod:fixed codebook             */
/*                          excitation.               */
/*-----------------------------------------*/
/*OUTPUT ARGUMENTS:                                       */
/*      _(FLOAT64[])    gainQ:Quantized adaptive and    */
/*                          fixed codebook gains.     */
/*      _(INT16*)       idx:codebook index.            */
/*-----------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                  */
/*                  _None.                          */
/*-----------------------------------------*/
/*RETURN ARGUMENTS:                                     */
/*                  _None.                          */
/*====================================*/
void GEQ_gainNSQMA_1_6(INT16 pos,FLOAT64*unfcod,FLOAT64**gainQ,INT16*idx)

    {

    /*-------------------------------------*/

    FLOAT64 energy,pred_gain,dist,dist_min,g_cdbk;

    INT16 i;

    INT16 num_candidate;

    FLOAT64 pred_energy;

    /*-------------------------------------*/

    /*====Compute the predicted cdbk gain=============*/

    /*-------------------------------------*/

    /*-------------------------------------*/

    /*Note:compute the cdbk energy with mean removed(i.e.,-30dB)  */

    /*-------------------------------------*/

    dot_dvector(past_energyq_2d,energy_pred_coeff_1,&amp;pred_energy,0,

              GVQ_VEC_SIZE_2D-1);

    pred_energy=MAX(pred_energy,-20.0);
				
				<dp n="d428"/>
    dot_dvector(unfcod+pos*40,unfcod+pos*40,&amp;energy,0,80-1);

    energy=30.0-10.0*log10(energy/(FLOAT64)80+EPSI);

    /*-----------------------------------------------*/

    /*                 Compute the predicted energy           */

    /*-----------------------------------------------*/

    energy+=pred_energy;

    /*-----------------------------------------------*/

    /*                  compute the predicted gain            */

    /*-----------------------------------------------*/

    pred_gain=pow(10.0,energy/20.0);

    /*-----------------------------------------------*/

    /*==============Optimal gainVQ search==============*/

    /*-----------------------------------------------*/

    dist_min=MAXFLT;

    num_candidate=64;

    for(i=0;i<num_candidate;i++)

        {

        g_cdbk=pred_gain*gainSQ_1_64[i];

        dist=sqr(g_cdbk-gainQ[1][pos]);

        if(dist<dist_min)

             {

             dist_min=dist;

             (*idx)=i;

              }

        }
/*-----------------------------------------------------*/
/*                        get the quantized gains               */
/*-----------------------------------------------------*/
				
				<dp n="d429"/>
    gainQ[1][pos]=pred_gain*gainSQ_1_64[*idx];

    /*---------------------------------------------*/

    /*           update past quantized energies               */

    /*---------------------------------------------*/

    for(i=GVQ_VEC_SIZE_2D-1;i>0;i--)

        past_energyq_2d[i]=past_energyq_2d[i-1];

    past_energyq_2d[0]=20.0*log10(gainSQ_1_64[*idx]);

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*======================================*/
/*FUNCTION    :GEQ_dec_gains_1_6().                             */
/*-------------------------------------------------*/
/*PURPOSE     :This function decodes the 6 bit 1-D VQ of Gc   */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:                                             */
/*      _(INT16)         index;      codebook index.       */
/*      _(INT16)         N_bfi:      duration of bad frame */
/*                                   seq.(0=good frame)  */
/*      _(FLOAT64[])     unfcod:      adaptive and fixed    */
/*                                  codebook excitation.  */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*      _(FLOAT64[][])   gainQ:     Quantized adaptive and  */
/*                              fixed codebook gains.     */
/*-------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                        */
/*                  _None.                                */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                            */
/*                  _None.                              */
/*=======================================*/
				
				<dp n="d430"/>
void GEQ_dec_gains_1_6(INT16 pos,INT16 index,FLOAT64**gainQ,

                  FLOAT64* unfcod,INT16 N_bfi)

    {

    /*-----------------------------------------------*/

    INT16 i;

    FLOAT64 current_fixed_energy;

    FLOAT64 energy,pred_gain;

    FLOAT64 cdown;

    FLOAT64 val;

    FLOAT64 min_erg_16;

    /*-----------------------------------------------*/

    /*   Compute the cdbk energy with mean removed(i.e.,-30dB)     */

    /*-----------------------------------------------*/

    dot_dvector(unfcod+pos*40,unfcod+pos*40,&amp;energy,0,80-1);

    current_fixed_energy=energy;

    energy/=(FLOAT64)80;

    energy=30.0-10.0*log10(energy+EPSI);

    /*-----------------------------------------------*/

    /*                Compute the predicted energy                  */

    /*-----------------------------------------------*/

    dot_dvector(past_energyq_2d,energy_pred_coeff_1,&amp;val,0,

              GVQ_VEC_SIZE_2D-1);

    val=MAX(val,-20.0);

    energy+=val;

    /*-----------------------------------------------*/

    /*                 Compute the predicted gain                   */

    /*-----------------------------------------------*/

    pred_gain=pow(10.0,energy/20.0);

    if(N_bfi==0)

        {
				
				<dp n="d431"/>
    /*----------------------------------------*/

    /*=============good frame==============*/

    /*----------------------------------------*/

    /*----------------------------------------*/

    /*           get the quantized gains                 */

    /*----------------------------------------*/

          gainQ[1][pos]=pred_gain*gainSQ_1_64[index];

    /*----------------------------------------*/

    /*         update past quantized energies            */

    /*----------------------------------------*/

    for(i=GVQ_VEC_SIZE_2D-1;i>0;i--)

         past_energyq_2d[i]=past_energyq_2d[i-1];

    past_energyq_2d[0]=20.0*log10(gainSQ_1_64[index]);

    }
else

    {

    /*=================================*/

    /*----------------------------------------*/

    /*==============bad frame==========*/

    /*----------------------------------------*/

    /*----------------------------------------*/

    /*   set down-scaling according to number of bad frames  */

    /*----------------------------------------*/

    switch(N_bfi)

        {

        case 1:

                 cdown=0.98;

                 break;

        case 2:

                 cdown=0.94;

                 break;

        case 3:

                 cdown=0.88:
				
				<dp n="d432"/>
                break;

        case 4:

                cdown=0.80;

                break;

        case 5:

                cdown=0.30;

                break;

        case 6:

                cdown=0.20;

                break;

        default:

                cdown=0.20;

                break;

        }

        gainQ[1][pos]=sqrt(past_fixed_energy/current_fixed_energy);

        gainQ[1][pos]*=cdown;

        /*-----------------------------------------*/

        /*         update past quantized energies           */

        /*-----------------------------------------*/

             min_erg_16=MIN(past_energyq_2d[0],past_energyq_2d[1]);

             for(i=GVQ_VEC_SIZE_2D-1;i>0;i--)

               past_energyq_2d[i]=past_energyq_2d[i-1];

           past_energyq_2d[0]=MIN(min_erg_16,-energy+

                               20*log10(fabs(0.6*gainQ[1][pos])+EPSI));

        }
/*-------------------------------------------------*/
/*             Update the past fixed codebook energy         */
/*-------------------------------------------------*/

    past_fixed_energy=current_fixed_energy*sqr(gainQ[1][pos]);
/*-------------------------------------------------*/
return;
				
				<dp n="d433"/>
    /*-----------------------------------------*/

    }
/*====================================*/
/*FUNCTION    :GEQ_gain_reopt_2().                          */
/*---------------------------------------------*/
/*PURPOSE     :This function jointly estimates Ga and Gc.*/
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                                         */
/*      _(FLOAT64[])      vec0:filtered adaptive codebook*/
/*                            excitation.              */
/*      _(FLOAT64[])      vec1:filtered fixed codebook   */
/*                            excitation.              */
/*      _(FLOAT64[])      target:target signal.         */
/*      _(INT1 6)       l_sf:length of subframe.        */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                           */
/*      _(FLOAT64)      gain0:adaptive codebook gain.     */
/*      _(FLOAT64)      gain1:fixed codebook gain.     */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                                      */
/*                  _None.                           */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                      */
/*                  _None.                           */
/*====================================*/
void GEQ_gain_reopt_2(FLOAT64*vec0,FLOAT64*vec1,FLOAT64*target,

                 FLOAT64*gain0,FLOAT64*gain1,INT16 l_sf)

    {

    /*-----------------------------------------*/

    FLOAT64*Cp,*Tgs,*Cc;

    FLOAT64 R_Cp_Tgs,R_Cp_Cp,R_Cc_Cc,R_Cp_Cc,R_Cc_Tgs;

    FLOAT64 den,num;

    /*-----------------------------------------*/

    Tgs=target;

    Cp=vec0;

    Cc=vec1;

    dot_dvector(Cp,Tgs,&amp;R_Cp_Tgs,0,l_sf-1);
				
				<dp n="d434"/>
    dot_dvector(Cp,Cp,&amp;R_Cp_Cp,0,l_sf-1);

    dot_dvector(Cc,Cc,&amp;R_Cc_Cc,0,l_sf-1);

    dot_dvector(Cp,Cc,&amp;R_Cp_Cc,0,l_sf-1);

    dot_dvector(Cc,Tgs,&amp;R_Cc_Tgs,0,l_sf-1);

    /*---------------------------------------------*/

    /*                     Optimize all gains                */

    /*---------------------------------------------*/

    num=R_Cp_Tgs*R_Cc_Cc-R_Cp_Cc*R_Cc_Tgs;

    den=R_Cp_Cp*R_Cc_Cc-R_Cp_Cc*R_Cp_Cc;

    if(den>0)

        den=MAX(0.001,den);

    else

        den=MIN(-0.001,den);

    (*gain0)=num/den;

    (*gain0)=MAX(0.0,*gain0);

    (*gain0)=MIN(1.2,*gain0);

    (*gain1)=(R_Cc_Tgs-(*gain0)*R_Cp_Cc)/MAX(R_Cc_Cc,0.00001);

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*====================================*/
/*FUNCTION    :GEQ_energy_extrapolation().                       */
/*-------------------------------------------------*/
/*PURPOSE     :This function extrapolate the energy of the  */
/*            excitation when a frame erasure occurs.      */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:                                                    */
/*      _(INT16)    i_s:   subframe starting sample.            */
/*      _(INT16)    i_sf:  subframe number.                      */
/*      _(INT16)    l_sf:  length of subframe.                  */
				
				<dp n="d435"/>
/*    _(FLOAT64[])gainQ:      adaptive and fixed codebook gains.*/
/*    _(FLOAT64**)unfcod_dec:  adaptive and fixed codebook excit.*/
/*    _(INT16)   bfi:      current frame Bad Frame Indicator.*/
/*    _(INT16[]) lag:      subframe lags.                   */
/*    _(FLOAT64[])ForPitch_dec:decoded picth evolution.      */
/*    _(PARAMETER)channel:       decoded indexes.               */
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*    _(FLOAT64[])ext_dec:       final scaled excitation.    */
/*    _(FLOAT64[])Prev_Beta_Pitch:excitation scaling factor.  */
/*    _(FLOAT64[])ET_buf:        subframe energy factor.        */
/*-----------------------------------------------*/
/*INPUT ARGUMENTS:                                                  */
/*                _None.                                      */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS:                                                */
/*                _Node.                                     */
/*========================================*/
void GEQ_energy_extrapolation(INT16 i_s,INT16 i_sf,INT16 l_sf,

                            FLOAT64 gainQ[],FLOAT64**qua_unfcod,

                            INT16 bfi,INT16 lag[],FLOAT64 ext_dec[],

                            FLOAT64 Prev_Beta_Pitch[],FLOAT64ET_buf[],

                            FLOAT64 ForPitch_dec[],PARAMETER channel)

    {

    /*-----------------------------------------------*/

    INT16 i;

       FLOAT64 E1,E2,ET,FET,PFET;

       FLOAT64*px,AA,BB;

       FLOAT64tmp_vec1[L_SF],tmp_vec2[L_SF],tmp_vec3[L_SF];

    /*-----------------------------------------------*/

    for(i=0;i<l_sf;i++)

         {

         tmp_vec1[i]=gainQ[1]*qua_unfcod[1][i+i_s];

         tmp_vec2[i]=gainQ[0]*qua_unfcod[0][i+i_s];

         tmp_vec3[i]=gainQ[0]*qua_unfcod[0][i+i_s]+

                               gainQ[1]*qua_unfcod[1][i+i_s];

         }
				
				<dp n="d436"/>
dot_dvector(tmp_vec1,tmp_vec1,&amp;E1,0,l_sf-1);
dot_dvector(tmp_vec2,tmp_vec2,&amp;E2,0,l_sf-1);
dot_dvector(tmp_vec3,tmp_vec3,&amp;ET,0,l_sf-1);
ET_buf[i_sf]=10.0*log10(ET+EPSI);
Prev_Beta_Pitch[i_sf]=E2/(E1+E2+EPSI);
px=ext_dec+MAX_LAG;
dot_dvector(px,px,&amp;FET,0,l_sf-1);
FET+=EPSI;
if(bfi==1)

    {

    /*-----------------------------------------------*/

    if(gainQ[0]>0.6)

       if(channel.idx_SVS_deci==0)

             BB=0.90;

       else

             BB=0.95;

       else

             BB=0.8;

       /*--------------------------------------------*/

       if(channel.idx_SVS_deci==0)

             {

             if((lag[i_sf]>0)&amp;&amp;(gainQ[0]>=0.6))

                   px=ext_dec+MAX_LAG-lag[i_sf];

             else

                   px=ext_dec+MAX_LAG-l_sf;

             }

       else

             {

             if(lag[i_sf]>0)

                   px=ext_dec+MAX_LAG-(INT16)ForPitch_dec[i_s];

             else

                   px=ext_dec+MAX_LAG-l_sf;

             }
				
				<dp n="d437"/>
        /*--------------------------------------------*/

        dot_dvector(px,px,&amp;PFET,0,l_sf-1);

        AA=BB*sqrt(PFET/FET);

        px=ext_dec+MAX_LAG;

        sca_dvector(px,AA,px,0,l_sf-1);

        }

    /*------------------------------------------------*/

    return;

    /*------------------------------------------------*/

    }
/*----------------------------------------------------*/
/*=======================================*/
/*FUNCTION     :GEQ_update_mem_4d_to_2d().                      */
/*----------------------------------------------------*/
/*PURPOSE      :This function update the cross memories       */
/*             for the gain quantizers for the transition */
/*             4 to 2 gains.                                */
/*----------------------------------------------------*/
/*INPUT ARGUMENTS:                                                   */
/*                _None.                                      */
/*----------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*                _None.                                      */
/*----------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                        */
/*                _None.                                     */
/*----------------------------------------------------*/
/*RETURN ARGUMENTS:                                             */
/*                _None.                                    */
/*=======================================*/
void GEQ_update_mem_4d_to_2d(void)

    {

    /*------------------------------------------------*/
				
				<dp n="d438"/>
    past_energyq_2d[0]=0.5*(past_energyq_4d[0]+past_energyq_4d[1]);

    past_energyq_2d[1]=0.5*(past_energyq_4d[2]+past_energyq_4d[3]);

    /*----------------------------------------------*/

    return;

    /*----------------------------------------------*/

    }
/*--------------------------------------------------*/
/*=======================================*/
/*FUNCTION         :GEQ_update_mem_2d_to_4d().                       */
/*-------------------------------------------*/
/*PURPOSE          :This function update the cross memories       */
/*                 for the gain quantizers for the transition  */
/*                 2 to 4 gains.                                 */
/*--------------------------------------------*/
/*INPUT ARGUMENTS  :                                                 */
/*                   _None.                                      */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                  */
/*                   _None.                                      */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                            */
/*                   _None.                                      */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                                  */
/*                   _None.                                      */
/*========================================*/
void GEQ_update_mem_2d_to_4d(void)

    {

    /*----------------------------------------*/

    FLOAT64 val;

    /*----------------------------------------*/

    val=0.5*(past_energyq_2d[0]+past_energyq_2d[1]);
				
				<dp n="d439"/>
    past_energyq_4d[0]=past_energyq_2d[0];

    past_energyq_4d[1]=val;

    past_energyq_4d[2]=val;

    past_energyq_4d[3]=past_energyq_2d[1];

    /*----------------------------------------------*/

    return;

    /*----------------------------------------------*/

    }
/*--------------------------------------------------*/
/*====================================*/
/*FUNCTION    :GEQ_update_mem_3d_to_2d().                     */
/*--------------------------------------------------*/
/*PURPOSE     :This function update the cross memories    */
/*            for the gain quantizers for the transition*/
/*            3 to 2 gains.                               */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*                 _None.                                    */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*                 _None.                                    */
/*--------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                        */
/*                 _None.                                    */
/*--------------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
/*                 _None.                                    */
/*====================================*/
void GEQ_update_mem_3d_to_2d(void)

    {

    /*-----------------------------------------------*/

    past_energyq_2d[0]=0.5*(past_energyq_3d[0]+past_energyq_3d[1]);

    past_energyq_2d[1]=0.5*(past_energyq_3d[1]+past_energyq_3d[2]);

    /*-----------------------------------------------*/
				
				<dp n="d440"/>
    return;

    /*-----------------------------------------------*/

    }
/*---------------------------------------------------*/
/*=====================================*/
/*FUNCTION    :GEQ_update_mem_2d_to_3d().                      */
/*---------------------------------------------------*/
/*PURPOSE     :This function update the cross memories     */
/*            for the gain quantizers for the transition*/
/*            2 to 3 gains.                               */
/*---------------------------------------------------*/
/*INPUT ARGUMENTS  :                                             */
/*                   _None.                                 */
/*---------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*                   _None.                                 */
/*---------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*                   _None.                                 */
/*---------------------------------------------------*/
/*RETURN ARGUMENTS:                                            */
/*                   _None.                                 */
/*=====================================*/
void GEQ_update_mem_2d_to_3d(void)

    {

    /*-----------------------------------------------*/

    past_energyq_3d[0]=past_energyq_2d[0];

    past_energyq_3d[1]=0.5*(past_energyq_2d[0]+past_energyq_2d[1]);

    past_energyq_3d[2]=past_energyq_2d[1];

    /*-----------------------------------------------*/

    return;

    /*-----------------------------------------------*/

    }
				
				<dp n="d441"/>
/*--------------------------------------------------*/
/*======================================*/
/*FUNCTION    :GEQ_update_mem_3d_to_4d().                 */
/*---------------------------------------------------*/
/*PURPOSE     :This fumction update the cross memories       */
/*            for the gain quantizers for the transition */
/*      3 to 4 gains.                               */
/*---------------------------------------------------*/
/*INPUT ARGUMENTS  :                                          */
/*                   _None.                               */
/*---------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                           */
/*                   _None.                               */
/*---------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                     */
/*                   _None.                               */
/*---------------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*                   _None.                               */
/*======================================*/
void GEQ_update_mem_3d_to_4d(void)

    {

    /*-----------------------------------------------*/

    past_energyq_4d[0]=past_energyq_3d[0];

    past_energyq_4d[1]=past_energyq_3d[1];

    past_energyq_4d[2]=past_energyq_3d[1];

    past_energyq_4d[3]=past_energyq_3d[2];

    /*-----------------------------------------------*/

    return:

    /*-----------------------------------------------*/

    }
/*---------------------------------------------------*/
				
				<dp n="d442"/>
/*======================================*/
/*FUNCTION    :GEQ_update_mem_4d_to_3d().                    */
/*-------------------------------------------------*/
/*PURPOSE     :This function update the cross memories       */
/*            for the gain quantizers for the transition*/
/*            4 to 3 gains.                               */
/*-----------------------------------------------*/
/*INPUT ARGUMENTS:                                             */
/*                 _None.                                 */
/#-----------------------------------------------*/
/*OUTPUT ARGUMENTS:                                           */
/*                 _None.                                */
/*-----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                    */
/*                 _None.                                */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS:                                          */
/*                 _None.                                */
/*======================================*/
void GEQ_update_mem_4d_to_3d(void)

    {

    /*-------------------------------------------*/

    past_energyq_3d[0]=past_energyq_4d[0];

    past_energyq_3d[1]=0.5*(past_energyq_4d[1]+past_energyq_4d[2]);

    past_energyq_3d[2]=past_energyq_4d[3];

    /*-------------------------------------------*/

    return;

    /*-------------------------------------------*/

    }
/*-----------------------------------------------*/
/*======================================*/
/*-----------------------END---------------------*/
/*======================================*/
				
				<dp n="d443"/>
/*================================================*/
/*===========================================*/
/*Conexant System Inc.                                           */
/*4311 Jamboree Road                                              */
/*Newport Beach,CA 92660                                          */
/*---------------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                           */
/*---------------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                    */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*===========================================*/
/*PROTOTYPE FILE:lib_geq.h                        */
/*===========================================*/
/*---------------------------------------------------------*/
/*----------------------------FUNCTIONS----------------------------*/
/*---------------------------------------------------------*/
void GEQ_init_lib  (void);
void GEQ_gainVQMA_2  (FLOAT64[],FLOAT64**,FLOAT64**,FLOAT64[],INT16*,

                INT16,INT16);
void GEQ_dec_gains_2_7(INT16,INT16,INT16,FLOAT64[],INT16,FLOAT64[],

                     INT16,INT16);
void GEQ_gainVQMA_2_8_5(FLOAT64[],FLOAT64**,FLOAT64**,FLOAT64[],INT16*,

                     INT16);
void GEQ_dec_gains_2_7_8_5(INT16,INT16,FLOAT64[],INT16,FLOAT64[],INT16,

                     INT16);
void GEQ_Quant_PitchGain_3D    (FLOAT64*,INT16*);
void GEQ_Quant_PitchGain_4D    (FLOAT64*,INT16*);
void GEQ_Dec_PitchGain_3D    (INT16,INT16,INT16,FLOAT64*);
void GEQ_Dec_PitchGain_4D    (INT16,INT16,INT16,FLOAT64*);
				
				<dp n="d444"/>
void GEQ_gainVQMA_3    (FLOAT64[],FLOAT64**,FLOAT64**,FLOAT64**,INT16*);
void GEQ_dec_gc_3_8    (INT16,FLOAT64*,INT16,FLOAT64**,INT16);
void GEQ_gainVQMA_4    (FLOAT64[],FLOAT64**,FLOAT64**,FLOAT64**,INT16*);
void GEQ_dec_gc_4_10   (INT16,FLOAT64*,INT16,FLOAT64**,INT16);
void GEQ_gainNSQMA_1_5(FLOAT64[],FLOAT64**,INT16[]);
void GEQ_dec_gains_1_5(INT16,FLOAT64**,FLOAT64[],INT16);
void GEQ_gainNSQMA_1_6(INT16,FLOAT64[],FLOAT64**,INT16[]);
void GEQ_dec_gains_1_6(INT16,INT16,FLOAT64**,FLOAT64[],INT16);
void GEQ_gain_reopt_2(FLOAT64[],FLOAT64[],FLOAT64[],FLOAT64*,

                      FLOAT64*,INT16);
void GEQ_energy_extrapolation(INT16,INT16,INT16,FLOAT64[],FLOAT64**,

                             INT16,INT16[],FLOAT64[],FLOAT64[],FLOAT64[],

                             FLOAT64[],PARAMETER);
void GEQ_update_mem_4d_to_2d(void);
void GEQ_update_mem_2d_to_4d(void);
void GEQ_update_mem_3d_to_2d(void);
void GEQ_update_mem_2d_to_3d(void);
void GEQ_update_mem_3d_to_4d(void);
void GEQ_update_mem_4d_to_3d(void);
/*=================================================*/
/*------------------------END----------------------*/
/*=================================================*/
				
				<dp n="d445"/>
/*=================================================*/
/*===========================================*/
/*Conexant System Inc.                                            */
/*4311 Jamboree Road                                               */
/*Newport Beach,CA 92660                                            */
/*------------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                            */
/*------------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                 */
/*No part of this software may be reproduced in any form or by any   */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*===========================================*/
/*LIBRARY:lib_ini.c                                                */
/*===========================================*/
/*------------------------------------------------------*/
/*---------------------------INCLUDE---------------------------*/
/*------------------------------------------------------*/
#include″typedef.h″
#include″const.h″
#include″main.h″
#include″mcutil.h″
#include″gputil.h″
#include″ext_var.h″
#include″lib_ini.h″
#include″lib_lpc.h″
#include″lib_qlsf.h″
#include″lib_geq.h″
#include″lib_vad.h″
#include″lib_ppr.h″
#include″lib_cla.h″
#include″lib_snr.h″
#include″lib_pwf.h″
#include″lib_pit.h″
#include″lib_ltp.h″
				
				<dp n="d446"/>
#include″lib_smo.h″
#include″lib_prc.h″
#include″lib_bit.h″
#include″lib_ppp.h″
#include″lib_fcs.h″
/*--------------------------------------------------*/
/*---------------------------FUNCTIONS------------------------*/
/*--------------------------------------------------*/
/*=======================================*/
/*FUNCTION    :INI_allocate_memory().                          */
/*--------------------------------------------------*/
/*PURPOSE     :This function performs memory allocation.    */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS:                                             */
/*                _None.                                  */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                           */
/*                _None.                                  */
/*--------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                     */
/*                _None.                                 */
/*--------------------------------------------------*/
/*RETURN ARGUMENTS:                                          */
/*                _None.                                 */
/*=======================================*/
void INI_allocate_memory(void)

    {

    /*----------------------------------------------*/

    /*      Memory Allocation for Time-Domain Pre Filtering    */

    /*----------------------------------------------*/

    pre_flt_num   =dvector(0,PPR_FLT_ORDER-1);

    pre_flt_den  =dvector(0,PPR_FLT_ORDER-1);

    pre_flt_buf_z=dvector(0,PPR_FLT_ORDER-1);

    pre_flt_buf_p=dvector(0,PPR_FLT_ORDER-1);

    lp_flt_num=dvector(0,LP_FLT_ORDER-1);

    lp_flt_buf=dvector(0,LP_FLT_ORDER-1);
				
				<dp n="d447"/>
/*----------------------------------------------*/
/*      Memory Allocation for Silence Enhancement        */
/*----------------------------------------------*/
zeroed    =svector(0,SE_MEM_SIZE-1);
zero_rate=dvector(0,SE_MEM_SIZE-1);
low_rate =dvector(0,SE_MEM_SIZE-1);
high_rate=dvector(0,SE_MEM_SIZE-1);
low_neg  =dvector(0,1);
low_pos  =dvector(0,1);
/*----------------------------------------------*/
/*  Memory Allocation for Tilt compansation Post Filtering      */
/*----------------------------------------------*/
tc_buff_exc=dvector(0,L_LPC-1);
/*----------------------------------------------*/
/*       Memory Allocation for Time-Domain Post Filtering        */
/*----------------------------------------------*/
buff_LTpost=dvector(0,MAX_LAG+L_SF-1);
PF_mem_syn   =dvector(0,NP-1);
/*----------------------------------------------*/
/*         Memory Allocation for Time-Domain Post Filtering      */
/*----------------------------------------------*/
pst_flt_num   =dvector(0,PPR_FLT_ORDER-1);
pst_flt_den  =dvector(0,PPR_FLT_ORDER-1);
pst_flt_buf_z=dvector(0,PPR_FLT_ORDER-1);
pst_flt_buf_p=dvector(0,PPR_FLT_ORDER-1);
/*----------------------------------------------*/
/*         Memory Allocation for Linear Prediction Analysis      */
/*----------------------------------------------*/
siglpc=dvector(0,L_LPC-1);
tilt_window=dvector(0,L_LPC-1);
				
				<dp n="d448"/>
  lpc_window =dvector(0,L_LPC-1);
  lpc_window1=dvector(0,L_LPC-1);
  lpc_window2=dvector(0,L_LPC-1);
  bwe_factor   =dvector(0,NP);
  rxx    =dvector(0,NP);
  refl   =dmatrix(0,N_SF_MAX,0,NP-1);
  lsf_new=dvector(0,NP-1);
  lsf_old=dvector(0,NP-1);
  lsf_mid=dvector(0,NP-1);
  IntLSF_C  =dvector(0,N_SF4-1);
  pdcf      =dmatrix(0,N_SF_MAX,0,NP-1);
  pdcfq     =dmatrix(0,N_SF_MAX,0,NP-1);
  pdcfq_dec =dmatrix(0,N_SF_MAX,0,NP-1);
  /*---------------------------------------------*/
  /*       Memory Allocation for the LSF quantization        */
  /*---------------------------------------------*/
  lsf_cb_08k=d3tensor(0,MAXLTT_08k-1,0,LMSMAX_08k-1,0,MAXLNp-1);
  lsf_cb_40k=d3tensor(0,MAXLTT_40k-1,0,LMSMAX_40k-1,0,MAXLNp-1);
  lsf_cb_85k=d3tensor(0,MAXLTT_85k-1,0,LMSMAX_85k-1,0,MAXLNp-1);
stage_cand_08k=svector(0,2);
stage_cand_40k=svector(0,3);
stage_cand_85k=svector(0,3);
MS_08k =svector(0,LTT_08k-1);
MS_40k =svector(0,LTT_40k-1);
MS_85k =svector(0,LTT_85k-1);
qes =dmatrix(0,LQMA_40k-1,0,NP-1);
qes_dec =dmatrix(0,LQMA_40k-1,0,NP-1);
last_qlsf =dvector(0,NP-1);
lsfq_old  =dvector(0,NP-1);
lsfq_old_dec=dvector(0,NP-1);
Mean           =dvector(0,NP-1);
				
				<dp n="d449"/>
lsfq_mem_dec =dvector(0,NP-1);
lsfq_mem_enc =dvector(0,NP-1);
/*---------------------------------------------*/
/*         Memory Allocation for Perceptual Weighting    */
/*---------------------------------------------*/
wspeech =dvector(0,L_OLPIT-1);
wspeech_mem =dvector(0,NP-1);
wpdcf_pole =dmatrix(0,N_SF_MAX,0,NP-1);
wpdcf_zero  =dmatrix(0,N_SF_MAX,0,NP-1);
tmp_ws_m    =dvector(0,NP-1);
ModiSig_m  =dvector(0,NP-1);
/*---------------------------------------------*/
/*  Memory Allocation for Impulse Response of the synthesis filter  */
/*---------------------------------------------*/
/*---------------------------------------------*/
/*    Memory Allocation for Signal Classification                    */
/*---------------------------------------------*/
frame_class_mem=svector(0,CLA_MEM_SIZE-1);
onstplsv_mem=svector(0,CLA_MEM_SIZE-1);
voiced_mem       =svector(0,CLA_MEM_SIZE-1);
buffer_cla    =dvector(0,L_FRM+MEM_CLASS+L_LPCLHD-1);
Lp_buffer     =dvector(0,N_Lp-1);
window1=dvector(0,LPC_WIN1-1);
P_w=dmatrix(0,1,0,SLOPE_MAX_SIZE-1);
buffer_refl0=dvector(0,CLA_MEM_SIZE-1);
buffer_wtilt =dvector(0,MAX_N_SF-1);
buffer_wmax   =dvector(0,MAX_N_SF-1);
buffer_wRp   =dvector(0,MAX_N_SF-1);
buffer_max_cla=dvector(0,MAX_N_SF-1);
/*---------------------------------------------*/
/*       Memory Allocation for Voice Activity Detection    */
				
				<dp n="d450"/>
/*---------------------------------------------*/
lag_buf  =svector(0,LTP_BUFF_SIZE-1);
pgain_buf=dvector(0,LTP_BUFF_SIZE-1);
flag_vad_mem=svector(0,FLAG_VAD_MEM_SIZE-1);
vad_lsf_mem=dmatrix(0,VAD_MEM_SIZE-1,0,NP-1);
min_energy_mem =dvector(0,VAD_MIN_MEM_SIZE-1);
mean_lsf    =dvector(0,NP-1);
norm_mean_lsf   =dvector(0,NP-1);
prev_cml_lsf_diff=dvector(0,VAD_MEM_SIZE-1);
prev_energy      =dvector(0,VAD_MEM_SIZE-1);
/*---------------------------------------------*/
/*   Memory Allocation for Smoothing parameters estimation    */
/*---------------------------------------------*/
lsf_smooth=dvector(0,NP-1);
N_sub=svector(0,N_SF_MAX-1);
lsf_old_smo=dvector(0,NP-1);
ma_lsf=dvector(0,NP-1);
dSP_buf=dvector(0,DSP_BUFF_SIZE-1);;
buffer_smo=dvector(0,HI_LAG2+L_SF-1);
buffer_sum_smo=dvector(0,SMO_BUFF_SIZE-1);
buffer_max_smo=dvector(0,SMO_BUFF_SIZE-1);
/*---------------------------------------------*/
/*     Memory Allocation for Open Loop Pitch Detection    */
/*---------------------------------------------*/
ol_lag=svector(0,N_SF_MAX);
lag=svector(0,N_SF_MAX);
Rp_sub=dvector(0,N_SF_MAX-1);
SincWindows=dvector(0,LEN_SINC_TAB-1);
PITmax0=svector(0,NUM_MAX_SRCH-1);
				
				<dp n="d451"/>
Rmax0  =dvector(0,NUM_MAX_SRCH-1);
pitch_f_mem=dvector(0,PIT_F_MEM-1);
PitLagTab5b=dvector(0,LEN_PITCH_TAB_5BIT-1);
PitLagTab7b=dvector(0,LEN_PITCH_TAB_7BIT-1);
PitLagTab8b=dvector(0,LEN_PITCH_TAB_8BIT-1);
/*---------------------------------------------*/
/*     Memory Allocation for Open Pitch Pre-processing    */
/*---------------------------------------------*/
SincWindows_PP=dvector(0,LEN_SINC_TAB_PP-1);
targ_mem=dvector(0,MAX_LAG-1);
/*---------------------------------------------*/
/*   Memory Allocation for Closed Loop Pitch Detection    */
/*---------------------------------------------*/
SincWindows_E=dvector(0,LEN_SINC_TAB_E-1);
NewTg=dvector(0,L_FRM+NP-1);
lag_f=dvector(0,N_SF_MAX-1);
ext  =dvector(0,MAX_LAG+L_SF-1);
/*---------------------------------------------*/
/*   Memory Allocation for Short Term Algebraic Analysis    */
/*---------------------------------------------*/
MaxIdx =svector(0,MAXPN-1);
p_track_2_5_0=smatrix(0,2-1,0,32-1);
p_track_2_7_1=smatrix(0,2-1,0,80-1);
p_track_3_2_80=s3tensor(0,16-1,0,3-1,0,4-1);
p_track_3_2_54=s3tensor(0,16-1,0,3-1,0,4-1);
p_track_5_4_0=smatrix(0,5-1,0,16-1);
p_track_5_3_1=smatrix(0,5-1,0,8-1);
p_track_5_3_2=smatrix(0,5-1,0,8-1);
				
				<dp n="d452"/>
p_track_8_4_0=smatrix(0,8-1,0,16-1);
PHI=dmatrix(0,L_SF-1,0,L_SF-1);
unfcod=dmatrix(0,1,0,L_SF-1);
fcod=dmatrix(0,1,0,L_SF-1);
qua_unfcod=dmatrix(0,1,0,L_FRM-1);
qua_fcod  =dmatrix(0,1,0,L_FRM-1);
unfcod_dec=dmatrix(0,1,0,L_SF-1);
wsp_m=dvector(0,L_WSP-1);
hh_hf=dvector(0,L_HF-1);
/*---------------------------------------------*/
/*     Memory Allocation for Gain Vector Quantisation    */
/*---------------------------------------------*/

    qua_gainQ      =dmatrix(0,1,0,N_SF_MAX-1);

    past_energyq_2d=dvector(0,GVQ_VEC_SIZE_2D-1);

    past_energyq_3d=dvector(0,GVQ_VEC_SIZE_3D-1);

    past_energyq_4d=dvector(0,GVQ_VEC_SIZE_4D-1);

    gp_buf=dyector(0,GP_BUF_SIZE-1);

    pred_energy_d38=dvector(0,GVQ_VEC_SIZE_3D-1);

    pred_energy_d410=dvector(0,GVQ_VEC_SIZE_4D-1);

    Prev_Beta_Pitch =dvector(0,BETA_BUF_SIZE-1);

    energy_pred_coeff_1=dvector(0,GVQ_VEC_SIZE_3D-1);

    energy_pred_coeff_2=dvector(0,GVQ_VEC_SIZE_3D-1);

    energy_pred_coeff_3=dvector(0,GVQ_VEC_SIZE_3D-1);

    energy_pred_coeff4d_1=dvector(0,GVQ_VEC_SIZE_4D-1);
				
				<dp n="d453"/>
    energy_pred_coeff4d_2=dvector(0,GVQ_VEC_SIZE_4D-1);

    energy_pred_coeff4d_3=dvector(0,GVQ_VEC_SIZE_4D-1);

    energy_pred_coeff4d_4=dvector(0,GVQ_VEC_SIZE_4D-1);

    gain_cb_2_128         =dmatrix(0,MSMAX_2_128-1,0,GVQ_VEC_SIZE_2D-1);

    gain_cb_2_128_8_5      =dmatrix(0,MSMAX_2_128-1,0,GVQ_VEC_SIZE_2D-1);
/*---------------------------------------------*/
/*         Memory Deallocation for bit stream             */
/*---------------------------------------------*/
bitno0=svector(0,3-1);
bitnol=svector(0,3-1);
/*---------------------------------------------*/
/*  Memory Deallocation for Frame Erasure Concealenement   */
/*---------------------------------------------*/
enrg_buff=dvector(0,ERNG_MEM_SIZE-1);
ext_dec_mem=dvector(0,MAX_LAG+L_SF-1);
/*---------------------------------------------*/
/*        Memory Allocation for Speech Synthesis          */
/*---------------------------------------------*/
synth_mem      =dvector(0,NP-1);
synth_mem_dec  =dvector(0,NP-1);
dif_mem     =dvector(0,L_SF+NP-1);
target_mem     =dvector(0,NP-1);
qua_synth_mem  =dvector(0,NP-1);
qua_dif_mem=dvector(0,L_SF+NP-1);
qua_target_mem=dvector(0,NP-1);
qua_ext=dvector(0,MAX_LAG+L_SF-1);
sigsyn_dec  =dvector(0,L_SF+NP-1);
ext_dec=dvector(0,MAX_LAG+L_SF-1);
/*---------------------------------------------*/
				
				<dp n="d454"/>
    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*=====================================*/
/*FUNCTION    :INI_deallocate_memory().                       */
/*-------------------------------------------------*/
/*PURPOSE     :This function performs memory deallocation.  */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*                 _None.                                 */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
/*                 _None.                                  */
/*-------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*                 _None.                                  */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                             */
/*                 _None.                                 */
/*======================================*/
void INI_deallocate_memory(void)

    {

    /*---------------------------------------------*/

    /*   Memory Deallocation for Time-Domain Pre Filtering    */

    /*---------------------------------------------*/

    free_dvector(pre_flt_num,0,PPR_FLT_ORDER-1);

    free_dvector(pre_flt_den,0,PPR_FLT_ORDER-1);

    free_dvector(pre_flt_buf_z,0,PPR_FLT_ORDER-1);

    free_dvector(pre_flt_buf_p,0,PPR_ELT_ORDER-1);

    free_dvector(lp_flt_num,0,LP_FLT_ORDER-1);

    free_dvector(lp_flt_buf,0,LP_FLT_ORDER-1);

    /*---------------------------------------------*/

    /*   Memory Deallocation for Time-Domain Silence Enhancement    */
				
				<dp n="d455"/>
    /*---------------------------------------------*/

    free_svector(zeroed,0,SE_MEM_SIZE-1);

    free_dvector(zero_rate,0,SE_MEM_SIZE-1);

    free_dvector(low_rate,0,SE_MEM_SIZE-1);

    free_dvector(high_rate,0,SE_MEM_SIZE-1);

    free_dvector(low_neg,0,1);

    free_dvector(low_pos,0,1);

    /*---------------------------------------------*/

    /*  Memory Deallocation for Tilt compansation Post Filtering    */

    /*---------------------------------------------*/

    free_dvector(tc_buff_exc,0,L_LPC-1);

    /*---------------------------------------------*/

    /*  Memory Deallocation for Time-Domain Post Filtering           */

    /*---------------------------------------------*/

    free_dvector(buff_LTpost,0,MAX_LAG+L_SF-1);

    free_dvector(PF_mem_syn,0,NP-1);

    /*---------------------------------------------*/

    /*   Memory Deallocation for Time-Domain Post Filtering           */

    /*---------------------------------------------*/

    free_dvector(pst_flt_num,0,PPR_FLT_ORDER-1);

    free_dvector(pst_flt_den,0,PPR_FLT_ORDER-1);

    free_dvector(pst_flt_buf_z,0,PPR_FLT_ORDER-1);

    free_dvector(pst_flt_buf_p,0,PPR_FLT_ORDER-1);

    /*---------------------------------------------*/

    /*    Memory Deallocation for Linear Prediction Analysis         */

    /*---------------------------------------------*/

    free_dvector(siglpc,         0,L_LPC-1);

    free_dvector(tilt_window,0,L_LPC-1);

    free_dvector(lpc_window,     0,L_LPC-1);

    free_dvector(lpc_window1,    0,L_LPC-1);

    free_dvector(lpc_window2,0,L_LPC-1);

    free_dvector(bwe_factor,0,NP);
				
				<dp n="d456"/>
    free_dvector(rxx,0,NP);

    free_dmatrix(refl,0,N_SF_MAX,0,NP-1);

    free_dvector(lsf_new,0,NP-1);

    free_dvector(lsf_old,0,NP-1);

    free_dvector(lsf_mid,0,NP-1);

    free_dvector(IntLSF_C,0,N_SF4-1);

    free_dmatrix(pdcf,0,N_SF_MAX,0,NP-1);

    free_dmatrix(pdcfq,0,N_SF_MAX,0,NP-1);

    free_dmatrix(pdcfq_dec,0,N_SF_MAX,0,NP-1);

    /*---------------------------------------------*/

    /*       Memory Allocation for the LSF quantization        */

    /*---------------------------------------------*/

    free_d3tensor(lsf_cb_08k,0,MAXLTT_08k-1,0,LMSMAX_08k-1,

                        0,MAXLNp-1);

    free_d3tensor(lsf_cb_40k,0,MAXLTT_40k-1,0,LMSMAX_40k-1,

                        0,MAXLNp-1);

    free_d3tensor(lsf_cb_85k,0,MAXLTT_85k-1,0,LMSMAX_85k-1,

                        0,MAXLNp-1);

    free_svector(stage_cand_08k,0,2);

    free_svector(stage_cand_40k,0,3);

    free_svector(stage_cand_85k,0,3);

    free_svector(MS_08k,0,LTT_08k-1);

    free_svector(MS_40k,0,LTT_40k-1);

    free_svector(MS_85k,0,LTT_85k-1);

    free_dmatrix(qes,        0,LQMA_40k-1,0,NP-1);

    free_dmatrix(qes_dec,0,LQMA_40k-1,0,NP-1);

    free_dvector(last_qlsf,0,NP-1);

    free_dvector(lsfq_old,0,NP-1);

    free_dvector(lsfq_old_dec,0,NP-1);

    free_dvector(Mean,0,NP-1);

    free_dvector(lsfq_mem_dec,0,NP-1);
				
				<dp n="d457"/>
    free_dvector(lsfq_mem_enc,0,NP-1);

    /*---------------------------------------------*/

    /*       Memory Deallocation for Perceptual Weighting       */

    /*---------------------------------------------*/

    free_dvector(wspeech,     0,L_OLPIT-1);

    free_dvector(wspeech_mem,0,NP-1);

    free_dmatrix(wpdcf_pole,0,N_SF_MAX,0,NP-1);

    free_dmatrix(wpdcf_zero,0,N_SF_MAX,0,NP-1);

    free_dvector(tmp_ws_m,   0,NP-1);

    free_dvector(ModiSig_m,  0,NP-1);

    /*---------------------------------------------*/

    /*Memory Deallocation for Impulse Response of the synthesis filter*/

    /*---------------------------------------------*/

    /*---------------------------------------------*/

    /*   Memory Deallocation for Signal Classifcation                 */

    /*---------------------------------------------*/

    free_svector(frame_class_mem,0,CLA_MEM_SIZE-1);

    free_svector(onstplsv_mem,0,CLA_MEM_SIZE-1);

    free_svector(voiced_mem,0,CLA_MEM_SIZE-1);

    free_dvector(buffer_cla,0,L_FRM+MEM_CLASS+L_LPCLHD-1);

    free_dvector(Lp_buffer,0,N_Lp-1);

    free_dvector(window1,0,LPC_WIN1-1);

    free_dmatrix(P_w,0,1,0,SLOPE_MAX_SIZE-1);

    free_dvector(buffer_refl0,0,CLA_MEM_SIZE-1);

    free_dvector(buffer_wtilt,0,MAX_N_SF-1);

    free_dvector(buffer_wmax,     0,MAX_N_SF-1);

    free_dvector(buffer_wRp,      0,MAX_N_SF-1);

    free_dvector(buffer_max_cla,0,MAX_N_SF-1);

    /*---------------------------------------------*/

    /*    Memory Deallocation for Voice Activity Detection            */

    /*---------------------------------------------*/
				
				<dp n="d458"/>
    free_svector(lag_buf, 0,LTP_BUFF_SIZE-1);

    free_dvector(pgain_buf,0,LTP_BUFF_SIZE-1);

    free_svector(flag_vad_mem,0,FLAG_VAD_MEM_SIZE-1);

    free_dmatrix(vad_lsf_mem,   0,VAD_MEM_SIZE-1,0,NP-1);

    free_dvector(min_energy_mem,0,VAD_MIN_MEM_SIZE-1);

    free_dvector(mean_lsf,0,NP-1);

    free_dvector(norm_mean_lsf,0,NP-1);

    free_dvector(prev_cml_lsf_diff,0,VAD_MEM_SIZE-1);

    free_dvector(prev_energy,0,VAD_MEM_SIZE-1);

    /*---------------------------------------------*/

    /*  Memory Deallocation for Smoothing parameters estimation    */

    /*---------------------------------------------*/

    free_dvector(lsf_smooth,0,NP-1);

    free_svector(N_sub,0,N_SF_MAX-1);

    free_dvector(lsf_old_smo,0,NP-1);

    free_dvector(ma_lsf,0,NP-1);

    free_dvector(dSP_buf,0,DSP_BUFF_SIZE-1);;

    free_dvector(buffer_smo,0,HI_LAG2+L_SF-1);

    free_dvector(buffer_sum_smo,0,SMO_BUFF_SIZE-1);

    free_dvector(bufffer_max_smo,0,SMO_BUFF_SIZE-1);

    /*---------------------------------------------*/

    /*  Memory Deallocation for Open Loop Pitch Detection    */

    /*---------------------------------------------*/

    free_svector(ol_lag,0,N_SF_MAX);

    free_svector(lag,   0,N_SF_MAX);

    free_dvector(Rp_sub,0,N_SF_MAX-1);

    free_dvector(SincWindows,0,LEN_SINC_TAB-1);

    free_svector(PITmax0,0,NUM_MAX_SRCH-1);

    free_dvector(Rmax0,  0,NUM_MAX_SRCH-1);
				
				<dp n="d459"/>
    free_dvector(pitch_f_mem,0,PIT_F_MEM-1);

    free_dvector(PitLagTab5b,    0,LEN_PITCH_TAB_5BIT-1);

    free_dvector(PitLagTab7b,    0,LEN_PITCH_TAB_7BIT-1);

    free_dvector(PitLagTab8b,    0,LEN_PITCH_TAB_8BIT-1);

    /*---------------------------------------------*/

    /*     Memory Deallocation for Open Pitch Pre-processing       */

    /*---------------------------------------------*/

    free_dvector(SincWindows_PP,0,LEN_SINC_TAB_PP-1);

    free_dvector(targ_mem,0,MAX_LAG-1);

    /*---------------------------------------------*/

    /*   Memory Deallocation for Closed Loop Pitch Detection    */

    /*---------------------------------------------*/

    free_dvector(SincWindows_E,0,LEN_SINC_TAB_E-1);

    free_dvector(NewTg,0,L_FRM+NP-1);

    free_dvector(lag_f,0,N_SF_MAX-1);

    free_dvector(ext,0,MAX_LAG+L_SF-1);

    /*---------------------------------------------*/

    /*  Memory Allocation for Residual and target signal buffer  */

    /*---------------------------------------------*/

    /*---------------------------------------------*/

    /*  Memory Deallocation for Short Term Algebraic Analysis    */

    /*---------------------------------------------*/

    free_svector(MaxIdx,0,MAXPN-1);

    free_dmatrix(PHI,0,L_SF-1,0,L_SF-1);

    free_smatrix(p_track_2_5_0,0,2-1,0,32-1);

    free_smatrix(p_track_2_7_1,0,2-1,0,80-1);

    free_s3tensor(p_track_3_2_80,0,16-1,0,3-1,0,4-1);

    free_s3tensor(p_track_3_2_54,0,16-1,0,3-1,0,4-1);
				
				<dp n="d460"/>
    free_smatrix(p_track_5_4_0,0,5-1,0,16-1);

    free_smatrix(p_track_5_3_1,0,5-1,0,8-1);

    free_smatrix(p_track_5_3_2,0,5-1,0,8-1);

    free_smatrix(p_track_8_4_0,0,8-1,0,16-1);

    free_dmatrix(unfcod,0,1,0,L_SF-1);

    free_dmatrix(fcod,0,1,0,L_SF-1);

    free_dmatrix(qua_unfcod,0,1,0,L_FRM-1);

    free_dmatrix(qua_fcod,0,1,0,L_FRM-1);

    free_dmatrix(unfcod_dec,0,1,0,L_SF-1);

    free_dvector(wsp_m,0,L_WSP-1);

    free_dvector(hh_hf,0,L_HF-1);

    /*---------------------------------------------*/

    /*     Memory Deallocation for Gain Vector Quantisation    */

    /*---------------------------------------------*/

    free_dmatrix(qua_gainQ,0,1,0,N_SF_MAX-1);

      free_dvector(past_energyq_2d,0,GVQ_VEC_SIZE_2D-1);

      free_dvector(past_energyq_3d,0,GVQ_VEC_SIZE_3D-1);

      free_dvector(past_energyq_4d,0,GVQ_VEC_SIZE_4D-1);

      free_dvector(gp_buf,0,GP_BUF_SIZE-1);

      free_dvector(pred_energy_d38,0,GVQ_VEC_SIZE_3D-1);

      free_dvector(pred_energy_d410,0,GVQ_VEC_SIZE_4D-1);

      free_dvector(Prev_Beta_Pitch,0,BETA_BUF_SIZE-1);

      free dvector(energy_pred_coeff_1,0,GVQ_VEC_SIZE_3D-1);

      free_dvector(energy_pred_coeff_2,0,GVQ_VEC_SIZE_3D-1);

      free_dvector(energy_pred_coeff_3,0,GVQ_VEC_SIZE_3D-1);
				
				<dp n="d461"/>
      free_dvector(energy_pred_coeff4d_1,0,GVQ_VEC_SIZE_4D-1);

      free_dvector(energy_pred_coeff4d_2,0,GVQ_VEC_SIZE_4D-1);

      free_dvector(energy_pred_coeff4d_3,0,GVQ_VEC_SIZE_4D-1);

      free_dvector(energy_pred_coeff4d_4,0,GVQ_VEC_SIZE_4D-1);

      free_dmatrix(gain_cb_2_128,0,MSMAX_2_128-1,0,GVQ_VEC_SIZE_2D-1);

      free_dmatrix(gain_cb_2_128_8_5,0,MSMAX_2_128-1,0,GVQ_VEC_SIZE_2D-1);

    /*---------------------------------------------*/

    /*         Memory Deallocation for bit stream               */

    /*---------------------------------------------*/

    free_svector(bitno0,0,3-1);

    free_svector(bitno1,0,3-1);

    /*---------------------------------------------*/

    /*   Memory Deallocation for Frame Erasure Concealenement    */

    /*---------------------------------------------*/

    free_dvector(enrg_buff,0,ERNG_MEM_SIZE-1);

    free_dvector(ext_dec_mem,0,MAX_LAG+L_SF-1);

    /*---------------------------------------------*/

    /*      Memory Deallocation for Speech Synthesis             */

    /*---------------------------------------------*/

    free_dvector(synth_mem,0,NP-1);

    free_dvector(synth_mem_dec,0,NP-1);

    free_dvector(dif_mem,0,L_SF+NP-1);

    free_dvector(target_mem,0,NP-1);

    free_dvector(qua_synth_mem,0,NP-1);

    free_dvector(qua_dif_mem,0,L_SF+NP-1);

    free_dvector(qua_target_mem,0,NP-1);

    free_dvector(qua_ext,0,MAX_LAG+L_SF-1);

    free_dvector(sigsyn_dec,0,L_SF+NP-1);

    free_dvector(ext_dec,0,MAX_LAG+L_SF-1);

    /*---------------------------------------------*/
				
				<dp n="d462"/>
    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*=====================================*/
/*FUNCTION  :INI_parameters_setup().                           */
/*-------------------------------------------------*/
/*PURPOSE   :Performs the encoder parameter initialisation.  */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:                                              */
/*      _(INT32)argc:number of input parameters.            */
/*      _(char*[])argv:pointer to the input parameters.   */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
/*      _(FILE**)fp_speech_in:input speech file.             */
/*      _(FILE**)fp_bitstream:input speech file.            */
/*      _(FILE**)fp_mode:      input speech file.            */
/*      _(FILE**)fp_signaling:input speech file.            */
/*      _(INT16**)smv_mode:     SMV mode.                      */
/*-------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*              _None.                                      */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                               */
/*               _None.                                    */
/*========================================*/
void INI_parameters_setup(INT32 argc,char*argv[],FILE**fp_speech_in,

     FILE**fp_bitstream,FILE**fp_mode,FILE**fp_signaling,

     INT16*smv_mode)

     {

     /*---------------------------------------------*/

     INT16 i,non_switch_cnt;

     /*---------------------------------------------*/

     /*                   Initialisation                      */

     /*---------------------------------------------*/
				
				<dp n="d463"/>
*fp_speech_in=NULL;
*fp_bitstream=NULL;
*fp_mode        =NULL;
*fp_signaling=NULL;
/*---------------------------------------------*/
if(argc<5)

    {

    printf(″Usage:%s-m M[-f mode_file][-s signaling_file]″,

                     argv[0]);

    printf(″input_speech_file output_bitstream_file\n″);

    exit(1);

    }
else

    {

    i=1;

    (*smv_mode)=0;

    non_switch_cnt=0;

    while(i<argc)

        {

        if(argv[i][0]!=′-′)

             {

             if(non_switcn_cnt>2)

                 nrerror(″Usage:smv_enc-mM[-f mode_file]

                 [-s signaling_file]input_speech_file

                       output_bitstream_file\n″);

             if(non_switch_cnt==0)

                 {

                 *fp_speech_in=file_open_rb(argv[i]);

                 printf(″Input speech file  :%s\n″,argv[i]);

                 non_switch_cnt++;

                 }

             else

                 {

                 *fp_bitstream=file_open_wb(argv[i]);

                 printf(″Output bitstream file:%s\n″,argv[i]);

                 non_switch_cnt++;

                 }

             i++;
				
				<dp n="d464"/>
        }

    else

        {

        switch(argv[i][1])

            {

            case′m′:i++;

                         (*smv_mode)=atoi(argv[i]);

                         if(((*smv_mode)<0)‖((*smv_mode)>2))

                             {

                              printf(″SMV mode=%hd(0,1,and

                                         2 allowed)\n″,(*smv_mode));

                              exit(0);

                              }

                         i++;

                break;

            case′f:i++;

                         *fp_mode=fopen(argv[i]″r″);

                         printf(″Mode control file:%s\n″,argv[i]);

                         i++;

                break;

            case′s′:i++;

                         *fp_signaling=file_open_rb(argv[i]);

                         printf(″Signaling file:%s\n″,argv[i]);

                         i++;

                break;

            default:printf(″Usage:%s-m M[-f mode_file][-s signaling_file]″,

                                         argv[0]);

                         printf(″input_speech_file output_bitstream_file\n″);

                         exit(1);

                break;

             }

          }

       }

    }
/*---------------------------------------------*/
return;
				
				<dp n="d465"/>
    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*======================================*/
/*FUNCTION  :INI_ini_decoder().                            */
/*-------------------------------------------------*/
/*PURPOSE   :Performs the encoder initialisation.        */
/*-------------------------------------------------*/
/*ALGORITHM:                                                */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS  :                                         */
/*              _None.                                   */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                            */
/*              _None.                                   */
/*-------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                        */
/*              _None.                                      */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                             */
/*              _None.                                      */
/*========================================*/
void INI_ini_encoder(void)

    {

    /*---------------------------------------------*/

    fix_rate=RATE8_5K;

    /*---------------------------------------------*/

    BIT_init_lib();

    PPR_silence_enhan_init();

    PPR_filters_init();

    VAD_init_lib();

    CLA_init_lib();

    PPP_init_lib();

    PIT_init_lib();

    GEQ_init_lib();
				
				<dp n="d466"/>
    LPC_init_lib();

    PWF_init_lib();

    SMO_init_lib();

    LSF_Q_init_lib();

      SNR_init_lib();

    FCS_init_lib();

    LTP_init_lib();

    PRC_init_lib();

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*========================================*/
/*FUNCTION :INI_init_decoder().                              */
/*-------------------------------------------------*/
/*PURPOSE  :Performs the decoder initialisation.           */
/*-------------------------------------------------*/
/*ALGORITHM:                                                 */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:                                              */
/*               _None.                                     */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*               _None.                                     */
/*-------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                        */
/*               _None.                                    */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                             */
/*               _None.                                   */
/*========================================*/
void INI_init_decoder(void)

     {

     /*---------------------------------------------*/
				
				<dp n="d467"/>
    fix_rate_mem=RATE8_5K;

    past_bfi  =0;

    ppast_bfi =0;

    bfi_caution=0;

       nbfi_count=MAX_BFI_COUNT;

    N_bfi=0;

    bfh_oh=0;

    /*---------------------------------------------*/

    BIT_init_lib();

    GEQ_init_lib();

    PPR_filters_init();

    LPC_init_lib();

    LSF_Q_init_lib();

    CLA_init_lib();

    FCS_init_lib();

    LTP_init_lib();

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*========================================*/
/*-------------------------END------------------------*/
/*========================================*/
				
				<dp n="d468"/>
/*========================================*/
/*=====================================*/
/*Conexant System Inc.                                          */
/*4311 Jamboree Road                                             */
/*Newport Beach,CA 92660                                         */
/*-------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                           */
/*-------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*=====================================*/
/*PROTOTYPE FILE:lib_ini.h                                            */
/*=====================================*/
/*-------------------------------------------------*/
/*-----------------------FUNCTIONS------------------------*/
/*-------------------------------------------------*/
void INI_allocate_memory   (void);
void INI_deallocate_memory (void);
void INI_parameters_setup  (INT32,char*[],FILE**,FILE**,FILE**,

                           FILE**,INT16*);
void INI_init_encoder      (void);
void INI_init_decoder      (void);
/*========================================*/
/*----------------------END----------------------*/
/*========================================*/
				
				<dp n="d469"/>
/*========================================*/
/*===================================*/
/*Conexant System Inc.                                          */
/*4311 Jamboree Road                                             */
/*Newport BeachCA 92660                                           */
/*-------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                         */
/*-------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                              */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*=====================================*/
/*LIBRARY:lib_io.c                                                  */
/*=====================================*/
/*-------------------------------------------------*/
/*-------------------------INCLUDE-------------------------*/
/*-------------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″mcutil.h″
#include″lib_io.h″
#include″lib_swb.h″
/*-------------------------------------------------*/
/*-------------------------FUNCTIONS-------------------------*/
/*-------------------------------------------------*/
/*=====================================*/
/*FUNCTION    :IO_readsamples().                             */
/*-------------------------------------------------*/
/*PURPOSE     :This function reads one block from the input */
/*            file.                                        */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
				
				<dp n="d470"/>
/*      _(FILE*)     file_x:input file.                */
/*      _(INT32)     N:       number of samples to be     */
/*                             extracted.                */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                           */
/*       _(FLOAT64[])x:        extracted frame.           */
/*       _(INT16[])s_x:      extrac.frame short format.*/
/*-------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*             _None.                                    */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*             _None.                                    */
/*========================================*/
INT32    IO_readsamples(FILE*file_x,INT16s_x[],FLOAT64x[],INT32N)

    {

    /*---------------------------------------------*/

    INT32    rd_samp,i,r_val;

    /*---------------------------------------------*/

    rd_samp=fread(s_x,sizeof(INT16),N,file x);

    /*---------------------------------------------*/

    if(rd_samp>0)

        {

        for(i=0;i<N;i++)

            {
#ifdefBYTE_SWAP_INPUT

            s_x[i]=byte_swap_int16(s_x[i]);
#endif

            x[i]=(FLOAT64)s_x[i];

            }

        r_val=rd_samp;

    }
				
				<dp n="d471"/>
    else

         r_val=0:

    /*---------------------------------------------*/

    return  r_val;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*========================================*/
/*FUNCTION    :IO_writesamples().                                */
/*-------------------------------------------------*/
/*PURPOSE     :This function write one block into the output  */
/*            file.                                          */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS  :                                             */
/*        _(FILE*)     file_y:output file.                 */
/*        _(INT32)     N:number of samples to write.          */
/*        _(FLOAT64[])y: output frame.                       */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                 */
/*        _(INT16[])s_y:output frame short format.          */
/*-------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*               _None.                                      */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
/*               _None.                                   */
/*========================================*/
INT32  IO_writesamples(FILE*file_y,FLOAT64y[],INT16 s_y[],INT32N)

    {

    /*---------------------------------------------*/

    INT32i,wt_samp;

    FLOAT64 tmp;

    /*---------------------------------------------*/
				
				<dp n="d472"/>
    for(i=0;i<N;i++)

        {

        tmp=y[i];

        if(tmp>=0.0)

             tmp+=0.5;

        else

             tmp-=0.5;

        if(tmp>32767.0);

             tmp=32767.0;

        if(tmp<-32768.)

             tmp=-32768.;

        if((INT16)tmp<0.0)

             s_y[i]=(INT16)tmp+2;

        else

             s_y[i]=(INT16)tmp;
#ifdef BYTE_SWAP_OUTPUT

        s_y[i]=byte_swap_int16(s_y[i]);
#endif

        }

    wt_samp=fwrite(s_y,sizeof(INT16),N,file_y);

    /*---------------------------------------------*/
#ifdef VERBOSE

    if(wt_samp!= N)

         nrerror(″Error Writing output Samples!″);
#endif

    /*---------------------------------------------*/

    return  wt_samp;

    /*---------------------------------------------*/

    }
				
				<dp n="d473"/>
/*-------------------------------------------------*/
/*========================================*/
/*-------------------------END-------------------------*/
/*========================================*/
/*========================================*/
/*=====================================*/
/*Conexant System Inc.                                          */
/*4311 Jamboree Road                                             */
/*Newport Beach,CA 92660                                          */
/*-------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                             */
/*-------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                  */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*=====================================*/
/*PROTOTYPE FILE:lib_io.h                                            */
/*=====================================*/
/*-------------------------------------------------*/
/*-------------------------FUNCTIONS-------------------------*/
/*-------------------------------------------------*/
INT32    IO_readsamples    (FILE*,INT16[],FLOAT64[],INT32);
INT32    IO_writesamples(FILE*,FLOAT64[],INT16[],INT32);
/*========================================*/
/*-------------------------END-------------------------*/
/*========================================*/
				
				<dp n="d474"/>
/*========================================*/
/*=====================================*/
/*Conexant System Inc.                                           */
/*4311 Jamboree Road                                              */
/*Newport Beach,CA 92660                                          */
/*-------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                            */
/*-------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                  */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation   */
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*=====================================*/
/*LIBRARY:lib_lpc.c                                                */
/*=====================================*/
/*-------------------------------------------------*/
/*-------------------------INCLUDE-------------------------*/
/*-------------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″mcutil.h″
#include″gputil.h″
#include″ext_var.h″
#include″lib_flt.h″
#include″lib_lpc.h″
/*-------------------------------------------------*/
/*-------------------------DEFINE-------------------------*/
/*-------------------------------------------------*/
#define       NB_BIS         5
#define       MAX_LPC_ORDER       50
#define       RESL           0.005
#define       NBIS           6
#define       PI2      6.283185307179586
				
				<dp n="d475"/>
/*-------------------------------------------------*/
/*-------------------------FUNCTIONS-------------------------*/
/*-------------------------------------------------*/
/*========================================*/
/*FUNCTION    :LPC_init_lib().                                         */
/*-------------------------------------------------*/
/*PURPOSE     :This function performs the initialisation of the  */
/*            global variables of the LPC library.             */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS  :                                                */
/*                   _None.                                   */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                 */
/*                   _None.                                  */
/*-------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                         */
/*                   _None.                                 */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                               */
/*                   _None.                                */
/*========================================*/
void LPC_init_lib(void)

    {

    /*----------------------------------------------*/

    INT16  i,l;

    FLOAT64 x,y;

    /*----------------------------------------------*/

    /*             Generate the LPC Hamming window          */

    /*----------------------------------------------*/

    1=L_LPC/2;

    for(i=0;i<1;i++)

        {

        x=cos(i*PI/(FLOAT64)1);

        lpc_window[i]=0.54-0.46*x;

        }
				
				<dp n="d476"/>
for(i=1;i<L_LPC;i++)

    {

    x=cos((i-1)*PI/(FLOAT64)(L_LPC-1));

    lpc_window[i]=0.54+0.46*x;

    }
/*-------------------------------------------------*/
/*    Generate the LPC Hamming window for the last sub-frame         */
/*-------------------------------------------------*/
1=L_LPC-(L_LPCLHD+L_SF4/2-10);
for(i=0;i<1;i++)

    {

    x=cos(i*PI/(FLOAT64)1);

    lpc_window1[i]=0.54-0.46*x;

    }
for(i=1;i<L_LPC;i++)

    {

    x=cos((i-1)*PI/(FLOAT64)(L_LPC-1));

    lpc_window1[i]=0.54+0.46*x;

    }
/*-------------------------------------------------*/
/*             Generate the window for look ahead                  */
/*-------------------------------------------------*/
1=L_LPC-L_LPCLHD/2;
for(i=0;i<1;i++)

    {

    x=cos(i*PI/(FLOAT64)1);

    lpc_window2[i]=0.54-0.46*x;

    }
for(i=1;i<L_LPC;i++)

    {

    x=cos((i-1)*0.48*PI/(FLOAT64)(L_LPC-1));

    lpc_window2[i]=x;

    }
				
				<dp n="d477"/>
    /*----------------------------------------------*/

    /*        Generate the 60 Hz bandwidth expansion factor    */

    /*            with white noise correction factor        */

    /*----------------------------------------------*/

    bwe_factor[0]=1.0001;

    x=2.0*PI*60.0/FS;

    for(i=1;i<NP+1;i++)

        {

         y=-0.5*s+(x*(FLOAT64)i);

         bwe_factor[i]=exp(y);

         }

    /*----------------------------------------------*/

    erg  =0.0;

    lpcgain=0.0;

    /*----------------------------------------------*/

    sub_lpcg=0.0;

    /*----------------------------------------------*/

    /*          LPC Adaptive Interpolation Coeffcients       */

    /*----------------------------------------------*/

    IntLSF_C[0]=0.5;

    IntLSF_C[1]=0.6;

    IntLSF_C[2]=0.7;

    IntLSF_C[3]=0.8;

    /*----------------------------------------------*/

    return;

    /*----------------------------------------------*/

    }
/*--------------------------------------------------*/
/*========================================*/
/*FUNCTION    :LPC_analysis().                              */
				
				<dp n="d478"/>
/*-------------------------------------------------*/
/*PURPOSE        :This function performs windowing.         */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:                                            */
/*      _(INT16)    l_lpc:      LPC frame size.             */
/*      _(FLOAT64[])sig:        input frame.               */
/*      _(FLOAT64[])lpc_window:analysis window.              */
/*      _(FLOAT64[])bwe_factor:bandwidth expansion            */
/*      _(INT16)Order:prediction order.                   */
/*      _(INT16)flag_flat:flat speech flag.              */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*      _(FLOAT64[])rxx:         autocrrelation function.      */
/*      _(FLOAT64[])refl:      output reflection coeff       */
/*      _(FLOAT64*)pderr:         output LPC prediction error. */
/*      _(FLOAT64[])lpc_alpha:output LP filter coeff         */
/*      _(FLOAT64[])lsf:     line spectrum frequencies.      */
/*      _(FLOAT64*)lpc_gain:   output LPC gain.                 */
/*-------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                            */
/*                  _None.                                    */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                                */
/*                  _None.                                   */
/*========================================*/
void LPC_analysis(INT16 l_lpc,FLOAT64 sig[],FLOAT64 lpc_window[],

              FLOAT64 rxx[],FLOAT64 bwe_factor[],FLOAT64 refl[],

              FLOAT64*pderr,FLOAT64 lpc_alpha[],FLOAT64 lsf[],

              INT16 LPC_ORDER,FLOAT64*lpcgain,INT16 flag_flat)

    {

    /*----------------------------------------------*/

    FLOAT64 w,energy,val;

    INT16 i;

    /*----------------------------------------------*/

    energy=0.0;

    for(i=0;i<l_lpc;i++)

        energy+=(INT16)sig[i]*(INT16)sig[i];
				
				<dp n="d479"/>
    if(energy==0.0)

         {

         ini_dvector(lpc_alpha,0,LPC_ORDER-1,0.0);

         ini_dvector(rxx,0,LPC_ORDER,0.0);

         ini_dvector(refl,0,LPC_ORDER-1,0.0);

         (*pderr)=0.0;

         (*lpcgain)=-DBL_MAX;

         }

    else

         {

    /*----------------------------------------------*/

    /*           Windowing for Linear Prediction Analysis    */

    /*----------------------------------------------*/

    mul_dvector(sig,lpc_window,siglpc,0,l_lpc-1);

    /*----------------------------------------------*/

    /*                  Autocorrelation Function             */

    /*----------------------------------------------*/

    LPC_autocorrelation(siglpc,l_lpc,rxx,(INT16)(LPC_ORDER+1));

    /*----------------------------------------------*/

    /*                      Bandwidth Expansion              */

    /*----------------------------------------------*/

    mul_dvector(rxx,bwe_factor,rxx,0,LPC_ORDER);

    /*----------------------------------------------*/

    /*                 Leroux-Gueguen Recursion              */

    /*----------------------------------------------*/

    LPC_leroux_gueguen(rxx,refl,pderr,LPC_ORDER);

    /*----------------------------------------------*/

    /*        PARCOR to prediction coefficient convertion    */

    /*----------------------------------------------*/
				
				<dp n="d480"/>
    LPC_refl2pred(refl,lpc_alpha,LPC_ORDER);

    /*----------------------------------------------*/

    /*                     Bandwith expassion                  */

    /*----------------------------------------------*/

    (*lpcgain)=-10.*log10((*pderr)/(rxx[0]+EPSI));

    /*----------------------------------------------*/

    if(flag_flat==1)

         {

         if((*lpcgain)<10.0)

               w=0.995;

         else if((*lpcgain)<20.0)

               w=0.995;

         else

               w=0.995;

         }

    else

         {

         if((*lpcgain)<10.0)

               w=0.995;

         else

              {

              if((*lpcgain)<20.0)

                    w=0.99;

              else

                    w=0.98;

              }

       }

        /*----------------------------------------------*/

    val=1.0;

    for(i=0;i<LPC_ORDER;i++)

        {

        val*=w;

        lpc_alpha[i]*=val;

        }

    /*----------------------------------------------------*/
				
				<dp n="d481"/>
          }

    /*----------------------------------------------*/

    /*                       LPC to LSP CONVERSION          */

    /*----------------------------------------------*/

    LPC_lpctolsf(lpc_alpha,lsf,LPC_ORDER);

    /*----------------------------------------------*/

    return;

    /*----------------------------------------------*/

    }
/*--------------------------------------------------*/
/*========================================*/
/*FUNCTION    :LPC_refl2pred().                                   */
/*--------------------------------------------------*/
/*PURPOSE     :This function calculate the prediction coeff.  */
/*            using the PARCOR coefficients.                     */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS:                                                   */
/*        _(FLOAT64[])refl        :output reflection coeff.    */
/*        _(INT16)LPC_ORDER:LPC order.                              */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                    */
/*        _(FLOAT64[])a    :output LP filter coeff.             */
/*--------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                            */
/*                   _None.                                   */
/*--------------------------------------------------*/
/*RETURN ARGUMENTS:                                                */
/*                   _None.                                 */
/*========================================*/
void LPC_refl2pred(FLOAT64 refl[],FLOAT64 a[],INT16 LPC_ORDER)

    {

    /*----------------------------------------------*/

    INT32      m,n,j;
				
				<dp n="d482"/>
    FLOAT64         x;

    /*----------------------------------------------*/

    for(m=0;m<LPC_ORDER;m++)

        {

        /*----------------------------------------------*/

        a[m]=-refl[m];

        /*----------------------------------------------*/

        for(j=0;j<m/2;j++)

            {

             n  =m-1-j;

             x  =a[j]+refl[m]*a[n];

             a[n]=a[n]+refl[m]*a[j];

             a[j]=x;

              }

        /*----------------------------------------------*/

        /*     Update the prediction coefficients every 2 cycles    */

        /*----------------------------------------------*/

        if(m&amp;1)

              a[m/2]=a[m/2]+refl[m]*a[m/2];

        /*----------------------------------------------*/

        }                                                           .

    /*----------------------------------------------*/

    return:

    /*----------------------------------------------*/

    }
/*--------------------------------------------------*/
/*========================================*/
/*FUNCTION          :LPC_leroux_gueguen().                    */
				
				<dp n="d483"/>
/*--------------------------------------------------*/
/*PURPOSE          :This function performs Leroux Gueguen recursion. */
/*                                                               */
/*This subroutine implements a modified form of Durbin′s             */
/*algorithm for solving a set of auto-correlation equations.This  */
/*routine uses an intermediate variable which is constrained to    */
/*be less than the energy of the signal,i.e.r[0].This         */
/*variable takes the role of the predictor coefficients which    */
/*normally are used in Durbin′s form of the algorithm.This       */
/*routine returns only the reflection coefficients.            */
/*Reference:J.Leroux and C.J.Gueguen,″A Fixed Point              */
/*           Computation of the Partial Correlation             */
/*           Coefficients″,IEEE Trans.ASSP,June 1977,          */
/*           pp.257-259.                                         */
/*                                                              */
/*In the case that either numerical instability or an         */
/*inappropriate auto-correlation vector results in a set of  */
/*coefficients corresponding to an unstable filter at some stage*/
/*in the recursion,this routine returns the coefficients as  */
/*determined at the previous iteration.This is equivalent to     */
/*truncating the auto-correlation coefficient at a point such  */
/*that it is positive definite.                               */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS  :                                                  */
/*            _(FLOAT64[])r          :input autocorrelation.*/
/*            _(INT16)LPC_ORDER:LPC order.                        */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                   */
/*            _(FLOAT64[])refl:output reflection coeff.       */
/*            _(FLOAT64*)re  :output residual energy            */
/*--------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*                   _None.                                */
/*--------------------------------------------------*/
/*RETURN ARGUMENTS:                                               */
/*                   _None.                                 */
/*========================================*/
void LPC_leroux_gueguen(FLOAT64r[],FLOAT64 refl[],FLOAT64*re,

                                     INT16 LPC_ORDER)

    {

    /*----------------------------------------------*/
				
				<dp n="d484"/>
    INT32  k,i;

    FLOAT64      rf,sum;

    FLOAT64      *ep,*en;

    /*----------------------------------------------*/

    ep=dvector(0,LPC_ORDER-1);

    en=dvector(0,LPC_ORDER-1);

    /*----------------------------------------------*/

    /*                        Initialisation                   */

    /*----------------------------------------------*/

    (*re)=r[0];

    for(i=0;i<LPC_ORDER;i++)

        {

        ep[i]=r[i+1];

        en[i]=r[i];

        }

    /*----------------------------------------------*/

    /*                          Algorithm                    */

    /*----------------------------------------------*/

    for(k=0;k<LPC_ORDER;k++)

        {

        /*------------------------------------------*/

        /*        Check for zero prediction error            */

        /*------------------------------------------*/

        if((en[0]==0.0)&amp;&amp;(ep[k]==0.0))

                 rf=0.0;

        else

                 rf=-ep[k]/en[0];

        /*------------------------------------------*/

        /*Calculate the error(equivalent to re=re*(1-rf**2))*/

        /*A change in sign of PRERR means that rf has a magnitude */

        /*greater than unity(corresponding to an unstable    */
				
				<dp n="d485"/>
      /*synthesis filter)                                     */

      /*----------------------------------------------*/

      en[0]+=rf*ep[k];

      if(en[0]<0.0)

             break;

      (*re)        =en[0];

           /*----------------------------------------------*/

      refl[k]=rf;

      if(k==(LPC_ORDER-1))

             return;

      for(i=k+1;i<(LPC_ORDER-1);i++)

             {

             sum  = ep[i]+rf*en[i-k];

             en[i-k]+=rf*ep[i];

             ep[i]     = sum;

             }

      ep[LPC_ORDER-1]+=rf*en[LPC_ORDER-k-1];

      }
  /*----------------------------------------------*/
  /*        Fixup for negative prediction error             */
  /*----------------------------------------------*/
  printf(″\nLPC_leroux_gueguen-negative error energy\n″);
  for(i=k;i<LPC_ORDER;i++)

      refl[i]=0.0;
  /*----------------------------------------------*/
  free_dvector(ep,0,LPC_ORDER-1);
  free_dvector(en,0,LPC_ORDER-1);
  /*----------------------------------------------*/
				
				<dp n="d486"/>
    return;

    /*----------------------------------------------*/

    }
/*--------------------------------------------------*/
/*========================================*/
/*FUNCTION    :LPC_pred2refl().                             */
/*--------------------------------------------------*/
/*PURPOSE     :This function calculate the PARCOR coefficients*/
/*            using the prediction coeff.                   */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*        _(FLOAT64[])a         :output LP filter coeff.   */
/*        _(INT16)LPC_ORDER:LPC order.                          */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*        _(FLOAT64[])refl      :output reflection coeff.    */
/*--------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                         */
/*                   _None.                                  */
/*--------------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
/*                   _None.                                  */
/*========================================*/
void LPC_pred2refl(FLOAT64 a[],FLOAT64 refl[],INT16 LPC_ORDER)

    {

    /*----------------------------------------------*/

    FLOAT64       f[MAX_LPC_ORDER];

    INT16    m,j,n;

    FLOAT64       km,denom,x;

    /*----------------------------------------------*/

    if(LPC_ORDER>MAX_LPC_ORDER)

            nrerror(″LPC order is too large!!!″);
				
				<dp n="d487"/>
    /*----------------------------------------------*/

    /*                      Initialisation                   */

    /*----------------------------------------------*/

    cpy_dvector(a,f,0,LPC_ORDER-1);

    /*----------------------------------------------*/

    for(m=LPC_ORDER-1;m>=0;m--)

        {

        km=f[m];

        if(km<=-1.0‖km>=1.0)

            {

            printf(″Nonstable reflection coeffs!!!\n″);

            return;

            }

        refl[m]=-km;

        denom=1.0/(1.0-km*km);

        for(j=0;j<m/2;j++)

            {

            n  =m-1-j;

            x  =denom*f[j]+km*denom*f[n];

            f[n]=denom*f[n]+km*denom*f[j];

            f[j]=x;

            }

        if(m&amp;1)

               f[j]=denom*f[j]+km*denom*f[j];

        }

    /*----------------------------------------------*/

    return;

    /*----------------------------------------------*/

    }
/*--------------------------------------------------*/
				
				<dp n="d488"/>
/*========================================*/
/*FUNCTION    :LPC_lpctolsf().                                            */
/*--------------------------------------------------*/
/*PURPOSE     :This function onvert predictor coefficients              */
/*            to LSF′s.                                              */
/*                                                                    */
/*    The transfer function of the predictor filter is transformed  */
/*    into two reciprocal polynomials having roots on the unit        */
/*    circle.These roots of these polynomials interlace.It is    */
/*    these roots that determine the line spectral frequencies.The */
/*    two reciprocal polynomials are expressed as series expansions */
/*    in Chebyshev polynomials with roots in the range-1 to+1.The   */
/*    inverse cosine of the roots of the Chebyshev polynomial       */
/*    expansion gives the line spectral frequencies.If NPTS line   */
/*    spectral frequencies are not found,this routine signals an */
/*    error condition.                                             */
/*                                                                  */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS:                                                   */
/*   _(FLOAT64[])PRCOF:      Predictor coefficients.               */
/*   _(INT16)LPC_ORDER:LPC order.                                     */
/*   _(INT16)NPTS:        Number of coefficients(at most 50)         */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                     */
/*     _(FLOAT64[])FRLSF:  line spectral frequencies(in            */
/*                         ascending order).                       */
/*--------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                               */
/*                    _None.                                       */
/*--------------------------------------------------*/
/*RETURN ARGUMENTS:                                                    */
/*                    _None.                                       */
/*========================================*/
void LPC_lpctolsf(FLOAT64 PRCOF[],FLOAT64 FRLSF[],INT16 NPTS)

    {

    /*----------------------------------------------*/

    INT16        NC[2],j,i,NF,IP;

    FLOAT64 F1[(MAX_LPC_ORDER+1)/2+1],F2[(MAX_LPC ORDER+1)/2+1],

       T[2][(MAX_LPC_ORDER+1)/2+1];
				
				<dp n="d489"/>
    FLOAT64 XLOW,XMID,XHIGH,XINT,YLOW,YMID,YHIGH;

    /*----------------------------------------------*/
#ifdef VERBOSE

    if(NPTS>MAX_LPC_ORDER)

        nrerror(″PTOLSF-Too many coefficients!!!!!″);
#endif

    /*----------------------------------------------*/

    /*Determine the number of coefficients in each of the polynomials  */

    /*with coefficients T(.,1)and T(.,2).                          */

    /*----------------------------------------------*/

    if((NPTS%2)!=0)

        {

        NC[1]=(NPTS+1)/2;

        NC[0]=NC[1]+1;

        }

    else

        {

         NC[1]=NPTS/2+1;

         NC[0]=NC[1];

         }

    /*----------------------------------------------*/

    /*Let D=z**(-1),the unit delay,then the predictor filter with*/

    /*N coefficients is                                              */

    /*                                                                */

    /*           N    n                                                */

    /*  P(D)=SUMp(n)D                                                    */

    /*       n=1                                                       */

    /*                                                                 */

    /*The error filter polynomial is A(D)=1-P(D)with N+1 terms.          */

    /*Two auxiliary polynomials*are formed from the error filter       */

    /*polynomial,                                                      */

    /*  F1(D)=A(D)+D**(N+1)A(D**(-1))(N+2terms,symmetric)                 */

    /*  F2(D)=A(D)-D**(N+1)A(D**(-1))(N+2terms,anti-symmetric)           */

    /*                                                                */

    /*Establish the symmetric polynomial F1(D)and the anti-symmetric    */

    /*polynomial F2(D)                                                 */
				
				<dp n="d490"/>
/*Only about half of the coefficients are evaluated since the   */
/*polynomials are symmetric and will later be reduced in order by    */
/*division by polynomials with roots at+1 and-1                     */
/*--------------------------------------------------*/
F1[0]=1.0;
j=NPTS-1;
for(i=1;i<NC[0];i++)

    {

    F1[i]=-PRCOF[i-1]-PRCOF[]];

    j=j-1;

    }
F2[0]=1.0;
j=NPTS-1;
for(i=1;i<NC[1];i++)

    {

    F2[i]=-PRCOF[i-1]+PRCOF[j];

    j=j-1;

    }
/*--------------------------------------------------*/
/*N even,F1(D)includes a factor 1+D,                          */
/*        F2(D)includes a factor 1-D                           */
/*N odd, F2(D)includes a factor 1-D**2                           */
/*Divide out these factors,leaving even order symmetric        */
/*polynomials,M is the total number of terms and Nc is the number  */
/*of unique terms,                                                */
/*  N       polynomial          M    Nc=(M+1)/2                            */
/*even,G1(D)=F1(D)/(1+D)      N+1    N/2+1                                */
/*      G2(D)=F2(D)/(1-D)      N+1    N/2+1                               */
/*odd, G1(D)=F1(D)            N+2  (N+1)/2+1                            */
/*      G2(D)=F2(D)/(1-D**2)    N    (N+1)/2                            */
/*--------------------------------------------------*/
if((NPTS%2)!=0)

    for(i=2;i<NC[1];i++)

        F2[i]=F2[i]+F2[i-2];

    else

    for(i=1;i<NC[0];i++)

        {

        F1[i]=F1[i]-F1[i-1];
				
				<dp n="d491"/>
         F2[i]=F2[i]+F2[i-1];

         }
/*--------------------------------------------------*/
/*To look for roots on the unit circle,G1(D)and G2(D)are   */
/*evaluated for D=exp(ja).Since G1(D)and G2(D)are symmetric,   */
/*they can be expressed in terms of a series in cos(na)for D on */
/*the unit circle.Since M is odd and D=exp(ja)                  */
/*                                                               */
/*         M-1          n                                          */
/*       G1(D)=SUM f1(n)D                (symmetric,f1(n)=f1(M-1-n))  */
/*            n=0                                                   */
/*                                      Mh-1                         */
/*          =exp(j Mh a)[f1(Mh)+2 SUM f1(n)cos((Mh-n)a)]               */
/*                                      n=0                         */
/*                       Mh                                           */
/*          =exp(j Mh a)SUM t1(n)cos(na),                          */
/*                       n=0                                      */
/*                                                                 */
/*where Mh=(M-1)/2=Nc-1.The Nc=Mh+1 coefficients t1(n)are            */
/*defined as                                                       */
/*  t1(n)= f1(Nc-1),  n=0,                                     */
/*       =2f1(Nc-1-n),n=1,...,Nc-1.                          */
/*The next step is to identify cos(na)with the Chebyshev polynomial  */
/*T(n,x).The Chebyshev polynomials satisfy T(n,cos(x))=cos(nx).   */
/*Then omitting the exponential delay term which does not affect the  */
/*positions of the roots on the unit circle,the series expansion in*/
/*terms of Chebyshev polynomials is                                      */
/*                                                                     */
/*           Nc-1                                                        */
/*   T1(x)=SUM t1(n)T(n,x)                                               */
/*           n=0                                                        */
/*                                                                     */
/*The domain of T1(x)is-1<x<+1.For a giyen root of T1(x),             */
/*say x0,the corresponding position of the root of F1(D)on the       */
/*unit circle is exp(j arccos(x0)).                                 */
/*                                                                     */
/*Establish the coefficients of the series expansion in Chebyshev     */
/*polynomials                                                            */
/*--------------------------------------------------*/
T[0][0]=F1[NC[0]-1];
				
				<dp n="d492"/>
j=NC[0]-2;
for(i=1;i<NC[0];i++)

    {

    T[O][i]=2.0*F1[j]];

    j=j-1;

    }
T[1][0]=F2[NC[1]-1];
j=NC[1]-2;
for(i=1;i<NC[1];i++)

    {

    T[1][i]=2.0*F2[j];

    j=j-1;

    }
/*--------------------------------------------------*/
/*Sample at equally spaced intervals between-1 and 1 to look for     */
/*sign changes.RESL is chosen small enough to avoid problems with      */
/*multiple roots in an interval.After detecting a sign change,    */
/*successive bisections and linear interpolation are used to find */
/*roots corresponding to LSF frequencies.Since the roots of the      */
/*two polynomials interlace,the search alternates between the       */
/*polynomials T(.,1)and T(.,2).IP is either 1 or 2 depending on   */
/*which polynomial is being examined.                                    */
/*--------------------------------------------------*/
NF=0;
IP=0;
XLOW=1.0;
YLOW=LPC_chebyshev(XLOW,T[IP],NC[IP]);
while((XLOW>-1.)&amp;&amp;(NF<NPTS))

    {

    XHIGH=XLOW;

    YHIGH=YLOW;

    if((XHIGH-RESL)>-1.0)

        XLOW=XHIGH-RESL;

    else

        XLOW=-1.0;

    YLOW=LPC_chebyshev(XLOW,T[IP],NC[IP]);
				
				<dp n="d493"/>
if(YLOW*YHIGH<=0.0)

    {

    NF=NF+1;

    /*----------------------------------------------*/

    /*Bisections of the interval containing a sign change  */

    /*----------------------------------------------*/

    for(i=0;i<NBIS;i++)

        {

              XMID=0.5*(XLOW+XHIGH);

              YMID=LPC_chebyshev(XMID,T[IP],NC[IP]);

              if(YLOW*YMID<=0.0)

              {

                  YHIGH=YMID;

                  XHIGH=XMID;

              }

              else

              {

                  YLOW=YMID:

                  XLOW=XMID;

                  }

        }
  /*----------------------------------------------*/
  /*Linear interpolation in the subinterval with a sign    */
  /*change(take care if YHIGH=YLOW=0)                          */
  /*----------------------------------------------*/
  if(YHIGH!=YLOW)

      XINT=XLOW-YLOW*(XHIGH-XLOW)/(YHIGH-YLOW);
  else

      XINT=0.5*(XLOW+XHIGH);
  FRLSF[NF-1]=acos(XINT)/PI2;
  /*----------------------------------------------*/
  /*Start the search for the roots of the next polynomial */
  /*at the estimated location of the root just found      */
  /*----------------------------------------------*/
				
				<dp n="d494"/>
                    IP=1-IP;

                    XLOW=XINT;

                    YLOW=LPC_chebyshev(XLOW,T[IP],NC[IP]);

                }

            }

        /*----------------------------------------------*/

        /*      Halt if NPTS frequencies have not been found    */

        /*----------------------------------------------*/

    #ifdef VERBOSE

             if(NF!=NPTS)

                 nrerror(″LPC_lpctolsf-Too few frequencies computed″);

    #endif

        /*-----------------------------------------------*/

        return;

        /*---------------------------------------------------*/

        }

    /*-------------------------------------------------------*/

    /*========================================*/

    /*FUNCTION    :LPC_chebyshev().                                    */

    /*-------------------------------------------------------*/

    /*PURPOSE     :Evaluate a series expansion in Chebyshev          */

    /*            polynomials.                                     */

    /*                                                            */

    /*    The series expansion in Chebyshev polynomials is defined as */

    /*                                                            */

    /*            N-1                                              */

    /*       Y(x)=SUM c(i)T(i,x),                               */

    /*            i=0                                             */

    /*                                                             */

    /*    where Y(x)is the resulting value(Y(x)=CHEBPS(...)),    */

    /*     N is the order of the expansion,                      */

    /*     c(i)is the coefficient for the i′th Chebyshev        */

    /*           polynomial                                          */

    /*           (c(i)=COF(i+1)),and                              */
				
				<dp n="d495"/>
/*         T(i,x)is the i′th order Chebyshev polynomial     */
/*                 evaluated at x.                           */
/*     The Chebyshev polynomials satisfy the recursion          */
/*       T(i,x)=2x T(i-1,x)-T(i-2,x),                  */
/*     with the initial conditions T(0,x)=1and T(1,x)=x.This*/
/*     routine evaluates the expansion using a backward recursion */
/*     to obtain a numerically stable solution.                 */
/*                                                                */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                     */
/*    _(FLOAT64)X:    Input value.                                 */
/*    _(FLOAT64[])COF:Array of coefficient values.COF[i]is         */
/*                   the coefficient corresponding to the  */
/*                   i-1′th order Chebyshev polynomial.    */
/*    _(INT16)N:     Order of the polynomial and number of     */
/*                   coefficients.                           */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                */
/*    _None.                                                */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                           */
/*    _None.                                                 */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                               */
/*    _(FLOAT64)CHEBPS:             Predictor coefficients.    */
/*========================================*/
FLOAT64 LPC_chebyshev(FLOAT64 X,FLOAT64 COF[],INT16 N)

    {

    /*----------------------------------------------------*/

    INT16 i;

    FLOAT64 B1,B0,B2,CHEBPS;

    /*----------------------------------------------------*/

    /*Consider the backward recursion b(i,x)=2xb(i+1,x)-b(i+2,x)+c(i),*/

    /*with initial conditions b(N,x)=0and b(N+1,x)=0.                 */

    /*Then dropping the dependence on x,c(i)=b(i)-2xb(i+1)+b(i+2).        */

    /*                                                                   */

    /*        N-1                                                        */

    /*     Y(x)=SUM c(i)T(i)                                             */

    /*        i=0                                                       */
				
				<dp n="d496"/>
    /*                                                           */

    /*         N-1                                                 */

    /*      =SUM[b(i)-2xb(i+1)+b(i+2)]T(i)                        */

    /*         i=0                                              */

    /*                                       N-1                 */

    /*    =b(0)T(0)+b(1)T(1)-2xb(1)T(0)+SUM b(i)[T(i)-2xT(i-1)+T(i-2)]*/

    /*                                       i=2                    */

    /*The term inside the sum is zero because of the recursive     */

    /*relationship satisfied by the Chebyshev polynomials.Then         */

    /*substituting the values T(0)=1 and T(1)=x,Y(x)is expressed in*/

    /*terms of the difference between b(0)and b(2)(errors in b(0)and*/

    /*b(2)tend to cancel),                                          */

    /*                                                                */

    /*  Y(x)=b(0)-xb(1)=[b(0)-b(2)+c(0)]/2                          */

    /*---------------------------------------------------*/

    B2=0.0;

    B1=0.0;

    B0=0.0;

    for(i=N-1;i>=0;i--)

        {

        B2=B1;

        B1=B0;

        B0=(2.*X)*B1-B2+COF[i];

        }

    CHEBPS=0.5*(B0-B2+COF[0]);

    /*---------------------------------------------------*/

    return(CHEBPS);

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION      :LPC_autocorrelation().                                  */
/*-------------------------------------------------------*/
/*PURPOSE       :Calculate the correlation for a data sequence.      */
/*                                                                 */
				
				<dp n="d497"/>
/*   This subroutine calculates the auto-correlation for a      */
/*   given data vector.Rxx(i)gives the auto-correlation at      */
/*   lag i,for i running from 0 to NTERM-1.                      */
/*                                                             */
/*             NX                                               */
/*    Rxx(i)=SUM X(j)*X(j-i)                                  */
/*            j=i                                           */
/*                                                             */
/*   This algorithm requires                                    */
/*     (N+1)*(NX+N/2)multiplies and                                */
/*     (N+1)*(NX+N/2)adds.                                        */
/*                                                              */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                     */
/*   _(FLOAT64[])x:           Input data vector with NX elements.    */
/*   _(INT16)L:              Number ofdata points.                 */
/*   _(INT16)ORDER_1:Order of the polynomial and number of            */
/*                coefficients.                                 */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                   */
/*   _(FLOAT64[])r:   Auto-correlation vector with ORDER_1         */
/*                   elements.                                  */
/*------------------------------------------------------- */
/*INPUT/OUTPUT ARGUMENTS:                                                */
/*      _None.                                                    */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                    */
/*      _None.                                                    */
/*========================================*/
void LPC_autocorrelation(FLOAT64 x[],INT16L,FLOAT64 r[],INT16 ORDER_1)

    {

    /*-------------------------------------------------------*/

    INT16 i;

    /*-------------------------------------------------------*/

    for(i=0;i<ORDE_1;i++)

        dot_dvector(x,x+i,r+i,0,(INT16)(L-i-1));

    /*-------------------------------------------------------*/
				
				<dp n="d498"/>
    return;

    /*---------------------------------------------------*/

    }
/*------------------------------------------------------- */
/*========================================*/
/*FUNCTION   :LPC_ptoa().                                         */
/*-------------------------------------------------------*/
/*PURPOSE    :This function convert the prediction coefff.in  */
/*           tha classical LP filter coefficients.         */
/*                                                             */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                  */
/*    _(FLOAT64[])p:               prediction coeffcients.     */
/*    _(INT16)LPC_ORDER:order of the LPC.                          */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                    */
/*    _(FLOAT64[])a:               LP  filter coefficients.    */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                            */
/*    _None.                                                   */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                 */
/*    _None.                                                   */
/*========================================*/
void LPC_ptoa(FLOAT64 p[],FLOAT64 a[],INT16 LPC_ORDER)

    {

    /*-------------------------------------------------------*/

    INT16 i;

    /*-------------------------------------------------------*/
#ifdef VERBOSE

    if(LPC_ORDER>MAX_LPC_ORDER)

        nrerror(″LPC order is too large in ptoa()!!!″);
#endif
				
				<dp n="d499"/>
    /*---------------------------------------------------*/

    a[0]=1.;

    for(i=0;i<LPC_ORDER;i++)

         a[i+1]=-p[i];

    /*---------------------------------------------------*/

    return;

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION       :LPC_lsftop().                                    */
/*-------------------------------------------------------*/
/*PURPOSE        :This function convert LSF′s to predictor coeff.*/
/*                                                              */
/*  The line spectral frequencies are assumed to be frequencies  */
/*  corresponding to roots on the unit circle.Altemate roots on */
/*  the unit circle belong to two polynomials.These polynomials     */
/*  are formed by polynomial multiplication of factors representing*/
/*  conjugate pairs of roots.Additional factors are used to give */
/*  a symnetric polynomial and an anti-symmetric polynomial.The     */
/*  sum(divided by 2)of these polynomials gives the predictor     */
/*  polynomial.                                                    */
/*                                                                */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                      */
/*   _(FLOAT64[])FRLSF:           Array of NPTS line spectral         */
/*                        frequencies(in ascending order).        */
/*                        Each line spectral frequency lies in   */
/*                        the range 0 to 0.5.                    */
/*   _(INT16)NPTS:         Number of coefficients(at most 50).      */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                      */
/*   _(FLOAT64[])PRCOF:predictor coefficients.                       */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                                  */
/*   _None.                                                         */
				
				<dp n="d500"/>
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                 */
/*    _None.                                                    */
/*========================================*/
void LPC_lsftop(FLOAT64 FRLSF[],FLOAT64 PRCOF[],INT16 NPTS)

    {

    /*---------------------------------------------------*/

    INT16 NC,i,M,k;

    FLOAT64 F1[(MAX_LPC_ORDER+1)/2+1],F2[(MAX_LPC_ORDER/2)+1];

    FLOAT64 A,x;

    /*---------------------------------------------------*/

    F1[0]=1.0;

    F2[0]=1.0;

    /*---------------------------------------------------*/

    /*Each line spectral frequency w contributes a second order         */

    /*polynomial of the form Y(D)=1-2*cos(w)*D+D**2.These polynomials       */

    /*are formed for each frequency and then multiplied together.     */

    /*Altemate line spectral frequencies are used to form two         */

    /*polynomials with interlacing roots on the unit circle.These two*/

    /*polynomials are again multiplied by 1+D and 1-D if NPTS is even   */

    /*or by 1 and 1-D**2 if NPTS is odd.This gives the symmetric and     */

    /*anti-symmetric polynomials that in turn are added to give the  */

    /*predictor coefficients.                                       */

    /*---------------------------------------------------*/
#ifdef VERBOSE

    if(NPTS>MAX_LPC_ORDER)

        nrerror(″LSFTOP-Too many coefficients!!!″);
#endif

    /*---------------------------------------------------*/

    /*    Form a symmetric F1(D)by multiplying together second order   */

    /*    polynomials corresponding to odd numbered LSF′s           */

    /*---------------------------------------------------*/

    NC=0;
				
				<dp n="d501"/>
    for(i=0;i<NPTS;i+=2)

       {

        x=cos(PI2*FRLSF[i]);

        A=-2.0*x;

        LPC_convsm(F1,&amp;NC,A);

       }
/*-------------------------------------------------------*/
/*    Form a symmetric F2(D)by multiplying together second order    */
/*         polynomials corresponding to even numbered LSF′s         */
/*-------------------------------------------------------*/
NC=0;
for(i=1;i<NPTS;i+=2)

    {

     x=cos(PI2*FRLSF[i]);

     A=-2.0*x;

     LPC_convsm(F2,&amp;NC,A);

    }
/*-------------------------------------------------------*/
/*Both F1(D)and F2(D)are symmetric,with leading coefficient    */
/*equal to unity.Exclusive of the leading coefficient,the   */
/*number ofcoefficients needed to specify F1(D)and F2(D)is:   */
/*  NPTS     F1(D)         F2(D)                                      */
/* even    NPTS/2          NPTS/2                                       */
/*  odd  (NPTS+1)/2       (NPTS-1)/2                                      */
/*-------------------------------------------------------*/
if((NPTS%2)!=0)

    {

    /*---------------------------------------------------*/

    /*NPTS odd                                                      */

    /*F2(D)is multiplied by the factor(1-D**2)                    */

    /*---------------------------------------------------*/

    M=(NPTS-1)/2;

    for(i=M;i>=2;i--)

         F2[i]=F2[i]-F2[i-2];

    /*---------------------------------------------------*/

    /*Form the predictor filter coefficients                     */
				
				<dp n="d502"/>
    /*Note that F1(D)is symmetric and F2(D)is now                 */

    /*anti-symmetric.Since only the first half of the          */

    /*coefficients are available,symmetries are used to get    */

    /*the other half.                                            */

    /*---------------------------------------------------*/

    k=NPTS-1;

    for(i=0;i<M;i++)

        {

        PRCOF[i]=-0.5*(F1[i+1]+F2[i+1]);

        PRCOF[k]=-0.5*(F1[i+1]-F2[i+1]);

        k=k-1;

        }

    PRCOF[k]=-0.5*F1[k];

    }
else

    {

    /*---------------------------------------------------*/

    /*NPTS even                                                      */

    /*F1(D)is multiplied by the factor(1+D)                         */

    /*F2(D)is multiplied by the factor(1-D)                       */

    /*---------------------------------------------------*/

    M=NPTS/2;

    for(i=M;i>=1;i--)

    {

        F1[i]=F1[i]+F1[i-1];

        F2[i]=F2[i]-F2[i-1];

    }

    /*---------------------------------------------------*/

    /*Form the predictor filter coefficients                       */

    /*Note that F1(D)is symmetric and F2(D)is now                       */

    /*anti-symmetric.                                                  */

    /*---------------------------------------------------*/

    k=NPTS-1;

    for(i=0;i<M;i++)

        {

        PRCOF[i]=-0.5*(F1[i+1]+F2[i+1]);

        PRCOF[k]=-0.5*(F1[i+1]-F2[i+1]);

        k=k-1;
				
				<dp n="d503"/>
            }

        }

    /*---------------------------------------------------*/

    return;

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION    :LPC_adptive_interp().                                */
/*-------------------------------------------------------*/
/*PURPOSE     :This function this function generates the LPC     */
/*            coefficients by interpolating in a NON linear    */
/*            way the lsf.                                     */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                   */
/*   _(FLOAT64[])lsf_1:first set of lsf.                        */
/*   _(FLOAT64[])lsf_2:second set of lsf.                          */
/*   _(FLOAT64[])lsf_old:lsf from last frame.                       */
/*   _(INT16*)int_idx:codebook index.                                 */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                          */
/*   _(FLOAT64**)pdcf:predictor coefficients.                         */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                                    */
/*   _None.                                                            */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                        */
/*   _None.                                                          */
/*========================================*/
void LPC_adptive_interp(FLOAT64 lsf[],FLOAT64 lsf1[],FLOAT64 lsf_old[],

                                FLOAT64**pdcf,INT16*int_idx)

    {

    /*---------------------------------------------------*/

    FLOAT64 ref_lsf[NP],int_lsf[NP],dis,mindis,delta,val1,val2;

    INT16   i,k;
				
				<dp n="d504"/>
/*-------------------------------------------------------*/
/*                          Middle lsf search                       */
/*-------------------------------------------------------*/
/*-------------------------------------------------------*/
/*                                  Weights                         */
/*-------------------------------------------------------*/
int_lsf[0]=(1.0-lsf1[0])*(1.0-lsf1[1]+lsf1[0]);
for(i=1;i<NP-1;i++)

    {

    val1=lsf1[i+1]-lsf1[i];

    val2=lsf1[i]   -lsf1[i-1];

    delta=MIN(val1,val2);

    int_lsf[i]=(1.0-lsf1[i])*(1.0-delta);

    }
delta=lsf1[NP-1]+lsf1[NP-2];
int_lsf[NP-1]=(1.0-lsf1[NP-1])*(1.0-delta);
/*-------------------------------------------------------*/
/*                                      Search                     */
/*-------------------------------------------------------*/
mindis=DBL_MAX;
for(k=0;k<N_SF4;k++)

    {

    for(i=0;i<NP;i++)

        ref_lsf[i]=IntLSF_C[k]*lsf[i]+(1-IntLSF_C[k])*lsf_old[i];

    dis=0.0;

    for(i=0;i<NP;i++)

        dis+=fabs(ref_lsf[i]-lsf1[i])*int_lsf[i];

    if(dis<mindis)

         {

         mindis  =dis;

         *int_idx=k;
				
				<dp n="d505"/>
        }

    }
/*-------------------------------------------------------*/
k=*int_idx;
for(i=0;i<NP;i++)

    ref_lsf[i]=IntLSF_C[k]*lsf[i]+(1-IntLSF_C[k])*lsf_old[i];
/*-------------------------------------------------------*/
/*               LSF to prediction coefficients convertion         */
/*-------------------------------------------------------*/
/*-------------------------------------------------------*/
/*                                 Sub-frame #0                     */
/*-------------------------------------------------------*/
for(i=0;i<NP;i++)

    int_lsf[i]=0.5*(lsf_old[i]+ref_lsf[i]);
LPC_lsftop(int_lsf,pdcf[0],NP);
/*-------------------------------------------------------*/
/*                                Sub-frame #1                      */
/*-------------------------------------------------------*/
LPC_lsftop(ref_lsf,pdcf[1],NP);
/*-------------------------------------------------------*/
/*                                Sub-frame #2                     */
/*-------------------------------------------------------*/
for(i=0;i<NP;i++)

    int_lsf[i]=0.5*(ref_lsf[i]+lsf[i]);
LPC_lsftop(int_lsf,pdcf[2],NP);
/*-------------------------------------------------------*/
/*                               Sub-frame #1                      */
/*-------------------------------------------------------*/
LPC_lsftop(lsf,pdcf[3],NP);
				
				<dp n="d506"/>
    /*---------------------------------------------------*/

    /*                         Update the memories               */

    /*---------------------------------------------------*/

    cpy_dvector(lsf,lsf_old,0,NP-1);

    /*---------------------------------------------------*/

    return;

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION           :LPC_adptive_interp_dec().                      */
/*-------------------------------------------------------*/
/*PURPOSE            :This function this function generates the LPC*/
/*                   coefficients by interpolating in a NON linear*/
/*                   way the lsf.                                */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                     */
/*   _(FLOAT64[])lsf_1:  first set of lsf.                     */
/*   _(FLOAT64[])lsf_old:lsf from last frame.                    */
/*   _(INT16*)int_idx:codebook index.                              */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                      */
/*   _(FLOAT64**)pdcf: predictor coefficients.                    */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                               */
/*   _None.                                                      */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                   */
/*   _None.                                                      */
/*========================================*/
void LPC_adptive_interp_dec(FLOAT64 lsf[],FLOAT64 lsf_old[],

                                 FLOAT64**pdcf,INT16int_idx)

    {

    /*---------------------------------------------------*/
				
				<dp n="d507"/>
    FLOAT64 ref_lsf[NP],int_lsf[NP];

    INT16 i;

    /*-------------------------------------------------------*/

    /*                              Middle LSF                         */

    /*-------------------------------------------------------*/

    for(i=0;i<NP;i++)

        ref_lsf[i]=IntLSF_C[int_idx]*lsf[i]+

                        (1-IntLSF_C[int_idx])*lsf_old[i];

    /*-------------------------------------------------------*/

    /*               LSF to prediction coefficients convertion         */

    /*-------------------------------------------------------*/

    /*-------------------------------------------------------*/

    /*                                 Sub-frame #0                    */

    /*-------------------------------------------------------*/

    for(i=0;i<NP;i++)

        int_lsf[i]=0.5*(lsf_old[i]+ref_lsf[i]);

    LPC_lsftop(int_lsf,pdcf[0],NP);

    /*-------------------------------------------------------*/

    /*                                Sub-frame #1                     */

    /*-------------------------------------------------------*/

    LPC_lsftop(ref_lsf,pdcf[1],NP);

    /*-------------------------------------------------------*/

    /*                                Sub-frame #2                     */

    /*-------------------------------------------------------*/

    for(i=0:i<NP;i++)

        int_lsf[i]=0.5*(ref_lsf[i]+lsf[i]);

    LPC_lsftoop(int_lsf,pdcf[2],NP);

    /*-------------------------------------------------------*/

    /*                                Sub-frame #1                     */
				
				<dp n="d508"/>
    /*---------------------------------------------------*/

    LPC_lsftop(lsf,pdcf[3],NP);

    /*---------------------------------------------------*/

    /*                             Update the memories                */

    /*---------------------------------------------------*/

    cpy_dvector(lsf,lsf_old,0,NP-1);

    /*---------------------------------------------------*/

    return;

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION         :LPC_interpolate_lpc_4to2().                       */
/*-------------------------------------------------------*/
/*PURPOSE          :This function this function generates the LPC  */
/*                 coefficients by interpolating the lsf        */
/*                 (frequency domain).                             */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                      */
/*   _(FLOAT64[])lsf_1:first set of lsf.                         */
/*   _(FLOAT64[])lsf_2:second set of lsf.                         */
/*   _(FLOAT64[])lsf_old:lsf from last frame.                      */
/*   _(INT16)flag:      switch between interpolation coeff.       */
/*                        for quantized(1)or unquantized            */
/*                        (0)LSF.                                    */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                      */
/*   _(FLOAT64**)pdcf:predictor coefficients.                        */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                                */
/*   _None.                                                         */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                     */
/*   _None.                                                        */
				
				<dp n="d509"/>
/*========================================*/
void LPC_interpolate_lpc_4to2(FLOAT64 lsf_1[],FLOAT64 lsf_2[],

                              FLOAT64 lsf_old[],FLOAT64**pdcf,INT16 flag)

    {

    /*---------------------------------------------------*/

    INT16 i;

    FLOAT64 C;

       FLOAT64 tmpmem [NP];

    /*---------------------------------------------------*/

    /*                             Sub-frame #1                    */

    /*---------------------------------------------------*/

    if(flag==1)

          {

          C=60.0/160.0;

          for(i=0;i<NP;i++)

              tmpmem[i]=C*lsf_1[i]+(1-C)*lsf_old[i];

          }

    else

         {

         C=60.0/80.0;

         for(i=0;i<NP;i++)

             tmpmem[i]=(1-C)*lsf_old[i]+C*lsf_2[i];

         }

    LPC_lsftop(tmpmem,pdcf[0],NP);

    /*---------------------------------------------------*/

    /*                              Sub-frame #2                     */

    /*---------------------------------------------------*/

    if(flag==1)

          {

          C=(60.0+80.0)/160.0;

          for(i=0;i<NP;i++)

              tmpmem[i]=C*lsf_1[i]+(1-C)*lsf_old[i];

          }

    else

          {
				
				<dp n="d510"/>
        C=60.0/80.0;

        for(i=0;i<NP;i++)

            tmpmem[i]=C*lsf_1[i]+(1-C)*lsf_2[i];

        LPC_lsftop(tmpmem,pdcf[1],NP);

        }

    LPC_lsftop(tmpmem,pdcf[1],NP);

    /*---------------------------------------------------*/

    /*      Update the lsf for interpolation in the next coding frame    */

    /*---------------------------------------------------*/

    cpy_dvector(lsf_1,lsf_old,0,NP-1);

    /*---------------------------------------------------*/

    return:

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION            :LPC_interpolate_lpc_4to3().                    */
/*-------------------------------------------------------*/
/*PURPOSE             :This function this function generates the LPC*/
/*                    coefficients by interpolating the lsf       */
/*                    (frequency domain).                            */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                      */
/*   _(FLOAT64[])lsf_1:first set of lsf.                        */
/*   _(FLOAT64[])lsf_2:second set of lsf.                        */
/*   _(FLOAT64[])lsf_old:lsft from last frame.                   */
/*   _(INT16)flag:switch between interpolation coeff.            */
/*                  for quantized(1)or unquantized                */
/*                  (0)LSF.                                       */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                     */
/*   _(FLOAT64**)pdcf:predictor coefficients.                      */
/*-------------------------------------------------------*/
				
				<dp n="d511"/>
/*INPUT/OUTPUT ARGUMENTS:                                              */
/*   _None.                                                       */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                    */
/*   _None.                                                      */
/*========================================*/
void LPC_interpolate_lpc_4to3(FLOAT64 lsf_1[],FLOAT64 lsf_2[],

                              FLOAT64 lsf_old[],FLOAT64**pdcf,INT16 flag)

    {

    /*---------------------------------------------------*/

    INT16 i;

    FLOAT64 C;

    FLOAT64 tmpmem[NP];

    /*---------------------------------------------------*/

    /*                               Sub-frame #1                  */

    /*---------------------------------------------------*/

    if(flag==1)

          {

          C=46.5/160.0;

          for(i=0;i<NP;i++)

              tmpmem[i]=C*lsf_1[i]+(1-C)*lsf_old[i];

          }

    else

         {

         C=46.5/80.0;

         for(i=0;i<NP;i++)

             tmpmem[i]=(1-C)*lsf_old[i]+C*lsf_2[i];

         }

    LPC_lsftop(tmpmem,pdcf[0],NP);

    /*---------------------------------------------------*/

    /*                             Sub-frame #2                   */

    /*---------------------------------------------------*/

    if(flag==1)

          {

          C=(46.5+53.0)/160.0;
				
				<dp n="d512"/>
        for(i=0;i<NP;i++)

            tmpmem[i]=C*lsf_1[i]+(1-C)*lsf_old[i];

        }

    else

        {

        C=20.0/80.0;

        for(i=0;i<NP;i++)

            tmpmem[i]=C*lsf_1[i]+(1-C)*lsf_2[i];

        LPC_lsftop(tmpmem,pdcf[1],NP);

        }

    LPC_lsftop(tmpmem,pdcf[1],NP);

    /*---------------------------------------------------*/

    /*                            Sub-frame #3                   */

    /*---------------------------------------------------*/

    if(flag==1)

          {

          C=(46.5+2.0*53.0)/160.0;

          for(i=0;i<NP;i++)

              tmpmem[i]=C*lsf_1[i]+(1-C)*lsf_old[i];

          }

    else

         {

         C=(20.0+53.0)/80.0;

         for(i=0;i<NP;i++)

             tmpmem[i]=C*lsf_1[i]+(1-C)*lsf_2[i];

         }

    LPC_lsftop(tmpmem,pdcf[2],NP);

    /*---------------------------------------------------*/

    /*   Update the lsf for interpolation in the next coding frame    */

    /*---------------------------------------------------*/

    cpy_dvector(lsf_1,lsf_old,0,NP-1);

    /*---------------------------------------------------*/

    return;
				
				<dp n="d513"/>
    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION              :LPC_convsm().                                */
/*-------------------------------------------------------*/
/*PURPOSE               :This function convolve coefficients for    */
/*                      symmetric polynomials.                      */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                        */
/*   _(INT16*)N:              number of coefficients.                */
/*   _(FLOAT64)A:                cosinusoidal coefficient.             */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                         */
/*   _None.                                                           */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                                 */
/*   _(FLOAT64[])X:input/outuput signal.                           */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                     */
/*   _None.                                                       */
/*========================================*/
void LPC_convsm(FLOAT64X[],INT16*N,FLOAT64 A)

    {

    /*---------------------------------------------------*/

    INT16k,n;

    /*---------------------------------------------------*/

    n=(*N);

    if(n>=2)

        {

        X[n+1]=X[n-1];

        for(k=n+1;k>=3;k--)

            X[k]=X[k]+A*X[k-1]+X[k-2];
				
				<dp n="d514"/>
        X[2]=X[2]+A*X[1]+1.0;

        X[1]=X[1]+A;

        }

    else if(n==1)

        {

        X[2]=2.0+A*X[1];

        X[1]=X[1]+A;

        }

    else if(n==0)

        X[1]=A;

    n=n+1:

    (*N)=n;

    /*---------------------------------------------------*/

    return;

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION            :LPC_ImpulseResponse().                        */
/*-------------------------------------------------------*/
/*PURPOSE             :This function calculates the LPC synthesis  */
/*                    filter filter response including perceptual  */
/*                    weighting.                                    */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                        */
/*   _(FLOAT64[])wpdcf_zero:precetual filter numerator               */
/*                         coefficients.                          */
/*   _(FLOAT64[])wpdcf_pole:precetual filter denominator            */
/*                         coefficients.                          */
/*   _(FLOAT64[])pdcfq:quantized prediction coeff.                   */
/*   _(INT16)l_sf:   sub-frame size.                               */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                      */
/*   _(FLOAT64[])hh:    impulse response.                            */
/*-------------------------------------------------------*/
				
				<dp n="d515"/>
/*INPUT/OUTPUT ARGUMENTS:                                             */
/*              _None.                                          */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                 */
/*              _None.                                        */
/*========================================*/
void LPC_ImpulseResponse(FLOAT64 hh[],FLOAT64 wpdcf_zero[],

                         FLOAT64 wpdcf_pole[],FLOAT64 pdcfq[],

                         INT16 l_sf)

    {

    /*---------------------------------------------------*/

    FLOAT64                   tmpmem[NP];

    /*---------------------------------------------------*/

    ini_dvector(hh,0,l_sf-1,0.0);

    LPC_ptoa(wpdcf_zero,hh,NP);

    ini_dvector(tmpmem,0,NP-1,0.0);

    FLT_allsyn(hh,l_sf,pdcfq,NP,hh,tmpmem);

    ini_dvector(tmpmem,0,NP-1,0.0);

    FLT_allsyn(hh,l_sf,wpdcf_pole,NP,hh,tmpmem);

    /*---------------------------------------------------*/

    return;

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*-------------------------------END--------------------------------*/
/*========================================*/
				
				<dp n="d516"/>
/*========================================*/
/*====================================*/
/*Conexant System Inc.                                           */
/*4311 Jamboree Road                                              */
/*Newport Beach,CA 92660                                          */
/*-------------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                           */
/*-------------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                  */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*====================================*/
/*PROTOTYPE FILE:lib_lpc.h                                           */
/*====================================*/
/*-------------------------------------------------------*/
/*---------------------------FUNCTIONS---------------------------*/
/*-------------------------------------------------------*/
void LPC_init_lib           (void);
void LPC_analysis           (INT16,FLOAT64[],FLOAT64[],FLOAT64[],

                                 FLOAT64[],FLOAT64[],FLOAT64*,FLOAT64[],

                                     FLOAT64[],INT16,FLOAT64*,INT16);
void LPC_autocorrelation  (FLOAT64[],INT16,FLOAT64[],INT16);
void LPC_leroux_gueguen       (FLOAT64[],FLOAT64[],FLOAT64*,INT16);
void LPC_refl2pred    (FLOAT64[],FLOAT64[],INT16);
void LPC_lpctolsf    (FLOAT64[],FLOAT64[],INT16);
FLOAT64LPC_chebyshev    (FLOAT64,FLOAT64[],INT16);
void LPC_ptoa    (FLOAT64[],FLOAT64[],INT16);
void LPC_lsftop    (FLOAT64[],FLOAT64[],INT16);
void LPC_pred2refl    (FLOAT64[],FLOAT64[],INT16);
void LPC_adptive_interp(FLOAT64[],FLOAT64[],FLOAT64[],FLOAT64**,

                                   INT16*);
				
				<dp n="d517"/>
void LPC_adptive_interp_dec(FLOAT64[],FLOAT64[],FLOAT64**,INT16);
void LPC_interpolate_lpc_4to3(FLOAT64[],FLOAT64[],FLOAT64[],

                                                      FLOAT64**,INT16);
void LPC_interpolate_lpc_4to2(FLOAT64[],FLOAT64[],FLOAT64[],

                                                      FLOAT64**,INT16);
void LPC_convsm    (FLOAT64[],INT16*,FLOAT64);
void LPC_ImpulseResponse(FLOAT64[],FLOAT64[],FLOAT64[],FLOAT64[],

                           INT16);
/*========================================*/
/*---------------------------END---------------------------*/
/*========================================*/
				
				<dp n="d518"/>
/*========================================*/
/*====================================*/
/*Conexant System Inc.                                         */
/*4311 Jamboree Road                                            */
/*Newport Beach,CA 92660                                         */
/*-------------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                          */
/*-------------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                               */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*====================================*/
/*LIBRARY:lib_ltp.c                                               */
/*====================================*/
/*-------------------------------------------------------*/
/*---------------------------INCLUDE---------------------------*/
/*-------------------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″gputil.h″
#include″mcutil.h″
#include″ext_var.h″
#include″lib_flt.h″
#include″lib_ltp.h″
#include″lib_pit.h″
/*-------------------------------------------------------*/
/*---------------------------FUNCTIONS---------------------------*/
/*-------------------------------------------------------*/
/*===============================================================================================================================================*/
/*FUNCTION:LTP_init_lib().                                        */
/*-------------------------------------------------------*/
/*PURPOSE  :This function initialise the gloval variable of the  */
				
				<dp n="d519"/>
/*                    library LTP.                               */
/*-------------------------------------------------------*/
/*ALGORITHM:                                                        */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                     */
/*             _None.                                             */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                   */
/*             _None.                                            */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                            */
/*             _None.                                           */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                  */
/*             _None.                                          */
/*========================================*/
void LTP_init_lib(void)

    {

    /*---------------------------------------------------*/

    ini_dvector(lag_f,0,N_SF_MAX-1,30.0);

    /*---------------------------------------------------*/

    min_pit=MIN_LAG;

    max_pit=HI_LAG;

    LTP_Init_SincWindows();

    LTP_generate_PitLagTab  ();

    /*---------------------------------------------------*/

    return:

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION  :Hwind().                                            */
				
				<dp n="d520"/>
/*-------------------------------------------------------*/
/*PURPOSE  :This function returns a value of a Hamming window    */
/*         centered at WinLim.                                */
/*-------------------------------------------------------*/
/*ALGORITHM:                                                    */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                 */
/*            _(INT16)WinLim:the center of the Hamming window.   */
/*            _(FLOAT64)t:  the location of the value.         */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                 */
/*                 _None.                                        */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                            */
/*                 _None.                                       */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                 */
/*      _(FLOAT64)val:    hamming window value at t.            */
/*========================================*/
FLOAT64 Hwind(FLOAT64 t,INT16 WinLim)

    {

    /*---------------------------------------------------*/

    FLOAT64 val,x;

    /*---------------------------------------------------*/

    val=0.0:

    if(fabs(t)<=WinLim)

         {

         x=cos(t*PI/WinLim);

         val=0.54+0.46*x;

         }

    /*---------------------------------------------------*/

    return val;

    /*------------------------------------------------------*/
				
				<dp n="d521"/>
    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION:smcFwin2().                                            */
/*-------------------------------------------------------*/
/*PURPOSE  :This function returns returns a value of a Hamming   */
/*         windowed SINC function to interpolate a discrete    */
/*         digital signal.                                  */
/*-------------------------------------------------------*/
/*ALGORITHM:                                                       */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                     */
/*          _(INT16)WinLim:the center of the Hamming window.        */
/*          _(FLOAT64)t:  the location of the value.             */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                  */
/*             _None.                                            */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                            */
/*             _None.                                           */
*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                 */
/*        _(FLOAT64)F:hamming window value at t.                */
/*========================================*/
FLOAT64 sincFwin2(FLOAT64 t,INT16 WinLim)

    {

    /*---------------------------------------------------*/

    FLOAT64 x,num,den,sinc;

    FLOAT64 F;

    /*---------------------------------------------------*/

    x=t;

    if(fabs(t)<0.000001)

         F=1.0;

    else
				
				<dp n="d522"/>
         {

            if(WinLim<=6)

               {

               num=sin(x*PI*0.9);

               den=PI*x*0.9;

               sinc=num/den;

               F=Hwind(t,WinLim)*sinc;

               }

            else

              {

              num=sin(x*PI*0.95);

              den=PI*x*0.95;

              sinc=num/den;

              F=Hwind(t,WinLim)*sinc;

              }

         }

    /*---------------------------------------------------*/

    return F;

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION   : sincFwin().                                          */
/*--------------------------------------------------*/
/*PURPOSE    :This function returns returns a value of a Hamming  */
/*           windowed SINC function to interpolate a discrete    */
/*           digital signal.                                  */
/*--------------------------------------------------*/
/*ALGORITHM:                                                        */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS  :                                                    */
/*       _(INT16)WinLim:the center of the Hamming window.           */
/*       _(FLOAT64)t:the location of the value.               */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                  */
/*               _None.                                        */
/*--------------------------------------------------*/
				
				<dp n="d523"/>
/*INPUT/OUTPUT ARGUMENTS:                                           */
/*               _None.                                        */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                */
/*       _(FLOAT64)F:hamming window valuea at t.                 */
/*========================================*/
FLOAT64 sincFwin(FLOAT64 t,INT16 WinLim)

    {

    /*---------------------------------------------------*/

    FLOAT64 x,num,den,sinc;

    FLOAT64 F;

    /*---------------------------------------------------*/

    x=t;

    if(fabs(t)<0.000001)

         F=1.0;

    else

         {

         num=sin(x*PI);

         den=PI*x;

         sinc=num/den;

         F=Hwind(t,WinLim)*sinc;

         }

    /*---------------------------------------------------*/

    return F;

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION  :D2A_InterpWeight().                                   */
/*-------------------------------------------------------*/
/*PURPOSE   :This function produces a weighting function w[] for  */
/*          the purpose of interpolating signal.              */
				
				<dp n="d524"/>
/*-------------------------------------------------------*/
/*ALGORITHM:                                                      */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                    */
/*       _(INT16)WinLim:half Weighting function length.           */
/*       _(FLOAT64)f:   Interpolation fractional value.         */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                    */
/*       _(FLOAT64[])w :Weighting function.                       */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                              */
/*                _None.                                         */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                  */
/*                _None.                                        */
/*========================================*/
void D2A_InterpWeight(FLOAT64w[],FLOAT64 f,INT16 WinLim)

    {

    /*---------------------------------------------------*/

    INT16 k;

    FLOAT64 C;

    /*---------------------------------------------------*/

    /*                              Sinc Function                 */

    /*---------------------------------------------------*/

    for(k=0;k<2*WinLim;k++)

        w[k]=sincFwin((f+WinLim-1-k),WinLim);

    /*---------------------------------------------------*/

    /*                              Normalization                 */

    /*---------------------------------------------------*/

    C=0:

    for(k=0;k<2*WinLim;k++)

        C+=w[k];

    C=1.0/MAX(C,0.1);

    for(k=0;k<2*WinLim;k++)

        w[k]*=C;
				
				<dp n="d525"/>
    /*---------------------------------------------------*/

    return;

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION   :D2A_InterpWeight2().                                   */
/*-------------------------------------------------------*/
/*PURPOSE    :This function produces a weighting function w[]for  */
/*           the purpose of interpolating signal.             */
/*-------------------------------------------------------*/
/*ALGORITHM:                                                       */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS  :                                                   */
/*          _(INT16)WinLim:half Weighting function length.        */
/*          _(FLOAT64)f:Interpolation fractional value.        */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                    */
/*          _(FLOAT64[])w:Weighting function.                     */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                               */
/*               _None.                                          */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                   */
/*               _None.                                         */
/*========================================*/
void D2A_InterpWeight2(FLOAT64 w[],FLOAT64 f,INT16 WinLim)

    {

    /*---------------------------------------------------*/

    INT16 k;

    FLOAT64 C;

    /*---------------------------------------------------*/
				
				<dp n="d526"/>
    /*                          Sinc Function                      */

    /*---------------------------------------------------*/

    for(k=0;k<2*WinLim;k++)

        w[k]=sincFwin2((f+WinLim-1-k),WinLim;

    /*---------------------------------------------------*/

    /*                          Normalization                      */

    /*---------------------------------------------------*/

    C=0:

    for(k=0;k<2*WinLim;k++)

        C+=w[k];

    C=1.0/MAX(C,0.1);

    for(k=0;k<2*WinLim;k++)

        w[k]*=C;

    /*---------------------------------------------------*/

    return;

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION  :D2A_interp().                                            */
/*-------------------------------------------------------*/
/*PURPOSE   :This function produces a interpolation of digital    */
/*          signal to return the signal value between two samples */
/*                                                               */
/*-------------------------------------------------------*/
/*ALGORITHM:                                                        */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                      */
/*       _(FLOAT64[])w:Weighting function.                           */
/*       _(FLOAT64[])s:signal.                                     */
/*       _(INT16)WinLim:half Weighting function length.                */
/*       _(INT16)Len:Length of signal.                               */
/*       _(FLOAT64)t:Time point of the signal value               */
				
				<dp n="d527"/>
/*                                  between two samples.        */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                 */
/*              _None.                                         */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                             */
/*              _None.                                          */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                */
/*       _(FLOAT64)X:             Interpolated signal sample.  */
/*========================================*/
FLOAT64 D2A_interp(FLOAT64w[],FLOAT64s[],INT16Len,FLOAT64 t,INT16 WinLim)

    {

    /*---------------------------------------------------*/

    INT16 k,L1,L2,LowL,HighL;

    FLOAT64 X;

    /*---------------------------------------------------*/

    LowL  =(INT16)t-WinLim+1;

    L1=MAX(0,LowL);

    HighL =LowL+2*WinLim;

    L2=MIN(Len,HighL);

    X =0.0;

    for(k=L1;k<L2;k++)

        X+=s[k]*w[k-LowL];

    /*---------------------------------------------------*/

    return X;

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION  :LTP_lag_to_idx7b  ().                                  */
				
				<dp n="d528"/>
/*-------------------------------------------------------*/
/*PURPOSE  :This function produces the extract the 7 bits index  */
/*         corresponding to the pitch value                    */
/*                                                             */
/*-------------------------------------------------------*/
/*ALGORITHM:                                                    */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                  */
/*       _(FLOAT64)pit:      pitch value.                      */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                  */
/*       _None.                                                 */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                              */
/*       _None.                                                  */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                  */
/*       _(INT16)idx:        corresponding index.               */
/*========================================*/
INT 16LTP_lag_to_idx7b(FLOAT64 pit)

    {

    /*---------------------------------------------------*/

    FLOAT64 Min,D;

    INT16 i,idx;

    /*---------------------------------------------------*/

        if(pit<53){

           Min=fabs(PitLagTab7b[0]-pit);

           idx=0:

           for(i=1;i<=60;i++){

               D=fabs(PitLagTab7b[i]-pit);

               if(D<Min){

                  Min=D;

                  idx=i;

               }

          }

    }

    else{

       idx=(pit-PitLagTab7b[60])+0.5;
				
				<dp n="d529"/>
            idx=MIN(60+idx,MAX_PIT_IDX_7b);

        }

    /*---------------------------------------------------*/

    return(idx);

    /*---------------------------------------------------*/

    }
/*========================================*/
/*FUNCTION:LTP_lag_to_idx8b().                                    */
/*-------------------------------------------------------*/
/*PURPOSE  :This function produces the extract the 8 bits index  */
/*         corresponding to the pitch value                     */
/*                                                               */
/*-------------------------------------------------------*/
/*ALGORITHM:                                                         */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                       */
/*       _(FLOAT64)pit:          pitch value.                    */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                    */
/*       _None.                                                   */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                                 */
/*       _None.                                                    */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                     */
/*       _(INT16)idx:             corresponding index.           */
/*========================================*/
INT 16LTP_lag_to_idx8b(FLOAT64 pit)

    {

    FLOAT64 Min,D;

    INT16 i,idx;

    if(pit<=33.2){

       idx=(INT16)((pit-MIN_LAG)/0.2+0.5);

       }
				
				<dp n="d530"/>
else{
  if(pit<44){

         Min=fabs(PitLagTab8b[81]-pit);

         idx=81;

         for(i=82;i<=121;i++){

             D=fabs(PitLagTab8b[i]-pit);

             if(D<Min){

                Min=D;

                idx=i;

             }

         }

    }

    else{

        if(pit<62.0){

              Min=fabs(PitLagTab8b[121]-pit);

              idx=121;

              for(i=122;i<=160;i++){

                  D=fabs(PitLagTab8b[i]-pit);

                  if(D<Min){

                     Min=D;

                     idx=i;

                  }

              }

         }

         else {

               if(pit<92){

                      Min=fabs(PitLagTab8b[160]-pit);

                      idx=160;

                      for(i=161;i<=199;i++){

                          D=fabs(PitLagTab8b[i]-pit);

                          if(D<Min){

                             Min=D;

                             idx=i;

                          }

                      }

                }

                else {

                     idx=(INT16)(pit-92)+199+0.5);

                }

              }

           }

        }
				
				<dp n="d531"/>
    idx=MAX(idx,0);

    idx=MIN(idx,MAX_PIT_IDX_8b);

    return(idx);

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION  :LTP_generate_PitLagTab  ().                             */
/*-------------------------------------------------------*/
/*PURPOSE   :This function generates the pitch lag table.        */
/*                                                               */
/*-------------------------------------------------------*/
/*ALGORITHM:                                                          */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                       */
/*               _None.                                             */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                     */
/*               _None.                                            */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                               */
/*               _None.                                          */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                   */
/*               _None.                                         */
/*========================================*/
void LTP_generate_PitLagTab(void)

    {

    /*---------------------------------------------------*/

    INT16 i,k;

    FLOAT64 D;

    /*---------------------------------------------------*/

    /*                                8 bit table                   */

    /*---------------------------------------------------*/

        PitLagTab8b[0]=MIN_LAG;

        for(i=1;i<=MAX_PIT_IDX_8b;i++){

          if(PitLagTab8b[i-1]<33){
				
				<dp n="d532"/>
        PitLagTab8b[i]=PitLagTab8b[i-1]+0.2;

    }

    else{

        if(PitLagTab8b[i-1]<91){

           D=0.2+0.8*(PitLagTab8b[i-1]-33.0)/(91.0-33.0);

           PitLagTab8b[i]=PitLagTab8b[i-1]+D;

           }

        else{

           k=(INT16)(PitLagTab8b[i-1]+1.1);

           PitLagTab8b[i]=k;

           }

        }

    }
/*-------------------------------------------------------*/
/*                                  7 bit table                       */
/*-------------------------------------------------------*/

    PitLagTab7b[0]=MIN_LAG;

    for(i=1;i<=MAX_PIT_IDX_7b;i++){

       D=MIN(0.325*PitLagTab7b[i-1]/MIN_LAG,1);

       if(D>0.99){

          k=PitLagTab7b[i-1]+D+0.5;

          PitLagTab7b[i]=k;

          }

       else

          PitLagTab7b[i]=PitLagTab7b[i-1]+D;

       }
/*-------------------------------------------------------*/
/*                                   5 bit table                   */
/*-------------------------------------------------------*/

    PitLagTab5b[0]=0.0;

    for(i=1;i<=MAX_PIT_IDX_5b;i++){

       if(PitLagTab5b[i-1]<=0.8)

          D=1.0/5.0;

       else{

           if(PitLagTab5b[i-1]<=1.8)

               D=1.0/4.0;

           else

               D=1.0/3.0;
				
				<dp n="d533"/>
                }

            PitLagTab5b[i]=PitLagTab5b[i-1]+D;

        }

    /*---------------------------------------------------*/

    /*---------------------------------------------------*/

    return:

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION        :LTP_Init_SincWindows  ().                     */
/*-------------------------------------------------------*/
/*PURPOSE  :This function initializes the table of Sinc      */
/*         interpolation windows.                              */
/*                                                            */
/*-------------------------------------------------------*/
/*ALGORITHM:                                                        */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS  :                                                    */
/*                 _None.                                          */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                     */
/*                 _None.                                         */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                                */
/*                 _None.                                         */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                   */
/*                 _None.                                        */
/*========================================*/
void LTP_Init_SincWindows(void)

    {

    /*---------------------------------------------------*/
				
				<dp n="d534"/>
    FLOAT64 t;

    INT16 i;

    /*---------------------------------------------------*/

        for(i=0;i<NUM_SINC_WIN;i++){

            f=DELT_F*i;

            D2A_InterpWeight2(SincWindows+i*LEN_SINC,f,SINC_LIMIT);

        }

        for(i=0;i<NUM_SINC_WIN;i++){

            f=DELT_F*i:

            D2A_InterpWeight(SincWindows_E+i*LEN_SINC_E,f,SINC_LIMIT_E);

        }

        for(i=0;i<NUM_SINC_WIN;i++){

          f=DELT_F*i;

          D2A_InterpWeight(SincWindows_PP+i*LEN_SINC_PP,f,SINC_LIMIT_PP);

      }

    /*---------------------------------------------------*/

    return;

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION     :LTP_excit_vari_pitch().                             */
/*-------------------------------------------------------*/
/*PURPOSE      :This function calculates LTP excitation with      */
/*             interpolated pitch track.                      */
/*-------------------------------------------------------*/
/*ALGORITHM:                                                      */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                    */
/*    _(FLOAT64[])SincWindows:table of interpolation weights.      */
/*    _(FLOAT64[])PitFun:     Pitch track.                       */
				
				<dp n="d535"/>
/*    _(FLOAT64[])LTm:            Excitation memory.             */
/*    _(INT16)L_LTm:            Length of the excitation memory. */
/*    _(INT16)Len:            Length of the LTP excitation.  */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*    _(FLOAT64[])E:         LTP excitation.                */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                         */
/*               _None.                                      */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
/*               _None.                                     */
/*========================================*/
void LTP_excit_vari_pitch(FLOAT64*SincWindows,INT16 Len_Sinc,INT16 Sinc_Limit,

                        FLOAT64 PitFun[],INT16 L_LTm,FLOAT64LTm[],INT16 Len,

                        FLOAT64 E[])

    {

    /*---------------------------------------------------*/

    FLOAT64   t,f,*Weight;

    INT16  k,T,m;

    /*---------------------------------------------------*/

    for(k=0;k<Len;k++)

        {

        t=L_LTm+k-PitFun[k];

        T=(INT16)t;

        f=t-(FLOAT64)T;

        m=(INT16)(f*(FLOAT64)DELT_F2+0.500001);

        Weight=SincWindows+m*Len_Sinc;

        E[k]=D2A_interp(Weight,LTm,(INT16)(L_LTm+Len),t,

                                                               Sinc_Limit);

        LTm[L_LTm+k]=E[k];

        }

    /*---------------------------------------------------*/

    return;

    /*---------------------------------------------------*/
				
				<dp n="d536"/>
    }
/*-------------------------------------------------------*/
/*========================================*/
/*FUNCTION          :LTP_excit_const_pitch().                       */
/*-------------------------------------------------------*/
/*PURPOSE           :This function calculates LTP excitation with */
/*                  constant pitch track.                        */
/*-------------------------------------------------------*/
/*ALGORITHM:                                                         */
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS:                                                        */
/*     _(FLOAT64)Pit_f:           Pitch lag(fractional).           */
/*     _(FLOAT64[])LTm:             Excitation memory.                */
/*     _(INT16)L_LTm:              Length of the excitation memory.  */
/*     _(INT16)Len:              Length of the LTP excitation.    */
/*     _(INT16)mem_flag  :        memory update flag.               */
/*-------------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                     */
/*     _(FLOAT64[])E:LTP excitation.                             */
/*-------------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                             */
/*                _None.                                         */
/*-------------------------------------------------------*/
/*RETURN ARGUMENTS:                                                  */
/*                _None.                                       */
/*========================================*/
voidLTP excit_const_pitch(FLOAT64 Pit_f,INT16 L_LTm,FLOAT64 LTm[],INT16 Len,

               FLOAT64 E[],INT16 mem_flag)

    {

    /*---------------------------------------------------*/

    FLOAT64 t,f,*Weight;

    INT16  k,T,m;

    /*---------------------------------------------------*/

    t=L_LTm-Pit_f;

    T=(INT16)t;
				
				<dp n="d537"/>
      f=t-(FLOAT64)T;

      m=(INT16)(f*(FLOAT64)DELT_F2+0.500001);

      Weight=SincWindows_E+m*LEN_SINC_E;

      for(k=0;k<Len;k++)

          {

          t=L_LTm+k-Pit_f;

          E[k]=D2A_interp(Weight,LTm,(INT16)(L_LTm+Len),t,

                                                              SINC_LIMIT_E);

          if(mem_flag==1)

              LTm[L_LTm+k]=E[k];

          }

      /*---------------------------------------------------*/

      return;

      /*---------------------------------------------------*/

      }
/*---------------------------------------------------------*/
/*==============================================================================*/
/*FUNCTION:LTP_FineIndex_search().                                  */
/*---------------------------------------------------*/
/*PURPOSE:   This function does the fine search of the correlation.*/
/*---------------------------------------------------*/
/*ALGORITHM:                                                          */
/*---------------------------------------------------*/
/*INPUT ARGUMENTS:                                                       */
/*    _(FLOAT64[])PitTab:    table of pitch values.                 */
/*    _(INT16   )P1:       sarch minimum value.                      */
/*    _(INT16   )P2:       sarch maximum value.                       */
/*    _(INT16   )LowL:       lower pitch value.                       */
/*    _(INT16   )L_R:       length of correlation.                   */
/*----------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                      */
/*    _(INT16   )index:     memory update flag.                      */
/*---------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                                */
/*    _(FLOAT64[])R:        correlation.                            */
				
				<dp n="d538"/>
/*----------------------------------------------*/
/*RETURN ARGUMENTS:                                            */
/*             _None.                                     */
/*========================================================================*/
void LTP_FineIndex_search(FLOAT64 PitTab[],INT16 P1,INT16 P2,INT16 LowL,

                    INT16 L_R,FLOAT64 R[],INT16*index)

    {

    /*------------------------------ -------------------*/

    FLOAT64   t,GG,f,MaxR=0,*Weight;

    INT16 i,T,m;

    /*--------------------------------------------------*/

    /*        Search for the best precise pitch and index          */

    /*--------------------------------------------------*/

    for(i=P1;i<=P2;i++)

        {

        t=PitTab[i]-LowL;

        T=(INT16)t;

        f=t-(FLOAT64)T;

        m=(INT16)(f*(FLOAT64)DELT_F2+0.500001);

        Weight=SincWindows+m*LEN_SINC;

        GG=D2A_interp(Weight,R,L_R,t,SINC_LIMIT);

        if(i==P1‖GG>MaxR)

             {

             MaxR=GG;

             (*index)=i;

             }

        }

     T=(INT16)(PitTab[*index]+0.5-LowL);

     R[T]=MaxR;

     /*-------------------------------------------*/

     return;

     /*--------------------------------------------*/

     }
				
				<dp n="d539"/>
/*------------------------------------------------------*/
/*=========================================================================*/
/*FUNCTION  :LTP_PP_pitch_ext  ().                               */
/*--------------------------------------------------*/
/*PURPOSE  :This function extracts the adaptive codebook       */
/*        excitation for pitch pre-processing(Mode 1)at the  */
/*        encoder.                                            */
/*-------------------------------------------------*/
/*ALGORITHM:                                                    */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:                                                */
/*    _(FLOAT64[])PitFun:  pitch track.                      */
/*    _(FLOAT64[])Tgs:     tartet signal.                   */
/*    _(FLOAT64[])ext:     excitation signal.               */
/*    _(FLOAT64[])hh:      impulse response.                 */
/*    _(INT16   )i_sf:   sub-frame number.                  */
/*    _(INT16   )l_sf:   sub-frame size.                  */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
/*    _(INT16  *)lag:      lag value.                    */
/*    _(FLOAT64  *)lag_f:    fractional lag value.        */
/*    _(FLOAT64  *)R_ltp:    pitch correlation.           */
/*    _(FLOAT64[])unfcod:    unfiltered excitation.      */
/*    _(FLOAT64[])fcod:      filtered excitation.       */
/*--------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*              _None.                                  */
/*--------------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*              _None.                                  */
/*============================================================================*/
void LTP_PP_pitch_ext(FLOAT64 PitFun[],FLOAT64 Tgs[],FLOAT64 ext[],

                  FLOAT64 hh[],INT16 i_sf,FLOAT64*unfcod,

                     FLOAT64*food,INT16*lag,FLOAT64*lag_f,

                        FLOAT64*R_ltp,INT16 l_sf)

     {

     /*-------------------------------------------*/

     FLOAT64      numerator,denominator,eng_Tgs,tmp[L_SF];
				
				<dp n="d540"/>
FLOAT64    *buf;
/*----------------------------------------------*/
buf=dvector(0,l_sf-1);
/*----------------------------------------------*/
/*                  LTP excitation:unfcod[]              */
/*----------------------------------------------*/
cpy_dvector(ext+MAX_LAG,tmp,0,L_SF-1);
LTP_excit_vari_pitch(SincWindows_E,LEN_SINC_E,SINC_LIMIT_E,PitFun,

                        MAX_LAG,ext,l_sf,unfcod);
cpy_dvector(tmp,ext+MAX_LAG,0,L_SF-1);
/*----------------------------------------------*/
/*               Filter the pitch vector(LTP excitation)    */
/*----------------------------------------------*/
filterAZ(hh,unfcod,fcod,buf,(INT16)(l_sf-1),l_sf);
/*----------------------------------------------*/
/*                        Integer pitch                    */
/*----------------------------------------------*/
lag[i_sf]  =(INT16)(MIN(PitFun[l_sf/2]+0.5,max_pit));
lag_f[i_sf]=PitFun[l_sf/2];
/*----------------------------------------------*/
/*                 Compute the pitch gain(LTP gain)        */
/*----------------------------------------------*/
dot_dvector(Tgs,fcod,&amp;numerator,0,l_sf-1);
dot_dvector(fcod,fcod,&amp;denominator,0,l_sf-1);
dot_dvector(Tgs,Tgs,&amp;eng_Tgs,0,1_sf-1);
(*R_ltp)=MAX(numerator,0.0)/sqrt(MAX(denominator*eng_Tgs,0.1));
/*----------------------------------------------*/
free_dvector(buf,0,l_sf-1);
				
				<dp n="d541"/>
    /*--------------------------------------------*/

    return;

    /*--------------------------------------------*/

    }
/*------------------------------------------------*/
/*============================================================================*/
/*FUNCTION  :LTP_PP_pitch_ext_decod  ().                      */
/*------------------------------------------------*/
/*PURPOSE :This function extracts the adaptive codebook      */
/*       excitation for pitch pre-processing(Mode 1)at the */
/*       decoder.                                           */
/*------------------------------------------------*/
/*ALGORITHM:                                                  */
/*------------------------------------------------*/
/*INPUT ARGUMENTS:                                                */
/*    _(FLOAT64[])PitFun:      Pitch track.                 */
/*    _(FLOAT64[])ext:         excitation signal.          */
/*    _(INT16  )i_sf:        sub-frame number.              */
/*    _(INT16  )l_sf:        sub-frame size.               */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
/*    _(INT16  *)lag:        lag value.                    */
/*    _(FLOAT64  *)lag_f;      fractional lag value.        */
/*    _(FLOAT64[])unfcod:      unfiltered excitation.       */
/*------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                         */
/*              _None.                                      */
/*------------------------------------------------*/
/* RETURN ARGUMENTS:                                             */
/*              _None.                                      */
/*================================================================================*/
void LTP_PP_pitch_ext_decod(FLOAT64 PitFun[],FLOAT64 ext[],INT16 i_sf,

                   FLOAT64*unfcod,INT16*lag,FLOAT64*lag_f,INT16 l_sf)

     {

     /*-------------------------------------------*/
				
				<dp n="d542"/>
    FLOAT64    tmp[L_SF];

    /*----------------------------------------*/

    /*                  LTP excitation:unfcod[]            */

    /*-----------------------------------------------*/

    cpy_dvector(ext+MAX_LAG,tmp,0,L_SF-1);

    LTP_excit_vari_pitch(SincWindows_E,LEN_SINC_E,SINC_LIMIT E,PitFun,

                                           MAX_LAG,ext,l_sf,unfcod);

    cpy_dvector(tmp,ext+MAX_LAG,0,L_SF-1);

    /*-----------------------------------------------*/

    /*                              pitch                  */

    /*-----------------------------------------------*/

    lag[i_sf]=(INT16)(PitFun[l_sf/2]+0.5);

    lag_f[i_sf]=PitFun[l_sf/2];

    /*-----------------------------------------------*/

    return;

    /*-----------------------------------------------*/

    }
/*---------------------------------------------------*/
/*=================================================================================*/
/*FUNCTION:LTP_close_7b_pitch().                                   */
/*---------------------------------------------------*/
/*PURPOSE  :This function performs the traditional search of the  */
/*        the adaptive codebook in Mode 0.                        */
/*---------------------------------------------------*/
/*ALGORITHM:                                                        */
/*---------------------------------------------------*/
/*INPUT ARGUMENTS:                                                     */
/*  _(FLOAT64[])Tgs:     target signal.                           */ 
/*  _(FLOAT64[])ext:     excitation signal.                      */
/*  _(FLOAT64[])hh:      impulse response.                        */
/*  _(INT16  )i_sf:    sub-frame number.                         */
/*  _(INT16  )l_sf:    sub-frame size.                          */
				
				<dp n="d543"/>
/*   _(INT16  )frm_class_pp:pitch pre-proc.classification.*/
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*   _(INT16  *)lag:        lag value.                     */
/*   _(FLOAT64  *)lag_f:      fractional lag value.        */
/*   _(FLOAT64  *)pgain:      pitch gain.                   */
/*   _(FLOAT64  *)R_ltp:      LTP criterion.                 */
/*   _(FLOAT64[])unfcod:      unfiltered excitation.        */
/*   _(FLOAT64[])fcod:        filtered excitation.         */
/*   _(INT16  *)pit_idx:    pitch index.                  */
/*------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*               _None.                                   */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:                                            */
/*               _None.                                   */
/*========================================================================*/
void LTP_close_7b_pitch(FLOAT64 Tgs[],FLOAT64 ext[],FLOAT64 hh[],

                  INT16 i_sf,FLOAT64 unfcod[],

                  FLOAT64 fcod[],INT16*lag,FLOAT64*lag_f,

                  FLOAT64*pgain,FLOAT64*R_ltp,INT16 l_sf,

                  INT16 frm_class_pp,INT16 pit_idx[])

    {

    /*-------------------------------------------------*/

    FLOAT64       pit_f,numerator,denominator,MaxR,eng_Tgs;

    FLOAT64       ftmp[L_SF];

    INT16         i,k,IP1,IP2,L_Rp,PITCHi;

    FLOAT64       *buf;

    FLOAT64       Rp[20]={0.0};

    /*-------------------------------------------------*/

    /*                  Allocate temporary memory            */

    /*-------------------------------------------------*/

    buf=dvector(0,l_sf-1);

    /*-------------------------------------------------*/

    /*                     Searching range                   */

    /*-------------------------------------------------*/
				
				<dp n="d544"/>
    if(lag[i_sf]<MIN_LAG2)

       lag[i_sf]*=2;

    IP1=MAX(MIN_LAG2,lag[i_sf]-3);

    IP2=MIN(HI_LAG2, lag[i_sf]+3);

    if((frm_class_pp>0)&amp;&amp;(i_sf=N_SF2-1)&amp;&amp;(lag[i_sf]>l_sf*0.75))

        {

        IP1=MAX(MIN_LAG2,lag[i_sf]-1);

        IP2=MIN(HI_LAG2,lag[i_sf]+1);

        }

    /*---------------------------------------------*/

    /*          Integer correlation for integer lag    */

    /*---------------------------------------------*/

    L_Rp    =IP2-IP1+1;
#ifdef VERBOSE

     if(L_Rp>=20)

         nrerror(″L_Rp>=20!!″);
#endif

     /*--------------------------------------------*/

    for(i=IP1;i<=IP2;i++)

        {

        if(i==IP1)

               filterAZ(hh,ext+MAX_LAG-i,ftmp,buf,

                                                (INT16)(l_sf-1),l_sf);

        else

            {

            for(k=1_sf-1;k>0;k--)

                ftmp[k]=ftmp[k-1]+ext[MAX_LAG-i]*hh[k];

            ftmp[0]=ext[MAX_LAG-i]*hh[0];

            }

        dot_dvector(Tgs,ftmp,&amp;Rp[i-IP1],0,l_sf-1);

        dot_dvector(ftmp,ftmp,&amp;denominator,0,l_sf-1);

        Rp[i-IP1]/=sqrt(MAX(denominator,0.1));

        }
				
				<dp n="d545"/>
/*-----------------------------------------*/
/*    Searching for integer pitch    */
/*-----------------------------------------*/
MaxR=Rp[0];
PITCHi=IP1;
for(i=IP1+1;i<=IP2;i++)

    {

    if(Rp[i-IP1]>MaxR)

        {

        MaxR=Rp[i-IP1];

        PITCHi=i;

        }

    }
if((MaxR<0)&amp;&amp;(i_sf==N_SF2-1)&amp;&amp;(frm_class_pp>0))

    PITCHi=lag[i_sf];
/*-------------------------------------------*/
/*                  Fine index searching                  */
/*-------------------------------------------*/
pit_idx[i_sf]=PITCHi-MIN_LAG2;
pit_f=PITCHi;
lag[i_sf]=PITCHi;
lag_f[i_sf]=PITCHi;
/*-------------------------------------------*/
/*                  LTP excitation:unfcod[]               */
/*-------------------------------------------*/
cpy_dvector(ext+MAX_LAG,ftmp,0,l_sf-1);
LTP_excit_const_pitch(pit_f,MAX_LAG,ext,l_sf,unfcod,1);
cpy_dvector(ftmp,ext+MAX_LAG,0,l_sf-1);
/*-------------------------------------------*/
/*             Filter the pitch vector(LTP excitation)    */
/*--------------------------------------------*/
ini_dvector(buf,0,l_sf-1,0.0);
filterAZ(hh,unfood,fcod,buf,(INT16)(l_sf-1),l_sf);
				
				<dp n="d546"/>
     /*----------------------------------------------*/

     /*              Compute the pitch gain(LTP gain)          */

     /*----------------------------------------------*/

     dot_dvector(Tgs,  fcod,&amp;numerator,      0,l_sf-1);

     dot_dvector(fcod,fcod,&amp;denominator,0,l_sf-1);

     dot_dvector(Tgs,  Tgs,&amp;eng_Tgs,           0,l_sf-1);

     (*pgain)=numerator/MAX(denominator,0.1);

     /*----------------------------------------------*/

     /*            Limit the pitch gain->0<=pgain<=1.2         */

     /*----------------------------------------------*/

     if((*pgain)<0.0)

         (*pgain)=0.0;

     if((*pgain)>1.2)

         (*pgain)=1.2;

     (*R_ltp)=MAX(numerator,0.0)/sqrt(MAX(denominator*eng_Tgs,0.1));

     /*----------------------------------------------*/

     /*                 Deallocate temporary memory           */

     /*----------------------------------------------*/

     free_dvector(buf,0,l_sf-1);

     /*----------------------------------------------*/

     return;

     /*----------------------------------------------*/

     }
/*---------------------------------------------------*/
/*===============================================================================*/
/*FUNCTION :LTP_close_8_5k_pitch  ().                              */
/*---------------------------------------------------*/
/*PURPOSE  :This function performs the traditional search of the  */
/*        the adaptive codebook for SMV 8.5kbps.                   */
				
				<dp n="d547"/>
/*---------------------------------------------*/
/*ALGORITHM:                                                  */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                              */
/*   _(FLOAT64[])Tgs:        target signal.                 */
/*   _(FLOAT64[])ext:        excitation signal.            */
/*   _(FLOAT64[])hh:         impulse response.               */
/*   _(INT16  )i_sf:       sub-frame number.                */
/*   _(INT16  )l_sf:       sub-frame size.                 */
/*   _(INT16  )frm_class_pp:pitch pre-proc.classification.*/
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                            */
/*   _(INT16  *)lag:       lag value.                    */
/*   _(FLOAT64  *)lag_f:     fractional lag value.        */
/*   _(FLOAT64  *)pgain:     pitch gain.                   */
/*   _(FLOAT64  *)R_ltp:     LTP criterion.                */
/*   _(FLOAT64[])unfcod:     unfiltered excitation.       */
/*   _(FLOAT64[])fcod:       filtered excitation.        */
/*   _(INT16  *)pit_idx:   pitch index.                 */
/*-----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                      */
/*              _None.                                  */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*              _None.                                 */
/*==============================================================================*/
void LTP_close_8_5k_pitch(FLOAT64 Tgs[],FLOAT64 ext[],FLOAT64 hh[],

                  INT16 i_sf,FLOAT64 unfcod[],

                  FLOAT64 fcod[],INT16*lag,FLOAT64*lag_f,

                  FLOAT64*pgain,FLOAT64*R_ltp,INT16 l_sf,

                  INT16 frm_class_pp,INT16 pit_idx[])

    {

    /*---------------------------------------------*/

    FLOAT64       pit_f,numerator,denominator,MaxR,eng_Tgs;

    FLOAT64       ftmp[L_SF],DifPitTab[33];

    INT16         i,k,PP1=0,PP2=0,IP1,IP2,LowL,HighL,L_Rp,PITCHi;

    FLOAT64       *buf;

    FLOAT64       Rp[2*SINC_LIMIT+40]={0.0};

    /*---------------------------------------------*/
				
				<dp n="d548"/>
/*                 Allocate temporary memory          */
/*--------------------------------------------*/
buf=dvector(0,l_sf-1);
/*--------------------------------------------*/
/*                 Searching range                    */
/*--------------------------------------------*/
IP1=MAX(MIN_LAG,lag[i_sf]-3);
IP2=MIN(HI_LAG2,lag[i_sf]+3);
if((i_sf=1)‖(i_sf=N_SF4-1))

     {

     for(i=0;i<16;i++)

         DifPitTab[16+i]=MIN(HI_LAG2,

                                  lag_f[i_sf-1]+PitLagTab5b[i]);

     for(i=1;i<=16;i++)

         DifPitTab[16-i]=MAX(MIN_LAG,

                                  lag_f[i_sf-1]-PitLagTab5b[i]);

     PP1=0;

     PP2=31;

     if((frm_class_pp>0)&amp;&amp;(i_sf==N_SF4-1))

          {

          IP1=MAX(MIN_LAG,lag[i_sf]-1);

          IP2=MIN(HI_LAG2,lag[i_sf]+1);

          if(DifPitTab[0]>=IP2)

               PP2=0;

          if(DifPitTab[31]<=IP1)

               PP1=31;

          for(i=0;i<32;i++)

              {

              if(DifPitTab[i]>=IP1)

                  {

                  PP1=i;

                  break;

                  }

              }

           for(i=31;i>=0;i--)

              {
				
				<dp n="d549"/>
                  if(DifPitTab[i]<=IP2)

                      {

                      PP2=i;

                      break;

                      }

                 }

             }

         IP1=DifPitTab[PP1]+0.5;

         IP2=DifPitTab[PP2]+0.5;

         }

     /*-------------------------------------------*/

     /*           Integer correlation for integer lag      */

     /*-------------------------------------------*/

     LowL   =IP1-SINC_LIMIT-1;

     HighL  =IP2+SINC_LIMIT+1;

     L_Rp   =HighL-LowL+1;
#ifdef VERBOSE

     if(L_Rp>=2*SINC_LIMIT+40)

          nrerror(″L_Rp>=2*SINC_LIMIT+24!!\n″);
#endif

     /*------------------------------------------*/

     for(i=LowL;i<=HighL;i++)

         {

         if(i=LowL)

               filterAZ(hh,ext+MAX_LAG-i,ftmp,buf,

                                                (INT16)(l_sf-1),l_sf);

         else

             {

             for(k=l_sf-1;k>0;k--)

                 ftmp[k]=ftmp[k-1]+ext[MAX_LAG-i]*hh[k];

             frmp[0]=ext[MAX_LAG-i]*hh[0];

             }

         dot_dvector(Tgs,ftmp,&amp;Rp[i-LowL],0,l_sf-1);

         dot_dvector(ftmp,ftmp,&amp;denominator,0,l_sf-1);
				
				<dp n="d550"/>
     Rp[i-LowL]/=sqrt(MAX(denominator,0.1));

     }
/*--------------------------------------------*/
/*             Searching for integer pitch          */
/*--------------------------------------------*/
MaxR=Rp[IP1-LowL];
PITCHi=IP1;
for(i=IP1+1;i<=IP2;i++)

    {

    if(Rp[i-LowL]>MaxR)

        {

        MaxR=Rp[i-LowL];

        PITCHi=i;

        }

    }
if((MaxR<0)&amp;&amp;(frm_class_pp>0)&amp;&amp;(i_sf=N_SF4-1))

    PITCHi=lag[i_sf];
/*--------------------------------------------*/
/*                  Fine index searching            */
/*--------------------------------------------*/
if((i_sf=0)‖(i_sf=N_SF4/2))

     {

     PP1=LTP_lag_to_idx8b(MAX(PITCHi-0.9,MIN_LAG));

     PP2=LTP_lag_to_idx8b(MIN(PITCHi+0.9,HI_LAG2));

     LTP_FineIndex_search(PitLagTab8b,PP1,PP2,LowL,L_Rp,Rp,

                               pit_idx+i_sf);

     pit_f=PitLagTab8b[pit_idx[i_sf]];

     lag[i_sf]=(INT16)(pit_f+0.5);

     lag_f[i_sf]=pit_f;

     }
else

     {

     if(DifPitTab[PP1]>=(PITCHi+0.9))

         PP2=PP1;
				
				<dp n="d551"/>
    if(DifPitTab[PP2]<=(PITCHi-0.9))

        PP1=PP2;

    for(i=PP1;i<=PP2;i++)

        {

        if(DifPitTab[i]>=(PITCHi-0.9))

            {

            PP1=i;

            break;

            }

        }

    for(i=PP2;i>=PP1;i--)

        {

        if(DifPitTab[i]<=(PITCHi+0.9))

            {

            PP2=i;

            break;

            }

        }

    PP1=MIN(PP1,PP2);

    LTP_FineIndex_search(DifPitTab,PP1,PP2,LowL,L_Rp,Rp,

                               pit_idx+i_sf);

    pit_f=DifPitTab[pit_idx[i_sf]];

    lag[i_sf]=(INT16)(pit_f+0.5);

    lag_f[i_sf]=pit_f;

    }
/*---------------------------------------------------*/
/*                LTP excitation;unfcod[]                */
/*---------------------------------------------------*/
cpy_dvector(ext+MAX_LAG,ftmp,0,l_sf-1);
LTP_excit_const_pitch(pit_f,MAX_LAG,ext,l_sf,unfcod,1);
cpy_dvector(ftmp,ext+MAX_LAG,0,l_sf-1);
/*---------------------------------------------------*/
/*            Filter the pitch vector(LTP excitation)    */
/*---------------------------------------------------*/
ini_dvector(buf,0,l_sf-1,0.0);
				
				<dp n="d552"/>
     filterAZ(hh,unfcod,fcod,buf,(INT16)(l_sf-1),l_sf);

     /*--------------------------------------------*/

     /*              Compute the pitch gain(LTP gain)         */

     /*--------------------------------------------*/

     dot_dvector(Tgs,fcod,&amp;numerator,        0,l_sf-1);

     dot_dvector(fcod,fcod,&amp;denominator,0,l_sf-1);

     dot_dvector(Tgs,Tgs,&amp;eng_Tgs,           0,l_sf-1);

     (*pgain)=numerator/MAX(denominator,0.1);

     /*--------------------------------------------*/

     /*          Limit the pitch gain->0<=pgain<=1.2      */

     /*--------------------------------------------*/

     if((*pgain)<0.0)

         (*pgain)=0.0;

     if((*pgain)>1.2)

         (*pgain)=1.2;

     (*R_ltp)=MAX(numerator,0.0)/sqrt(MAX(denominator*eng_Tgs,0.1));

     /*--------------------------------------------*/

     /*             Dellocate temporary memory              */

     /*--------------------------------------------*/

     free_dvector(buf,0,l_sf-1);

     /*--------------------------------------------*/

     return;

     /*--------------------------------------------*/

     }
/*-------------------------------------------------*/
/*=========================================================================*/
/*FUNCTION  :LTP_pitch_decodtemp().                         */
/*-------------------------------------------------*/ 
				
				<dp n="d553"/>
/*PURPOSE  :This function perfroms a temporary decoding of the  */
/*        LTP information codebook contribution.               */
/*-------------------------------------------------*/
/*ALGORITHM:                                                  */
/*-------------------------------------------------*/ 
/*INPUT ARGUMENTS:                                              */
/*  _(FLOAT64[])ext:          excitation signal.        */
/*   _(INT16  )i_sf:        sub-frame number.            */
/*   _(INT16  )l_sf:        sub-frame size.            */
/*   _(FLOAT64  )pit_f:       fractional lag value.      */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*   _(FLOAT64[])unfcod:      unfiltered LTP excitation.   */
/*-------------------------------------------------*/ 
/*INPUT/OUTPUT ARGUMENTS:                                         */
/*             _None.                                     */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                             */
/*             _None.                                    */
/*============================================================================*/
void LTP_pitch_decodtemp(FLOAT64 ext[],INT16 i_sf,FLOAT64 unfcod[],

                       FLOAT64 pit_f,INT16 l_sf)

    {

    /*--------------------------------------------*/

    FLOAT64 LTm[MAX_LAG+L_SF];

    /*--------------------------------------------*/

    cpy_dvector(ext,LTm,0,MAX_LAG-1);

    LTP_excit_const_pitch(pit_f,MAX_LAG,LTm,l_sf,unfcod,1);

    /*--------------------------------------------*/

    return;

    /*--------------------------------------------*/

    }
/*------------------------------------------------*/
				
				<dp n="d554"/>
/*==============================================================================*/
/*FUNCTION:LTP_7b_pitch_decod().                               */
/*-------------------------------------------------*/
/*PURPOSE  :This function decodes the traditional adaptive    */
/*        codebook contribution.                             */
/*-------------------------------------------------*/
/*ALGORITHM:                                                    */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:                                                */
/*   _(INT16    )bfi:      bad frame indicator.             */
/*   _(FLOAT64[])ext:        excitation signal.             */
/*   _(INT16  )i_sf:       sub-frame number.                  */
/*   _(INT16  )l_sf:       sub-frame size.                  */
/*   _(INT16  *)pit_idx:   pitch index.                     */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*   _(INT16  *)lag:       lag value.                       */
/*   _(FLOAT64  *)lag_f:     fractional lag value.            */
/*   _(FLOAT64[])unfcod:    unfiltered excitation.            */
/*-------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                         */
/*               _None.                                      */
/*-------------------------------------------------*/ 
/*RETURN ARGUMENTS:                                              */
/*               _None.                                     */
/*================================================================================*/
void LTP_7b_pitch_decod(INT16 bfi,FLOAT64 ext[],INT16 i_sf,

                        FLOAT64 unfcod[],INT16 lag[],FLOAT64 lag_f[],

                           INT16 l_sf,INT16 pit_idx[])

    {

    /*---------------------------------------------*/

    FLOAT64   LTm[MAX_LAG+L_SF],pit_f;

    /*---------------------------------------------*/

    /*                  Decode lag                         */

    /*---------------------------------------------*/

    if(bfi==0)

         {
				
				<dp n="d555"/>
         pit_f=pit_idx[i_sf]+MIN_LAG2;

         lag[i_sf]=(INT16)(pit_f+0.5);

         lag_f[i_sf]=pit_f;

         }

     else

         {

         if(i_sf==0)

             lag[i_sf]=lag[1];

         else

             lag[i_sf]=MIN(lag[i_sf-1],HI_LAG2);

         lag_f[i_sf]=(FLOAT64)lag[i_sf];

         pit_f=(FLOAT64)lag[i_sf];

         }

    /*---------------------------------------------*/

    /*                    LTP excitation:unfcod[]          */

    /*---------------------------------------------*/

    cpy_dvector(ext,LTm,0,MAX_LAG-1);

    LTP_excit_const_pitch(pit_f,MAX_LAG,LTm,l_sf,unfcod,1);

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*==============================================================================*/
/*FUNCTION :LTP_8_5k_pitch_decod().                             */
/*-------------------------------------------------*/
/*PURPOSE  :This function decodes the traditional adaptive    */
/*        codebook contribution in Mode 0.                   */
/*-------------------------------------------------*/
/*ALGORITHM:                                                   */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS  :                                              */
/*    _(INT16  )bfi:      bad frame indicator.            */
/*    _(FLOAT64[])ext:     excitation signal.              */
				
				<dp n="d556"/>
/*  _(INT16  )i_sf:      sub-frame number.                */
/*  _(INT16  )i_sf:      sub-frame size.                */
/*  _(INT16  *)pit_idx:  pitch index.                   */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                            */
/*  _(INT16  *)lag:      lag value.                     */
/*  _(FLOAT64 *)lag_f;     fractional lag value.          */
/*  _(FLOAT64[])unfcod:    unfiltered excitation.         */
/*-------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                        */
/*              _None.                                    */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                             */
/*              _None.                                    */
/*==========================================================================*/
void LTP_8_5k_pitch_decod(INT16 bfi,FLOAT64 ext[],INT16 i_sf,

                       FLOAT64 unfcod[],INT16 lag[],FLOAT64 lag_f[],

                          INT16 l_sf,INT16 pit_idx[])

    {

    /*---------------------------------------------*/

    FLOAT64 LTm[MAX_LAG+L_SF],pit_f,DifPitTab[33];

    INT16   i;

    /*---------------------------------------------*/

    /*                     Decode lag                      */

    /*---------------------------------------------*/

    if(bfi==0)

         {

         if((i_sf==1)‖(i_sf==N_SF4-1))

             {

         for(i=0;i<16;i++)

             DifPitTab[16+i]=MIN(HI_LAG2,

                                     lag_f[i_sf-1]+PitLagTab5b[i]);

         for(i=1;i<=16;i++)

             DifPitTab[16-i]=MAX(MIN_LAG,

                                     lag_f[i_sf-1]-PitLagTab5b[i]);
				
				<dp n="d557"/>
              pit_f=DifPitTab[pit_idx[i_sf]];

              }

          else

              pit_f=PitLagTab8b[pit_idx[i_sf]];

          lag[i_sf]=(INT16)(pit_f+0.5);

          lag_f[i_sf]=pit_f;

          }

      else

          {

          if(i_sf=0)

              lag[i_sf]=lag[3];

          else

              lag[i_sf]=MIN(lag[i_sf-1],HI_LAG2);

          lag_f[i_sf]=(FLOAT64)lag[i_sf];

          pit_f=(FLOAT64)lag[i_sf];

          }

    /*---------------------------------------------*/

    /*                    LTP excitation:unfcod[]             */

    /*---------------------------------------------*/

    cpy_dvector(ext,LTm, 0,MAX_LAG-1);

    LTP_excit_const_pitch(pit_f,MAX_LAG,LTm,l_sf,unfcod,1);

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*===============================================================================*/
/*FUNCTION  :LTP_adap_cbk_correction().                          */
/*-------------------------------------------------*/
/*PURPOSE  :This function extrapolated the adaptive codebook    */
/*       excitation when a frame erasure occurs.             */
				
				<dp n="d558"/>
/*-------------------------------------------------*/
/*ALGORITHM:                                                  */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS:                                                */
/* _(INT16  )fix_rate_m:previous frame bit-rate.           */
/* _(INT16  )bfi:       frame#n Bad Frame Indicator.        */
/* _(INT16  )past_bfi:  frame#n-1 Bad Frame Indicator.      */
/* _(INT16  )ppast_bfi: frame#n-2 Bad Frame Indicator.     */
/* _(FLOAT64**)qua_gainQ:adaptive and fixed codebook gains.    */
/* _(INT16  )SVS_deci_m:frame#n-1 mode indicator.             */
/* _(FLOAT64[])lag_f; decoded pitch lags                     */
/* _(FLOAT64  )temp_lagf: extrapolated fractional pitch lags */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                    */
/*  _(INT16  *)update:          update flag.                       */
/*  _(INT16  [])lag:           extrapolated lag values.           */
/*  _(FLOAT64**)gainQ:        adaptive and fixed codebook gains.     */
/*  _(FLOAT64[])lag_f:          extrapolated fract.lag values.*/
/*  _(FLOAT64  *)ForPitch_decTEMP:interpolated pitch track.        */
/*  _(FLOAT64[])ext_dec:       updated LTP memory.                  */
/*  _(FLOAT64**)unfcod_dec:    extrapolated LTP excitation.        */
/*-------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                               */
/*  _(FLOAT64[])pitch_f_mem:past pitch values.                   */
/*_(FLOAT64[])tempext_dec:temporary LTP memory.                       */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:                                                      */
/*             _None.                                           */
/*======================================================================================*/
void LTP_adap_cbk_correction(INT16 fix_rate_m,INT16 bfi,INT16 past_bfi,

                             INT16 ppast_bfi,FLOAT64**qua_gainQ,

                             FLOAT64 gainQ[],INT16 SVS_deci_m,

                             FLOAT64 temp_lagf,INT16*update,

                             FLOAT64 pitch_f_mem[],INT16 lag[],

                             FLOAT64 lag_f[],FLOAT64 ForPitch_decTEMP[],

                             FLOAT64 tempext_dec[],FLOAT64 ext_dec[],

                             FLOAT64**unfcod_dec,PARAMETER channel)

    {

    /*------------------------------------------*/

    INT16 n_sf,i_s,i_sf,l_sf;
				
				<dp n="d559"/>
INT16  curr_lsf;
FLOAT64*px,temp_lag;
FLOAT64 FET,PFET,AA;
/*-------------------------------------------------*/
if((bfi==0)&amp;&amp;(past_bfi==1)&amp;&amp;(ppast_bfi==0)&amp;&amp;

      ((channel.fix_rate==RATE4_0K)‖(channel.fix_rate==RATE8_5K))

      &amp;&amp;((fix_rate_m==RATE4_0K)‖(fix_rate_m==RATE8_5K))&amp;&amp;

    (qua_gainQ[0][0]>0.6))

    {

    (*update)=1;

    if(fix_rate_m=RATE8_5K)

         n_sf=N_SF4;

    else

        {

        if(SVS_deci_m=1)

            n_sf=N_SF3;

        else

            n_sf=N_SF2;

        }

    if(channel.fix_rate=RATE8_5K)

         curr_lsf=L_SF4;

    else

         curr_lsf=L_SF0;

    if((SVS_deci_m==1)&amp;&amp;(channel.idx_SVS_deci==0))

        {

        /*----------------------------------------*/

        /*             PP then LTP                         */

        /*----------------------------------------*/

        temp_lag=(temp_lagf-pitch_f_mem[0])*159.0/

                   ((double)L_FRM+curr_lsf-1.0)+pitch_f_mem[0];

        PIT_PitchInterpolat(temp_lag,pitch_f_mem,

                                           ForPitch_decTEMP,0);

        }
				
				<dp n="d560"/>
/*-------------------------------------------------*/
/*               Sub-frame loop                        */
/*-------------------------------------------------*/
i_s=0;
for(i_sf=0;i_sf<n_sf;i_sf++)

    {

    /*========================================================================*/

    /*---------------------------------------------*/

    /*            Set subframe size                    */

    /*---------------------------------------------*/

    if(fix_rate_m!=RATE4_0K)

         l_sf=L_SF4;

    else

         {

         if(SVS_deci_m==1)

             {

             if(i_sf==N_SF3-1)

                 l_sf=L_SF3;

             else

                 l_sf=L_SF0;

             }

         else

             l_sf=L_SF;

         }

    /*-------------------------------------------*/

    /*             Adaptive Codebook Contribution    */

    /*-------------------------------------------*/

    if(SVS_deci_m==1)

        {

        /*---------------------------------------*/

        /*             PP then LTP(LTP or PP)        */

        /*---------------------------------------*/

        LTP_PP_pitch_ext_decod(ForPitch_decTEMP+i_s,

                    tempext_dec,i_sf,unfcod_dec[0],lag,
				
				<dp n="d561"/>
                   lag_f,l_sf);

    }
else

    {

    if((SVS_deci_m==0)&amp;&amp;(channel.idx_SVS_deci==1))

        {

        /*---------------------------*/

        /*            LTP then PP              */

        /*---------------------------*/

        temp_lag=((pitchf-lag_f[0])*(i_sf+1.0)*l_sf)/

                      ((double)L_FRM*2.0)+lag_f[0];

        }

    else

        {

        /*---------------------------*/

        /*            LTP then PP              */

        /*---------------------------*/

        temp_lag=((temp_lagf-lag_f[0])*(i_sf+1.0)*l_sf)/

                      ((double)L_FRM+curr_lsf)+lag_f[0];

        }

    lag[i_sf]=(short)temp_lag;

    LTP_pitch_decodtemp(tempext_dec,i_sf,unfcod_dec[0],

                          temp_lag,l_sf);

    }
/*-------------------------------------*/
/*                 Gains                      */
/*-------------------------------------*/
gainQ[0]=qua_gainQ[0][i_sf];
gainQ[1]=qua_gainQ[1][i_sf];
/*-------------------------------------*/
/*            RE-Build the excitation         */
/*-------------------------------------*/
wad_dvector(unfcod_dec[0],gainQ[0],qua_unfcod[1]+i_s,

              gainQ[1],tempext_dec+MAX_LAG,0,l_sf-1);
				
				<dp n="d562"/>
       dot_dvector(tempext_dec+MAX_LAG,tempext_dec+MAX_LAG,&amp;FET,

                     0,l_sf-1);

       FET+=EPSI;

       if(lag[i_sf]>0)

           {

           if(SVS_deci_m=1)

               px=tempext_dec+MAX_LAG-(short)ForPitch_decTEMP[i_s];

           else

               px=tempext_dec+MAX_LAG-lag[i_sf];

           dot_dvector(px,px,&amp;PFET,0,l_sf-1);

           AA=sqrt(PFET/FET);

           }

       else

           {

           px=tempext_dec+MAX_LAG-l_sf;

           dot_dvector(px,px,&amp;PFET,0,l_sf-1);

           AA=sqrt(PFET/FET);

           }

        px=tempext_dec+MAX_LAG;

        sca_dvector(px,AA,px,0,l_sf-1);

        cpy_dvector(tempext_dec+l_sf,tempext_dec,0,MAX_LAG-1);

        i_s+=l_sf;

        /*================================================================*/

        }

    /*---------------------------------------------*/

    /*                Replace Adaptive CB               */

    /*---------------------------------------------*/

    cpy_dvector(tempext_dec,ext_dec,0,MAX_LAG-1);

    }
/*-------------------------------------------------*/
return;
				
				<dp n="d563"/>
    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*======================================================================================*/
/*-----------------------END-----------------------*/
/*======================================================================================*/
				
				<dp n="d564"/>
/*===================================================================================*/
/*==============================================================================*/
/*Conexant System Inc.                                               */
/*4311 Jamboree Road                                                  */
/*Newport Beach,CA 92660                                               */
/*-------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                               */
/*-------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                      */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*===================================================================================*/
/*PROTOTYPE FILE:lib_ltp.h                                     */
/*===================================================================================*/
/*-------------------------------------------------*/
/*------------------FUNCTIONS----------------------*/
/*-------------------------------------------------*/
void LTP_init_lib          (void);
void LTP_Init_SincWindows  (void);
void LTP_generate_PitLagTab(void);
FLOAT64Hwind        (FLOAT64,INT16);
FLOAT64 sincFwin2   (FLOAT64,INT16);
FLOAT64 sincFwin(FLOAT64,INT16);
void D2A_InterpWeight (FLOAT64[],FLOAT64,INT16);
void D2A_InterpWeight2(FLOAT64[],FLOAT64,INT16);
FLOAT64D2A_interp             (FLOAT64[],FLOAT64[],INT16,FLOAT64,INT16);
INT16    LTP_lag_to_idx5b     (FLOAT64);
INT16    LTP_lag_to_idx7b     (FLOAT64);
INT16    LTP_lag_to_idx8b     (FLOAT64);
void LTP_FineIndex_search  (FLOAT64[],INT16,INT16,INT16,INT16,

                              FLOAT64[],INT16*);
				
				<dp n="d565"/>
void LTP_excit_vari_pitch   (FLOAT64*,INT16,INT16,FLOAT64[],INT16,

                            FLOAT64[], INT16,FLOAT64[]);
void LTP_excit_const_pitch  (FLOAT64,INT16,FLOAT64[],INT16,FLOAT64[],

                            INT16);
void LTP_PP_pitch_ext       (FLOAT64[],FLOAT64*,FLOAT64*,FLOAT64*,

                               INT16,FLOAT64*,FLOAT64*,INT16*,

                                   FLOAT64*,FLOAT64*,INT16);
void LTP_PP_pitch_ext_decod (FLOAT64[],FLOAT64*,INT16,FLOAT64*,

                               INT16*,FLOAT64*,INT16);
void LTP_close_8_5k_pitch   (FLOAT64[],FLOAT64[],FLOAT64[],INT16,

                              FLOAT64[],FLOAT64[],INT16*,FLOAT64*,

                                FLOAT64*,FLOAT64*,INT16,INT16,INT16[]);
void LTP_close_7b_pitch     (FLOAT64[],FLOAT64[],FLOAT64[],INT16,

                                FLOAT64[],FLOAT64[],INT16*,FLOAT64*,

                                   FLOAT64*,FLOAT64*,INT16,INT16,

                                      INT16[]);
void LTP_pitch decodtemp    (FLOAT64[],INT16,FLOAT64[],FLOAT64,INT16);
void LTP_7b_pitch_decod     (INT16,FLOAT64[],INT16,FLOAT64[],INT16[],

                            FLOAT64[],INT16,INT16[]);
void LTP_8_5k_pitch_decod   (INT16,FLOAT64[],INT16,FLOAT64[],INT16[],

                            FLOAT64[],INT16,INT16[]);
void LTP_adap_cbk_correction(INT16,INT16,INT16,INT16,FLOAT64**,

                            FLOAT64[],INT16,FLOAT64,INT16*,FLOAT64[],

                            INT16[],FLOAT64[],FLOAT64[],FLOAT64[],

                            FLOAT64[],FLOAT64**,PARAMETER);
/*==========================================================================*/
/*---------------END----------------------*/
/*==========================================================================*/
				
				<dp n="d566"/>
/*===============================================================================*/
/*========================================================================*/
/*Conexant System Inc.                                    */
/*4311 Jamboree Road                                       */
/*Newport Beach,CA 92660                                    */
/*--------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                     */
/*---------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                           */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
*================================================================================*/
/*LIBRARY:lib_pit.c                                                 */
/*===============================================================================*/
/*-----------------------------------------------------------*/
/*----------------------INCLUDE----------------------------------*/
/*-----------------------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″gputil.h″
#include″ext_var.h″
#include″lib_pit.h″
#include″lib_ltp.h″
#ifdefDIAGNOSTICS
#include″lib_dia.h″
#endif
/*---------------------------------------------------------*/
/*--------------------------FUNCTIONS---------------------------*/
/*---------------------------------------------------------*/
				
				<dp n="d567"/>
/*===============================================================================*/
/*FUNCTION  :PIT LT_Corr_Rmax().                                   */
/*---------------------------------------------*/
/*PURPOSE   :This function performs initialisa the global      */
/*         variables of the PIT library.                     */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                                */
/*                    _None.                                  */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*                    _None.                                  */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                         */
/*                    _None.                                 */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                               */
/*                    _None.                                 */
/*===============================================================================*/
void PIT_init_lib(void)

    {

    /*-----------------------------------------*/

    lagl=20;

    /*-----------------------------------------*/

    pitchf=MIN_LAG;

    ini_dvector(pitch_f_mem,0,PIT_F_MEM-1,MIN_LAG);

    /*-----------------------------------------*/

    /*                   PIT_ol_2pitchs                   */

    /*-----------------------------------------*/

    VUVm=1;

    VUVmm=0;

    pitch_m=20;

    pitch_mm=40;

    Iopt0=0;
				
				<dp n="d568"/>
    ini_svector(PITmax0,0,NUM_MAX_SRCH-1,20); 

    LagCount=0;

    VadCount=0;

    Av_lag=MIN_LAG;

    Rp_m=0.0;

    ini_svector(ol_lag,0,N_SF_MAX,30);

    ini_svector(lag,0,N_SF_MAX,30);

    /*-----------------------------------------*/

    return;

    /*-----------------------------------------*/

    }
/*---------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :PIT_LT_Corr_Rmax().                             */
/*---------------------------------------------*/
/*PURPOSE    :This function performs a first pitch         */
/*           determination by finding NUM_MAX_SRCH maxima in  */
/*           the autocorrelation.                        */
/*                                                       */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                                 */
/*       _(INT16)    Low_order: lower autocorrelation order. */
/*       _(INT16)    High_order:Higher autocorrelation order.*/
/*       _(INT16)    L:         length of correlation window.*/
/*       _(INT16)    L_r:       length of input.            */
/*       _(FLOAT64[])res:       input frame.                 */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                */
/*       _(INT16[])PITmax:      autocorrelation maxima         */
/*                            position.                    */
/*       _(FLOAT64[])Rmax:      autocorrelation maxima values  */
/*---------------------------------------------*/
/*INPUT/OUTPUT AKGUMENTS:                                          */
				
				<dp n="d569"/>
/*                        _None.                      */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                         */
/*                        _None.                      */
/*===============================================================================*/
void PIT_LT_Corr_Rmax(INT16 Low_order,INT16 High_order,INT16 L,

                     INT16 L_r,FLOAT64 res[],INT16 PITmax[],

                        FLOAT64 Rmax[])

     {

     /*-----------------------------------------*/

     INT16 i,k,i0,T1,T2,K1,K2,L_R,low,high;

     FLOAT64 x,y,eng;

     FLOAT64 R[(HI_LAG2-MIN_LAG+4+2*SINC_LIMIT)];

     /*-----------------------------------------*/

     /*       Residual Aurocorrelation Calculation        */

     /*-----------------------------------------*/

     low=Low_order-SINC_LIMIT-1;

     high=High_order+SINC_LIMIT+1;

     L_R=high-low+1;
#ifdef VERBOSE

    if(L_R>=HI_LAG2-MIN_LAG+4+2*SINC_LIMIT)

         {

         printf(″L_R>=HI_LAG2-MIN_LAG+4+2*SINC_LIMIT!!!\n″);

         exit(0);

         }
#endif

    i0=L_r-L;

    dot_dvector(res+i0,res+i0,&amp;eng,0,L-1);

    dot_dvector(res+i0-low+1,res+i0-low+1,&amp;y,0,L-1);

    for(i=low;i<=high;i++)

        {

        dot_dvector(res+i0,res+i0-i,&amp;R[i-low],0,L-1);

        y+=res[i0-i]*res[i0-i];

        y-=res[i0-i+L]*res[i0-i+L];

        R[i-low]/=sqrt(MAX(y*eng,0.01));

        }
				
				<dp n="d570"/>
/*---------------------------------------------*/
/*                   Determine 4 best lags            */
/*---------------------------------------------*/
T2=Low_order;
for(k=0;k<4;k++)
{
/*---------------------------------------------*/
/*                   Initial search                  */
/*---------------------------------------------*/
T1=T2;
T2=MIN(T1*2,High_order+1);
PITmax[k]=T1;
Rmax[k]=R[T1-low];
for(i=T1+1;i<T2;i++)

    {

    if(R[i-low]>Rmax[k])

         {

         Rmax[k]=R[i-low];

         PITmax[k]=i;

         }

    }
/*---------------------------------------------*/
/*       Further search with low-pass filtering        */
/*---------------------------------------------*/
K1=MAX(PITmax[k]-1,Low_order);
K2=MIN(PITmax[k]+1,High_order);
x=K1-low;
R[K1-low]=D2A_interp(SincWindows,R,L_R,x,SINC_LIMIT);
PITmax[k]=K1;
Rmax[k]=R[K1-low];
for(i=K1+1;i<=K2;i++)

    {

    x=i-low;

    R[i-low]=D2A_interp(SincWindows,R,L_R,x,SINC_LIMIT);

    if(R[i-low]>Rmax[k])

         {

         PITmax[k]=i;
				
				<dp n="d571"/>
              Rmax[k]=R[i-low];

              }

          }

    /*========================================================================*/

       }

    /*----------------------------------------*/

    /*                 In case of 3 regions          */

    /*----------------------------------------*/

    if(Low_order*8>=High_order)

         {

         PITmax[3]=PITmax[2];

         Rmax[3]=Rmax[2];

         }

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :PIT_FirstPitchLag().                            */
/*--------------------------------------------*/
/*PURPOSE    :This function performs a first pitch           */
/*           determination.                                 */
/*                                                         */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                             */
/*    _(INT16  [])PITmax:    autocorrelation maxima         */
/*                         position.                     */
/*    _(FLOAT64[])Rmax:      autocorrelation maxima values  */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                            */
/*    _(INT16  *)lag_opt:  optimum lag position.         */
/*    _(FLOAT64*)R_opt:      optimum lag frame               */
				
				<dp n="d572"/>
/*                           autocorrelation value.    */
/*      _(INT16  *)Iopt:     optimum PITmax index.        */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                    */
/*                    _None.                            */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                          */
/*                    _None.                           */
/*===============================================================================*/
void PIT_FirstPitchLag(INT16 PITmax[],FLOAT64 Rmax[],INT16*lag_opt,

                                        FLOAT64*R_opt,INT 6*Iopt)

     {

     /*----------------------------------------*/

     FLOAT64 MaxR;

     INT16  i;

     /*----------------------------------------*/

     /*         First search and correction           */

     /*----------------------------------------*/

     (*Iopt)=0;

     MaxR=Rmax[0];

     for(i=1;i<NUM_MAX_SRCH;i++)

         {

         if(Rmax[i]>MaxR)

             {

             (*Iopt)=i;

             MaxR    =Rmax[i];

             }

         }

     /*-----------------------------------------*/

     (*lag_opt)  =PITmax[(*Iopt)];

     (*R_opt)=MaxR;

     /*-----------------------------------------*/

     return;
				
				<dp n="d573"/>
    /*-----------------------------------------*/

    }
/*---------------------------------------------*/
/*=============================================================================*/
/*FUNCTION   :PIT_PitchLagCorrect().                            */
/*----------------------------------------------*/ 
/*PURPOSE    :This function corrects the first pitch       */
/*           determination.                               */
/*                                                       */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                                            */
/*      _(INT16  )pitch_m:  pitch of previous frame.      */
/*      _(INT16  )VUVm:       voice/unvoiced decision of     */
/*                          previous frame.              */
/*      _(INT16  )pitch_mm:  pitch value of 2 frames        */
/*                          earlier.                    */
/*      _(INT16  )VUVmm:         voice/unvoiced decision of    */
/*                          2 frames earlier.            */
/*      _(INT16 [])PITmax:    autocorrelation maxima          */
/*                          position.                    */
/*      _(FLOAT64[])Rmax:      autocorrelation maxima values  */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*      _(INT16  *)Iop:     optimum PITmax index.            */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                             */
/*                  _None.                                  */
/*---------------------------------------------*/
/*RETURN APGUMENTS:                                                  */
/*      _(INT16  )PITi:     corrected pitch value.              */
/*===============================================================================*/
INT16 PIT_PitchLagCorrect(INT16 pitch_m,INT16 VUVm,INT16 pitch_mm,INT16 VUVmm,

                  INT16 hi_lag,INT16*Iop,INT16*PITmax,FLOAT64*Rmax)

    {

    /*----------------------------------------*/

    INT16  PITi,i,k,P1,P2,PIT_test,Iopt,flag;

    INT16  Decis_m,Decis_mm;
				
				<dp n="d574"/>
FLOAT64    D,D0;
/*---------------------------------------------*/
Iopt=*Iop;
PITi=PITmax[Iopt];
/*---------------------------------------------*/
/*                     Second Correction              */
/*---------------------------------------------*/
D0=1.0;
for(i=Iopt-1;i>=0;i--)

    {

    /*-----------------------------------------*/

    P1=(INT16)MAX(PITmax[i]*0.7,MIN_LAG);

    P2=(INT16)MIN(PITmax[i]*1.3,hi_lag);

    D=D0;

    if(VUVm>3‖(VUVm>2&amp;&amp;VUVmm>2))

        {

        if(Rmax[i]>0.95)D=0.95*D0;

        }

    else

        {

        if(Rmax[i]>0.85)D=0.9*D0;

        }

    /*-------------------------------------*/

    Decis_m=(VUVm>2&amp;&amp;pitch_m>=P1&amp;&amp;pitch_m<=P2);

    Decis_mm=(VUVmm>2&amp;&amp;pitch_mm>=P1&amp;&amp;pitch_mm<=P2);

    if(Decis_m‖Decis_mm)

        D=0.85*D0;

    if(Decis_m&amp;&amp;Decis_mm)

        D=0.65*D0;

    /*-------------------------------------*/

    Decis_m=(VUVm>3&amp;&amp;pitch_m>=P1&amp;&amp;pitch_m<=P2);
				
				<dp n="d575"/>
        Decis_mm=(VUVmm>3&amp;&amp;pitch_mm>=P1&amp;&amp;pitch_mm<=P2);

        if(Decis_m‖Decis_mm)

            D=0.75*D0;

        if(Decis_m&amp;&amp;Decis_mm)

            D=0.6*D0;

        /*-------------------------------------*/

        flag=0;

        for(k=2;k<=4;k++)

            {

            PIT_test=  PITmax[Iopt]/k;

            P1      =  (INT16)MAX(PIT_test*0.8,MIN_LAG);

            P2      =  (INT16)MIN(PIT_test*1.2,hi_lag);

            if(PITmax[i]>=P1&amp;&amp;PITmax[i]<=P2)

                flag=1;

            }

        /*-------------------------------------*/

        if((flag=1)&amp;&amp;(Rmax[i]>D*Rmax[Iopt])

            &amp;&amp;(Rmax[i]>0.25))

            {

            PITi=PITmax[i];

            *Iop=i;

            break;

            }

        /*-------------------------------------*/

        }

    /*-----------------------------------------*/

    return  PITi;

    /*-----------------------------------------*/

    }
/*---------------------------------------------*/
				
				<dp n="d576"/>
/*===========================================================================*/
/*FUNCTION    :PIT_ol_2pitchs().                               */
/*---------------------------------------------*/
/*PURPOSE     :This function estimati the 2 pitch per frame. */
/*                                                          */
/*---------------------------------------------*/
/*INPUT ARGUMENTS  :                                            */
/*      _(FLOAT64[])wspeech:   weighted input speech.          */
/*      _(INT16   )L_ws       input frame size.              */
/*      _(FLOAT64[])Rp:        autocorrelation maxima values   */
/*      _(INT16  )vad:        vad decision.                 */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*      _(INT16[])lag:        estimated lag values.       */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                      */
/*                  _None.                              */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                            */
/*                  _None.                            */
/*=============================================================================*/
void    PIT_ol_2pitchs  (FLOAT64 wspeech[],INT16 L_ws,INT16 lag[],

                        FLOAT64 Rp[],INT16 frame_class,INT16 hi_lag)

        {

        /*-------------------------------------*/

        INT16 i,L_corr,L,Iopt,Iopt1,Iopt2,CorrectFlag,

            PITmax1[NUM_MAX_SRCH],PITmax2[NUM_MAX_SRCH];

        FLOAT64 Rmax1[NUM_MAX_SRCH],Rmax2[NUM_MAX_SRCH];

        /*-------------------------------------*/

        /*     Open loop pitch estimation in lookahead      */

        /*------------------------------------*/

        L_corr=L_FRM/2;

        lag[0]=lag[2];

        Rp[0]=Rp[2];
				
				<dp n="d577"/>
   /*------------------------------------------*/
   /*        Calculate the autocorrelation values         */
   /*------------------------------------------*/
   L=MIN(L_ws-L_LPCLHD+L_corr,L_ws);
   PIT_LT_Corr_Rmax(MIN_LAG,hi_lag,L_corr,L,wspeech,PITmax2,Rmax2);
   /*------------------------------------------*/
   /*          Searching for integer pitch                */
   /*------------------------------------------*/
   PIT_FirstPitchLag(PITmax2,Rmax2,&amp;(lag[2]),&amp;(Rp[2]),&amp;Iopt2);
   Iopt=Iopt2;
lag[2]=PIT_PitchLagCorrect(pitch_m,VUVm,pitch_mm,VUVmm,hi_lag,

         &amp;Iopt2,PITmax2,Rmax2);
   Rp[2]=Rmax2[Iopt2];
   /*------------------------------------------*/
   /*    Open loop pitch in second half frame          */
   /*------------------------------------------*/
  if((VUVmm<3)&amp;&amp;(VUVm<3))

    {

    if(Rp[2]>0.5)

        {

        VUVmm=3;

        pitch_mm=lag[2];

        if(Rp[0]>0.5&amp;&amp;lag[0]<lag[2])

            pitch_mm=lag[0];

        }
   else

        {

        if(Rp[0]>0.5)

            {

            VUVmm=3;

            pitch_mm=lag[0];

                 }

        }
   }
/*---------------------------------------------*/
/*       Calculate the autocorrelation values          */
				
				<dp n="d578"/>
/*---------------------------------------------*/
L=L_ws-L_LPCLHD;
PIT_LT_Corr_Rmax(MIN_LAG,hi_lag,L_corr,L,wspeech,PITmax1,Rmax1);
/*---------------------------------------------*/
/*             Searching for integer pitch              */
/*---------------------------------------------*/
PIT_FirstPitchLag(PITmax1,Rmax1,&amp;(lag[1]),&amp;(Rp[1]),&amp;Iopt1);
Iopt=Iopt1;
lag[1]=PIT_PitchLagCorrect(pitch_m,VUVm,pitch_mm,VUVmm,hi_lag,

      &amp;Iopt1,PITmax1,Rmax1);
Rp[1]=Rmax1[Iopt1];
/*---------------------------------------------*/
/*             Second correction for lag[1]             */
/*---------------------------------------------*/
CorrectFlag=0;
if(abs(lag[2]-pitch_m)<0.25*MIN(lag[2],pitch_m)&amp;&amp;
   abs(lag[2]-lag[1])>0.25*lag[1]&amp;&amp;
   (Rp[2]>0.5‖Rp_m>0.5))

     {
if(Rp[2]>0.5)

    pitch_mm=lag[2];
else

    pitch_mm=pitch_m;
CorrectFlag=1;
}
if(abs(lag[2]-lag[0])<0.25*MIN(lag[2],lag[0])&amp;&amp;
   abs(lag[2]-lag[1])>0.25*lag[1])

     {
if((Rp[2]>0.5)&amp;&amp;(Rp[0]>0.5))

     {

     lag[1]=(lag[0]+lag[2])/2;

     CorrectFlag=0;
   }
else
				
				<dp n="d579"/>
           {

           if(Rp[0]>0.5)

               {

               pitch_mm=lag[0];

               CorrectFlag=1;

               }

           if(Rp[2]>0.5)

               {

               pitch_mm=lag[2];

               CorrectFlag=1;

               }

           }

    }
if(((lag[1]-lag[2]>=0.3*MIN(lag[1],lag[2]))&amp;&amp;

          (Rp[2]>1.25*Rp[1]&amp;&amp;Rp[1]<0.75&amp;&amp;Rp[2]>0.5))‖

      ((lag[2]-lag[1]>0.3*lag[1])&amp;&amp;(Rp[2]>1.25*Rp[1]&amp;&amp;Rp[2]>0.5)))

          {

          lag[1]=lag[2];

          CorrectFlag=0;

          }
if(CorrectFlag==1)

    {

     for(i=0;i<NUM_MAX_SRCH;i++)

          {

           if((PITmax1[i]>0.75*pitch_mm)&amp;&amp;

                    (PITmax1[i]<1.25*pitch_mm)&amp;&amp;

                        (Rmax1[i]>0.5*Rmax1[Iopt1])&amp;&amp;

                           (PITmax1[i]>PITmax1[Iopt1]/NUM_MAX_SRCH))

                           {

                           lag[1]=PITmax1[i];

                           Rp[1]=Rmax1[i];

                           break;

                           }

            }

     }
/*---------------------------------------------*/
/*            Second correction for lag[0]              */
/*---------------------------------------------*/
				
				<dp n="d580"/>
CorrectFlag=0;
if((lag[0]-lag[1]>=0.25*MIN(lag[0],lag[1]))&amp;&amp;

       (Rp[1]>1.1*Rp[0])&amp;&amp;(Rp[0]<0.75)&amp;&amp;(Rp[1]>0.5))

    {

    pitch_mm=lag[1];

    CorrectFlag=1;

    }

    if(abs(lag[2]-lag[1])<0.25*MIN(lag[2],lag[1])&amp;&amp;

       abs(lag[0]-lag[1])>0.25*lag[0]&amp;&amp;Rp[1]>0.5){

      pitch_mm=lag[1];

      CorrectFlag=1;
}

    if(abs(lag[1]-pitch_m)<0.25*MIN(lag[1],pitch_m)&amp;&amp;

       abs(lag[1]-lag[0])>0.25*lag[0]){

     if(Rp[1]>0.5&amp;&amp;Rp_m>0.5)

         lag[0]=(pitch_m+lag[1])/2;

       CorrectFlag=0;

     }

     else{

       if(Rp_m>0.5)

             pitch_mm=pitch_m;

             CorrectFlag=1;

           }

       if(Rp[1]>0.5)

             pitch_mm=lag[1];

             CorrectFlag=1;

           }

     }
}
  if(CorrectFlag==1){
   for(i=0;i<NUM_MAX_SRCH;i++){

     if(PITmax0[i]>0.75*pitch_mm&amp;&amp;

            PITmax0[i]<1.25*pitch_mm&amp;&amp;

        Rmax0[i]>0.75*Rmax0[Iopt0]&amp;&amp;

            PITmax0[i]>PITmax0[Iopt0]/NUM_MAX_SRCH)

        {

      lag[0]=PITmax0[i];

      Rp[0]=Rmax0[i];
				
				<dp n="d581"/>
            break;

             }

         }

       }

     /*-----------------------------------------*/

     /*                       Set large lag          */

     /*-----------------------------------------*/

     if((frame_class>=3)&amp;&amp;(lag[1]<50)&amp;&amp;

            (Av_lag>MAX(2.25*lag[1],50)))

       {

       if(PITmax1[1]>lag[1]&amp;&amp;Rmax1[1]>Rmax1[2])

           {

           lag[1]=MAX(PITmax1[1],pitch_m);

           Rp[1]=Rmax1[1];

           }

       else

           {

           if(Rmax1[3]>Rmax1[2])

               {

               lag[1]=MAX(PITmax1[3],pitch_m);

               Rp[1]=Rmax1[3];

               }

           else

               {

               lag[1]=MAX(PITmax1[2],pitch_m);

               Rp[1]=Rmax1[2];

               }

           }

    }
if((frame_class>=3)&amp;&amp;(lag[0]<50)&amp;&amp;

         (Av_lag>MAX(2.25*lag[0],50)))

         {

         if((PITmax0[1]>lag[0])&amp;&amp;(Rmax0[1]>Rmax0[2]))

              {

              lag[0]=MAX(PITmax0[1],pitch_m);

              Rp[0]=Rmax0[1];

              }

         else

              {
				
				<dp n="d582"/>
         if(Rmax0[3]>Rmax0[2])

             {

             lag[0]=MAX(PITmax0[3],pitch_m);

             Rp[0]=Rmax0[3];

             }

         else

             {

             lag[0]=MAX(PITmax0[2],pitch_m);

             Rp[0]=Rmax0[2];

             }

        }

    }
/*---------------------------------------------*/
/*                    Estimate Average pitch              */
/*---------------------------------------------*/
if((frame_class>=3)&amp;&amp;(Rp[1]>0.5)&amp;&amp;(lag[1]>0.7*pitch_m)
 &amp;&amp;(lag[1]<1.3*pitch_m))

     LagCount++;
else

     LagCount=0;
if(LagCount>=2)
   Av_lag=(short)((double)Av_lag*0.75+(double)lag[1]*0.25);
if(frame_class<=0)
   VadCount++;
else
   VadCount=0;
if(VadCount>3)
   Av_lag=40/*MIN_LAG*/;
/*---------------------------------------------*/
/*                         Update memory              */
/*---------------------------------------------*/
pitch_mm=pitch_m;
pitch_m=lag[1];
VUVmm=VUVm;
				
				<dp n="d583"/>
   VUVm=1;
  if(Rp[1]>0.25)
   VUVm=2;
  if(Rp[1]>0.5)
   VUVm=3;
  if(Rp[1]>0.75)
   VUVm=4;
  Rp_m=Rp[1];
  Iopt0=Iopt2;
  for(i=0;i<NUM_MAX_SRCH;i++)

    {

    PITmax0[i]=PITmax2[i];

    Rmax0[i]=Rmax2[i];

    }
  /*-----------------------------------------*/
  /*                    high limit                 */
  /*-----------------------------------------*/
  if(hi_lag==HI_LAG)

    {

    if(lag[0]>HI_LAG)

         {

         if((PITmax0[2]<=HI_LAG)&amp;&amp;(PITmax0[2]>L_SF))

              lag[0]=PITmax0[2];

         else

              lag[0]=HI_LAG;

         }

    if(lag[1]>HI_LAG)

         {

         if((PITmax1[2]<=HI_LAG)&amp;&amp;(PITmax1[2]>L_SF))

              lag[1]=PITmax1[2];

         else

              lag[1]=HI_LAG;

         }

    }
/*---------------------------------------------*/
return;
				
				<dp n="d584"/>
    /*-----------------------------------------*/

    }
/*---------------------------------------------*/
/*===================================================================================*/
/*FUNCTION    :PIT_FinePitch().                                 */
/*---------------------------------------------*/
/*PURPOSE     :This function corrects the pitch refinement.   */
/*                                                           */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*      _(INT16  )bitrate:  bitrate value.                  */
/*      _(INT16  )low_Pitch: low pitch value.                 */
/*      _(INT16  )high_Pitch:high pitch value.               */
/*      _(FLOAT64[])res:     weighted speech.                 */
/*      _(INT16  )L_r:       length of wspeech.              */
/*      _(FLOAT64 )Delay_pp:   pre-processing delay.           */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*      _(FLOAT64  *)Rp_max:      autocorrelation maximum value  */
/*      _(FLOAT64  *)pitchf:    PitLagTab7b extracted pitch    */
/*                            value                         */
/*      _(INT16  *)index:      optimum PitLagTab7b index.     */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                        */
/*                 _None.                                 */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                            */
/*                 _(INT16)PITi:    pitch value.         */
/*=====================================================================================*/
INT16    PIT_FinePitch(INT16 bitrate,INT16 low_pit,INT16 high_pit,FLOAT64 res[],

                 INT16 L_r,FLOAT64 Delay_pp,FLOAT64*Rp_max,

                     FLOAT64*pitchf,INT16*index)

    {

    /*------------------------------------------*/

    FLOAT64    MaxR,x,y,z,R[(20+2*SINC_LIMIT)];

    INT16  i0,i,LowL,HighL,L_R,PITi,L,P1,P2;

    /*------------------------------------------*/
				
				<dp n="d585"/>
/*            Determine the correlation                  */
/*---------------------------------------------*/
LowL   =low_pit-SINC_LIMIT-2;
HighL  =high_pit+SINC_LIMIT+2;
L_R=HighL-LowL+1;
/*---------------------------------------------*/
L =L_FRM/2;
i0=L_r-L/2;
dot_dvector(res+i0,res+i0,&amp;x,0,L-1);
for(i=LowL;i<=HighL;i++)

    {

    dot_dvector(res+i0-i,res+i0-i,&amp;y,0,L-1);

    dot_dvector(res+i0,res+i0-i,&amp;z,0,L-1);

    R[i-LowL]=   z/sqrt(MAX(x*y,0.0001));

    }
/*---------------------------------------------*/
/*            Searching for integer pitch              */
/*---------------------------------------------*/
PITi=low_pit;
MaxR=R[low_pit-LowL];
for(i=low_pit+1;i<=high_pit;i++)
if(R[i-LowL]>MaxR)

     {

     PITi=i;

     MaxR=R[i-LowL];

     }
   if(bitrate==RATE8_5K)

     {

     /*-----------------------------------------*/

     /*  Search for the best precise pitch and index     */

     /*-----------------------------------------*/

     P1=LTP_lag_to_idx8b((double)(PITi-1.0));
				
				<dp n="d586"/>
    P2=LTP_lag_to_idx8b((double)(PITi+1.0));

    LTP_FineIndex_search(PitLagTab8b,P1,P2,LowL,L_R,R,index);

    /*---------------------------------------------*/

    /*                   Estimate Rp_max                   */

    /*---------------------------------------------*/

    PITi=(INT16)(PitLagTab8b[*index]+0.5-LowL);

    (*Rp_max)=R[PITi];

    PITi=(INT16)(PitLagTab8b[*index]+0.5);

    /*---------------------------------------------*/

    /*                   Modify pitch index                */

    /*---------------------------------------------*/

    if(Delay_pp>10)

        (*index)=MIN((*index)+1,MAX_PIT_IDX_8b);

    if(Delay_pp<-10)

        (*index)=MAX((*index)-1,0);

    if(Delay_pp>15)

        (*index)=MIN((*index)+1,MAX_PIT_IDX_8b);

    if(Delay_pp<-15)

        (*index)=MAX((*index)-1,0);  

    (*pitchf)=PitLagTab8b[(*index)];

    PITi=(INT16)MIN(*pitchf+0.5,high_pit);

    }
else

    {

    /*---------------------------------------------*/

    /*    Search for the best precise pitch and index      */

    /*---------------------------------------------*/

    P1=LTP_lag_to_idx7b((FLOAT64)(PITi-1.0));

    P2=LTP_lag_to_idx7b((FLOAT64)(PITi+1.0));

    LTP_FineIndex_search(PitLagTab7b,P1,P2,LowL,L_R,R,index);

    /*---------------------------------------------*/

    /*                Estimate Rp_max                      */
				
				<dp n="d587"/>
         /*------------------------------------*/

         PITi  =(INT16)(PitLagTab7b[*index]+0.5-LowL);

         (*Rp_max)=R[PITi];

         PITi  =(INT16)(PitLagTab7b[*index]+0.5);

         /*------------------------------------*/

         /*               Modify pitch index            */

         /*------------------------------------*/

         if(Delay_pp>10)

             (*index)=MIN((*index)+1,MAX_PIT_IDX_7b);

         if(Delay_pp<-10)

             (*index)=MAX((*index)-1,0);

         (*pitchf)=PitLagTab7b[(*index)];

         PITi=(INT16)MIN(*pitchf+0.5,high_pit);

         }

    /*-----------------------------------------*/

    return  PITi;

    /*-----------------------------------------*/

    }
/*---------------------------------------------*/
/*===================================================================================*/
/*FUNCTION   :PIT_PitchInterpolat().                           */
/*---------------------------------------------*/
/*PURPOSE    :This function calculate the interpolated pitch  */
/*           track.                                          */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                            */
/*    _(FLOAT64  )pitch:      current pitch value.         */
/*    _(FLOAT64  )pitch_1:    previous frame(n-1)pitch.  */
/*    _(FLOAT64  )pitch_2:    previous frame(n-2)pitch.  */
				
				<dp n="d588"/>
/*    _(INT16  )enc_flag:  signals encoder(=1)or decoder*/
/*                        (=0)operation.                 */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                            */
/*    _(FLOAT64[])ForPitch:  interpolated pitch track.   */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                      */
/*                  _None.                               */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                            */
/*                  _None.                              */
/*===================================================================================*/
void PIT_PitchInterpolat(FLOAT64 pitch,FLOAT64 pitch_mem[],

                        FLOAT64 ForPitch[],INT16 enc_flag)

     {

     /*----------------------------------------*/

     INT16    i;

     FLOAT64 pitch_mean;

     /*----------------------------------------*/

     pitch_mean  =(pitch_mem[1]+pitch)*0.5;

     /*----------------------------------------*/

     if((fabs(pitch_mem[0]-pitch)<0.2*0.5*(pitch_mem[0]+pitch))‖

              (fabs(pitch_mem[0]-pitch_mean)<0.15*pitch_mem[0]))

        {

        for(i=0;i<L_FRM;i++)

            ForPitch[i]=(i*pitch+(L_FRM-i)*pitch_mem[0])/L_FRM;

        if(enc_flag==1)

          for(i=0;i<L_FRM/2;i++)

            ForPitch[i+L_FRM]=pitch;

        }

    else

        {

        if(enc_flag=1)

             for(i=0;i<L_FRM+L_FRM/2;i++)

                  ForPitch[i]=pitch;

        else
				
				<dp n="d589"/>
            for(i=0;i<L_FRM;i++)

                ForPitch[i]=pitch;

         }

    /*-----------------------------------------*/

    return;

    /*-----------------------------------------*/

    }
/*---------------------------------------------*/
/*=================================================================================*/
/*FUNCTION     :PIT_pitch_track_recons().                        */
/*---------------------------------------------*/
/*PURPOSE      :This function reconstruct the pitch track in    */
/*             case of frame erasure.                          */
/*----------------------------------------------*/
/*INPUT ARGUMENTS:                                                 */
/*  _(INT16)fix_rate_m:      previous frame fixed rate.        */
/*  _(INT16)bfi:            frame#n Bad Frame Indicator.       */
/*  _(INT16)past_bfi:       frame#n-1 Bad Frame Indicator.     */
/*  _(INT16)ppast_bfi:      frame#n-2 Bad Frame Indicator.     */
/*  _(FLOAT64[])lag_f:       decoded pitch lags                */
/*  _(INT16)SVS_deci_m:       frame#n-1 mode indicator.          */
/*  _(FLOAT64 **)qua_gainQ:    adaptive and fixed codebook gains.  */
/*  _(parameter)channel:  decoded parameters indexes structure.*/
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                  */
/*   _(FLOAT64*)pitchf:        extrapolated pitch value.       */
/*   _(FLOAT64*)ForPitch_decTEMP:   interpolated pitch track.       */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                               */
/*   _(FLOAT64[])pitch_f_mem:past pitch values.                   */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                                   */
/*   _None.                                                      */
/*===================================================================================*/
void PIT_pitch_track_recons(INT16 fix_rate_m,INT16 bfi,INT16   past_bfi,

                         INT16 ppast_bfi,FLOAT64 lag_f[],INT16 SVS_deci_m,
				
				<dp n="d590"/>
              FLOAT64**qua_gainQ,PARAMETER channel,

              FLOAT64*pitchf,FLOAT64 pitch_f_mem[],

              FLOAT64 ForPitch_decTEMP[])
{
/*---------------------------------------------*/
  FLOAT64 temp_lagf;
/*---------------------------------------------*/
if((bfi==0)&amp;&amp;((ppast_bfi==1)‖(past_bfi==0)))

     {

     pitch_index=channel.idx_pitch[0];

     pitch_f_mem[1]=pitch_f_mem[0];

     pitch_f_mem[0]=(*pitchf);

     if(channel.fix_rate==RATE8_5K)

          (*pitchf)=PitLagTab8b[pitch_index];

     else

          (*pitchf)=PitLagTab7b[pitch_index];

     if((fix_rate_m==RATE2_0K)‖(fix_rate_m==RATE0_8K))

          {

          pitch_f_fmem[1]=(*pitchf);

               pitch_f_mem[0]=(*pitchf);

          }

     else if(SVS_deci_m==0)

          {

          if(fix_rate_m!=RATE8_5K)

               {

               pitch_f_mem[1]=lag_f[N_SF2-1];

               pitch_f_mem[0]=lag_f[N_SF2-1];

               }

          else

               {

               pitch_f_mem[1]=lag_f[N_SF4-1];

               pitch_f_mem[0]=lag_f[N_SF4-1];

               }

          }

     }
else
				
				<dp n="d591"/>
{
if((bfi==0)&amp;&amp;(ppast_bfi==0)&amp;&amp;(pas_bfi==1))
   {
   if((fix_rate_m==RATE2_0K)‖

            (fix_rate_m==RATE0_8K))

            {

            pitch_f_mem[1]=(*pitchf);

            pitch_f_mem[0]=(*pitchf);

            }
   else if(SVS_deci_m=0)

        {

        if(fix_rate_m!=RATE8_5K)

             {

             pitch_f_mem[1]=lag_f[N_SF2-1];

             pitch_f_mem[0]=lag_f[N_SF2-1];

             }

        else

             {

             pitch_f_mem[1]=lag_f[N_SF4-1];

             pitch_f_mem[0]=lag_f[N_SF4-1];

             }

        }    

    pitch_index=channel.idx_pitch[0];

    if(channel.fix_rate==RATE8_5K)

        (*pitchf)=PitLagTab8b[pitch_index];

    else

        (*pitchf)=PitLagTab7b[pitch_index];

    temp_lagf=((*pitchf)-pitch_f_mem[0])*159.0/319.0

                          +pitch_f_mem[0];

    if(SVS_deci_m=1)

        PIT_PitchInterpolat(temp_lagf,pitch_f_mem,

                ForPitch_decTEMP,0);

    pitch_f_mem[1]=pitch_f_mem[0];

    if((SVS_deci_m==1)‖(qua_gainQ[0][0]>=0.6))

            pitch_f_mem[0]=temp_lagf;

    }
else
				
				<dp n="d592"/>
             {

             pitch_f_mem[1]=pitch_f_mem[0];

             pitch_f_mem[0]=(*pitchf);

             }

         }

    /*------------------------------------------*/

    return;

    /*------------------------------------------*/

    }
/*----------------------------------------------*/
/*===================================================================================*/
/*-----------------------END--------------------*/
/*===================================================================================*/
				
				<dp n="d593"/>
/*===================================================================================*/
/*==============================================================================*/
/*Conexant System Inc.                                  */
/*4311 Jamboree Road                                     */
/*Newport Beach,CA 92660                                  */
/*----------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                  */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                                        */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*===================================================================================*/
/*LIBRARY:lib_pit.h                                                  */
/*===================================================================================*/
/*---------------------------------------------*/
/*-----------------FUNCTIONS ----------------------*/
/*---------------------------------------------*/
void PIT_init_lib        (void);
void PIT_LT_Corr_Rmax    (INT16,INT16,INT16,INT16,FLOAT64[],INT16*,

                         FLOAT64*);
void PIT_FirstPitchLag   (INT16*,FLOAT64*,INT16*,FLOAT64*,INT16*);
INT16 PIT_PitchLagCorrect(INT16,INT16,INT16,INT16,INT16,INT16*,

                         INT16*,FLOAT64*);
void PIT_ol_2pitchs      (FLOAT64[],INT16,INT16[],FLOAT64[],INT16,

                         INT16);
INT16 PIT_FinePitch          (INT16,INT16,INT16,FLOAT64[],INT16,FLOAT64,

                         FLOAT64*,FLOAT64*,INT16*);
void PIT_PitchInterpolat(FLOAT64,FLOAT64[],FLOAT64[],INT16);
				
				<dp n="d594"/>
void PIT_pitch_track_recons(INT16,INT16,INT16,INT16,FLOAT64[],INT16,

                            FLOAT64**,PARAMETER,FLOAT64*,

                            FLOAT64[],FLOAT64[]);
/*===================================================================================*/
/*-----------------END---------------------*/
/*===================================================================================*/
				
				<dp n="d595"/>
/*===================================================================================*/
/*============================================================================*/
/*Conexant System Inc.                               */
/*4311 Jamboree Road                                 */
/*Newport Beach,CA 92660                              */
/*----------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.               */
/*----------------------------------------------*/
/*ALL RIGHTS RESERVED:                                    */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation*/
/*or adaptation)without the authorisation of Conexant System Inc. */
/*===================================================================================*/
/*LIBRARY:lib_ppp.c                                                  */
/*===================================================================================*/
/*---------------------------------------------*/
/*----------------INCLUDE-------------------------*/
/*----------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″gputil.h″
#include″ext var.h″
#include″lib_lpc.h″
#include″lib_flt.h″
#include″lib_ltp.h″
#include″lib_ppp.h″
#ifdef DIAGNOSTICS
#include″lib_dia.h″
#endif
/*---------------------------------------------*/
/*-----------------FUNCTIONS-----------------------*/
				
				<dp n="d596"/>
/*---------------------------------------------*/
/*===================================================================================*/
/*FUNCTION    :PPP_init_lib().                         */
/*---------------------------------------------*/
/*PURPOSE     :This function initialise the global variables of*/
/*            the library PPP.                                */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                                 */
/*      _None.                                               */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                 */
/*      _None.                                               */
/*----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                           */
/*      _None.                                               */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                                 */
/*      _None.                                               */
/*===================================================================================*/
void PPP_init_lib(void)

    {

    /*----------------------------------------*/

    /*               pitch_preproc                     */

    /*----------------------------------------*/

    Delay_pp=0.0;

    frame_class_pp_m=3;

    Last_Rp=0.0;

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===================================================================================*/
/*FUNCTION    :PPP_mapping_residu().                    */
				
				<dp n="d597"/>
/*----------------------------------------------*/
/*PURPOSE    :This function this subroutine maps the residual*/
/*           (from T0 to T1)to modified residual            */
/*           (MapResidu[0,1,...,Len-1]).                   */
/*----------------------------------------------*/
/*INPUT ARGUMENTS:                                              */
/*    _(FLOAT64[])Sinc:       table of interpolation weights.*/
/*    _(INT16   )sinc_lmit:half interpolation table size.*/
/*    _(INT16   )len_sinc: interpolation table size.      */
/*    _(FLOAT64[])residu:    number of pulses.               */
/*    _(INT16   )T0:         Original starting time point. */
/*    _(INT16   )T1:         Original ending time point.   */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
/*     _(FLOAT64[])MapResidu:mapped residual.                */
/*----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*     _None.                                              */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
/*     _None.                                             */
/*===============================================================================*/
void PPP_mapping_residu(FLOAT64 sinc[],INT16 sine_limit,INT16 len_sinc,

            FLOAT64 residu[],FLOAT64 T0,FLOAT64 T1,INT16 Len,

               FLOAT64 MapResidu[])

     {

     /*----------------------------------------*/

     FLOAT64*Weight;

     FLOAT64 t,f,D;

     INT16  i,m,T;

     /*----------------------------------------*/

     D=(T1-T0)/(FLOAT64)Len;

     if(fabs(D-1.0)>0.0001)

          {

          for(i=0;i<Len;i++)

              {

              t=T0+i*D;
				
				<dp n="d598"/>
             T=(INT16)t;

             f=t-(FLOAT64)T;

             m=(INT16)(f*(FLOAT64)DELT_F2+0.500001);

             Weight=sinc+m*len_sinc;

             MapResidu[i]=D2A_interp(Weight,residu,L_OLPIT,t,

                                          sinc_limit);

             }

         }

    else

         {

         T=(INT16)T0;

         f=T0-(FLOAT64)T;

         m=(INT16)(f*(FLOAT64)DELT_F2+0.500001);

         Weight=sinc+m*len_sinc;

         for(i=0;i<Len;i++)

             {

             t=T0+i;

             MapResidu[i]=D2A_interp(Weight,residu,L_OLPIT,t,

                                          sinc_limit);

             }

         }

    /*------------------------------------------*/

    return;

    /*------------------------------------------*/

    }
/*----------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :PPP_update_LT_mem().                              */
/*----------------------------------------------*/
/*PURPOSE    :This function updates the excitation memory.  */
/*----------------------------------------------*/
/*INPUT ARGUMENTS:                                             */
/*    _(FLOAT64[])LTm:   table of interpolation weights.  */
/*    _(INT16   )L_LTm:  excitation memory size.        */
/*    _(INT16   )L_E:   new excitation memory size.      */
/*----------------------------------------------*/
				
				<dp n="d599"/>
/*OUTPUT ARGUMENTS:                                          */
/*     _(FLOAT64[])E:     new excitation.              */
/*----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                     */
/*    _None.                                          */
/*----------------------------------------------*/
/*RETURN ARGUMENTS:                                          */
/*    _None.                                          */
/*===============================================================================*/
void PPP_update_LT_mem(INT16 L_LTm,FLOAT64 LTm[],INT16 L_E,FLOAT64 E[])

     {

     /*-----------------------------------------*/

     INT16  j;

     /*-----------------------------------------*/

     for(j=0;j<L_LTm-L_E;j++)

         LTm[j]=LTm[j+L_E];

     /*-----------------------------------------*/

     cpy_dvector(E,LTm+L_LTm-L_E,0,L_E-1);

     /*-----------------------------------------*/

     return;

     /*-----------------------------------------*/

     }
/*----------------------------------------------*/
/*===============================================================================*/
/*FUNCTION    :PPP_search_shift_pp().                               */
/*----------------------------------------------*/
/*PURPOSE     :This function find the first sub-optimal shift   */
/*           by maximising the intercorrelation between the     */
/*           target signal and the input signal.              */
/*----------------------------------------------*/
/*INPUT ARGUMENTS:                                                   */
				
				<dp n="d600"/>
/*    _(FLOAT64[])residu:original signal.                    */
/*    _(INT16   )T0:     original starting time point.      */
/*    _(INT16   )i0:    starting index for the intercorr.  */
/*    _(INT16   )i1:    ending index for the intercorr.   */
/*    _(INT16   )Len:    input signal length.              */
/*    _(FLOAT64[])Tg:     target signal.                    */
/*----------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*    _(FLOAT64  *)Shift:  optimum shift.                  */
/*    _(FLOAT64  *)MaxRp:    maximum intercorrelation value.*/
/*----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*    _None.                                            */
/*----------------------------------------------*/
/*RETURN ARGUMENTS:                                            */
/*    _None.                                            */
/*===============================================================================*/
void PPP_search_shift_pp(FLOAT64 residu[],FLOAT64 T0,INT16 i0,INT16 i1,

                   INT16 Len,FLOAT64 Tg[],FLOAT64*Shift,FLOAT64*MaxRp)

     {

     /*-----------------------------------------*/

     INT16  L,i,i00,i11,i0L,i1H,t0,Iopt,Idx,L_R;

     FLOAT64 R,R1,R2,crit,Rp[20+2*SINC_LIMIT],

        DifTab[MAX_DIF_TAB],ShiftRes[MAX_L_TG+30],TT1,TT0;

     /*------------------------------------------*/

     (*Shift)=0;

     Iopt=0;

     dot_dvector(Tg,Tg,&amp;R1,0,Len-1);

     i00=i0-SINC_LIMIT-1;

     i11=i1+SINC_LIMIT+1;

     TT0=T0+i00;

     TT1=T0+i11+Len+1;

     L=i11+Len+1-i00;

     /*-------------------------------------------*/

     PPP_mapping_residu(SincWindows_PP,SINC_LIMIT_PP,LEN_SINC_PP,residu,
				
				<dp n="d601"/>
              TT0,TT1,L,ShiftRes);
for(i=i0;i<=i1;i++)

    {

    t0=i-i00;

    dot_dvector(Tg,ShiftRes+t0,&amp;R,0,Len-1);

    dot_dvector(ShiftRes+t0,ShiftRes+t0,&amp;R2,0,Len-1);

    Rp[i-i00]=R/sqrt(MAX(0.001,R2*R1));

    crit=Rp[i-i00];

    if(crit>(*MaxRp))

         {

         (*MaxRp)=crit;

         (*Shift)=i;

         Iopt=i;

         }

    }
/*----------------------------------------------*/
/*               Additional correlation               */
/*----------------------------------------------*/
i0L=Iopt-SINC_LIMIT-1;
i1H=Iopt+SINC_LIMIT+1;
for(i=i0L;i<i0;i++)

    {

    t0=i-i00;

    dot_dvector(Tg,ShiftRes+t0,&amp;R,0,Len-1);

    dot_dvector(ShiftRes+t0,ShiftRes+t0,&amp;R2,0,Len-1);

    Rp[i-i00]=R/sqrt(MAX(0.001,R2*R1));

    }
for(i=i1+1;i<=i1H;i++)

    {

    t0=i-i00;

    dot_dvector(Tg,ShiftRes+t0,&amp;R,0,Len-1);

    dot_dvector(ShiftRes+t0,ShiftRes+t0,&amp;R2,0,Len-1);

    Rp[i-i00]=R/sqrt(MAX(0.001,R2*R1));

    }
/*----------------------------------------------*/
/*           Fractional seareh of the delay           */
/*----------------------------------------------*/
				
				<dp n="d602"/>
      for(i=0;i<MAX_DIF_TAB;i++)

         DifTab[i]=Iopt-0.75+0.1*i;
#ifdefPROG_BUG_FIX

      L_R=i1H-i00;
#else

      L_R=i1H-i0L+1;
#endif

      LTP_FineIndex_search(DifTab,0,MAX_DIF_TAB-1,i00,L_R,Rp,&amp;Idx);

      (*Shift)=DifTab[Idx];

      i=(INT16)(DifTab[Idx]+0.5-i00);

      (*MaxRp)=MAX(Rp[i],0);

      /*----------------------------------------*/

      return;

      /*----------------------------------------*/

      }
/*----------------------------------------------*/
/*===============================================================================*/
/*FUNCTION     :PPP_search_opt_shift_pp().                    */
/*-----------------------------------------------*/
/*PURPOSE      :This function find the optimal shift by      */
/*            maximising the intercorrelation between the   */
/*            target signal and the input signal.And if the*/
/*            procedure″fails″the waveform interpolation is */
/*            performed.                                         */
/*----------------------------------------------*/
/*INPUT ARGUMENTS:                                                   */
/*    _(INT16    )frame_class:class of the current frame.        */
/*    _(FLOAT64   )PitLag:      current pitch lag.                 */
/*    _(FLOAT64[])residu:      original signal.                   */
/*    _(INT16  )T0:           starting time point.               */
/*    _(INT16  )Center:       segment center.                       */
/*    _(INT16  )l_sf:         sub-frame size.                      */
/*    _(INT16  )L_Tg:          target size.                         */
				
				<dp n="d603"/>
/*    _(FLOAT64[])Tg:         target signal.                   */
/*    _(INT16   )SRCH0:       starting index for max intercorr.*/
/*                          search.                           */
/*    _(INT16    )SRCH1:      ending index for max intercorr.  */
/*                          search.                          */
/*----------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*    _(FLOAT64[])MapResOpt:    wrapped signal.                */
/*    _(FLOAT64  *)Delay:      optimum shift.                 */
/*    _(FLOAT64  *)Rp_Opt:     maximum intercorrelation value.*/
/*-----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                        */
/*    _None.                                               */
/*----------------------------------------------*/
/*RETURN ARGUMENTS:                                             */
/*    _None.                                               */
/*===============================================================================*/
void PPP_search_opt_shift_pp(INT16 frame_class,FLOAT64 PitLag,FLOAT64 rgsidu[],

                  FLOAT64 T0,INT16 Center,INT16 l_sf,INT16 L_Tg,

                  FLOAT64 Tg[],FLOAT64 MapResOpt[],INT16 SRCH0,

                  INT16 SRCH1,FLOAT64*Delay,FLOAT64*Rp_Opt)

     {

     /*-----------------------------------------*/

     FLOAT64 Shift,CRITmax,TT0,T1;

     FLOAT64 Tg_m[MAX_L_TG];

     INT16   i;

     /*-----------------------------------------*/

     /*                Search of the delay            */

     /*-----------------------------------------*/

    if(frame_class>=3)

         {

         CRITmax=0.3;

         for(i=0;i<Center;i++)

             Tg_m[i]=(0.25+0.75*i/Center)*Tg[i];

         }

    else

         {

         CRITmax=0.4;
				
				<dp n="d604"/>
         for(i=0;i<Center;i++)

             Tg_m[i]=(0.5+0.5*i/Center)*Tg[i];

         }

     cpy_dvector(Tg,Tg_m,Center,L_Tg-1);

     PPP_search_shift_pp(residu,T0,SRCH0,SRCH1,L_Tg,Tg_m,&amp;Shift,

                             &amp;CRITmax);

     (*Delay)=Shift;

     (*Rp_Opt)  =CRITmax;

     /*----------------------------------------*/

     /*                Wrapped residual                   */

     /*----------------------------------------*/

     T1=T0+Center+Shift;

     PPP_mapping_residu(SincWindows_E,SINC_LIMIT_E,LEN_SINC_E,residu,

                          T0,T1,Center,MapResOpt);

     if(L_Tg>Center)

         {

         TT0=T1;

         T1=TT0+L_Tg-Center;

         PPP_mapping_residu(SincWindows_E,SINC_LIMIT_E,LEN_SINC_E,

                                  residu,TT0,T1,(INT16)(L_Tg-Center),

                                       (MapResOpt+Center));

         }

     /*------------------------------------------*/

     return;

     /*------------------------------------------*/

     }
/*----------------------------------------------*/
/*===============================================================================*/
/*FUNCTION    :PPP_periodicity_detect().    */
/*----------------------------------------------*/ 
				
				<dp n="d605"/>
/*PURPOSE    :This function estimate the level of periodicity  */
/*          of the input signal and calculate the normalized */
/*          crosscorrelation factors.                        */
/*-----------------------------------------------*/
/*INPUT ARGUMENTS:                                                 */
/*   _(FLOAT64[])Tg0:        target signal.                    */
/*   _(INT16   )L_ModiSig:   size of the modified signal.      */
/*----------------------------------------------*/
/*OUTPLT ARGUMENTS:                                                 */
/*   _(FLOAT64  *)Gp:        optimum shift.                     */
/*   _(FLOAT64  *)Rp:        normalized crosscorrelation factor.*/
/*-----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                           */
/*   _(FLOAT64[])ModiSig0:   modified signal.                   */
/*----------------------------------------------*/
/*RETURN ARGUMENTS :                                                */
/*     _None.                                                  */
/*===============================================================================*/
void PPP_periodicity_detect(FLOAT64 ModiSig0[],FLOAT64 Tg0[],INT16 L_ModiSig,

                   FLOAT64*Gp,FLOAT64*Rp,INT16 smv_mode,FLOAT64 nsr)

     {

     /*-----------------------------------------*/

     FLOAT64 R0,R1,R2,R3;

     FLOAT64 Tg[MAX_L_TG],ModiSig[MAX_L_TG];

     INT16i;

     /*-----------------------------------------------*/

     dot_dvector(ModiSig0,ModiSig0,&amp;R0,0,L_ModiSig-1);

     cpy_dvector(Tg0,     Tg,      0,L_ModiSig-1);

     cpy_dvector(ModiSig0,ModiSig,0,L_ModiSig-1);

     dot_dvector(ModiSig, Tg,  &amp;R1,0,L_ModiSig-1);

     dot_dvector(Tg,      Tg,  &amp;R2,0,L_ModiSig-1);

     dot_dvector(ModiSig, ModiSig,&amp;R3,0,L_ModiSig-1);

     (*Gp)=R1/MAX(R2,0.001);

     (*Rp)=R1/sqrt(MAX(0.1,R2*R3));
				
				<dp n="d606"/>
    /*-----------------------------------------*/

    if((*Rp)>0.5)

        {

        if(smv_mode>=1)

            R1=MIN(nsr*4+0.25,0.4)*MIN((*Gp),1.0);

        else

            R1=MIN(nsr*4+0.125,0.25)*MIN((*Gp),1.0);

        for(i=0;i<L_ModiSig;i++)

            ModiSig0[i]+=R1*Tg0[i];

        dot_dvector(ModiSig0,ModiSig0,&amp;R3,0,L_ModiSig-1);

        R2=sqrt(R0/MAX(R3,0.0001));

        for(i=0;i<L_ModiSig;i++)

            ModiSig0[i]*=R2;

        }

    /*---------------------------------------*/

    return;

    /*---------------------------------------*/

    }
/*-------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :PPP_sharpness().                                  */
/*-------------------------------------------*/
/*PURPOSE    :This function estimate the sharpeness of the     */
/*           input signal.                                 */
/*-------------------------------------------*/
/*INPUT ARGUMENTS:                                              */
/*  _(INT16   )Len:     size of the input signal.         */
/*  _(FLOAT64[])res:    target signal.                    */
/*-------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*  _None.                                                */
/*-------------------------------------------*/
				
				<dp n="d607"/>
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*    _None.                                           */
/*----------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*    _(FLOAT64  )P_SHP:    sharpness factor.              */
/*===============================================================================*/
FLOAT64 PPP_sharpness(INT16 len,FLOAT64 res[])
   {
   /*-------------------------------------------*/
   FLOAT64 Max,E_x,M,P_SHP;
   INT16i:
   /*-------------------------------------------*/
   E_x=0.0;
   Max=0.0;
   for(i=0;i<len;i++)

       {

       M=fabs(res[i]);

       E_x+=M;

       if(M>Max)

          Max=M;

       }
   P_SHP=E_x/(len*MAX(1.0,Max));
   /*-------------------------------------------*/
   return(P_SHP);
   /*-------------------------------------------*/
   }
/*----------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :PPP_locat_max_puls().                              */
/*----------------------------------------------*/
/*PURPOSE    :This function locate the peak of energy into a  */
/*           pitch period.                                    */
				
				<dp n="d608"/>
/*-----------------------------------------------*/
/*INPUT ARGUMENTS:                                            */
/*   _(FLOAT64[])Res:      input signal.                   */
/*   _(INT16   )Start:   starting index.                 */
/*   _(INT16   )End:      ending index.                    */
/*   _(INT16   )n_peak:   number of peaks.                 */
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*   _(INT16 *)PulsLoc:    pulse index.                     */
/*   _(FLOAT64  *)PeakRatio: ration between the peak energy and*/
/*                        signal energy.                   */
/*-----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                      */
/*   _None.                                                 */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS:                                            */
/*    _None.                                                */
/*===============================================================================*/
void PPP_locat_max_puls(FLOAT64 Res[],INT16 Start,INT16 End,INT16 n_peak,

                 INT16*PulsLoc,FLOAT64*PeakRatio)

     {

     /*----------------------------------------------*/

     FLOAT64 Eng,MaxEng[MAX_PULS_NUM],AvgEng;

     INT16 i,k,Loc,PulsLocat[MAX_PULS_NUM];

     /*----------------------------------------------*/

     for(k=0;k<n_peak;k++)

         PulsLocat[k]=Start;

     Eng=0;

     for(k=-HALFP;k<=HALFP;k++)

         Eng+=Res[Start+k]*Res[Start+k];

     AvgEng=Eng;

     for(k=0;k<n_peak;k++)

         MaxEng[k]=Eng;

     /*----------------------------------------------*/

     for(i=Start+1;i<=End;i++)

         {
				
				<dp n="d609"/>
         Eng=0.0;

         for(k=-HALFP;k<=HALFP;k++)

             Eng+=Res[i+k]*Res[i+k];

         if(Eng<4*AvgEng)

             AvgEng=0.875*AvgEng+0.125*Eng;

         if(Eng>MaxEng[0])

             {

             MaxEng[0]=Eng;

             PulsLocat[0]=i;

             for(k=1;k<n_peak;k++)

             if(MaxEng[k-1]>MaxEng[k])

                 {

                 Eng           =MaxEng[k];

                 MaxEng[k]        =MaxEng[k-1];

                 MaxEng[k-1]   =Eng;

                 Loc           =PulsLocat[k];

                 PulsLocat[k]  =PulsLocat[k-1];

                 PulsLocat[k-1]=Loc;

                 }

         }

    }
/*-----------------------------------------------*/
Loc=PulsLocat[n_peak-1];
Eng=MaxEng[n_peak-1];
for(k=n_peak-2;k>=0;k--)

    if((MaxEng[k]>0.75*MaxEng[n_peak-1])&amp;&amp;

            (AvgEng/MAX(MaxEng[k],0.1)<1/9.0))

    {

    Loc=PulsLocat[k];

    Eng=MaxEng[k];

    break;

    }
(*PulsLoc)  =Loc;
(*PeakRatio)=AvgEng/MAX(Eng,0.1);
/*-----------------------------------------------*/
				
				<dp n="d610"/>
    return;

    /*-------------------------------------------*/

    }
/*-----------------------------------------------*/
/*===============================================================================*/
/*FUNCTION    :PPP_pitch_preproc().    */
/*-----------------------------------------------*/
/*PURPOSE    :This function perform the pitch modify the input*/
/*           signal in order to improve the LTP performance  */
/*           and without introducing perceptually significant*/
/*           distortions.                                   */
/*-----------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*  _(INT16  )smv_mode:       selected SMV mode.                */
/*  _(INT16  )fix_rate:    selected fixed bit-rate.        */
/*  _(INT16  )flat_flag:   flat input speech flag.          */
/*  _(FLOAT64  )nsr:          estim.noise to signal ratio.   */
/*  _(FLOAT64[])wspeech:      input signal.                  */
/*  _(FLOAT64[])ForPitch:    forward pitch estimations.     */
/*  _(INT16   )frame_class_pp:class of the current frame for*/
/*                          picth preprocessing.          */
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                */
/*  _(FLOAT64[])ModiSig:       modified signal.                 */
/*  _(FLOAT64  *)Delay_pp:      pitch pre-processing delay.    */
/*  _(INT16    *)frame_class: class of the current frame.    */
/*  _(INT16    *)VUV:           voice unvoice decision.        */
/*  _(INT16[])gp:             Pitch gains.                  */
/*-----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                         */
/*  _None.                                                 */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
/*  _None.                                                */
/*===============================================================================*/
void PPP_pitch_preproc(INT16 smv_mode,INT16 fix_rate,INT16 flat_flag,

                      FLOAT64 nsr,FLOAT64 wspeech[],FLOAT64 ModiSig[],

                          FLOAT64 ForPitch[],FLOAT64*Delay_pp,
				
				<dp n="d611"/>
                            INT16 frame_clas_pp,INT16*frame_class,

                                INT16*VUV,FLOAT64 gp[])
{
/*-----------------------------------------------*/
INT16  i0,i,i_s,L_Tg,L,l_sf,Center;
FLOAT64 T0,T1,Delay,Delay_tmp,P_SHP,P_SHP_Tg,Rp_Opt;
FLOAT64 LTm[MAX_LAG+MAX_L_TG],Tg[MAX_L_TG],PitFunc[L_FRM+L_FRM/2];
FLOAT64 ModiRes[MAX_L_TG];
INT16   SRCH0,SRCH1,StartPoint,EndPoint,LocPuls,PulsLen;
INT16   cond_abs,cond0,cond1,cond2,cond3,cond;
FLOAT64 ltp_gain=0,pit_corr=0,avg_Rp,min_Rp;
FLOAT64 Rp[N_SF4]={0.0};
/*-----------------------------------------------*/
Delay_tmp=(*Delay_pp);
if((frame_class_pp<=0)‖(frm_count==1))

    {

    /*-------------------------------------------*/

    /*                    Reset of the delay           */

    /*-------------------------------------------*/

    if(frame_class_pp==-1)

          Delay_tmp=0;

    T0=L_OLPIT-L_LPCLHD-L_FRM+Delay_tmp;

    T1=T0+L_FRM;

    PPP_mapping_residu(SincWindows_E,SINC_LIMIT_E,LEN_SINC_E,

                              wspeech,T0,T1,L_FRM,ModiSig);

    /*-------------------------------------------*/

    /*                   Memorize the wspeech           */

    /*-------------------------------------------*/

    PPP_update_LT_mem(MAX_LAG,targ_mem,L_FRM,ModiSig);

    ltp_gain=0.0;

    pit_corr=0.0;

    avg_Rp     =0.0;

    min_Rp     =1;
				
				<dp n="d612"/>
    ini_dvector(gp,0,N_SF4-1,0.0);

    ini_dvector(Rp,0,N_SF4-1,0.0);

      }
else

    {

    i0 =0;

    i_s=0;

    ini_dvector(gp,0,N_SF4-1,0.0);

    ini_dvector(Rp,0,N_SF4-1,0.0);

    avg_Rp=0.0;

    min_Rp=1.0;

    while(i0<L_FRM)

        {

        /*-----------------------------------------*/

        /*                 Determine some parameters      */

        /*-----------------------------------------*/

        /*-----------------------------------------*/

        /*                 Pulse Length                   */

        /*-----------------------------------------*/

        PulsLen=(INT16)MAX(ForPitch[i0]*0.2,5);

        PulsLen=MIN(PulsLen,30);

        /*-----------------------------------------*/

        /*                 Peak location                  */

        /*-----------------------------------------*/

        /*-----------------------------------------*/

        /*       Starting point on the original wspeech   */

        /*-----------------------------------------*/

        T0=L_OLPIT-L_LPCLHD-L_FRM+i0+Delay_tmp;

        StartPoint=(INT16)T0;

        EndPoint=(INT16)MIN(StartPoint+ForPitch[i0],

                           L_OLPIT-8-SINC_LIMIT);

        PPP_locat_max_puls(wspeech,StartPoint,EndPoint,1,

                                  &amp;LocPuls,&amp;P_SHP);
				
				<dp n="d613"/>
    if((i0==0)&amp;&amp;(LocPuls<PulsLen+T0))

    LocPuls=(INT16)(PulsLen+T0);
/*-----------------------------------------------*/
/*                    Searching Length                 */
/*-----------------------------------------------*/
  l_sf=(INT16)MIN(LocPuls-T0+PulsLen,L_FRM-i0);
  L_Tg=(INT16)(LocPuls-T0+2*PulsLen);
  if(LocPuls+ForPitch[i0]*1.25>

                        L_OLPIT-L_LPCLHD+Delay_tmp)

      {

      StartPoint=(INT16)(LocPuls+ForPitch[i0]*0.5);

      EndPoint=(INT16)MIN(StartPoint+ForPitch[i0],

                          L_OLPIT-8-SINC_LIMIT);

      PPP_locat_max_puls(wspeech,StartPoint,EndPoint,1,

                                &amp;L,&amp;P_SHP);

      if(L>L_OLPIT-L_LPCLHD+Delay_tmp)

          {

          l_sf=L_FRM-i0;

          L_Tg=(INT16)MAX(l_sf,LocPuls-T0+2*PulsLen);

          }

      }
  SRCH1=5;
  L=L_FRM-i0+MAX(0,L_LPCLHD-(INT16)Delay_tmp-

                                SINC_LIMIT_E-SRCH1);
  L_Tg=MIN(L_Tg,L);
  L_Tg=MIN(L_Tg,MAX_L_TG);
  Center=(INT16)MAX(LocPuls-T0-PulsLen,PulsLen/2);
  Center=MIN(l_sf,Center);
/*------------------------------------------------*/
/*       Calculate the target:Tg[0,..,L_Tg-1],for the  */
/*                       wspeech modification             */
/*-----------------------------------------------*/
cpy_dvector(targ_mem,LTm,0,MAX_LAG-1);
L=MIN(L_Tg,L_FRM-i0+L_FRM/2);
cpy_dvector(ForPitch+i0,PitFunc,0,L-1);
				
				<dp n="d614"/>
ini_dvector(PitFunc,L,L_Tg-1,PitFunc[L-1]);
LTP excit_vari_pitch(SincWindows_E,LEN_SINC_E,

                  SINC_LIMIT_E,PitFunc,MAX_LAG,

                          LTm,L_Tg,Tg);
/*----------------------------------------*/
/*                  Searching Range             */
/*----------------------------------------*/
/*----------------------------------------*/
/*                   Peakness                   */
/*----------------------------------------*/
StartPoint=(INT16)(LocPuls-ForPitch[i0]*0.5);
EndPoint=(INT16)MIN(StartPoint+ForPitch[i0],

                    L_OLPIT-8-SINC_LIMIT);
PPP_locat_max_puls(wspeech,StartPoint,EndPoint,1,&amp;L,

                                                     &amp;P_SHP);
PPP_locat_max_puls(Tg,(INT16)(HALFP+1),

             (INT16)(L_Tg-HALFP-1),(INT16)1,&amp;L,&amp;P_SHP_Tg);
/*----------------------------------------*/
/*                Search range                   */
/*----------------------------------------*/
SRCH1=MAX(MIN(Center*0.075+0.5,SRCH1),1);
SRCH0=-SRCH1;
/*----------------------------------------*/
/*         Influence of P_SHP                    */
/*----------------------------------------*/
if(P_SHP>1/4.0)

    {

    SRCH1=MIN(SRCH1,3);

    SRCH0=MAX(SRCH0,-3);

    }
else if(P_SHP>1/12.0)

    {

    SRCH1=MIN(SRCH1,4);
				
				<dp n="d615"/>
    SRCH0=MAX(SRCH0,-4);

    }
/*--------------------------------------*/
/*         Influence of P_SHP_Tg                 */
/*--------------------------------------*/
if(frame_class_pp>=3)

    L=4;
else

    L=3;
if(P_SHP_Tg>1/3.0)

    {

    SRCH1=MIN(SRCH1,L);

    SRCH0=MAX(SRCH0,-L);

    }
else if(P_SHP_Tg>1/6.0)

    {

          SRCH1=MIN(SRCH1, (L+1));

          SRCH0=MAX(SRCH0,-(L+1));

    }
/*------------------------------------*/
/*   Influence of LocPuls and non-voiced speech    */
/*------------------------------------*/
if((L_Tg<LocPuls-T0-HALFP)‖(ForPitch[i0]<25)

            ‖(LocPuls<=PulsLen+T0))

    {

    if(P_SHP>1/4.0)

        {

        SRCH1=MIN(SRCH1, 1);

        SRCH0=MAX(SRCH0,-1);

        }

    else

        {

        SRCH1=MIN(SRCH1,2);

        SRCH0=MAX(SRCH0,-2);

        }

    }
				
				<dp n="d616"/>
             /*---------------------------------------*/

             /*            Influence of Delay_tmp             */

             /*---------------------------------------*/

             if(Delay_tmp>5)

                 SRCH1=MIN(SRCH1,4);

             if(Delay_tmp>10)

                 SRCH1=MIN(SRCH1,2);

             if(Delay_tmp>15)

                 SRCH1=0;

             if(Delay_tmp<-5)

                 SRCH0=MAX(SRCH0,-4);

             if(Delay_tmp<-10)

                 SRCH0=MAX(SRCH0,-2);

             if(Delay_tmp<-15)

                 SRCH0=0;

             /*-----------------------------------------*/

             /*           Searching for the best delay;             */

             /*-----------------------------------------*/

             PPP_search_opt_shift_pp(frame_class_pp,ForPitch[i0+1_sf-1],

                                    wspeech,T0,Center,l_sf-L_Tg,Tg,

                                        ModiRes,SRCH0,SRCH1,&amp;Delay,

                                           &amp;Rp_Opt);

             /*-----------------------------------------*/

             /*  Determine the delay at the end point:ModiRes[l_sf]  */

             /*-----------------------------------------*/

             if(Center>l_sf)

                 Delay*=(FLOAT64)l_sf/(FLOAT64)Center;

             Delay=Delay_tmp+Delay;

             if(fabs(Delay)>MAX_DELAY)

                 {
#ifdef VERBOSE

                 if(frame_clas_pp>=3)

                     printf″Danger!!!,Delay_tmp>MAX_DELAY\n″);

                 else
				
				<dp n="d617"/>
               printf(″Danger!!!!,Delay_tmp>MAX_DELAY\n″);
#endif

           T1=T0+L_Tg;

           PPP_mapping_residu(SincWindows_E,SINC_LIMIT_E,

                                    LEN_SINC_E,wspeech,T0,T1,

                                       L_Tg,ModiRes);

           }

       else

           Delay_tmp=Delay;

       /*--------------------------------------*/

       /*          Memorize the modified wspeech       */

       /*--------------------------------------*/

       PPP_update_LT_mem(MAX_LAG,targ_mem,l_sf,ModiRes);

       /*--------------------------------------*/

       /*                Periodicity                   */

       /*--------------------------------------*/

       PPP_periodicity_detect(ModiRes,Tg,L_Tg,&amp;ltp_gain,

                          &amp;pit_corr,smv_mode,nsr);

       cpy_dvector(ModiRes,ModiSig+i0,0,l_sf-1);

       if(((P_SHP<1.0/30)‖(ltp_gain>0.7)‖

                (pit_corr>0.6))&amp;&amp;(L_Tg>LocPuls-T0+HALFP)

                    &amp;&amp;((*VUV)==2))

                       (*VUV)=3;

       if(pit_corr<min_Rp)

                min_Rp=pit_corr;

       pit_corr=MAX(pit_corr,0.0);

       avg_Rp   +=pit_corr*l_sf;

           /*---------------------------------*/

       if(fix_rate==RATE8_5K)
				
				<dp n="d618"/>
            {

            for(i=0;i<N_SF4;i++)

                 {

                 L=MIN(i0+l_sf,(i+1)*L_SF4)-MAX(i0,i*L_SF4);

                 gp[i]+=ltp_gain*MAX(L,0);

                 Rp[i]+=pit_corr*MAX(L,0);

                 }

            }

        else

            {

            for(i=0;i<N_SF3;i++)

                {

                L=MIN(i0+l_sf,(i+1)*L_SF0)-MAX(i0,i*L_SF0);

                gp[i]+=ltp_gain*MAX(L,0);

                Rp[i]+=pit_corr*MAX(L,0);

                }

           }

        i0+=l_sf;

        }

    }
/*-----------------------------------------------*/
/*          Classification and output LTP gains           */
/*-----------------------------------------------*/
avg_Rp/=L_FRM;
if(fix_rate==RATE8_5K)

     {

     /*------------------------------------------*/

     /*            RATE 8.5kbit/s                         */

     /*------------------------------------------*/

     /*------------------------------------------*/

     /*               gains                               */

     /*------------------------------------------*/

     for(i=0;i<N_SF4;i++)

         Rp[i]/=L_SF4;
				
				<dp n="d619"/>
for(i=0;i<N_SF4;i++)

    gp[i]/=L_SF4;
if(flat_flag==1)

    {

    for(i=0;i<N_SF4;i++)

        gp[i]=MAX(MIN(gp[i]*(0.75+0.25*Rp[i]),1.2),0);

    }
else

    {

    for(i=0;i<N_SF4;i++)

        gp[i]=MAX(MIN(gp[i]*(0.7+0.3*avg_Rp),1.2),0);

    }
/*----------------------------------------*/
/*    Correct classfication    */
/*----------------------------------------*/
if((Last_Rp>0.6)&amp;&amp;(avg_Rp>0.6)&amp;&amp;(frame_class_pp>0))

    {

    ltp_gain=(gp[0]+gp[1]+gp[2]+gp[3])/4.0;

    cond0=(fabs(gp[0]-ltp_gain)<0.25);

    cond1=(fas(gp[1]-ltp_gain)<0.25);

    cond2=(fabs(gp[2]-ltp_gain)<0.25);

    cond3=(fabs(gp[3]-ltp_gain)<0.25);

    cond_abs=cond0&amp;&amp;cond1&amp;&amp;cond2&amp;&amp;cond3;

    cond0=(gp[0]>0.5);

    cond1=(gp[1]>0.5);

    cond2=(gp[2]>0.5);

    cond3=(gp[3]>0.5);

    cond=cond0&amp;&amp;cond1&amp;&amp;cond2&amp;&amp;cond3;

    if((cond_abs==1)&amp;&amp;(cond==1)&amp;&amp;(ltp_gain>0.5)

             &amp;&amp;(min_Rp>0.5))

               (*frame_class)=6;

    cond0=(Rp[0]>0.75);
				
				<dp n="d620"/>
         cond1=(Rp[1]>0.75);

         cond2=(Rp[2]>0.75);

         cond3=(Rp[3]>0.75);

         cond=cond0&amp;&amp;cond1&amp;&amp;cond2&amp;&amp;cond3;

         if((ltp_gain>0.5)&amp;&amp;(cond==1))

              (*frame_class)=6;

         }

     Last_Rp=Rp[N_SF4-1];

     }
else

     {

     /*---------------------------------------*/

     /*               RATE 4.0kbit/s                 */

     /*---------------------------------------*/

     /*---------------------------------------*/

     /*                     gains                    */

     /*---------------------------------------*/

     for(i=0;i<N_SF3;i++)

         Rp[i]/=L_SF0;

     for(i=0;i<N_SF3;i++)

         gp[i]/=L_SF0;

     for(i=0;i<N_SF4;i++)

         gp[i]=MAX(MIN(gp[i]*(0.75+0.25*Rp[i]),1.2),0);

     ltp_gain=(gp[0]+gp[1]+gp[2])/3.0;

     /*--------------------------------------*/

     /*               Correct classfication        */

     /*--------------------------------------*/

     if((avg_Rp>0.6)&amp;&amp;(frame_class_pp>0))

          {

          cond0=(fabs(gp[0]-ltp_gain)<0.25);

          cond1=(fabs(gp[1]-ltp_gain)<0.25);

          cond2=(fabs(gp[2]-ltp_gain)<0.25);
				
				<dp n="d621"/>
             cond_abs=cond0&amp;&amp;cond1&amp;&amp;cond2;

             cond0=(gp[0]>0.4);

             cond1=(gp[1]>0.4);

             cond2=(gp[2]>0.4);

             cond=cond0&amp;&amp;cond1&amp;&amp;cond2;

             if((cond_abs==1)&amp;&amp;(cond==1)&amp;&amp;(ltp_gain>0.5)

                      &amp;&amp;(min_Rp>0.4))

                        (*frame_class)=6;

             }

         Last_Rp=Rp[N_SF3-1];

         }

    /*----------------------------------------*/

    /*        Reset the delay    */

    /*----------------------------------------*/

    (*Delay_pp)=Delay_tmp;

    frame_class_pp_m=frame_class_pp;

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*-----------------END---------------------------*/
/*===============================================================================*/
				
				<dp n="d622"/>
/*===============================================================================*/
/*======================================================================*/
/*Conexant System Inc.                                       */
/*4311 Jamboree Road                                         */
/*Newport Beach,CA 92660                                       */
/*--------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                      */
/*--------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation*/
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*===============================================================================*/
/*PROTOTYPE FILE:lib_ppp.h                                            */
/*===============================================================================*/
/*--------------------------------------------*/
/*------------------FUNCTIONS-----------------------*/
/*--------------------------------------------*/
void PPP_init_lib     (void);
void PPP_mapping_residu(FLOAT64[],INT16,INT16,FLOAT64[],FLOAT64,

                       FLOAT64,INT16,FLOAT64[]);
void PPP_update_LT_mem    (INT16,FLOAT64[],INT16,FLOAT64[]);
void PPP_search_shift_pp(FLOAT64[],FLOAT64,INT16,INT16,INT16,FLOAT64[],

                                                   FLOAT64*,FLOAT64*);
void PPP_search_opt_shift_pp(INT16,FLOAT64,FLOAT64[],FLOAT64,INT16,INT16,

                          INT16,FLOAT64[],FLOAT64[],INT16,INT16,

                              FLOAT64*,FLOAT64*);
void PPP_periodicity_detect  (FLOAT64[],FLOAT64[],INT16,FLOAT64*,FLOAT64*,

                          INT16,FLOAT64);
				
				<dp n="d623"/>
FLOAT64 PPP_sharpness(INT16,FLOAT64[]);
void PPP_locat_max_puls(FLOAT64[],INT16,INT16,INT16,INT16*,FLOAT64*);
void PPP_pitch_preproc(INT16 smv_mode,INT16 fix_rate,INT16 flat_flag,

                       FLOAT64 nsr,FLOAT64 wspeech[],FLOAT64 ModiSig[],

                          FLOAT64 ForPitch[],FLOAT64*Delay_pp,

                             INT16 frame_class_pp,INT16*frame_class,

                                 INT16*VUV,FLOAT64 gp[]);
/*===============================================================================*/
/*-----------------------END--------------------------*/
/*===============================================================================*/
				
				<dp n="d624"/>
/*===================================================================================*/
/*=============================================================================*/
/*Conexant System Inc.                                           */
/*4311 Jamboree Road                                              */
/*Newport Beach,CA 92660                                           */
/*--------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                            */
/*--------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                  */
/*No part of this software may be reproduced in any form or by any*/
/*means or used to make any derivative work(such as transformation*/
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*============================================================================*/
/*LIBRARY:lib_ppr.c                                     */
/*============================================================================*/
/*--------------------------------------------*/
/*----------------INCLUDE--------------------------*/
/*--------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″ext_var.h″
#include″mcutil.h″
#include″gputil.h″
#include″lib_ppr.h″
#include″lib_flt.h″
#include″lib_lpc.h″
#include″lib_ltp.h″
#include″lib_ppp.h″
/*--------------------------------------------*/
/*------------------FUNCTIONS----------------------*/
/*---------------------------------------------*/
/*============================================================================*/
/*FUNCTION      :PPR_filters_init()                     */
/*--------------------------------------------*/
				
				<dp n="d625"/>
/*PURPOSE       :This function performs the initialisation    */
/*              for the post and pre processing.            */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                                  */
/*              _None.                                       */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                 */
/*              _None.                                       */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                                 */
/*              _None.                                       */
/*===============================================================================*/
void PPR_filters_init(void)

     {

     /*---------------------------------------*/

     INT16  i,l;

     FLOAT64 x;

     /*---------------------------------------*/

     /*   Generate the window for Tilt Compensation           */

     /*---------------------------------------*/

     l=L_LPC-L_SF/3;

     for(i=0;i<1;i++)

         {

         x=cos(i*PI/(FLOAT64)1);

         tilt_window[i]=0.54-0.46*x;

         }

     for(i=1;i<L_LPC;i++)

       tilt_window[i]=cos((i-1)*PI*0.49/(L_LPC-1));

     /*-------------------------------------*/

     /*      Pre-processing High-pass filters             */

     /*-------------------------------------*/

     pre_flt_num[0]=-0.92724705/0.46363718;

     pre_flt_num[1]=+1.00000000,
				
				<dp n="d626"/>
pre_flt_den[0]=-1.9059465;
pre_flt_den[1]=+0.9114024;
pre_gain=0.46363718;
/*--------------------------------------------*/
/*                   Tilt compensation                  */
/*--------------------------------------------*/
tc_mem_dec=0.0;
tc_coeff=0.0;
tc_gain=1.0;
/*--------------------------------------------*/
/*                    Post-processing filters           */
/*--------------------------------------------*/
r_zero=0.57;
r_pole=0.75;
pst_scale=1.0;
pst_hp_mem=0.0;
/*--------------------------------------------*/
/*    Post-processing filters    */
/*--------------------------------------------*/
pst_flt_num[0]=-1.8544941/0.92727435;
pst_flt_num[1]=+1.00000000,
pst_flt_den[0]=-1.9059465;
pst_flt_den[1]=+0.9114024;
pst_gain=0.92727435*2.0;
/*--------------------------------------------*/
return;
/*--------------------------------------------*/
				
				<dp n="d627"/>
/*--------------------------------------------*/
/*==============================================================================*/
/*FUNCTION       :PPR_silence_enhan_init()                       */
/*--------------------------------------------*/
/*PURPOSE        :This function performs the initialisation    */
/*               for the silence enhancement in the input     */
/*               frame                                          */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                                */
/*               _None.                                      */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*               _None.                                      */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                               */
/*               _None.                                      */
/*===============================================================================*/
void PPR_silence_enhan_init(void)

     {

     /*---------------------------------------*/

     INT16  i;

     /*---------------------------------------*/

     /*    Set-up the initial values    */

     /*---------------------------------------*/

     zero_level=8.0;

     min_delta=65534;

     for(i=0;i<SE_MEM_SIZE;i++)

         {

         zero_rate[i]=0.0;

         low_rate [i]=0.0;

         high_rate[i]=0.0;

         zeroed   [i]=1;

         }
				
				<dp n="d628"/>
    12_neg=-24.0;

    11_neg=-8.0;

    11_pos=8.0;

    12_pos=24.0;

    low_neg[0]=-32766.0;

    low_neg[1]=-32767.0;

    low_pos[0]=32767.0;

    low_pos[1]=32768.0;

        /*------------------------------------*/

        return;

        /*------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :PPR_silence_enhan()                          */
/*--------------------------------------------*/
/*PURPOSE    :This function perfroms the enhancement of the*/
/*           silence in the input frame.              */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                           */
/*            _(FLOAT64[])x_in:input speech frame.      */
/*            _(INT16  )N     :speech frame size.      */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                           */
/*            _(FLOAT64[])x_out:output speech frame.    */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*            _None.                                   */
/*===============================================================================*/
void PPR_silence_enhan(FLOAT64 x_in[],FLOAT64 x_out[],INT16 N)

     {

     /*---------------------------------------*/

     INT16 tmp;

     INT16 i,idle_noise;
				
				<dp n="d629"/>
INT16  cond1,cond2,cond3,cond4;
INT16  *hist;
INT32 delta;
FLOAT64*min,*max;
  /*-----------------------------------------*/
  hist  =svector(0,SE_HIS_SIZE-1);
max=dvector(0,1);
  min  =dvector(0,1);
  /*-----------------------------------------*/
  /*             Initialisation                     */
  /*-----------------------------------------*/
min[0]=32767.0;
min[1]=32766.0;
max[0]=-32767.0;
max[1]=-32766.0;
/*-------------------------------------------*/
/*    Loop on the input sample frame    */
/*-------------------------------------------*/
for(i=0;i<N;i++)

    {

    /*---------------------------------------*/

    tmp=(INT16)x_in[i];

    /*---------------------------------------*/

    /* Find the 2 Max values in the input frame   */

    /*---------------------------------------*/

    if(tmp>max[0])

        {

        max[1]=max[0];

        max[0]=tmp;

        }

    else if((tmp>max[1])&amp;&amp;(tmp<max[0]))

         max[1]=tmp;
				
				<dp n="d630"/>
  /*--------------------------------------------*/
  /*     Find the 2 Min values in the input frame       */
  /*--------------------------------------------*/
  if(tmp<min[0])

      {

      min[1]=min[0];

      min[0]=tmp;

      }
  else if((tmp<min[1])&amp;&amp;(tmp>min[0]))

      min[1]=tmp;
  /*--------------------------------------------*/
  /*       Find the 2 Min positive values and the 2 Min    */
  /*         abs.negative values in the input frame       */
  /*--------------------------------------------*/
  if(tmp>=0)

      {

      if(tmp<low_pos[0])

          {

          low_pos[1]=low_pos[0];

          low_pos[0]=tmp;

          }

      else if((tmp<low_pos[1])&amp;&amp;(tmp>low_pos[0]))

           low_pos[1]=tmp;

      }
  else

      {

      if(tmp>low_neg[0])

           {

           low_neg[1]=low_neg[0];

           low_neg[0]=tmp;

           }

      else if((tmp>low_neg[1])&amp;&amp;(tmp<low_neg[0]))

           low_neg[1]=tmp;

      }
  /*--------------------------------------------*/
  }
/*--------------------------------------------*/
				
				<dp n="d631"/>
  /*  Calculate the difference between Max and Min    */
  /*--------------------------------------------*/
delta=(INT32)(max[0]-min[0]);
if((delta<min_delta)&amp;&amp;(max[0]>min[0]))

    {

    min_delta=delta;

    if(min_delta<=DELTA_THRLD)

        {

        /*--------------------------------------*/

        if((max[1]>=0.0)&amp;&amp;(max[0]>0.0))

             {

             11_pos=max[1];

             12_pos=max[0];

             }

        else

             {

             if(low_pos[0]<32767.0)

                  11_pos=low_pos[0];

             if(low_pos[1]<32767.0)

                  12_pos=low_pos[1];

             }

        /*-------------------------------------*/

        if((min[0]<0.0)&amp;&amp;(min[1]<0.0))

             {

             12_neg=min[0];

             11_neg=min[1];

             }

        else

             {

             if(low_neg[0]>-32766.0)

                 11_neg=low_neg[0];

             if(low_neg[1]>-32766.0)

                 12_neg=low_neg[1];

             }

        /*-------------------------------------*/
				
				<dp n="d632"/>
         }

    }
  /*--------------------------------------------*/
  /*               Update zero level                       */
  /*--------------------------------------------*/
if(low_pos[0]<zero_level)

    zero_level=low_pos[0];
  /*--------------------------------------------*/
  /*               Update the Histogramm                   */
  /*--------------------------------------------*/
for(i=0;i<N;i++)

     {

     if((x_in[i]>=12_neg)&amp;&amp;(x_in[i]<11_neg))

          hist[0]++;

     else if((x_in[i]>=11_neg)&amp;&amp;(x_in[i]<0.0))

          hist[1]++;

     else if((x_in[i]>=0.0)&amp;&amp;(x_in[i]<=11_pos))

          hist[2]++;

     else if((x_in[i]>11_pos)&amp;&amp;(x_in[i]<=12_pos))

          hist[3]++;

     else

          hist[4]++;

     }
  /*--------------------------------------------*/
  /*                 Update the History             */
  /*--------------------------------------------*/
for(i=SE_MEM_SIZE-1;i>0;i--)

     {

     zero_rate[i]=zero_rate[i-1];

     low_rate[i] =low_rate[i-1];

     high_rate[i]=high_rate[i-1];

     zeroed[i]   =zeroed[i-1];

     }
  /*--------------------------------------------*/
				
				<dp n="d633"/>
  /*            Current Frame Rate Calculation            */
  /*--------------------------------------------*/
if(hist[2]==N)

     zero_rate[0]=1.0;
else

     zero_rate[0]=(FLOAT64)hist[2]/(FLOAT64)N;
if((hist[1]+hist[2])==N)

     low_rate[0]=1.0;
else

     low_rate[0]=(FLOAT64)(hist[1]+hist[2])/(FLOAT64)N;
if(hist[4]==N)

     high_rate[0]=1.0;
else

     high_rate[0]=(FLOAT64)hist[4]/(FLOAT64)N;
  /*--------------------------------------------*/
  /*            Silence Frame Detection                 */
  /*--------------------------------------------*/
idle_noise=1;
for(i=0;i<SE_MEM_SIZE;i++)

    {

    if((zero_rate[i]<0.55)‖(low_rate[i]<0.80)‖

                   (high_rate[i]>0.07))

                       idle_noise=0;

    }
cond1=((zero_rate[0]>=0.95)&amp;&amp;(high_rate[0]<=0.03));
cond2=((low_rate[0]>=0.90)&amp;&amp;(low_rate[1]>=0.90)&amp;&amp;

       (high_rate[0]<=0.030));
cond3=((low_rate[0]>=0.80)&amp;&amp;(low_rate[1]>=0.90)&amp;&amp;

       (high_rate[0]<=0.010)&amp;&amp;(zeroed[1]==1));
cond4=((low_rate[0]>=0.75)&amp;&amp;(low_rate[1]>=0.75)&amp;&amp;

       (high_rate[0]<=0.004)&amp;&amp;(zeroed[1]==1));
				
				<dp n="d634"/>
  /*--------------------------------------------*/
  /*    Modify the dignal if is a silence frame            */
  /*--------------------------------------------*/
if(cond1‖cond2‖cond3‖cond4‖idle_noise)

    {

    if(zeroed[1]==1)

         {

         /*-------------------------------------*/

         /*            Keep the Signal Down               */

         /*-------------------------------------*/

         ini_dvector(x_out,0,N-1,zero_level);

         }

    else

        {

        /*--------------------------------------*/

        /*              Ramp Signal Down                  */

        /*--------------------------------------*/

        for(i=0;i<SE_RAMP_SIZE;i++)

            x_out[i]=((FLOAT64)(SE_RAMP_SIZE-1-i)*x_in[i]+

                            (FLOAT64)i*zero_level)/

                                   (FLOAT64)(SE_RAMP_SIZE-1);

        ini_dvector(x_out,SE_RAMP_SIZE,N-1,zero_level);

        }

    zeroed[0]=1;

    }
else if(zeroed[1]==1)

    {

    /*----------------------------------------*/

    /*                    Ramp Signal Up                */

    /*----------------------------------------*/

    for(i=0;i<SE_RAMP_SIZE;i++)

         x_out[i]=((FLOAT64)i*x_in[i]+

                     (FLOAT64)(SE_RAMP_SIZE-1-i)*zero_level)/

                         (FLOAT64)(SE_RAMP_SIZE-1);

    zeroed[0]=0;

    }
				
				<dp n="d635"/>
    else

      zeroed[0]=0;

      /*--------------------------------------*/

    free_svector(hist,0,SE_HIS_SIZE-1);

    free_dvector(max,0,1);

    free_dvector(min,0,1);

        /*------------------------------------*/

        return;

        /*------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :PPR_lowpass()                                  */
/*--------------------------------------------*/
/*PURPOSE    :This function perfroms the lowpass filtering  */
/*           of the input frame.                         */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                              */
/*    _(INT16  )l_frm:  speech frame size.                 */
/*    _(INT16  )smv_mode:SMV running mode.                     */
/*    _(INT16  )flat_flag:flat input speech flag.       */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
/*            _None.                                      */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                        */
/*   _(FLOAT64[])x_in:input/output speech frame.          */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                             */
/*            _None.                                     */
/*===============================================================================*/
void PPR_lowpass(FLOAT64 x_in[],INT16 l_frm,INT16 smv_mode,INT16 flat_flag)

     {
				
				<dp n="d636"/>
/*--------------------------------------------*/
FLOAT64 x;
INT16   i;
/*--------------------------------------------*/
if(flat_flag==0)

    {

    switch(smv_mode)

         {

         case 0:lp_flt_num[0]=0.0;

              break;

         case 1:lp_flt_num[0]=0.05;

              break;

         case 2:lp_flt_num[0]=0.075;

              break;

         }

    }
else

    {

    switch(smv_mode)

        {

        case 0:lp_flt_num[0]=-0.1;

             break;

        case 1:lp_flt_num[0]=0.0;

             break;

        case 2:lp_flt_num[0]=0.0;

             break;

        }

    }
/*--------------------------------------------*/
for(i=0;i<l_frm;i++)

    {

    x=x_in[i]+lp_flt_buf[0]*lp_flt_num[0];

    lp_flt_buf[0]=x_in[i];

    x_in[i]=x;

    }
/*--------------------------------------------*/
				
				<dp n="d637"/>
    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :PPR_highpass()                                */
/*--------------------------------------------*/
/*PURPOSE    :This function perfroms the highpass filtering*/
/*           of the input frame.                         */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                             */
/*        _(INT16  )l_frm:speech frame size.             */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*            _None.                                     */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*        _(FLOAT64[])x :input/output speech frame.       */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*            _None.                                     */
/*===============================================================================*/
void PPR_highpass(INT16 l_frm,FLOAT64 x[])

     {

     /*---------------------------------------*/

     PPR_ZeroPoleFilter(l_frm,x,pre_flt_buf_z,pre_flt_buf_p,

                            pre_flt_num,pre_flt_den,pre_gain,

                                  PPR_FLT_ORDER);

     /*---------------------------------------*/

     return;

     /*---------------------------------------*/

     }
				
				<dp n="d638"/>
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION    :PPR_pitch postfilter()                         */
/*--------------------------------------------*/
/*PURPOSE     :This function perfroms the pitch               */
/*            postfiltering in order to enhance the speech */
/*            periodicity.                                 */
/*--------------------------------------------*/ 
/*INPUT ARGUMENTS:                                              */
/*            _(FLOAT64  )lag_f:decoded lag value.       */
/*            _(FLOAT64  )PSF:  pitch gain scale factor.*/
/*            _(INT16    )l_sf:sub-frame size.         */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                            */
/*            _None.                                   */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*            _(FLOAT64[])ext:input excitation signal. */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*           _None.                                    */
/*===============================================================================*/
void PPR_pitch_postfilter(FLOAT64 ext[],FLOAT64 lag_f,FLOAT64 PSF,INT16 l_sf)

     {

     /*---------------------------------------*/

     FLOAT64    Rp[2*SINC_LIMIT+8],x,y,gain,pit_step,pit_ab[25],

                                                               tmp[L_SF];

     INT16 i,IP1,IP2,P1,P2,pit_idx,Low1,HighL,L_Rp;

     /*---------------------------------------*/

     /*           Searching range defiinition             */

     /*---------------------------------------*/

     pit_step=1.0/8.0;

     P1  =0;

     P2  =24;

     pit_tab[0]=MAX(min_pit,lag_f-1.5);

     for(i=1;i<=P2;i++)
				
				<dp n="d639"/>
       {

       pit_tab[i]=pit_tab[i-1]+pit_step;

       pit_tab[i]=MIN(HI_LAG2,pit_tab[i]);

       }

    IP1=(INT16)pit_tab[P1];

    IP2=(INT16)(pit_tab[P2]+1.0);

    IP2=MAX(IP1,IP2);

    LowL=IP1-SINC_LIMIT-1;

    LowL=MAX(0,LowL);

    HighL=IP2+SINC_LIMIT+1; 

    L_Rp=HighL-LowL+1;
#ifdef VERBOSE

    if(L_Rp>=2*SINC_LIMIT+8)

        nrerror(″Memory Error:L_Rp>=2*SINC_LIMIT+8!!\n″);
#endif

      /*-----------------------------------------*/

    /*              Integer correlation                */

      /*-----------------------------------------*/

    cpy_dvector(ext,buff_LTpost+MAX_LAG,0,l_sf-1);

    dot_dvector(buff_LTpost+MAX_LAG-LowL+1,buff_LTpost+MAX_LAG-LowL+1,&amp;y,

                          0,l_sf-1);

    for(i=LowL;i<=HighL;i++)

        {

        dot_dvector(ext,buff_LTpost+MAX_LAG-i,&amp;x,0,l_sf-1);

        y+=buff_LTpost[MAX_LAG-i]*buff_LTpost[MAX_LAG-i];

        y-=buff_LTpost[MAX_LAG-i+1_sf]*buff_LTpost[MAX_LAG-i+l_sf];

        Rp[i-LowL]=x/sqrt(MAX(y,0.1));

        }

    /*----------------------------------------*/

    /*                Fine index searching              */

    /*----------------------------------------*/

    LTP_FineIndex_search(pit_tab,P1,R2,LowL,L Rp,Rp,&amp;pit_idx);

    /*----------------------------------------*/

    /*                 LTP excitation                   */
				
				<dp n="d640"/>
/*--------------------------------------------*/
LTP_excit_const_pitch(pit_tab[pit_idx],MAX_LAG,buff_LTpost,l_sf,

                             tmp,0);
/*--------------------------------------------*/
/*                  Update residual buffer               */
/*--------------------------------------------*/
PPP_update_LT_mem(MAX_LAG,buff_LTpost,l_sf,ext);
/*--------------------------------------------*/
/*           Compute the harmonic filter coefficient     */
/*--------------------------------------------*/
dot_dvector(ext,tmp,&amp;x,0,l_sf-1);
dot_dvector(tmp,tmp,&amp;y,0,l_sf-1);
gain=x/MAX(y,0.001);
gain=MIN(1.0,gain);
gain*=PSF;
/*--------------------------------------------*/
/*           Pefform the harmonic filtering              */
/*--------------------------------------------*/
for(i=0;i<l_sf;i++)

    tmp[i]=ext[i]+gain*tmp[i];
/*--------------------------------------------*/
/*                       AGC                             */
/*--------------------------------------------*/
dot_dvector(ext,ext,&amp;x,0,l_sf-1);
dot_dvector(tmp,tmp,&amp;y,0,l_sf-1);
gain=sqrt(x/MAX(y,0.001));
for(i=0;i<l_sf;i++)
   ext[i]=tmp[i]*gain;
				
				<dp n="d641"/>
    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*==============================================================================*/
/*FUNCTION    :PPR_post_process()                          */
/*--------------------------------------------*/
/*PURPOSE     :This function perfroms post-filtering     */
/*            (harmonic+formant)in order to enhance the */
/*             speech quality.                         */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                           */
/*           _(FLOAT64[])pdcfq: decoded prediction coeff.*/
/*           _(FLOAT64[])lag_f: decoded lag value.      */
/*           _(INT16  )l_sf:  sub-frame size.          */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                          */
/*           _None.                                    */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                    */
/*          _(FLOAT64[])sigsyn:synthetised signal.     */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                          */
/*         _None.                                      */
/*===============================================================================*/
void PPR_post_process(FLOAT64 sigsyn[],FLOAT64 pdcfq[],FLOAT64 r_0,

                  FLOAT64 r_p,FLOAT64 lag_f,INT16 l_sf,INT16 flat_flag,

                     INT16 fix_rate)

    {

    /*---------------------------------------*/

    /*        Adaptive(weighted)postfilter variables        */

    /*---------------------------------------*/

    FLOAT64 wpdcf_pole[NP],wpdcf_zero[NP],ai_zero[NP+1];

    FLOAT64 tmpmem[NP],hh[L_SF],after_syn[L_SF];

    FLOAT64 va11,va12;
				
				<dp n="d642"/>
/*--------------------------------------------*/
/*           Harmonic Filtering  variables                */
/*--------------------------------------------*/
INT16  i,Lh,L2;
FLOAT64 gain,numerator,denominator;
FLOAT64 residu_w[L_SF];
/*--------------------------------------------*/
/*                Tilt compensation variables             */
/*--------------------------------------------*/
FLOAT64 r0,r1,k1,coeff,after_ti1t[L_SF];
/*--------------------------------------------*/
/*            Compute the weighted LPC coefficients       */
/*--------------------------------------------*/
r_zero=0.75*r_zero+0.25*r_0;
va11=1.0;
va12=1.0;
for(i=0;i<NP;i++)

    {

    vall*=r_pole;

    va12*=r_zero;

    wpdcf_pole[i]=pdcfq[i]*va11;

    wpdcf_zero[i]=pdcfq[i]*va12;

    }
/*--------------------------------------------*/
  /*                Compute the residual signal            */
/*--------------------------------------------*/
LPC_ptoa(wpdcf_zero,ai_zero,NP);
FLT_conv(sigsyn,ai_zero,NP+1,l_sf,residu_w);
/*--------------------------------------------*/
/*                  Update the memory                      */
/*---------------------------------------------*/
				
				<dp n="d643"/>
cpy_dvector(sigsyn+l_sf,sigsyn,0,NP-1);
/*--------------------------------------------*/
/*                     Pitch post-filter                  */
/*--------------------------------------------*/
if(l_sf==L_SF)

    {

    L2=L_SF/2;

    for(i=0;i<N_SF2;i++)

        PPR_pitch_postfilter(residu_w+i*L2,lag_f,r_p,L2);

    }
else

    PPR_pitch_postfilter(residu_w,lag_f,r_p,l_sf);
/*--------------------------------------------*/
/*                   Tilt compensation                     */
/*--------------------------------------------*/
/*--------------------------------------------*/
/*  Compute the impulse response of the zero-pole filter   */
/*--------------------------------------------*/
Lh=22;
ini_dvector(hh,0,l_sf-1,0.0);
LPC_ptoa(wpdcf_zero,hh,NP);
ini_dvector(tmpmem,0,NP-1,0.0);
FLT_allsyn(hh,(INT16)(Lh+1),wpdcf_pole,NP,hh,tmpmem);
/*--------------------------------------------*/
/*    Compute the first reflection coefficient             */
/*--------------------------------------------*/
dot_dvector(hh,hh,&amp;r0,0,Lh-1);
dot_dvector(hh,hh+1,&amp;r1,0,Lh-2);
k1=-r1/MAX(r0,0.0001);

    coeff=MAX(MIN(0.5*k1,0.0),-0.1);
if(k1<0.0)

    {

    if(flat_flag==0)
				
				<dp n="d644"/>
         coeff-=0.1;

    else

         coeff-=0.05;

    }
/*--------------------------------------------*/
/*            Pefform the tilt compensation              */
/*--------------------------------------------*/
after_tilt[0]=residu_w[0]+coeff*pst_hp_mem;
for(i=1;i<1_sf;i++)

    after_tilt[i]=residu_w[i]+coeff*residu_w[i-1];
/*--------------------------------------------*/
/*                    Update the memory                  */
/*--------------------------------------------*/
pst_hp_mem=residu_w[l_sf-1];
/*--------------------------------------------*/
/*                    Synthesis filter                   */
/*--------------------------------------------*/
FLT_allsyn(after_tilt,l_sf,wpdcf_pole,NP,after_syn,PF_mem_syn);
/*--------------------------------------------*/
/*                    Adaptive gain control              */
/*--------------------------------------------*/
/*--------------------------------------------*/
/*    Compute the gain factor for the current subframe   */
/*--------------------------------------------*/
dot_dvector(sigsyn+NP,sigsyn+NP,&amp;numerator,0,l_sf-1);
dot_dvector(after_syn,after_syn,&amp;denominator,0,l_sf-1);
gain=sqrt(numerator/MAX(denominator,0.001));
if(flat_flag==0)
				
				<dp n="d645"/>
         gain*=1.1;

    else

         gain*=1.15;

    /*----------------------------------------*/

    /*               Perform the gain control          */

    /*----------------------------------------*/

    for(i=0;i<l_sf;i++)

        {

        pst_scale=0.9*pst_scale+0.1*gain;

        after_syn[i]*=pst_scale;

        }

    /*----------------------------------------*/

    /*                   High-pass filtering           */

    /*----------------------------------------*/

    PPR_post_highpass(l_sf,after_syn);

    cpy_dvector(after_syn,sigsyn+NP,0,l_sf-1);

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION    :PPR_ZeroPoleFilter()                          */
/*--------------------------------------------*/
/*PURPOSE     :This function perfroms the pole and zero    */
/*            filtering.                                */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                          */
/*           _(INT16    )Len: signal size.            */
/*           _(FLOAT64[])Zz:  zero filter memory.      */
/*           _(FLOAT64[])Zp:  pole filter memory.      */
/*           _(FLOAT64[])b:   numerator coefficients. */
				
				<dp n="d646"/>
/*           _(FLOAT64[])a:    denominator coefficients.*/
/*           _(FLOAT64  )K:     filter gain.           */
/*           _(INT16   )order:filter order.          */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                          */
/*           _None.                                     */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                    */
/*           _(FLOAT64[])InOut:    input output signal. */
/*--------------------------------------------*/ 
/*RETURN ARGUMENTS:                                          */
/*           _None.                                     */
/*===============================================================================*/
void PPR_ZeroPoleFilter(INT16 Len,FLOAT64 InOut[],FLOAT64 Zz[],FLOAT64 Zp[],

                              FLOAT64 b[],FLOAT64 a[],FLOAT64 K,INT16 order)

     {

     /*---------------------------------------*/

     INT16i,k;

     FLOAT64 S;

     /*---------------------------------------*/

     for(i=0;i<Len;i++)

         {

         S=InOut[i];

         for(k=0;k<order;k++)

             S+=b[k]*Zz[k];

         for(k=order-1;k>0;k--)

             Zz[k]=Zz[k-1];

         Zz[0]=InOut[i];

         InOut[i]=S;

         }

     /*---------------------------------------*/

     for(i=0;i<Len;i++)

         {

         S=InOut[i];

         for(k=0;k<order;k++)

             S-=a[k]*Zp[k];
				
				<dp n="d647"/>
        for(k=order-1;k>0;k--)

            Zp[k]=Zp[k-1];

        Zp[0]=S;

        InOut[i]=S*K;

        }

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION    :PPR_post_highpass()                            */
/*--------------------------------------------*/
/*PURPOSE    :This function perfroms G.729 high pass         */
/*           filtering.                                  */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                         */
/*    _(INT16  )Len:  signal size.    */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
/*           _None.                                        */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                        */
/*           _(FLOAT64[])InOut:input output signal.        */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                             */
/*           _None.                                        */
/*===============================================================================*/
void PPR_post_highpass(INT16 Len,FLOAT64 InOut[])

    {

    /*----------------------------------------*/

    PPR_ZeroPoleFilter(Len,InOut,pst_flt_buf_z,pst_flt_buf_p,

                          pst_flt_num,pst_flt_den,pst_gain,

                               PPR_FLT_ORDER);
				
				<dp n="d648"/>
    /*--------------------------------------------*/

    return;

    /*--------------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*-----------------------END----------------------*/
/*===============================================================================*/
				
				<dp n="d649"/>
/*===============================================================================*/
/*===========================================================================*/
/*Conexant System Inc.                                               */
/*4311 Jamboree Road                                                 */
/*Newport Beach,CA 92660                                              */
/*--------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                               */
/*--------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                   */
/*No part of this software may be reproduced in any form or by any*/
/*means or used to make any derivative work(such as transformation*/
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*===============================================================================*/
/*PROTOYPE FILE:lib_ppr.h                                 */
/*===============================================================================*/
/*--------------------------------------------*/
/*----------------------FUNCTIONS-------------------*/
/*--------------------------------------------*/
void PPR_filters_init      (void);
void PPR_silence_enhan_init(void);
void PPR_silence_enhan     (FLOAT64[],FLOAT64[],INT16);
void PPR_ZeroPoleFilter    (INT16,FLOAT64[],FLOAT64[],FLOAT64[],

                               FLOAT64[],FLOAT64[],FLOAT64,INT16);
void PPR_lowpass               (FLOAT64[],INT16,INT16,INT16);
void PPR_highpass          (INT16,FLOAT64[]);
void PPR_post_highpass     (INT16,FLOAT64[]);
void PPR_post_process      (FLOAT64[],FLOAT64[],FLOAT64,FLOAT64,

                               FLOAT64,INT16,INT16,INT16);
				
				<dp n="d650"/>
void PPR_pitch_postfilter(FLOAT64[],FLOAT64,FLOAT64,INT16);
/*===============================================================================*/
/*--------------------END-------------------------*/
/*===============================================================================*/
				
				<dp n="d651"/>
/*===============================================================================*/
/*===========================================================================*/
/*Conexant System Inc.                                        */
/*4311 Jamboree Road                                           */
/*Newport Beach,CA 92660                                        */
/*--------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                         */
/*--------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                 */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*===============================================================================*/
/*LIBRARY:lib_prc.c                                                 */
/*===============================================================================*/
/*--------------------------------------------*/
/*--------------------INCLUDE------------------------*/
/*--------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″gputil.h″
#include″mcutil.h″
#include″ext_var.h″
#include″lib_flt.h″
#include″lib_lpc.h″
#include″lib_prc.h″
/*--------------------------------------------*/
/*-----------------FUNCTIONS-----------------------*/
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :PRC_init_lib().                              */
/*--------------------------------------------*/
/*PURPOSE    :This function performs initialise the PRC    */
				
				<dp n="d652"/>
/*              library global variables.           */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                           */
/*            _None.                                  */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                           */
/*            _None.                                  */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                    */
/*           _None.                                   */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                         */
/*          _None.                                    */
/*===============================================================================*/
void PRC_init_lib(void)

     {

     /*---------------------------------------*/

       /*                 PRC_ol_cl_GainNorm                   */

     /*---------------------------------------*/

    cl_Eg=-1;

    ol_Eg=-1;

    m_lpc_gain=0.8;

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION    :PRC_GainsNorm_Gc_Gp().                         */
/*--------------------------------------------*/
/*PURPOSE     :This function performs fhe Mode 0 energy    */
/*            manipulation.                             */
/*--------------------------------------------*/
				
				<dp n="d653"/>
/*INPUT ARGUMENTS:                                            */
/*        _(FLOAT64  )nsr:     Noise to Signal Ratio.    */
/*        _(FLOAT64  )sub_eng:  sub-frame energy.            */
/*        _(FLOAT64[])res:     excitation signal.       */
/*        _(FLOAT64**)unfcod:   excitation vectors(ALG and    */
/*                                                 LTP).    */
/*        _(FLOAT64**)fcod:     filtered excitation vectors  */
/*                                       (ALG and LTP).       */
/*        _(FLOAT64[])Tgs:      target signal.               */
/*        _(INT16  )exc_mode:excitation mode.                 */
/*        _(FLOAT64  )beta_sub:smoothing factor.               */
/*        _(INT16  )l_sf:    sub-frame size.                */
/*--------------------------------------------*/
/* OUTPUT ARGUMENTS:                                               */
/*        _None.                                            */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*       _(FLOAT64[])gainQ:  quantizied gains.               */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                               */
/*       _None.                                            */
/*===============================================================================*/
void PRC_GainsNorm_Gc_Gp(FLOAT64 nsr,FLOAT64 sub_eng,FLOAT64 res[],

                        FLOAT64 gainQ[],FLOAT64**unfcod,

                           FLOAT64**fcod,FLOAT64 Tgs[],

                              INT16 exc_mode,FLOAT64 beta_sub,

                                 INT16 l_sf)

    {

    /*---------------------------------------*/

    FLOAT64    lpc_gain,ol_g,cl_g,gain,x,y,E_ex,E_Tgs,Temp[L_SF];

    /*--------------------------------------*/

    if(nsr>0.125)

         {

         /*---------------------------------*/

         /*                    Energy                 */

         /*---------------------------------*/

         E_ex=sub_eng/L_SF;
				
				<dp n="d654"/>
    dot_dvector(Tgs,Tgs,&amp;E_Tgs,0,l_sf-1);

    E_Tgs/=l_sf;

    /*--------------------------------------*/

    /*                  Energy smooth                */

    /*--------------------------------------*/

    if(cl_Eg<0)

         {

         ol_Eg  =E_ex;

         cl_Eg  =E_Tgs;

         }

    else

         {

         ol_Eg=beta_sub*ol_Eg+(1.0-beta_sub)*E_ex;

         cl_Eg=beta_sub*cl_Eg+(1.0-beta_sub)*E_Tgs;

         }

    /*-------------------------------------*/

    /*                Open-loop gain                   */

    /*-------------------------------------*/

    wad_dvector(unfcod[0],gainQ[0],unfcod[1],gainQ[1],

                              Temp,0,l_sf-1);

    dot_dvector(Temp,Temp,&amp;x,0,l_sf-1);

    x/=l_sf;

    x=sqrt(MAX(ol_Eg-5.0,0)/MAX(x,0.1));

    gain=MIN(0.75*x,(1.2/MAX(gainQ[0],0.01)));

    }
else

    {

    /*-------------------------------------*/

    /*                 LPC gain                    */

    /*-------------------------------------*/

    dot_dvector(res,res,&amp;E_ex,0,l_sf-1);

    E_ex/=l_sf;
				
				<dp n="d655"/>
  dot_dvector(Tgs,Tgs,&amp;E_Tgs,0,l_sf-1};
  E_Tgs/=l_sf;
  lpc_gain=sqrt(E_ex/MAX(E_Tgs,0.1));
  lpc_gain=MIN(lpc_gain,m_lpc_gain);
  /*------------------------------------------*/
  /*                     Energy smooth                 */
  /*------------------------------------------*/
  if(cl_Eg<0)

      {

      ol_Eg  =E_ex;

      cl_Eg  =E_Tgs;

      }
  else

      {

      ol_Eg=beta_sub*ol_Eg+(1.0-beta_sub)*E_ex;

      cl_Eg=beta_sub*cl_Eg+(1.0-beta_sub)*E_Tgs;

      }
/*--------------------------------------------*/
/*                 Open-loop gain                     */
/*--------------------------------------------*/
wad_dvector(unfcod[0],gainQ[0],unfcod[1],gainQ[1],

                          Temp,0,l_sf-1);
dot_dvector(Temp,Temp,&amp;x,0,l_sf-1);
x/=l_sf;
ol_g=sqrt(MAX(ol_Eg-5.0,0)/MAX(x,0.1));
/*--------------------------------------------*/
/*                  Close-loop gain                   */
/*--------------------------------------------*/
				
				<dp n="d656"/>
          wad_dvector(fcod[0],gainQ[0],fcod[1],gainQ[1],

                                     Temp,0,l_sf-1);

          dot_dvector(Temp,Temp,&amp;y,0,l_sf-1);

          y/=l_sf;

          cl_g=sqrt(MAX(cl_Eg-5.0,0)/MAX(y,0.1));

          /*-----------------------------------*/

          /*             Apply the gain                  */

          /*-----------------------------------*/

          if(exc_mode!=0)

              {

              x=lpc_gain/MAX(m_lpc_gain,0.1);

              y=1.0-x;

              gain=x*ol_g+y*cl_g;

              gain=MIN(0.75*gain,1.2/MAX(gainQ[0],0.01));

              gain=MIN((1+lpc_gain),gain);

              }

          else

              {

              gain=0.75*MIN(ol_g,cl_g);

              gain=MIN(gain,1.2/MAX(gainQ[0],0.01));

              }

         }

    /*----------------------------------------*/

    gain=MAX(1.0,gain);

    gainQ[0]*=gain;

    gainQ[1]*=gain;

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
				
				<dp n="d657"/>
/*===============================================================================*/
/*FUNCTION      :PRC_ol_cl_GainNorm_Gc().                       */
/*--------------------------------------------*/
/*PURPOSE       :This function performs the Mode 1 energy     */
/*              manipulation.                             */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*        _(FLOAT64[])res2:  excitation signal.           */
/*        _(FLOAT64**)unfcod: excitation vectors(ALG and       */
/*                                               LTP).    */
/*        _(FLOAT64**)fcod:   filtered excitation vectors */
/*                                     (ALG and LTP).       */
/*        _(FLOAT64[])Tg:     target signal.              */
/*        _(INT16  )exc_mode:excitation mode.              */
/*        _(INT16  )l_sf:  sub-frame size.               */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*           _None.                                      */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                        */
/*       _(FLOAT64[])gainQ:    quantizied gains.          */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                            */
/*       _None.                                         */
/*===============================================================================*/
void PRC_GainNorm_Gc(FLOAT64 res2[],FLOAT64 gainQ[],FLOAT64**unfcod,

                        FLOAT64**fcod,FLOAT64 Tg[],INT16 l_sf)

     {

     /*---------------------------------------*/

     FLOAT64 lpc_gain,ol_g,cl_g,gain,E_ex,E_Tg;

     FLOAT64 val;

     /*---------------------------------------*/

     /*                  LPC gain                       */

     /*---------------------------------------*/

     dot_dvector(res2,res2,&amp;E_ex,0,l_sf-1);

     dot_dvector(Tg,Tg,&amp;E_Tg,0,l_sf-1);
				
				<dp n="d658"/>
    lpc_gain=sqrt(E_ex/MAX(E_Tg,0.1));

    lpc_gain=MIN(lpc_gain,0.8);

    /*----------------------------------------*/

    /*                     Open-loop gain             */

    /*----------------------------------------*/

    dot_dvector(unfcod[1],unfcod[1],&amp;val,0,l_sf-1);

    ol_g=gainQ[1]*gainQ[1]*val;

    ol_g=sqrt(E_ex/MAX(ol_g,0.1));

    /*----------------------------------------*/

    /*                     Close-loop gain            */

    /*----------------------------------------*/

    dot_dvector(fcod[1],fcod[1],&amp;val,0,l_sf-1);

    cl_g=gainQ[1]*gainQ[1]*val;

    cl_g=sqrt(E_Tg/MAX(cl_g,0.1));

    /*----------------------------------------*/

    /*                     Apply the gain              */

    /*----------------------------------------*/

    lpc_gain*=  0.75;

    gain     =  lpc_gain*ol_g+(1-lpc_gain)*cl_g;

    gain     =  MAX(1.0,0.5*gain);

    gain     =  MIN(1+lpc_gain,gain);

    gainQ[1]*=  gain;

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
				
				<dp n="d659"/>
/*===============================================================================*/
/*FUNCTION    :PRC_Ideal_Excit().                            */
/*--------------------------------------------*/
/*PURPOSE     :This function calculates the ideal fixed     */
/*            codebook excitation.                         */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                              */
/*      _(FLOAT64[])Tg:       target signal.                */
/*      _(FLOAT64[])pdcfq:    quantized prediction coeff.    */
/*      _(FLOAT64[])wpdcf_den: precetual filter denominator   */
/*                          coefficients.                  */
/*      _(FLOAT64[])wpdcf_num: precetual fliter numerator     */
/*                          coefficients.                  */
/*      _(INT16   )l_sf:    sub-frame size.                 */
/*--------------------------------------------*/
/* OUTPUT ARGUMENTS:                                                */
/*      _(FLOAT64[])res2:   ideal excitation signal.        */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                            */
/*              _None.                                      */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                                */
/*              _None.                                     */
/*===============================================================================*/
void PRC_ldeal_Excit(FLOAT64 Tg[],FLOAT64 pdcfq[],FLOAT64 wpdcf_den[],

                       FLOAT64 wpdcf_num[],FLOAT64 res2[],INT16 l_sf)

     {

     /*---------------------------------------*/

     FLOAT64 ai_zero[NP+1],tmpmem[NP+1],tmp[L_SF+NP];

     /*---------------------------------------*/

     ini_dvector(tmp,0,NP-1,0.0);

     cpy_dvector(Tg,tmp+NP,0,l_sf-1);

     LPC_ptoa     (pdcfq,ai_zero,NP);

     FLT_conv     (tmp,ai_zero,NP+1,l_sf,res2);

     ini_dvector(tmpmem,0,NP-1,0.0);

     FLT_allsyn(res2,l_sf,wpdcf_num,NP,tmp+NP,tmpmem);
				
				<dp n="d660"/>
    LPC_ptoa(wpdcf_den,ai_zero,NP);

    FLT_conv(tmp,ai_zero,NP+1,l_sf,res2);

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :PRC_TargetSignal().                            */
/*--------------------------------------------*/
/*PURPOSE    :This function calculates the target signal.  */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*      _(FLOAT64[])wpdcf_num:  precetual filter numerator    */
/*                          coefficients.                 */
/*      _(FLOAT64[])wpdcf_den:  precetual filter denominator  */
/*                          coefficients.                 */
/*      _(FLOAT64[])pdcfq:    quantized prediction coeff.   */
/*      _(FLOAT64[])OriSig:   original signal              */
/*      _(FLOAT64[])dif_mem:   memory for synthesis filter  */
/*      _(INT16   )target_mem:memory for taget synthesis.  */
/*      _(INT16   )l_sf:    sub-frame size.               */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*      _(FLOAT64[])res:    residual signal.              */
/*      _(FLOAT64[])Tgs:    target signal.                */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*             _None.                                     */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*             _None.                                     */
/*===============================================================================*/
void PRC_TargetSignal(FLOAT64 wpdcf_num[],FLOAT64 wpdcf_den[],

              FLOAT64 pdcfq[],FLOAT64 OriSig[],FLOAT64 res[],
				
				<dp n="d661"/>
    FLOAT64 Tgs[],FLOAT64 dif_mem[],

    FLOAT64 target_mem[],INT16 l_sf)
{
/*--------------------------------------------*/
FLOAT64 ai_zero[NP+1],tmpmem[NP];
/*--------------------------------------------*/
/*  The residual signal is located at ext+MAX_LAG for use in the    */
/*                      close-loop pitch search                   */
/*--------------------------------------------*/
LPC_ptoa(pdcfq,ai_zero,NP);
FLT_conv(OriSig,ai_zero,NP+1,l_sf,res);
/*--------------------------------------------*/
/*    Filter the residual signal with the synthesis filter    */
/*           NOTES:reverse the order of the memory                 */
/*--------------------------------------------*/
rev_dvector(dif_mem,tmpmem,0,NP-1);
FLT_allsyn(res,l_sf,pdcfq,NP,dif_mem+NP,tmpmem);
/*--------------------------------------------*/
/*                Perceptual weighting filter                 */
/*--------------------------------------------*/
LPC_ptoa(wpdcf_num,ai_zero,NP);
FLT_conv(dif_mem,ai_zero,NP+1,l_sf,Tgs);
/*--------------------------------------------*/
/*      NOTES:reverse the order of the memory                 */
/*--------------------------------------------*/
rev_dvector(target_mem,tmpmem,0,NP-1);
FLT_allsyn(Tgs,l_sf,wpdcf_den,NP,Tgs,tmpmem);
/*--------------------------------------------*/
return;
				
				<dp n="d662"/>
    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :PRC_average_rate().                           */
/*--------------------------------------------*/
/*PURPOSE    :This function calculates the SMV average      */
/*           bit rate.                                 */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                          */
/*      _(INT16  )codec_rate:current frame bitrate.    */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                         */
/*            _None.                                   */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                   */
/*     _(FLOAT64*)avg_rate:average bit rate.           */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                        */
/*            _None.                                  */
/*===============================================================================*/
void PRC_average_rate(INT16 codec_rate,FLOAT64*avg_rate)

    {

    /*--------------------------------------------*/

    INT16 bits=0;

    /*--------------------------------------------*/

    /*    Set bits incl.overhead in order to measure the     */

    /*                 average SMV bit-rate                    */

    /*--------------------------------------------*/

    switch(codec_rate)

        {

        case RATE8_5K:bits=RATE_1_1;

             break;

        case RATE4_0K:bits=RATE_1_2;

             break;
				
				<dp n="d663"/>
        case RATE2_0K:bits=RATE_1_4;

            break;

        case RATE0_8K:bits=RATE_1_8;

            break;

        default:nrerror(″Invalid codec rate!!!\n″);

            break;

        }

    /*----------------------------------------*/

    (*avg_rate)=((*avg_rate)*(FLOAT64)(frm_count-1)+(FLOAT64)bits)/(double)frm_count;

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*--------------------END-------------------------*/
/*===============================================================================*/
				
				<dp n="d664"/>
/*===============================================================================*/
/*===========================================================================*/
/*Conexant System Inc.                                 */
/*4311 Jamboree Road                                    */
/*Newport Beach,CA 92660                                 */
/*--------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                  */
/*--------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                  */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc.*/
/*===============================================================================*/
/*PROTOTYPE FILE:lib_prc.h                                              */
/*===============================================================================*/
/*--------------------------------------------*/
/*--------------------FUNCTIONS---------------------*/
/*--------------------------------------------*/
void PRC_init_lib    (void);
void PRC_GainsNorm_Gc_Gp(FLOAT64,FLOAT64,FLOAT64[],FLOAT64[],

                           FLOAT64**,FLOAT64**,FLOAT64[],INT16,

                              FLOAT64,INT16);
void PRC_GainNorm_Gc    (FLOAT64[],FLOAT64[],FLOAT64**,FLOAT64**,

                                    FLOAT64[],INT16);
void PRC_Ideal_Excit    (FLOAT64[],FLOAT64[],FLOAT64[],FLOAT64[],

                                    FLOAT64[],INT16);
void PRC_TargetSignal   (FLOAT64*,FLOAT64*,FLOAT64*,FLOAT64*,

                               FLOAT64*,FLOAT64*,FLOAT64*,FLOAT64*,

                                  INT16);
				
				<dp n="d665"/>
void PRC_average_rate  (INT16,FLOAT64*);
/*===============================================================================*/
/*--------------------END------------------------*/
/*===============================================================================*/
				
				<dp n="d666"/>
/*===============================================================================*/
/*==========================================================================*/
/*Conexant System Inc.                                   */
/*4311 Jamboree Road                                      */
/*Newport Beach,CA 92660                                   */
/*--------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                */
/*--------------------------------------------*/
/*ALL RIGHTS RESERVED:                                       */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of France Telecom and   */
/*Conexant System Inc.                                             */
/*===============================================================================*/
/*LIBRARY:lib_pwf.c                                                   */
/*===============================================================================*/
/*--------------------------------------------*/
/*---------------------INCLUDE----------------------*/
/*--------------------------------------------*/
#include″main.h″
#include″typedef.h″
#include″const.h″
#include″gputil.h″
#include″ext_var.h″
#include″lib_lpc.h″
#include″lib_flt.h″
#ifdef DIAG_SMV
#include″lib_dia.h″
#endif
/*--------------------------------------------*/
/*-------------------FUNCTIONS--------------------*/
/*--------------------------------------------*/
				
				<dp n="d667"/>
/*===============================================================================*/
/*FUNCTION   :PWF_init_lib().                                   */
/*--------------------------------------------*/
/*PURPOSE    :This function initialise the global variables  */
/*           of the PWF library.                            */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*            _None.                                        */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
/*            _None.                                        */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                         */
/*            _None.                                        */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
/*            _None.                                        */
/*===============================================================================*/
void PWF_init_lib(void)

     {

     /*---------------------------------------*/

     /*                 wspeech_to_speech                         */

     /*---------------------------------------*/

     r_pole_ws=0.55;

     Z1_ws_1=0.0;

     Z1_ws_2=0.0;

     /*---------------------------------------*/

     return;

     /*---------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION    :PWF_speech_to_residu().                           */
/*--------------------------------------------*/
/*PURPOSE     :This function perform a filtering operation to  */
				
				<dp n="d668"/>
/*           pass from the input signal domain to the    */
/*           perceptually weighted domain residual.       */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                              */
/*   _(FLOAT64[])sigpp:    input signal.                  */
/*   _(FLOAT64**)pdcf:     prediction coeff.matrix.        */
/*   _(FLOAT64  )r_zero:   band-expantion oefficient        */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*   _(FLOAT64[])residu:   perceptually weigthed domain     */
/*                        residual.                      */
/*   _(FLOAT64**)wpdcf_zero:band-expanded prediction coeff.  */
/*                        matrix.                        */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                        */
/*   _None.                                              */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                            */
/*   _None.                                              */
/*===============================================================================*/
void PWF_speech_to_residu(FLOAT64 sigpp[],FLOAT64 residu[],FLOAT64**pdcf,

                       FLOAT64**wpdcf_zero,FLOAT64 r_zero)

     {

     /*---------------------------------------*/

     INT16  i,j,i_s;

     FLOAT64 ai_zero[NP+1],val;

     /*---------------------------------------*/

     /*  Generate the perceptual weighting filter zeros coefficients  */

     /*---------------------------------------*/

     for(i=0;i<=N_SF4;i++)

         {

         val=1.0;

         for(j=0;j<NP;j++)

             {

             val*=r_zero;

             wpdcf_zero[i][j]=pdcf[i][j]*val;

             }

         }
				
				<dp n="d669"/>
    /*----------------------------------------*/

    /*         Generate the weighted residual             */

    /*----------------------------------------*/

    i_s=0;

    for(i=0;i<N_SF4;i++)

        {

        LPC_ptoa(wpdcf_zero[i],ai_zero,NP);

          FLT_cony(sigpp+L_PP-L_FRM-L_LPCLHD+i_s-NP,ai_zero,NP+1,L_SF4,

                                  residu+L_OLPIT-L_FRM-L_LPCLHD+i_s);

        i_s+=L_SF4;

        }

    /*----------------------------------------*/

    LPC_ptoa(wpdcf_zero[i],ai_zero,NP);

    FLT_cony(sigpp+L_PP-L_LPCLHD-NP,ai_zero,NP+1,L_LPCLHD,

                                    residu+L_OLPIT-L_LPCLHD);

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :PWF_residu_to_wspeech().                             */
/*--------------------------------------------*/
/*PURPOSE    :This function perform a filtering operation to  */
/*           pass from the perceptually weighted domain        */
/*           residual to the perceptually weighted domain     */
/*           signal.                                         */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                                */
				
				<dp n="d670"/>
/*    _(INT16    )flat_flag:   flat input speech flag.       */
/*    _(FLOAT64[])residu:       residual signal.               */
/*    _(FLOAT64**)refl:         partial corr.coeff.matrix.    */
/*    _(FLOAT64  )r_zero:       band-expantion oefficient        */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                   */
/*    _(FLOAT64[])wspeech:      perceptually weigthed domain        */
/*                           signal.                         */
/*    _(FLOAT64**)pdcf:         prediction coeff.matrix.         */
/*    _(FLOAT64**)wpdcf_pole:    band-expanded prediction coeff.  */
/*                           matrix.                          */
/*    _(FLOAT64[])LP_CF:        first adaptiye order lowpass     */
/*                           coefficient.                    */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                              */
/*    _(FLOAT64[])wspeech_mem:synthesis filter memory.            */
/*    _(FLOAT64  *)Z1_ws:    first adapive order lowpass         */
/*                         memory.                              */
/*---------------------------------------*/
/*RETURN ARGUMENTS:                                                   */
/*   _None.                                                     */
/*===============================================================================*/
void PWF_residu_to_wspeech(INT16 flat_flag,FLOAT64 residu[],

                       FLOAT64 wspeech[],FLOAT64**refl,FLOAT64**pdcf,

                        FLOAT64**wpdcf_pole,FLOAT64*LP_CF,

                          FLOAT64 wspeech_mem[],FLOAT64*Z1_ws)

    {

    /*----------------------------------*/

    INT16  i,k,j,i_s,i0;

    FLOAT64 val,x,y,tmpmem[NP];

    *-----------------------------------*/

    /*  Generate the perceptual weighting filter poles coefficients  */

    /*----------------------------------*/

    for(i=0;i<=N_SF4;i++)

        {

        val=1.0;

        for(j=0;j<NP;j++)

            {
				
				<dp n="d671"/>
         val*=0.5;

         wpdcf_pole[i][j]=pdcf[i][j]*val;

         }

    }
/*--------------------------------------------*/
if(flat_flag==0)

     y=0.2;
else

     y=0.0;
/*--------------------------------------------*/
for(i=0;i<=N_SF4;i++)

        LP_CF[i]=y;
/*--------------------------------------------*/
/*  Geherate the weighted speech for openloop pitch lag search  */
/*--------------------------------------------*/.
i_s=0;
for(i=0;i<N_SF4;i++)

    {

    FLT_allsyn(residu+L_OLPIT-L_FRM-L_LPCLHD+i_s,L_SF4,

                  wpdcf_pole[i],NP,wspeech+L_OLPIT-L_FRM-

                     L_LPCLHD+i_s,wspeech_mem);

    i_s+=L_SF4;

    }
cpy_dvector(wspeech_mem,tmpmem,0,NP-1);
FLT_allsyn(residu+L_OLPIT-L_LPCLHD,L_LPCLHD,wpdcf_pole[i],NP,

                               wspeech+L_OLPIT-L_LPCLHD,tmpmem);
/*--------------------------------------------*/
/*                Adaptive low pass                  */
/*--------------------------------------------*/
i_s=0;
for(i=0;i<N_SF4;i++)

    {
				
				<dp n="d672"/>
        for(k=0;k<L_SF4;k++)

            {

            i0=L_OLPIT-L_FRM-L_LPCLHD+i_s;

            x=wspeech[i0+k]+LP_CF[i]*(*Z1_ws);

            (*Z1_ws)=wspeech[i0+k];

            wspeech[i0+k]=x;

            }

        i_s+=L_SF4;

        }

    y=(*Z1_ws);

    for(i=0;i<L_LPCLHD;i++)

        {

        x=wspeech[L_OLPIT-L_LPCLHD+i]+LP_CF[N_SF4]*y;

        y=wspeech[L_OLPIT-L_LPCLHD+i];

        wspeech[L_OLPIT-L_LPCLHD+i]=x;

        }

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :PWF_wspeech_to_speech().                  */
/*--------------------------------------------*/
/*PURPOSE    :This function perform a filtering operation to    */
/*           pass from the perceptually weighted domain         */
/*           signal to the signal.                            */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*   _(FLOAT64**)wpdcf_zero:  band-expanded prediction coeff.  */
/*                        matrix numarator.               */
/*   _(FLOAT64**)wpdcf_pole:  band-expanded prediction coeff.  */
/*                        matrix denominator.             */
/*   _(FLOAT64[])LP_CF:       first adaptive order lowpass   */
/*                        coefficient.                   */
/*--------------------------------------------*/
				
				<dp n="d673"/>
/*OUTPUT ARGUMENTS:                                            */
/*  _(FLOAT64[])ModiSig:  pitch preprocessed signal.      */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                      */
/*  _(FLOAT64*)Z1_ws_2:   first adaptive order lowpass     */
/*                     memory.                          */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                          */
/*  _None.                                             */
/*===============================================================================*/
void PWF_wspeech_to_speech(FLOAT64 ModiSig[],FLOAT64**wpdcf_zero,

                          FLOAT64**wpdcf_pole,FLOAT64 LP_CF[],

                             FLOAT64*Z1_ws_2)

    {

    /*----------------------------------------*/

    FLOAT64 tmp_ws[L_FRM+NP],ai_zero[NP+1];

    INT16 i,k,i_s;

    /*----------------------------------------*/

    cpy_dvector(tmp_ws_m,tmp_ws,0,NP-1);

    i_s=0;

    for(i=0;i<N_SF4;i++)

        {

        for(k=0;k<L_SF4;k++)

            {

            tmp_ws[N+i_s+k]=ModiSig[i_s+k]-

                                      LP_CF[i]*(*Z1_ws_2);

            (*Z1_ws_2)=tmp_ws[NP+i_s+k];

            }

            i_s+=L_SF4;

        }

    cpy_dvector(tmp_ws+L_FRM,tmp_ws_m,0,NP-1);

    /*-----------------------------------------*/

    i_s=0;

    for(i=0;i<N_SF4;i++)

        {
				
				<dp n="d674"/>
        LPC_ptoa(wpdcf _pole[i],ai_zero,NP);

        FLT_conv(tmp_ws+i_s,ai_zero,NP+1,L_SF4,ModiSig+i_s);

        FLT_allsyn(ModiSig+i_s,L_SF4,wpdcf_zero[i],NP,ModiSig+i_s,

                         ModiSig_m);

        i_s+=L_SF4;

        }

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*===============================================================================*/
/*---------------------END--------------------*/
/*===============================================================================*/
				
				<dp n="d675"/>
/*===============================================================================*/
/*=======================================================================*/
/*Conexant System Inc.                                             */
/*4311 Jamboree Road                                                */
/*Newport Beach,CA 92660                                             */
/*--------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                           */
/*--------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                   */
/*No part of this software may be reproduced in any form or by any*/
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of France Telecom and   */
/*Conexant System Inc.                                             */
/*===============================================================================*/
/*PROTOTYPE FILE:lib_pwf.h                                             */
/*--------------------------------------------*/
/*IMPLEMENTATION:                                            [26/05/2000]*/
/*Conexant System Inc.                                              */
/*Media Access Department                                            */
/*Speech Technology Development                                       */
/*--------------------------------------------*/
/*Last Version                                            [26/05/2000]*/
/*C.Murgia                                                            */
/*--------------------------------------------*/
/*PURPOSE:Perceptuel Weighting Filter library                            */
/*===============================================================================*/
/*--------------------------------------------*/
/*-----------------FUNCTIONS-----------------------*/
/*--------------------------------------------*/
void PWF init lib          (void);
void PWF_speech_to_residu  (FLOAT64[],FLOAT64[],FLOAT64**,FLOAT64**,

                                                             FLOAT64);
void PWF_residu_to_wspeech (INT16,FLOAT64[],FLOAT64[],FLOAT64**,

                           FLOAT64**,FLOAT64**,FLOAT64*,FLOAT64[],

                           FLOAT64*);
				
				<dp n="d676"/>
void PWF_wspeech_to_speech(FLOAT64[],FLOAT64**,FLOAT64**,FLOAT64[],

                           FLOAT64*);
/*===============================================================================*/
/*------------------------END------------------------*/
/*===============================================================================*/
				
				<dp n="d677"/>
/*===============================================================================*/
/*========================================================================*/
/*Conexant System Inc.                                             */
/*4311 Jamboree Road                                               */
/*Newport Beach,CA 92660                                            */
/*---------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                             */
/*--------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                  */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*===============================================================================*/
/*LIBRARY:lib_qlsf.c                                                 */
/*===============================================================================*/
/*--------------------------------------------*/
/*---------------------INCLUDE------------------------*/
/*--------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″gputil.h″
#include″mcutil.h″
#include″ext_var.h″
#include″lib_qlsf.h″
/*-----------------------------------------------*/
/*--------------------FUNCTIONS------------------------*/
/*-----------------------------------------------*/
/*===============================================================================*/
/*FUNCTION   :LSF_Q_init_lib().                                */
/*--------------------------------------------*/
/*PURPOSE    :This function initialise the global variable    */
/*           for the LSF_Q library.                          */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
				
				<dp n="d678"/>
/*             _None.                                */
/*--------------------------------------------*/
/* OUTPUT ARGUMENTS:                                         */
/*             _None.                                */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                    */
/*             _None.                                */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                         */
/*            _None.                                 */
/*===============================================================================*/
void LSF_Q_init_lib(void)

     {

     /*---------------------------------------*/

     INT16  i,j,k;

     /*---------------------------------------*/

       MS_08k[0]=LMS1_08k;

       MS_08k[1]=LMS2_08k;

       MS_08k[2]=LMS3_08k;

       MS_40k[0]=LMS1_40k;

       MS_40k[1]=LMS2_40k;

       MS_40k[2]=LMS3_40k;

       MS_85k[0]=LMS1_85k;

       MS_85k[1]=LMS2_85k;

       MS_85k[2]=LMS3_85k;

       MS_85k[3]=LMS4_85k;

    /*---------------------------------------*/

    last_qlsf[0]=0.049793355045123;

    last_qlsf[1]=0.071543733408561;

    last_qlsf[2]=0.115002634382656;

    last_qlsf[3]=0.164845365833111;

    last_qlsf[4]=0.211800568342986;

    last_qlsf[5]=0.252341845504398;

    last_qlsf[6]=0.303571730115036;
				
				<dp n="d679"/>
last_qlsf[7]=0.341160910229804;
last_qlsf[8]=0.387682253964778;
last_qlsf[9]=0.418740763446287;
/*--------------------------------------------*/
Mean[0]=0.049793355045123;
Mean[1]=0.071543733408561;
Mean[2]=0.115002634382656;
Mean[3]=0.164845365833111;
Mean[4]=0.211800568342986;
Mean[5]=0.252341845504398;
Mean[6]=0.303571730115036;
Mean[7]=0.341160910229804;
Mean[8]=0.387682253964778;
Mean[9]=0.418740763446287;
/*--------------------------------------------*/
  /*    Table of candidates for 0.8k LSF quantization    */
/*--------------------------------------------*/
ini_svector(stage_cand_08k,0,2,8);
/*--------------------------------------------*/
  /*    Table of candidates for 4.0k LSF quantization     */
/*--------------------------------------------*/
ini_svector(stage_cand_40k,0,3,10);
/*--------------------------------------------*/
  /*    Table of candidates for 8.5k LSF quantization    */
/*--------------------------------------------*/
ini_svector(stage_cand_85k,0,3,10);
/*--------------------------------------------*/
  /*                    Copy the MA-VQ Tables            */
/*--------------------------------------------*/
for(i=0;i<MAXLTT_08k;i++)

    for(j=0;j<LMSMAX_08k;j++)

        for(k=0;k<MAXLNp;k++)
				
				<dp n="d680"/>
               lsf_cb_08k[i][j][k]=CBes_08k[i][j][k];

    for(i=0;i<MAXLTT_40k;i++)

        for(j=0;j<LMSMAX_40k;j++)

             for(k=0;k<MAXLNp;k++)

                 lsf_cb_40k[i][j][k]=CBes_40k[i][j][k];

    for(i=0;i<MAXLTT_85k;i++)

            for(j=0;j<LMSMAX_85k;j++)

               for(k=0;k<MAXLNp;k++)

                 lsf_cb_85k[i][j][k]=CBes_85k[i][j][k];

    /*-----------------------------------------*/

    for(i=0;i<NP;i++)

        lsf_new[i]=(i+0.5)*0.5/NP;

    for(i=0;i<NP;i++)

        lsf_mid[i]=(i+0.5)*0.5/NP;

    for(i=0;i<NP;i++)

        lsf_old[i]=(i+0.5)*0.5/NP;

    for(i=0;i<NP;i++)

        lsfq_old[i]=(i+0.5)*0.5/NP;

    for(i=0;i<NP;i++)

        lsfq_old_dec[i]=(i+0.5)*0.5/NP;

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/* FUNCTION    :LSF_Q_lsfqnt().                             */
/*--------------------------------------------*/
				
				<dp n="d681"/>
/*PURPOSE    :This function quntize the LSF unsig an MA         */
/*           residual quntization algorithm.               */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                              */
/*        _(FLOAT64[])1sf:        LSF vector.               */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*        _(FLOAT64[])qntlsf:    quantized LSF vector.      */
/*        _(INT16[])channel_idx: bitstream buffer.        */
/*        _(INT16[])stage_cnd:   prooning information.     */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*             _None.                                      */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                             */
/*             _None.                                      */
/*===============================================================================*/
void LSF_Q_lsfqnt(FLOAT64 lsf[],FLOAT64 qntlsf[],INT16 channel_idx[],

                                                 INT16 rate)

    {

    /*----------------------------------------*/

    INT16  flip_total;

    INT16  k,l,p;

    INT16  Pbest[1];

    INT16  indices[LTT_85k];

    FLOAT64 weight[NP];

    FLOAT64 e_lsf[LP_40k*NP];

    FLOAT64 tmp_qe_qlsf[NP];

    /*---------------------------------------*/

    /*               Weights calculation               */

    /*---------------------------------------*/

    LSF_Q_lsf_to_weight(lsf,weight,rate);

    /*---------------------------------------*/

    /*           Mean subtraction from lsf             */
				
				<dp n="d682"/>
/*--------------------------------------------*/
dif_dvector(lsf,Mean,lsf,0,NP-1);
/*--------------------------------------------*/
/*          Vector Prediction and Quantization */
/*--------------------------------------------*/
  switch(rate){

    case RATE0_8K:

      for(p=0;p<LP_08k;p++){

        for(l=0;l<NP;l++){

          e_lsf[p*NP+1]=lsf[1];

          for(k=0;k<LQMA_08k;k++){

            e_lsf[p*NP+1]-=B_08k[p][k][l]*qes[k][l];

          }

        }

      }

      LSF_Q_Qnt_e(e_lsf,weight,LP_08k,tmp_qe_qlsf,Pbest,l,

               indices,lsf_cb_08k,MS_08k,stage_cand_08k,LTT_08k);

    for(l=0;l<LTT_08k;l++)
   channel_idx[1]=(INT16)indices[1];

    break;

    case RATE4_0K:

      for(p=0;p<LP_40k;p++){

        for(l=0;l<NP;l++){

          e_lsf[p*NP+1]=lsf[1];

          for(k=0;k<LQMA_40k;k++){

            e_lsf[p*NP+1]-=B_40k[p][k][l]*qes[k][l];

          }

        }

      }

      LSF_Q_Qnt_e(e_lsf,weight,LP_40k,tmp_qe_qlsf,Pbest,1,

                   indices,lsf_cb_40k,MS_40k,stage_cand_40k,LTT_40k);

    for(l=0;l<LTT_40k;l++)
   channel_idx[1]=(INT16)indices[1];
				
				<dp n="d683"/>
      channel_idx[LTT_40k]=(INT16)Pbest[0];

      break;

     case RATE8_5K:

     case RATE2_0K:

        for(p=0;p<LP_85k;p++){

         for(l=0;l<NP;l++){

          e_lsf[p*NP+1]=lsf[1];

          for(k=0;k<LQMA_85k;k++){

            e_lsf[p*NP+1]-=B_85k[p][k][l]*qes[k][l];

          }

         }

       }

      LSF_Q_Qnt_e(e_lsf,weight,LP_85k,tmp_qe_qlsf,Pbest,1,

              indices,lsf_cb_85k,MS_85k,stage_cand_85k,LTT_85k);

    for(l=0;l<LTT_85k;l++)
   channel_idx[1]=(INT16)indices[1];

    break;

    default:

        printf(″Invalid rate!!\n″);

        exit(0);

    }
/*--------------------------------------------*/
/*     Note:all the delayed decision information are available    */
/*--------------------------------------------*/
ini_dvector(qntlsf,0,NP-1,0.0);
   switch(rate){

     case RATE0_8K:

          for(l=0;l<NP;l++){

            for(k=0;k<LQMA_08k;k++){

              qntlsf[1]+=B_08k[0][k][l]*qes[k][l];

            }

          }

     break;
				
				<dp n="d684"/>
    case RATE4_0K:

          for(l=0;l<NP;l++){

              for(k=0;k<LQMA 40k;k++){

                  qntlsf[1]+=B_40k[pbest[0]][k][l]*qes[k][l];

              }

          } 

     break;

    case RATE8_5K:

    case RATE2_0K:

         for(l=0;l<NP;l++){

             for(k=0;k<LQMA_85k;k++){

               qntlsf[1]+=B_85k[0][k][l]*qes[k][l];

             }

         }

    break;

    default:

        printf(″Invalid rate!!\n″);

        exit(0);

    }
add_dvector(qntlsf,tmp_qe_qlsf,  qntlsf,0,NP-1);
add_dvector(qntlsf,Mean,    qntlsf,0,NP-1);
flip_total=0;
if(qntlsf[0]<=0.0)

    flip_total++;
for(k=1;k<NP;k++)

    {

    if(qntlsf[k]<qntlsf[k-1])

         flip_total++;

    }
/*---------------------------------------------*/
/*          simulate decoder lsf-erasure                */
/*--------------------------------------------*/
if(flip_total>1)
				
				<dp n="d685"/>
          {

          wad_dvector(last_qlsf,0.9,Mean,0.1,qntlsf,0,NP-1);
#ifdef VERBOSE

          printf(″\nWARNING frame%ld:Encoder flipped%d lsf pairs\n″,

                        frm_count,flip_total);
#endif

          }

    /*-----------------------------------------*/

    LSF_Q_Order(qntlsf);

    LSF_Q_Space_lsf(qntlsf,0);

    /*-----------------------------------------*/

    /*       Shifting the prediction states           */

    /*-----------------------------------------*/

      switch(rate){

        case RATE0_8K:

        case RATE4_0K:/*MA order is 4 for 0.8k and 4.0k*/

          for(k=LQMA_40k-1;0<k;k--)

             cpy_dvector(qes[k-1],qes[k],0,NP-1);

        break;

        case RATE8_5K:

        case RATE2_0K:/*MA order is 2 for 8.5k and 2.0k*/

          for(k=LQMA_40k-1;LQMA_85k<=k;k--){

               ini_dvector(qes[k],0,NP-1,0.0);

            }

            for(k=LQMA 85k-1;0<k;k--){

              cpy_dvector(qes[k-1],qes[k],0,Np-1);

            }

        break;

       default:

          printf(″Invalid rate!!\n″);

          exit(0);

       }

     cpy_dvector(tmp_qe_qlsf,qes[0],0,NP-1);
				
				<dp n="d686"/>
    /*----------------------------------------*/

    /*         Add the Mean vector to the LSF           */ 

    /*----------------------------------------*/

    add_dvector(lsf,Mean,lsf,0,NP-1);

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*===============================================================================*/
/*FUNCTION      :LSF_Q_lsf_decode().                     */
/*--------------------------------------------*/
/*PURPOSE       :This function decodes the LSF vector.    */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                             */
/*        _(INT16  [])channel_idx:indices.                 */
/*        _(INT16   )bfi:        Bad Farme Indicator.       */
/*        _(INT16   )count:      Bad Farme counter.          */
/*        _(FLOAT64[])bfi_lpcg:   lpc gain of previous frame.*/
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*        _(FLOAT64[])qntlsf:     decoded LSF vector.        */
/--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                         */
/*        _None.                                            */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
/*        _None.                                            */
/*===============================================================================*/
void LSF_Q_lsf_decode(INT16 bfi_caution,INT16*exp_flg,FLOAT64 qntlsf[],

              INT16 channel_idx[],INT16 bfi,INT16 count,INT16 rate)

     {

     /*---------------------------------------*/

     INT16 prd_idx;
				
				<dp n="d687"/>
INT16 flip_total;
INT16 lsf_caution;
INT16 k,l;
FLOAT64 tmp_qe_qlsf[NP];
/*---------------------------------------------*/
/*              Not frame erasure                     */
/*---------------------------------------------*/
prd_idx=0;
if(bfi==0)

    {

    lsf_caution=0;

    if(rate==RATE4_0K)

         prd_idx=channel_idx[3];

    /*-----------------------------------------*/

    /*        Generate the codebook vector            */

    /*-----------------------------------------*/

    ini_dvector(tmp_qe_qlsf,0,NP-1,0.0);

    switch(rate)

         {

         case RATE0_8K:

                 for(l=0;l<LTT_8k;l++)

                      {

                      k=channel_idx[1];

                      add_dvector(tmp_qe_qlsf,lsf_cb_08kf[l][k],

                                                 tmp_qe_qlsf,0,NP-1);

                      }

              break;

             case RATE4_0K:

             for(l=0;l<LTT_40k;l++)

                {

                 k=channel_idx[1];

                 add_dvector(tmp_qe_qlsf,lsf_cb_40k[l][k],

                                                tmp_qe_qlsf,0,NP-1);
				
				<dp n="d688"/>
              }

         break;

        case RATE8_5K:

        case RATE2_0K:

        for(l=0;l<LTT_85k;l++)

             {

             k=channel_idx[1];

             add_dvector(tmp_qe_qlsf,lsf_cb_85k[l][k],

                                            tmp_qe_qlsf,0,NP-1);

             }

        break;

    default:nrerror(″Invalid rate!!\n″);

        break;

    }
/*---------------------------------------------*/
/*      Generate the predicted lsf vector              */
/*---------------------------------------------*/
ini_dvector(qntlsf,0,NP-1,0.0);
switch(rate)

    {

    case RATE0_8K:

        for(l=0;l<NP;l++)

           for(k=0;k<LQMA_08k;k++)

               qntlsf[1]+=B_0k[0][k][l]*qes_dec[k][l];

        break;

    case RATE4_0K:

        for(l=0;l<NP;l++)

            for(k=0;k<LQMA_40k;k++)

            qntlsf[1]+=B_40k[prd_idx][k][l]*qes_dec[k][l];

        break;

    case RATE8_5K:

    case RATE2_0K:

        for(l=0;l<NP;l++)
				
				<dp n="d689"/>
                  for(k=0;k<LQMA_85k;k++)

             qntlsf[l]+=B_85k[0][k][l]*qes_dec[k][l];

                  break;

             default:nrerror(″Invalid rate!!″);

                  break;

             }

          /*--------------------------------------*/

          add_dvector(qntlsf,tmp_qe_qlsf,qntlsf,0,NP-1);

          add_dvector(qntlsf,Mean,         qntlsf,0,NP-1);

          flip_total=0;

          if(qntlsf[0]<=0.0)

              flip_total++;

          for(k=1;k<NP;k++)

             {

             if(qntls[k]<qntlsf[k-1])

                  flip_total++;

             }

          /*--------------------------------------*/

          /*     lsf-erasure,synchronized with encoder          */

          /*--------------------------------------*/

          if(flip_total>1)

             {

             wad_dvector(last_qlsf,0.9,Mean,0.1,qntlsf,0,NP-1);
#ifdef VERBOSE

             printf(″WARNING frame%ld:Decoder flipped%d lsf pairs\n″,

                      frm_count,flip_total);
#endif

             }

             /*-----------------------------------*/

             LSF_Q_Order(qntlsf;

             LSF_Q_Space_lsf(qntlsf,lsf_caution);

                 if(count<=2&amp;&amp;count>=1&amp;&amp;bfi_caution==1)
				
				<dp n="d690"/>
               {

               lsf_caution=0;

               *exp_flg=0;

               for(k=0;k<NP-1;k++)

               {

               if(8000.0*(qntlsf[k+1]-qntlsf[k])<75.0)

                    {

                    lsf_caution=2;

                    *exp_flg=1;
#ifdef VERBOSE

               printf(″LSF_CAUTION1 HAPPENED at FRAME%ld%hd%f\n″,

                             frm_count,k,8000.0*(qntlsf[k+1]-qntlsf[k]));
#endif

                     }

               }

            }

       else

            {

            lsf_caution=0;

                *exp_flg=0;

                }

       /*------------------------------------*/

       LSF_Q_Space_lsf(qntlsf,lsf_caution);

       }
   else

      {

      /*-------------------------------------*/

      /*                   Frame erasure                   */

      /*----------------------------------------*/

      /*----------------------------------------*/

      /* Generate the average past error lsf vector      */

      /*----------------------------------------*/

          (*exp_flg)=0;

      /*----------------------------------------*/

      /*    Shift previous LPC slightly towards mean               */

      /*-----------------------------------------*/
				
				<dp n="d691"/>
  wad_dvector(last_qlsf,0.9,Mean,0.1,qntlsf,0,NP-1);
  LSF_Q_Order(qntlsf);
  lsf_caution=5;
  LSF_Q_Space_lsf(qntlsf,lsf_caution);
  ini_dvector(tmp_qe_qlsf,0,NP-1,0.0);
  switch(rate)

    {

         case RATE0_8K:

              for(l=0;l<NP;l++)

                  for(k=0;k<LQMA_08k;k++)

                      tmp_qe_qlsf[1]+=B_08k[0][k][l]*qes_dec[k][l];

              break;

         case RATE4_0K:

              for(l=0;l<NP;l++)

                  for(k=0;k<LQMA_40k;k++)

                      tmp_qe_qlsf[1]+=B_40k[0][k][l]*qes_dec[k][l];

             break;

         case RATE8_5K:

         case RATE2_0K:

              for(l=0;1<NP;l++)

                  for(k=0;k<LQMA_85k;k++)

                      tmp_qe_qlsf[1]+=B_85k[0][k][l]*qes_dec[k][l];

             break;

         default:nrerror(″Invalid rate!!″);

             break;

         }

    /*------------------------------------------*/

    dif_dvector(qntlsf,     tmp_qe_qlsf,tmp_qe_qlsf,0,NP-1);

    dif_dvector(tmp_qe_qlsf,Mean,tmp_qe_qlsf,0,NP-1);

    }
/*---------------------------------------------*/
/*                Shifting the prediction states           */
				
				<dp n="d692"/>
/*---------------------------------------------*/
cpy_dvector(qntlsf,last_qlsf,0,NP-1);
switch(rate)

    {

    /*-----------------------------------------*/

    /*    MA order is 4 for 0.8k and 4.0k                 */

    /*-----------------------------------------*/

    case RATE0_8K:

    case RATE4_0K:

         for(k=LQMA_40k-1;0<k;k--)

             cpy_dvector(qes_dec[k-1],qes_dec[k],0,NP-1);

         break;

    /*-----------------------------------------*/

    /*         MA order is 2 for 8.5k and 2.0k            */

    /*-----------------------------------------*/

    case RATE8_5K:

    case RATE2_0K:

         for(k=LQMA_40k-1;LQMA_85k<=k;k--)

             ini_dvector(qes_dec[k],0,NP-1,0.0);

         for(k=LQMA_85k-1;0<k;k--)

             cpy_dvector(qes_dec[k-1],qes_dec[k],0,NP-1);

         break;

    default:nrerror(″Invalid rate!!″);

         break;

    }
cpy_dvector(tmp_qe_qlsf,qes_dec[0],0,NP-1);
/*---------------------------------------------*/
return;
/*---------------------------------------------*/
				
				<dp n="d693"/>
      }
/*---------------------------------------------*/
/*=========================================================================*/
/*FUNCTION    :LSF_Q_Order().                                   */
/*----------------------------------------------*/
/* PURPOSE    :This function reorder the decoded LSF vector.  */
/*---------------------------------------------*/
/* INPUT ARGUMENTS:                                               */
/*             _None.                                        */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                */
/*             _None.                                        */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                           */
/*       _(FLOAT64[])qlsf:    decoded LSF vector.             */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                                */
/*           _None.                                          */
/*=========================================================================*/
void LSF_Q_Order(FLOAT64 qlsf[])

    {

    /*-----------------------------------------*/

    INT16  i,j;

    FLOAT64 temp;

    /*-----------------------------------------*/

    for(i=NP-1;i>=0;i--)

        {

         /*------------------------------------*/

         for(j=0;j<i;j++)

             {

             if(qlsf[j]>qlsf[j+1])

                 {

                 temp       =qlsf[j];

                 qlsf[j]  =qlsf[j+1];

                 qlsf[j+1]=temp;
				
				<dp n="d694"/>
                 }

             }

         /*------------------------------------*/

         }

    /*-----------------------------------------*/

    return;

    /*-----------------------------------------*/

    }
/*---------------------------------------------*/
/*=========================================================================*/
/*FUNCTION   :LSF_Q_Space_lsf().                           */
/*---------------------------------------------*/
/*PURPOSE    :This function preserve the minimum spacing  */
/*           between the decoded LSF vector             */
/*           (range:0<=val<=0.5).                      */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                            */
/*       _(INT16  [])lsf_caution:flag for LSF caution.  */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                           */
/*       _None.                                         */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                     */
/*       _(FLOAT64[])lsf:      decoded LSF vector.       */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                          */
/*       _None.                                          */
/*=========================================================================*/
void LSF_Q_Space_lsf(FLOAT64 lsf[],INT16 lsf_caution)

     {

     /*----------------------------------------*/

     INT16  i;

     FLOAT64 lsf_min,min_dist;
				
				<dp n="d695"/>
    /*-----------------------------------------*/

    lsf_min=0.0;

    min_dist=0.0;

    /*-----------------------------------------*/

    if(lsf_caution==0)

           lsf_min=min_dist=0.00625;/*At least 50Hz Spacing*/

    else if(lsf_caution==1)

           lsf_min=min_dist=0.01250;/*At least 100Hz Spacing*/

    else if(lsf_caution==2)

           lsf_min=min_dist=0.015625;/*At least 125Hz Spacing*/

    else if(lsf_caution==3)

           lsf_min=min_dist=0.01875;/*At least 150Hz Spacing*/

    else if(lsf_caution==4)

           lsf_min=min_dist=0.03125;/*At least 250Hz Spacing*/

    else if(lsf_caution==5)

           lsf_min=min_dist=0.0075;/*At least 60Hz Spacing*/

    /*-----------------------------------------*/

    for(i=0;i<NP;i++)

        {

        if(lsf[i]<lsf_min)

              lsf[i]=lsf_min;

        lsf_min=lsf[i]+min_dist;

        }

    /*-----------------------------------------*/

    return;

    /*-----------------------------------------*/

    }
/*---------------------------------------------*/
/*=========================================================================*/
/*FUNCTION    :LSF_Q_lof_to_weight().                         */
/*---------------------------------------------*/
/*PURPOSE     :This function calculates the proper weight    */
				
				<dp n="d696"/>
/*                 factor of each LS value.            */
/*---------------------------------------------*/ 
/*INPUT ARGUMENTS:                                              */
/*        _(FLOAT64[])lsf;     LSF vector.                */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
 /*       _(FLOAT64[])weight:  error weights.             */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                         */
/*              _None.                                    */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
/*              _None.                                   */
/*=========================================================================*/
void LSF_Q_lsf_to_weight(FLOAT64 lsf[],FLOAT64 weight[],INT16 rate)

    {

    /*----------------------------------------*/

    INT16  j,i;

    INT16 idx1,idx2;

    FLOAT64  p[NP+1],q[NP+1];

    FLOAT64  p_poly,q_poly;

    FLOAT64 inv_pow_spect;

    FLOAT64 p_coeff,q_coeff,pi_arg,x;

    /*----------------------------------------*/

    pi_arg=2*PI;

    p[0]=1.0;

    q[0]=1.0;

    p[2]=1.0;

    q[2]=1.0;

    p[1]=cos(lsf[1]*pi_arg);

    p[1]=-2.0*p[1];

    q[1]=cos(lsf[0]*pi_arg);

    q[1]=-2.0*q[1];

    /*-----------------------------------------*/

    for(i=2;i<=NP/2;i++)
				
				<dp n="d697"/>
    {

    idx1=2*i-1:

    idx2=2*i;

    p_coeff=cos(lsf[idx2-1]*pi_arg);

    p_coeff=-2.0*p_coeff;

    q_coeff=cos(lsf[idx2-2]*pi_arg);

    q_coeff=-2.0*q_coeff;

    for(j=i;j>=2;j--)

         {

         q[j]=q[j]+q[j-1]*q_coeff+q[j-2];

         p[j]=p[j]+p[j-1]*p_coeff+p[j-2];

         q[idx2-j]=q[j];

         p[idx2-j]=p[j];

         }

    p[1]   =p[1]+p_coeff;

    p[idx1]=p[1];

    q[1]   =q[1]+q_coeff;

    q[idx1]=q[1];

    p[idx2]=1.0;

    q[idx2]=1.0;

    }
/*---------------------------------------------*/
/*  Calculating the(1/(power spectrum))and the proper weight  */
/*---------------------------------------------*/
for(i=0;i<NP;i+=2)

    {

    p_poly=LSF_Q_cosine_polynomial(p,pi_arg*lsf[i]);

    x=cos(pi_arg*lsf[i]);

    inv_pow_spect=4*sqr(p_poly)*(2.-2.*x);

    weight[i]=pow(inv_pow_spect/4.,-0.4);

    }
				
				<dp n="d698"/>
     for(i=1;i<NP;i+=2)

        {

        q_poly=LSF_Q_cosine_polynomial(q,pi_arg*lsf[i);

        x=cos(pi_arg*lsf[i]);

        inv_pow_spect=4*sqr(q_poly)*(2.+2.*x);

        weight[i]=pow(inv_pow_spect/4.,-0.4);

        }

      if(rate==RATE0_8K){

        /*difierent weights for difierent frequencies.10/24/99,Eyal*/

        for(i=4;i<NP;i++){

          weight[i]*=-0.16*(FLOAT64)i+1.64; /*1.0 at i=4 an 0.2 at i=9*/

        }

      }

    /*-----------------------------------------*/

    return:

    /*-----------------------------------------*/

    }
/*---------------------------------------------*/
/*=========================================================================*/
/*FUNCTION     :LSF_Q_cosine_polynomial().                        */
/*---------------------------------------------*/
/*PURPOSE      :This function calculates the cosine polynomial.*/
/*             Note that coef[0]should be 1.0.               */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                                 */
/*         _(INT16[])coef:coeffiicients.                     */
/*         _(INT16  )omega:frequency.                           */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                */
/*            _None.                                          */
/*---------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*            _None.                                          */
/*---------------------------------------------*/
/*RETURN ARGUMENTS:                                               */
/*       _(FLOAT64)sum:  polynomial cosinus modulated sum.      */
				
				<dp n="d699"/>
/*=========================================================================*/
FLOAT64 LSF_Q_cosine_polynomial(FLOAT64 coef[],FLOAT64 omega)

    {

    /*-------------------------------------*/

    INT16 j;

    FLOAT64 sum,x;

    /*-------------------------------------*/

    sum=coef[NP/2]/2.;

    for(j=0;j<NP/2;j++){

      x=cos((NP/2-j)*omega);

      sum+=coef[j]*x;

    }

    /*-------------------------------------*/

    return(sun);

    /*-------------------------------------*/

    }
/*-----------------------------------------*/
/*=========================================================================*/
/*FUNCTION     :LSF_Q_Qnt_e().                                        */
/*---------------------------------------------*/
/*PURPOSE      :This function quantizes the prediction error of*/
/*             the lsf prediction.                            */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*      _(FLOAT64  [])e:    prediction residual.              */
/*      _(FLOAT64  [])w:     LSP weight factor.                 */
/*      _(INT16     )DIn:  number of input candidates        */
/*                        (always 1 in the ITU-T 4kbit/s).*/
/*      _(INT16    )DOut:    number of output candidates     */
/*                          (always 1 in the ITU-T 4kbit/s).*/
/*      _(FLOAT64[][][])CBe:  odebooks.                        */
/*      _(INT16      [])MS:   size of codebooks.              */
				
				<dp n="d700"/>
/*    _(INT16    [])stage_cnd:prooning information.        */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                */
/*    _(INT16    *)Pptr:   best predictor.                */
/*    _(FLOAT64  [])qe:      quantized prediction residual.*/
/*    _(INT16    *)cluster:best indices.                  */
/*----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*             _None.                                     */
/*----------------------------------------------*/
/*RETURN ARGUMENTS:                                               */
/*             _None.                                     */
/*=========================================================================*/
void LSF_Q_Qnt_e(FLOAT64 e[],FLOAT64 w[],INT16 DIn,FLOAT64 qe[],INT16*Pptr,

            INT16 DOut,INT16 cluster[],

               FLOAT64***CBe,INT16 MS[],

                  INT16*stage_cnd,INT16 ltt)

    {

    /*------------------------------------------*/

    INT16 ptr_back[LTT_85k][MAX_CAND_LSFQ];

    INT16 best_indx[LTT_85k][MAX_CAND_LSFQ];

    INT16 N_indx[LTT_85k];

    INT16 ptr;

    INT16 i;

    FLOAT64   d_data[LTT_85k][MAX_CAND_LSFQ*NP];

    /*------------------------------------------*/

    LSF_Q_New_ML_search(e,w,DIn,d_data[0],(INT16)stage_cnd[0],

                       best_indx[0],ptr_back[0],CBe[0],MS[0]);

    for(i=1;i<ltt-1;i++)

        {

        LSF_Q_New_ML_search(d_data[i-1],w,(INT16)stage_cnd[i-1],

                                d_data[i],(INT16)stage_cnd[i],

                                    best_indx[i],ptr_back[i],CBe[i],

                                         MS[i]);
				
				<dp n="d701"/>
         }

    LSF_Q_New_ML_search(d_data[ltt-2],w,(INT16)stage_cnd[ltt-2],

                       d_data[ltt-1],DOut,best_indx[ltt-1],

                           ptr_back[ltt-1],CBe[ltt-1],MS[ltt-1]);

     /*----------------------------------------*/

         N_indx[ltt-1]=best_indx[ltt-1][0];

         ptr=ptr_back[ltt-1][0];

         for(i=ltt-2;i>=0;i--){

          N_indx[i]=best_indx[i][ptr];

          ptr=ptr_back[i][ptr];

         }

            /*this is the pointer to the best predictor*/

        *Pptr=ptr;

        for(i=0;i<ltt;i++){

         cluster[i]=N_indx[i];

        }

        ini_dvector(qe,0,NP-1,0.0);

        for(i=0;i<ltt;i++){

         add_dvector(qe,CBe[i][N_indx[i]],qe,0,NP_1);

        }

    /*-----------------------------------------*/

    return;

    /*-----------------------------------------*/

    }
/*---------------------------------------------*/
/*=========================================================================*/
/*FUNCTION   :LSF_Q_New_ML_search().                           */
/*---------------------------------------------*/
/*PURPOSE    :This function performs the ML search.The data */
/*           pointer points to a J vectors array(each of */
				
				<dp n="d702"/>
/*           length NP,concatenated),the diff_data        */
/*           pointer points to a J*K vectors array(each of*/
/*           lengts NP,concatenated).The diff_data holds, */
/*           for each vector in data,the K smallest       */
/*           quantization error vector,using the given    */
/*           code book.                                    */
/*---------------------------------------------*/
/*INPUT ARGUMENTS:                                              */
/*     _(FLOAT64  [])d_data:    prediction residual.       */
/*     _(FLOAT64  [])weight:    LSP weight factor.          */
/*     _(INT16    )J:         number of input candidates. */
/*     _(INT16    )K:          number of output candidates.*/
/*     _(FLOAT64[][])code:     codebook.                    */
/*     _(INT16    )MQ:         size of codebook.             */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*     _(FLOAT64  [])new_d_data:  new prediction residual.   */
/*     _(INT16  [])best_indx:  array of the optmisaed      */
/*                            indexes.                    */
/*     _(INT16  [])ptr_back:   best candidates of past.    */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*     _None.                                             */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                             */
/*     _None.                                             */
/*==============================================================================*/
void LSF_Q_New_ML_search(FLOAT64 d_data[],FLOAT64 weight[],INT16 J,

                FLOAT64 new_d_data[],INT16 K,INT16 best_indx[],

                   INT16 ptr_back[],FLOAT64**code,

                       INT16 MQ)

     {

     /*---------------------------------------*/

     INT16  idx1,idx2;

     INT16  m,l,p,q;

     FLOAT64 sum[LMSMAX_85k*MAX_CAND_LSFQ];

     FLOAT64 min[MAX_CAND_LSFQ];

     INT16 min_indx_p[MAX_CAND_LSFQ];

     INT16 min_indx_m[MAX_CAND_LSFQ];
				
				<dp n="d703"/>
/*--------------------------------------------*/
/*                   Initialisation                     */
/*--------------------------------------------*/
for(q=0;q<K;q++)

    min[q]=DBL_MAX;
/*--------------------------------------------*/
for(p=0;p<J;p++)

    {

    for(m=0;m<MQ;m++)

        {

        sum[p*MQ+m]=0.0;

        for(l=0;l<NP;l++)

            sum[p*MQ+m]+=weight[1]*sqr(d_data[p*NP+1]-code[m][l]);

        }

    }
/*--------------------------------------------*/
for(q=0;q<K;q++)

    {

    /*----------------------------------------*/

    for(p=0;p<J;p++)

        {

            for(m=0;m<MQ;m++)

                {

                    if(sum[p*MQ+m]<min[q])

                         {

                         min[q]=sum[p*MQ+m];

                         min_indx_p[q]=p;

                         min_indx_m[q]=m;

                         }

                }

        }

    idx1=min_indx_p[q]*MQ+min_indx_m[q];
				
				<dp n="d704"/>
        sum[idx1]=DBL_MAX;

        /*------------------------------------*/

        }

    /*----------------------------------------*/

    for(q=0;q<K;q++)

        {

        /*------------------------------------*/

        for(l=0;l<NP;l++)

            {

            idx1=min_indx_p[q]*NP+1;

            idx2=min_indx_m[q];

            new_d_data[q*NP+1]=d_data[idx1]-code[idx2][1];

            }

        /*------------------------------------*/

        ptr_ack[q]=min_indx_p[q];

        best_indx[q]=min_indx_m[q];

        /*------------------------------------*/

        }

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*==============================================================================*/
/*---------------------END----------------------*/
/*==============================================================================*/
				
				<dp n="d705"/>
/*============================================================================*/
/*=======================================================================*/
/*Conexant System Inc.                                             */
/*4311 Jamboree Road                                                */
/*Newport Beach,CA 92660                                             */
/*--------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                              */
/*--------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                    */
/*No part of this software may be reproduced in any form or by any */
/*means or used to nake any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*==============================================================================*/
/*PROTOTYPE FILE:lib_q_lsf.h                                             */
/*==============================================================================*/
/*--------------------------------------------*/
/*--------------------FUNCTIONS---------------------*/
/*--------------------------------------------*/
void LSF_Q_int_lib           (void);
void LSF_Q_lsfqnt            (FLOAT64[],FLOAT64[],INT16*,INT16);
void LSF_Q_Order             (FLOAT64[]);
void LSF_Q_lsf_to_weight     (FLOAT64[],FLOAT64[],INT16);
FLOAT64 LSF_Q_cosine_polynomial  (FLOAT64[],FLOAT64);
void LSF_Q_Space_lsf         (FLOAT64[],INT16);
void LSF_Q_lsf_decode        (INT16,INT16*,FLOAT64[],INT16[],

                             INT16,INT16,INT16);
void LSF_Q_Qnt_e             (FLOAT64[],FLOAT64[],INT16,FLOAT64[],

                             INT16[],INT16,INT16[],FLOAT64***,

                                 INT16[],INT16*,INT16);
				
				<dp n="d706"/>
void LSF_Q_New_ML_search    (FLOAT64[],FLOAT64[],INT16,FLOAT64[],

                             INT16,INT16[],INT16[],

                                 FLOAT64**,INT16);
/*==============================================================================*/
/*-----------------------END-----------------------------*/
/*==============================================================================*/
				
				<dp n="d707"/>
/*==============================================================================*/
/*=========================================================================*/
/*Conexant System Inc.                                       */
/* 4311 Jamboree Road                                         */
/*Newport Beach,CA 92660                                       */
/*--------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                        */
/*--------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                  */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*==============================================================================*/
/*LIBRARY:lib_smo.c                                                  */
/*==============================================================================*/
/*--------------------------------------------*/
/*---------------------INCLUDE--------------------*/
/*--------------------------------------------*/
#include″typedef.h″
#include″main.h″
#include″const.h″
#include″gputil.h″
#include″ext_var.h″
#include″lib_smo.h″
/*--------------------------------------------*/
/*-------------------FUNCTIONS----------------------*/
/*--------------------------------------------*/
/*==============================================================================*/
/*FUNCTION  :SMO_init_lib().                                 */
/*--------------------------------------------*/
/*PURPOSE   :This function initialisa the global variables */
/*          for the library SMO.                          */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                            */
				
				<dp n="d708"/>
/*           _None.                                    */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                            */
/*           _None.                                    */
/*--------------------------------------------*/ 
/*INPUT/OUTPUT ARGUMENTS:                                      */
/*           _None.                                    */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*           _None.                                    */
/*==============================================================================*/
void SMO_init_lib(void)

     {

     /*---------------------------------------*/

     /*                  SMO_lsf_smooth est                  */

     /*---------------------------------------*/

     N_mode_sub_est=0;

     N_mode_frm=0;

     /*---------------------------------------*/

     /*                SMO_initial_analysis             */

     /*---------------------------------------*/

     consec_low=0;

     consec_high=0;

     consec_vad_0=0;

     updates_noise=0;

     updates_speech=0;

     calls=0;

     lev_reset=0;

     ma_max_noise=0.0;

     ma_max_speech=0.0;

     ma_cp=0.0;

     buffer_p=buffer_smo+HI_LAG2;

     /*---------------------------------------*/

     /*              SMO_refined_analysis               */

     /*---------------------------------------*/
				
				<dp n="d709"/>
    N_mode_sub_ref=N_MODE_SUB_START;

    consec=0;

    updates=0;

    ma_max=0.0;

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*==============================================================================*/
/*FUNCTION    :SMO_lsf_smooth_est ().                            */
/*--------------------------------------------*/
/*PURPOSE     :This function classify teh input signal frame:  */
/*            file.                                          */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                               */
/*       _(INT16  )Vad    :VAD of current frame.              */
/*       _(INT16  )PastVad:VAD of previous frame.             */
/*       _(FLOAT64 )refl  :first reflection coefficient.*/
/*       _(FLOAT64[])lsf  :curent frame LSF coefficients. */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*       _(FLOAT64  )beta_frm:estimated LSF smoothing        */
/*                          factor.                      */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                       */
/*             _None.                                    */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*             _None.                                    */
/*================================================================================*/
void SMO_lsf_smooth_est(INT16 Vad,INT16 PastVad,FLOAT64 refl,

             FLOAT64 lsf[],FLOAT64 beta_frm[])

    {

    /*----------------------------------------*/
				
				<dp n="d710"/>
INT16 i,i_sf;
INT16 mode_frm,N_sub_and;
FLOAT64 dSP,dSP_avg,dSP_int;
/*--------------------------------------------*/
/*                Algorithm initialisation            */
/*--------------------------------------------*/
if(frm_count==1)

    {

    cpy_dvector(lsf,lsf_old_smo,0,NP-1);

    cpy_dvector(lsf,ma_lsf,0,NP-1);

    ini_dvector(dSP_buf,0,DSP_BUFF_SIZE-1,0.0);

    }
/*--------------------------------------------*/
/*             Calculate subframe smoothing           */
/*--------------------------------------------*/
for(i_sf=0;i_sf<N_SF4;i_sf++)

    {

    if(Vad==1‖PastVad==1)

        {

        /*------------------------------------*/

        /*                 Speech/spike mode          */

        /*------------------------------------*/

          N_mode_sub_est=0;

        }

    N_sub[i_sf]=N_mode_sub_est;

    if(Vad==0&amp;&amp;PastVad==0)

        {

        /*------------------------------------*/

        /*           Unvoiced/non-speech mode         */

        /*------------------------------------*/

        N_mode_sub_est++;

        if(N_mode_sub_est>4)

            N_mode_sub_est=4;
				
				<dp n="d711"/>
         }

     }
/*---------------------------------------*/
/*          Calculate frame smoothing             */
/*---------------------------------------*/
for(dSP=0.0,dSP_avg=0.0,i=0;i<NP;i++)

    {

    dSP+=(lsf[i]-lsf_old_smo[i])*(lsf[i]-lsf_old_smo[i]);

    dSP_avg+=(lsf[i]-ma_lsf[i])*(lsf[i]-ma_lsf[i]);

    }
for(dSP_int=0.0,i=DSP_BUFF_SIZE-1;i>0;i--)

    {

    dSP_buf[i]=dSP_buf[i-1];

    dSP_int+=dSP_buf[i];

    }
dSP_buf[0]=dSP_avg;
dSP_int+=dSP_buf[0];
/*---------------------------------------*/
mode_frm=0;
N_sub_and=1;
for(i=0;i<N_SF4;i++)

    {

    if(Vad==1‖PastVad==1)

        mode_frm=3;

    if(N_sub[i]==0)

        N_sub_and=0;

    }
/*---------------------------------------*/
if(mode_frm==3‖N_sub_and==0‖refl>Rllim)

    {

    N_mode_frm=0;

    *beta_frm=0.0;
				
				<dp n="d712"/>
         ini_dvector(dSP_buf,0,DSP_BUFF_SIZE-1,0.0);

         }

    ele if((dSP>dSP1‖dSP_int>dSP_int1)&amp;&amp;N_mode_frm>0)

         {

         N_mode_frm=0;

         *beta_frm=0.0;

         ini_dvector(dSP_buf,0,DSP_BUFF_SIZE-1,0.0);

         }

    else if(dSP>dSP2&amp;&amp;N_mode_frm>1)

         N_mode_frm=1;

    /*---------------------------------------*/

    if(mode_frm==0)

         {

         N_mode_frm++;

         if(N_mode_frm>5)

             N_mode_frm=5;

         *beta_frm=(FLOAT64)((N_mode_frm-1)*(N_mode_frm-1))/

                                                           16.0*BETA_FRM;

         }

    /*---------------------------------------*/

    /*                Buffer parameters              */

    /*---------------------------------------*/

    cpy_dvector(lsf,lsf_old_smo,0,NP-1);

    for(i=0;i<NP;i++)

        ma_lsf[i]=(*beta_frm)*ma_lsf[i]+(1.0-(*beta_frm))*lsf[i];

    /*----------------------------------------*/

    return;

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
/*==============================================================================*/
				
				<dp n="d713"/>
/*FUNCTION    :SMO_refined_analysis().                           */
/*---------------------------------------------*/
/*PURPOSE     :This function performs the refined analysis of  */
/*            the energy evolution and calculates the       */
/*            smoothing factor for the energy manipulation.  */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                                */
/*        _(FLOAT64[])res    :input frame.                   */
/*        _(INT16  )   speech_mode:result of the initial    */
/*                             analysis.                   */
/*        _(FLOAT64[])pitch_corr:pitch correlation values. */
/*        _(FLOAT64[])lsf       :curent frame LSF             */
/*                              coefficients.              */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                             */
/*        _(FLOAT64  *)exc_mode:  smoothing mode.              */
/*        _(FLOAT64  *)beta_sub:  estimated smoothing factor.*/
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*             _None.                                     */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
/*             _None.                                     */
/*================================================================================*/
void SMO_refined_analysis(FLOAT64 res[],INT16 speech_mode,

                       FLOAT64 pitch_corr[],INT1 6*exc_mode,

                          FLOAT64*beta_sub,INT16 l_sf)

     {

     /*---------------------------------------*/

     INT16 i;

     FLOAT64 max,max_mes,val;

     /*---------------------------------------*/

     /*        Find the max excitation value          */

     /*---------------------------------------*/

     for(max=-DBL_MAX,i=0;i<l_sf;i++)

          {

          val=(res[i]>0.0?res[i]:-res[i]);

          if(val>max)
				
				<dp n="d714"/>
          max=val;

     }
/*--------------------------------------------*/
max_mes=max/(ma_max+EPSI);
if(speech_mode==1)

    {

    /*----------------------------------------*/

    /*            speech/spike mode                   */

    /*----------------------------------------*/

    N_mode_sub_ref=N_MODE_SUB_START;

    (*beta_sub)=0.0;

    (*exc_mode)=1;

    }
else

    {

    /*----------------------------------------*/

    if(max_mes<1.75)

        {

        /*------------------------------------*/

        /*          Unvoiced/non-speech mode          */

        /*------------------------------------*/

        N_mode_sub_ref++;

        if(N_mode_sub_ref>4)

            N_mode_sub_ref=4;

        /*------------------------------------*/

        /*    Smooth energy if sustained unvoiced/non-speech    */

        /*------------------------------------*/

        if(N_mode_sub_ref>0)

            (*beta_sub)=BETA_SUB*(FLOAT64)((N_mode_sub_ref-1)*

                                           (N_mode_sub_ref-1))/9.0;

        else

            (*beta_sub)=0.0;
				
				<dp n="d715"/>
         (*exc_mode)=0;

         }

    else

         {

         /*-----------------------------------*/

         /*      speech/spike mode                         */

         /*-----------------------------------*/

         N_mode_sub_ref=N_MODE_SUB_START;

         (*beta_sub)=0.0;

         (*exc_mode)=1;

         }

    if(max_mes<=0.5)

         {

         if(consec<CONSEC_MAX)

             consec++;

         }

    else

         consec=0;

    /*----------------------------------------*/

    /*            Update moving average of maximum           */

    /*----------------------------------------*/

    if((*exc_mode==0&amp;&amp;(max_mes>0.5‖consec>CONSEC_MAX-1))‖

        (updates<=UPDATE_MAX &amp;&amp;pitch_corr[1]<0.60&amp;&amp;

                 pitch_corr[0]<0.65))

                 {

                      ma_max=0.9*ma_max+0.1*max;

                          if(updates<=UPDATE_MAX)

                          updates++;

                 }

    /*----------------------------------------*/

    }
/*--------------------------------------------*/
return;
				
				<dp n="d716"/>
    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*=========================*/
/*FUNCTION    :SMO_initial_analysis().                             */
/*-----------------------------------------------*/
/*PURPOSE     :This function performs the initial analysis of  */
/*            the energy evolution.                          */
/*-----------------------------------------------*/
/*INPUT ARGUMENTS:                                                  */
/*        _(FLOAT64[])signal:input frame.                    */
/*        _(INT16   )Vad    :VAD of current frame.            */
/*        _(FLOAT64  )lag   :sub-frame lag value.             */
/*        _(FLOAT64  )refl  :first reflection coefficient   */
/*                             analysis.                    */
/*        _(FLOAT64[])lsf:curent frame LSF coefficients.     */
/*-----------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
/*        _(FLOAT64[])pitch_corr:pitch correlation values.  */
/*        _(FLOAT64 *)speech_mode:smoothing mode(1/0).        */
/*---------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*             _None.                                     */
/*---------------------------------------*/
/*RETURN ARGUMENTS:                                                */
/*             _None.                                     */
/*============================*/
Void SMO_initial_analysis(FLOAT64 signal[],INT16 Vad,

                FLOAT64 lag,FLOAT64 refl,INT16*speech_mode,

                FLOAT64*pitch_corr,INT16 l_sf)

     {

     /*-------------------------------------------*/

     INT16  i,j;

     INT16  lag1,lag2,start;

     INT16  cond1,cond2,cond3,cond4;

     FLOAT64 max,max_mes,val,energy; 

     FLOAT64 cp1,cp2,cp,SNR_max,alpha_speech;
				
				<dp n="d717"/>
FLOAT64 deci_max_mes,deci_ma_cp;
FLOAT64 update_max_mes;
FLOAT64 update_ma_cp_speech;
FLOAT64 max_group[MAX_GRP_SIZE],min_max,end_max;
FLOAT64 y,yx,slope,sum;
FLOAT64 val1,val2,val3;
/*-------------------------------------------------*/
/*    Update counter for consecutive non-speech subframes       */
/*-------------------------------------------------*/
if(Vad==0)

     {

     /*--------------------------------------------*/

     /*           Counts to max 2 frames(8 subframes)           */

     /*--------------------------------------------*/

     if(consec_vad_0<8)

         consec_vad_0++;

     }
else

     consec_vad_0=0;
/*-------------------------------------------------*/
/*     Estimate speech to noise ratio for adaptation of thresholds  */
/*-------------------------------------------------*/
if(updates_noise>=20 &amp;&amp; updates_speech>=20)

    {

    SNR_max=ma_max_speech/(ma_max_noise+EPSI);

    SNR_max=(SNR_max>32.0?32.0:SNR_max);

    }
else

    SNR_max=3.5;
if(SNR_max<1.75 &amp;&amp; ADAPT_THRESHOLDS)

    {

    deci_max_mes=1.30;

    deci_ma_cp=0.70;

    update_max_mes=1.10;

    update_ma_cp_speech=0.72;
				
				<dp n="d718"/>
    }
else if(SNR_max<2.5&amp;&amp;ADAPT_THRESHOLDS)

    {

    deci_max_mes=1.65;

    deci_ma_cp=0.73;

    update_max_mes=1.30;

    update_ma_cp_speech=0.72;

    }
else

    {

    /*-------------------------------------------*/

    /*        Start-up and non-adaptive thresholds     */

    /*-------------------------------------------*/

    deci_max_mes=1.75;

    deci_ma_cp      =0.77;

    update_max_mes=1.30;

    update_ma_cp_speech=0.77;

    }
/*------------------------------------------------*/
/*                Update signal buffer                   */
/*------------------------------------------------*/
for(i=0;i<HI_LAG2;i++)

    buffer_smo[i]=buffer_smo[i+l_sf];
for(i=0;i<1_sf;i++)

    buffer_p[i]=signal[i];
/*--------------------------------------------------------*/
/*           Calculate pitch correlation of the speech signal       */
/*--------------------------------------------------------*/
energy=0.0;
for(i=0;i<1_sf;i++)

    energy+=(INT16)buffer_p[i]*(INT16)buffer_p[i];
				
				<dp n="d719"/>
lag1=(INI16)lag;
if(lag1==HI_LAG2)

     lag2=lag1-1;
else

     lag2=lag1+1;
if(energy==0.0)

     cp=0.0;
else

    {

    dot_dvector(buffer_p,buffer_p-lag1,    &amp;val1,0,l_sf-1);

    dot_dvector(buffer_p,buffer_p,         &amp;val2,0,l_sf-1);

    dot_dvector(buffer_p-lag1,buffer_p-lag1,&amp;val3,0,l_sf-1);

    cp1=val1/(sqrt(val2*val3)+EPSI);

    dot_dvector(buffer_p,bufffer_p-lag2,   &amp;val1,0,l_sf-1);

    dot_dvector(buffer_p,buffer_p,         &amp;val2,0,l_sf-1);

    dot_dvector(buffer_p-lag2,buffer_p-lag2,&amp;val3,0,l_sf-1);

    cp2=val1/(sqrt(val2*val3)+EPSI);

    cp=(cp1>cp2)?cp1:cp2;

    }
ma_cp=0.9*ma_cp+0.1*cp;
/*-------------------------------------------------*/
/*                 Find the max in pitch period                */
/*-------------------------------------------------*/
start=(lag2>l_sf)?(l_sf-lag2):0;
sum=0.0;
max=-MAXFLT;
for(i=start;i<l_sf;i++)

    {

    val=(buffer_p[i]>0.0)?buffer_p[i]:-buffer_p[i];

    /*-------------------------------------------*/
				
				<dp n="d720"/>
    /*                  Mean Update                          */

    /*------------------------------------------------*/

    sum+=val;

    /*------------------------------------------------*/

    /*                  Max Update                           */

    /*------------------------------------------------*/

    if(val>max)

        max=val;

    }
max_mes =max/(rna_max_noise+EPSI);
/*----------------------------------------------------*/
/*                Update buffer of maxima                    */
/*----------------------------------------------------*/
for(i=0;i<SMO_BUFF_SIZE-1;i++)

    {

    buffer_max_smo[i]=buffer_max_smo[i+1];

    buffer_sun_smo[i]=buffer_sum_smo[i+1];

    }
buffer_sum_smo[SMO_BUFF_SIZE-1]=sum;
buffer_max_smo[SMO_BUFF_SIZE-1]=max;
/*----------------------------------------------------*/
/*     Find sum excluding current subframe,and max in groups of    */
/*                         3 subframes                           */
/*----------------------------------------------------*/
sum=0.0;
for(i=0;i<MAX_GRP_SIZE;i++)

    {

    max_group[i]=buffer_max_smo[3*i];

    for(j=1;j<3;j++)

        {

        /*--------------------------------------------*/

        /*                    sum Update                         */
				
				<dp n="d721"/>
    /*--------------------------------------*/

    if(3*i+j<SMO_BUFF_SIZE-1)

        sum+=buffer_sum_smo[3*i+j];

    /*--------------------------------------*/

    /*               Update subgroup max             */

    /*--------------------------------------*/

    if(buffer_max_smo[3*i+j]>max_group[i])

              max_group[i]=buffer_max_smo[3*i+j];

    }
  }
/*-----------------------------------------------*/
sum*=1.7857e-03;
/*-----------------------------------------------*/
/*           Find minimum among first 4 subgroups    */
/*-----------------------------------------------*/
min max=max_group[0];
for(i=1;i<MAX_GRP_SIZE-1;i++)

    {

    if(max_group[i]<min_max)

             min_max=max_group[i];

    }
/*--------------------------------------------------*/
/*          Extract the maximum of last subgroup          */
/*--------------------------------------------------*/
end_max=max_group[MAX_GRP_SIZE-1];
/*--------------------------------------------------*/
/*       Find slope of MSE linear fit to the 5 maximums    */
/*--------------------------------------------------*/
yx=0.0;
y=0.0;
				
				<dp n="d722"/>
for(i=0;i<MAX_GRP_SIZE;i++)

    {

    yx+=(FLOAT64)i*max_group[i];

    y +=max_group[i];

    }
slope=0.1*(yx-2.0*y);
/*----------------------------------------*/
/*                  Classify subframe              */
/*----------------------------------------*/
if(((max_mes<deci_max_mes &amp;&amp; ma_cp<deci_ma_cp)‖(Vad==0)))

     *speech_mode=0;
else

     *speech_mode=1;
/*------------------------------------------------*/
/*  Measure consecutive low level(compared to noise)subframes   */
/*------------------------------------------------*/
if(updates_noise==21 &amp;&amp; max_mes<=0.3)

     {

     if(consec_low<HL_COUNT_MAX)

          consec_low++;

     }
else

     consec_low=0;
/*-------------------------------------------------------*/
/*      Reset noise update if significant decrease compared to    */
/*                       the noise level                         */
/*-------------------------------------------------------*/
if(consec_low==HL_COUNT_MAX)

     {

     updates_noise=0;

     lev_reset=-1;

     }
/*---------------------------------------------------*/
/*  Measure consecutive stationary high level(compared to noise)  */
				
				<dp n="d723"/>
/*                 subframes likely to be noise          */
/*----------------------------------------------*/
if((updates_noise>=20‖lev_reset==-1)&amp;&amp; max_mes>1.5 &amp;&amp;

     ma_cp<0.70 &amp;&amp; cp<0.85 &amp;&amp; refl<-0.40 &amp;&amp;

        end_max<50.0*min_max &amp;&amp; max<35.0*sum &amp;&amp; slope>-100.0 &amp;&amp;

            slope<120.0)

            {

            if(consec_high<HL_COUNT_MAX)

                 consec_high++;

            }
else

    consec_high=0;
/*-------------------------------------------------------*/
/*       Reset noise update if significant stationary increase     */
/*           in noise level subframes likely to be noise           */
/*-----------------------------------------------------*/
if((consec_high==HL_COUNT_MAX)&amp;&amp;(end_max<6.0*min_max)&amp;&amp;

         (max<5.0*sum))

     {

     updates_noise=20;

     lev_reset=1;

     }
/*-----------------------------------------------------*/
/*                 Update of noise max                      */
/*-----------------------------------------------------*/
/*-----------------------------------------------------*/
/*                1.condition:regular update                */
/*-----------------------------------------------------*/
condl=((max_mes<update_max_mes)&amp;&amp;(ma_cp<0.60)&amp;&amp;

        (cp<0.65)&amp;&amp;(max_mes>0.3));
/*-----------------------------------------------------*/
/*            2.condition:vad conditioned update            */
/*-----------------------------------------------------*/
				
				<dp n="d724"/>
  cond2=(consec_vad_0==8);
  /*----------------------------------------*/
  /*            3.condition:start-up/reset update             */
  /*----------------------------------------*/
  cond3=(updates_noise<=20 &amp;&amp; ma_cp<0.70 &amp;&amp; cp<0.75 &amp;&amp;

        refl<-0.40 &amp;&amp; end_max<5.0*min_max &amp;&amp;

             (lev_reset!=-1‖(lev_reset==-1 &amp;&amp; max_mes<2.0)));
/*----------------------------------------------*/
/*                4.condition:pitch correlation               */
/*----------------------------------------------*/
cond4    =(ma_cp>update_ma_cp_speech);
if(calls==3 &amp;&amp;(cond1‖cond2‖cond3))

      {

      /*-------------------------------------------*/

      /*        Update moving average of noise maximum        */

      /*-------------------------------------------*/

      ma_max_noise=0.9*ma_max_noise+0.1*max;

      if(updates_noise<=20)

          updates_noise++;

      else

          lev_reset=0;

      /*-------------------------------------------*/

      }
/*-------------------------------------------------*/
/*                    Update of speech max                    */
/*-------------------------------------------------*/
else if(calls=3 &amp;&amp; cond4)

     {

     /*------------------------------------------*/

     /*        Update moving average of speech maximum        */

     /*------------------------------------------*/
				
				<dp n="d725"/>
    if(updates_speech<=60)

        alpha_speech=0.95;

    else

        alpha_speech=0.999;

    ma_max_speech=alpha_speech*ma_max_speech+

                                          (1.0-alpha_speech)*max;

    if(updates_speech<=60)

             updates_speech++;

    /*-------------------------------------*/

    }
  /*---------------------------------------*/
  if(calls<3)

       calls++;.
  pitch_corr[0]=cp;
  pitch_corr[1]=ma_cp;
  /*---------------------------------------*/
  return;
  /*---------------------------------------*/
  }
/*-----------------------------------------*/
/*====================*/
/*---------------------END-----------------*/
/*====================*/
				
				<dp n="d726"/>
/*============================*/
/*===========================*/
/*Conexant System Inc.                                        */
/*4311 Jamboree Road                                           */
/*Newport Beach,CA 92660                                        */
/*-----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                         */
/*-----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*=========================================================================*/
/*PROTOTYPE FILE:lib_smo.h                                           */
/*=========================================================================*/
/*------------------------------------------------*/
/*-------------------FUNCTIONS-----------------------*/
/*------------------------------------------------*/
void SMO_init_lib        (void);
void SMO_lsf_smooth_est            (INT16,INT16,FLOAT64,FLOAT64[],FLOAT64[]);
void SMO_initial_analysis   (FLOAT64[],INT16,FLOAT64,FLOAT64,INT16*,

                                                  FLOAT64*,INT16);
void SMO_refined_analysis   (FLOAT64*,INT16,FLOAT64*,INT16*,FLOAT64*,

                                                  INT16);
/*===========================================================================*/
/*--------------------------END---------------------*/
/*===========================================================================*/
				
				<dp n="d727"/>
/*==========================*/
/*==========================*/
/*Conexant System Inc.                                 */
/*4311 Jamboree Road                                    */
/*Newport Beach,CA 92660                                 */
/*---------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                  */
/*---------------------------------------------------*/
/*ALL RIGHTS RESERVED;                                                 */
/*No part of this software may be reproduced in any form orby any   */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*============================================================================*/
/*LIBRARY:lib_snr.c                                                */
/*============================================================================*/
/*-------------------------------------------------------------*/
/*--------------------------INCLUDE-------------------------------*/
/*-------------------------------------------------------------*/
#include"typedef.h"
#include"main.h"
#include"const.h"
#include"gputil.h"
#include"ext_var.h"
#include"lib_snr.h"
#ifdef DIAGNOSTICS
#include"lib_dia.h"
#endif
/*--------------------------------------------------------*/
/*-------------------FUNCTIONS------------------------------*/
/*--------------------------------------------------------*/
				
				<dp n="d728"/>
/*=========================*/
/*FUNCTION    :  SNR_Calc_NSR_dec().                                 */
/*------------------------------------------------*/
/*PURPOSE    :   This function performs the initialisation of    */
/*           the global variables of the SNR library            */
/*------------------------------------------------*/
/*INPUT ARGUMENTS:                                                   */
/*             _None.                                            */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                  */
/*             _None.                                            */
/*------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                            */
/*             _None.                                            */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:                                                  */
/*             _None.                                            */
/*===========================*/
void SNR_init_lib(void)

     {

     /*-------------------------------------------*/

     NoiseGainFactor=1.0;

     /*-------------------------------------------*/

     /*                      SNR_Calc_NSR_enc                */

     /*-------------------------------------------*/

     NoisEng_enc=-1.0;

     snr_frm_count=0;

     snr_count_vad=0;

     eng_m_eno=0.0;

     diff_lsf_m_enc=0.0;

     diff_eng_m_enc=0.0;

     n_nois_ext_enc=0;

     /*--------------------------------------------*/

     return;
				
				<dp n="d729"/>
    /*------------------------------------------*/

    }
/*----------------------------------------------*/
/*=====================*/
/*FUNCTION    :SNR_Calc_NSR_enc().                                   */
/*--------------------------------------------*/
/*PURPOSE    : This function performs the SNR estimation at         */
/*           the encoder                                           */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                                  */
/*         _(FLOAT64[])syn:      synthetized signal.         */
/*         _(FLOAT64[])lsfq:    quntised LSF vector          */
/*         _(INT16   )Vad:      vad information.             */
/*         _(INT16   )fame_class:input frame fame_class.     */
/*         _(INT16   )l_frm:     frame size.                 */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                            */
/*        _(FLOAT64  *)NSR:     estimated NSR at the encoder  */
/*-------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                      */
/*              _None.                                   */
/*-------------------------------------------*/
/*RETURN ARGUMENTS:                                            */
/*              _None.                                   */
/*=====================*/
void SNR_Calc_NSR_enc(FLOAT64 syn[],FLOAT64 lsfq[],INT16 Vad,

                      INT16 frame class,FLOAT64*NSR,INT16 l_frm)

     {

     /*-------------------------------------------*/

     FLOAT64 snr,eng,diff_lsf,diff_eng,vall,val2;

     INT16i,vad_nsr;

     /*-------------------------------------------*/

     if(frame_class<3)

          n_nois_ext_enc++;

     else
				
				<dp n="d730"/>
        n_nois_ext_enc=0;

    if(Vad==0)

        snr_count_vad++;

    else

        snr_count_vad=0;

    dot_dvector(syn,syn,&amp;eng,0,l_frm-1);

    /*----------------------------------------------*/

    if(snr_frm_count==0)

         {

         (*NSR)=0.0;

          vad_nsr=1;

          eng_m_enc=eng;

          }

    else

          {

          /*----------------------------------------*/

         diff_lsf=0;

         for(i=0;i<NP;i++)

             diff_lsf+=fabs(lsfq[i]-lsfq_mem_enc[i]);

        diff_lsf*=100;

        diff_lsf_m_enc=diff_lsf_m_enc*0.75+diff_lsf*0.25;

        /*-----------------------------------------*/

        diff_eng=fabs(eng-eng_old_enc)/MAX(eng+eng_old_enc,50*l_frm);

        diff_eng_m_enc=diff_eng_m_enc*0.75+diff_eng*0.25;

        /*----------------------------------------*/

        snr=eng/MAX(eng_m_enc,0.1);

        if(Vad=0)

            {

            if(eng_m_enc<0.1)

                eng_m_enc=eng;

            else

                eng_m_enc=0.75*eng_m_enc+0.25*eng;
				
				<dp n="d731"/>
       }

    /*---------------------------------------*/

    vad_nsr=1;

    if((snr_count_vad>15)&amp;&amp;(snr_count_vad<30)&amp;&amp;

              (diff_lsf_m_enc<10)&amp;&amp;(diff_lsf<10)&amp;&amp;

                    (diff_eng_m_enc<0.25)&amp;&amp;(diff_eng<0.25)&amp;&amp;

                    (snr<10))

                        vad_nsr=0;

    else

        {

        if(((snr_count_vad>15)‖(snr_frm_count<100))&amp;&amp;

                  (n_nois_ext_enc>10)&amp;&amp;(diff_lsf_m_enc<7)&amp;&amp;

                  (diff_lsf<7)&amp;&amp;(diff_eng_m_enc<0.2)&amp;&amp;

                     (diff_eng<0.2)&amp;&amp;(snr<8))

                          vad_nsr=0;

        }

    /*---------------------------------------*/

    if((NoisEng_enc<0.0)&amp;&amp;(snr_frm_count>500))

         vad_nsr=Vad;

    /*---------------------------------------*/

    if(vad_nsr==0)

         {

         if(NoisEng_enc<0.0)

         NoisEng_enc=eng;

    else

         NoisEng_enc=NoisEng_enc*0.85+eng*0.15;

         NoisEng_enc=MIN(NoisEng_enc,eng);

         }

    /*---------------------------------------*/

    val1=MAX(NoisEng_enc-100*l_frm,0);

    val2=MAX(eng,0.1);

    (*NSR)=MIN(sqrt(val1/val2),1.0);
				
				<dp n="d732"/>
        /*----------------------------------------*/

        }

    /*--------------------------------------------*/

    snr_frm_count=MIN(snr_frm_count+1,1000);

    for(i=0;i<NP;i++)

        lsfq_mem_enc[i]=lsfq[i];

    eng_old_enc=eng;

    /*--------------------------------------------*/

    return;

    /*--------------------------------------------*/

    }
/*------------------------------------------------*/
/*=======================*/
/*---------------------END------------------------*/
/*=======================*/
				
				<dp n="d733"/>
  /*========================*/
  /*========================*/
  /*Conexant System Inc.                                    */
  /*4311 Jamboree Road                                       */
  /*Newport Beach,CA 92660                                    */
  /*----------------------------------------------------*/
  /*Copyright(C)2000 Conexant System Inc.                     */
  /*----------------------------------------------------*/
  /*ALL RIGHTS RESERVED:                                                */
  /*No part of this software may be reproduced in any form orby any   */
  /*means or used to make any derivative work(such as transformation */
  /*or adaptation)without the authorisation of Conexant System Inc. */
  /*=========================================================================*/ 
  /*PROTOTYPE FILE:lib_snr.h                                        */
  /*=========================================================================*/
  /*----------------------------------------------*/
  /*--------------------FUNCTINS------------------------*/
  /*----------------------------------------------*/
  void SNR_init_lib(void);
  void SNR_Calc_NSR_enc(FLOAT64[],FLOAT64[],INT16,INT16,FLOAT64*,INT16);
  /*========================*/
  /*----------------------END----------------------*/
  /*=======================*/
				
				<dp n="d734"/>
/*================================*/
/*=============================*/
/*Conexant System Inc.                                            */
/*4311 Jamboree Road                                               */
/*Newport Beach,CA 92660                                           */
/*-----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                             */
/*-----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                   */
/*No part of this software may be reproduced in any form or by any    */
/*means or used to make any derivative work(such as transformation   */
/*or adaptation)without the authorisation of Conexant System Inc.   */
/*==========================*/
/*LIBRARY:lib_swb.c                                                  */
/*==========================*/
/*---------------------------------------------------------*/
/*----------------------------INCLUDE---------------------------*/
/*---------------------------------------------------------*/
#include"typedef.h"
#include"main.h"
#include"lib_swb.h"
/*--------------------------------------------*/
/*--------------------FUNCTIONS----------------------*/
/*--------------------------------------------*/
/*======================*/
/*FUNCTION  :byte_swap_int16().                               */
/*--------------------------------------------*/
/*PURPOSE  :Byte swap a 16 bit integer number.               */
/*--------------------------------------------*/
/*INPUT ARGUMENTS:                                            */
/*         _(INT16  )input:    data to be swapped.         */
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                           */
/*           _None                                         */
/*--------------------------------------------*/
				
				<dp n="d735"/>
  /* INPUT/OUTPUT ARGUMENTS:                             */
  /*               _None                            */
  /*---------------------------------------*/
  /*RETURN ARGUMENTS:                                    */
  /*       _(INT16  )output:data to be swapped.       */
  /*======================*/
  INT16   byte_swap_int16(INT16 input)

      {

      /*------------------------------------------*/

      INT16 output;

      /*------------------------------------------*/

      output=(input>>8&amp;0x00ff)^(input<<8);

      /*------------------------------------------*/

      return output;

      /*------------------------------------------*/

      }
  /*----------------------------------------------*/
  /*======================*/
  /*FUNCTION  :byte_swap_int32().                                     */
  /*----------------------------------------------*/
  /*PURPOSE  :Byte swap a 32 bit integer point number.              */
  /*         Verified for swapping between SGI Unix and PC Linux.   */
  /*------------------------------------------------*/
  /*INPUT ARGUMENTS:                                                   */
  /*         _(INT32  )input:  data to be swapped.                 */
  /*------------------------------------------------*/
  /*OUTPUT ARGUMENTS:                                                  */
  /*            _None                                               */
  /*------------------------------------------------*/
  /*INPUT/OUTPUT ARGUMENTS:                                            */
  /*             _None                                              */
  /*------------------------------------------------*/
  /*RETURN ARGUMENTS:                                               */
				
				<dp n="d736"/>
/*       _(INT32)output:swapped data.                        */
/*=========================*/
INT32 byte_swap_mt32(INT32 input)

    {

    /*--------------------------------------------*/

    INT16 i;

    INT32 output;

    /*--------------------------------------------*/

    for(i=0;i<4;i++)

        *((char*)(&amp;output)+i)=*((char*)(&amp;input)+3-i);

    /*--------------------------------------------*/

    return output;

    /*--------------------------------------------*/

    }
/*------------------------------------------------*/
/*=======================*/
/*FUNCTION  :byte_swap_int64().                                  */
/*------------------------------------------------*/
/*PURPOSE  :Byte swap a 64 bit integer point number.            */
/*         Verified for swapping between SGI Unix andPC Linux. */
/*------------------------------------------------*/
/*INPUT ARGUM[ENTS:                                              */
/*        _(INT64  )input:   data to be swapped.              */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                              */
/*            _None                                           */
/*------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                        */
/*             _None                                          */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:                                              */
/*       _(INT64  )output:  swapped data.                       */
/*============================================================================*/
				
				<dp n="d737"/>
INT64  byte_swap_mt64(INT64 input)

    {

    /*--------------------------------------------*/

    INT16 i;

    INT64 output;

    /*--------------------------------------------*/

    for(i=0;i<8;i++)

        *((char*)(&amp;output+i)=*((char*)(&amp;input)+3-i);

    /*-------------------------------------------*/

    return output;

    /*-------------------------------------------*/

    }
/*-----------------------------------------------*/
/*=======================*/
/*FUNCTION :byte_swap_float32().                                */
/*-----------------------------------------------*/
/*PURPOSE  :Byte swap a 32 bit floating point number.          */
/*         Verified for swapping between SGI Unix and PC Linux.*/
/*-----------------------------------------------*/
/*INPUT ARGUMENTS:                                                */
/*        _(FLOAT32  *)input:  data to be swapped.              */
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*        _(FLOAT32  *)output:  swapped data.                   */
/*-----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS;                                          */
/*             _None                                           */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS;                                              */
/*             _None.                                          */
/*=======================*/
void byte_swap_float32(FLOAT32*input,FLOAT32*output)
				
				<dp n="d738"/>
    {

    /*---------------------------------------------------*/

    INT16 i;

    /*---------------------------------------------------*/

    for(i=0;i<4;i++)

        *((char*)(output)+i)=*((char*)(input)+3-i);

    /*---------------------------------------------------*/

    return;

    /*---------------------------------------------------*/

    }
/*-------------------------------------------------------*/
/*===========================*/
/*FUNCTION  :byte_swap_float64().                                 */
/*------------------------------------------------*/
/*PURPOSE  :Byte swap a 64 bit floating point number.            */
/*         Verified for swapping between SGI Urix and PC Linux. */
/*------------------------------------------------*/
/*INPUT ARGUMENTS  :                                               */
/*        _(FLOAT64  )input:  data to be swapped.               */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                */
/*        _(FLOAT64  )output:  swapped data.                    */
/*------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                          */
/*              _None                                           */
/*------------------------------------------------*/
/*RETURN ARGUMENTS:                                                 */
/*            _None.                                            */
/*=======================*/
void byte_swap_float64(FLOAT64*input,FLOAT64*output)

     {    

     /*-------------------------------------------*/
				
				<dp n="d739"/>
    INT16 i;

    /*-------------------------------------------*/

    for(i=0;i<8;i++)

        *((char*)(output)+i)=*((char*)(input)+7-i);

    /*-------------------------------------------*/

    return;

    /*-------------------------------------------*/

    }
/*-----------------------------------------------*/
/*=======================*/
/*----------------------------END----------------*/
/*======================*/
				
				<dp n="d740"/>
/*=========================*/
/*======================*/
/*Conexant System Inc.                                                */
/*4311 Jamboree Road                                                   */
/*Newport Beach,CA 92660                                                */
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                                 */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                    */
/*No part of this software may be reproduced in any form or by any     */
/*means or used to make any derivative work(such as transformation    */
/*or adaptation)without the authorisation of Conexant System Inc.    */
/*==========================*/
/*PROTOYPE FILE:lib_swb.h                                              */
/*==========================*/
/*-----------------------------------------------------------*/
/*-------------------FUNCTIONS------------------------------------*/
/*-----------------------------------------------------------*/
INT16  byte_swap_int16(INT16);
INT32  byte_swap_int32(INT32);
INT64  byte_swap_int64(INT64);
void byte_swap_float32(FLOAT32*,FLOAT32*);
void byte_swap_float64(FLOAT64*,FLOAT64*);
/*===========================*/
/*------------------------END---------------------*/
/*==========================*/
				
				<dp n="d741"/>
 /*============================*/
 /*===========================*/
 /*Conexant System Inc.                                                */
 /*4311 Jamboree Road                                                   */
 /*Newport Beach,CA 92660                                               */
 /*----------------------------------------------------*/
 /*Copyight(C)2000 Conexant System Inc.                                 */
 /*----------------------------------------------------*/
 /*ALL RIGHTS RESERVED:                                                */
 /*No part of this software may be reproduced in any form or by any   */
 /*means or used to make any derivative work(such as transformation */
 /*or adaptation)without the authorisation of Conexant System Inc.  */
 /*==============================*/
 /*LIBRARY:lib_vad.c                                                 */
 /*============================*/
 /*---------------------------------------------------------*/
 /*-------------------------INCLUDE------------------------------*/
 /*---------------------------------------------------------*/
 #include"typedef.h"
 #include"main.h"
 #innclude"const.h"
 #include"gputil.h"
 #include"mcutil.h"
 #include"ext_var.h"
 #include"lib_lpc.h"
 #include"lib_vad.h"
 /*--------------------------------------------------------*/
 /*---------------------FUNCTIONS-------------------------------*/
 /*--------------------------------------------------------*/
 /*===========================*/
 /*FUNCTION    :VAD_init_lib().                                 */
 /*-------------------------------------------------*/
 /*PURPOSE    :  This function performs initialisation of the  */
 /*           global variables of the VAD library.            */
				
				<dp n="d742"/>
/*---------------------------------------------------*/
/*INPUT ARGUMENTS  :                                          */
/*            _None.                                       */
/*---------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                           */
/*            _None.                                       */
/*---------------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                     */
/*             _None.                                      */
/*---------------------------------------------------*/
/*RETURN ARGUMENTS:                                           */
/*            _None.                                       */
/*========================*/
void VAD_init_lib(void)

     {

     /*----------------------------------------------*/

     INT16  i,j;

     /*----------------------------------------------*/

     ini_svector(lag_buf,    0,LTP_BUFF_SIZE-1,20);

     ini_dvector(pgain_buf,0,LTP_BUFF_SIZE-1,0.7);

     /*----------------------------------------------*/

     Vad    =1;

     ini_svector(flag_vad_mem,0,1,1);

     /*----------------------------------------------*/

     flag=1;

     count_sil=0;

     count_ext=0;

     dec3_flg_mem=0;

     pitch_gain_mean=0.5;

     for(i=0;i<VAD_MEM_SIZE;i++)
				
				<dp n="d743"/>
        for(j=1;j<NP;j++)

            vad_lsf_mem[i][j]=vad_lsf_mem[i][j-1]+0.05;

    min_energy=MAX_ENERGY;

    mean_energy=0.0;

    mean_max=0;

    mean_s_energy=0.0;

    ini_dvector(prev_cml_lsf_dif,0,VAD_MEM_SIZE-1,0.0);

    ini_dvector(prev_energy,     0,VAD_MEM_SIZE-1,0.0);

    snr=0.0;

    onset_flg=0;

    count_onset=0;

    count_noise=0;

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
/*========================*/
/*FUNCTION    :VAD_voice_detection().                              */
/*---------------------------------------------*/
/*PURPOSE    :  This function performs Voice Activity Detection.  */
/*-----------------------------------------------*/
/*INPUT ARGUMENTS:                                                  */
/*       _(FLOAT64[])x:       input frame.                         */
/*       _(FLOAT64[])rc:      reflection coefffcients.           */
/*       _(FLOAT64  )pderr:   energy of residual.                  */
/*       _(INT16  [])lag_mem: history ofpitch lag.               */
/*       _(FLOAT64[])pitch_gain_mem:history ofpitch gain.          */
/*       _(FLOAT64[])lsf:   lsf vector.                          */
/*       _(FLOAT64[])rxx:   autocorrelation coefficients.         */
/*       _(INT64  )frm_count:frame counter.                       */
/*       _(INT16  )flag_vad_mem_1:past vad decision(n-1).         */
/*       _(INT16  )flag_vad_mem 2:past vad decision(n-2).         */
				
				<dp n="d744"/>
/*--------------------------------------------*/
/*OUTPUT ARGUMENTS:                                               */
/*      _(INT16  *)flag_vad:vad decision.                       */
/*--------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                         */
/*             _None.                                           */
/*--------------------------------------------*/
/*RETURN ARGUMENTS:                                               */
/*            _None.                                            */
/*=====================*/
void VAD_voice_detection(FLOAT64 x[],FLOAT64 rc[],FLOAT64 pderr,

              INT16 lag_mem[],FLOAT64 pitch_gain_mem[],

              FLOAT64 lsf[],FLOAT64 rxx[],INT64 frm_count,

              INT16*flag_vad,INT16 flag_vad_mem[])

    {

    /*----------------------------------------------*/

    FLOAT64 pitch_gain_avg;

    INT16 decision;

    INT16i;

    INT16 pflag,pflag1,pflag2;

    INT16 dec3_flg;

    FLOAT64 lags_std;

    FLOAT64 max_frame,val;

    FLOAT64 w1,w2;

    FLOAT64 norm_energy;

    FLOAT64 nnorm_energy;

    FLOAT64*sum2_p,*sum2_a,*temp;

    FLOAT64 norm_cml_lsf_diff;

    FLOAT64 spd;

    FLOAT64 vad_partial_lpc_gain,vad_lpc_gain;

    FLOAT64 nthrs;

    FLOAT64 cml_lsf_diff=0.0;

    FLOAT64*suml_lsf,*sum2_lsf;

    /*----------------------------------------------*/

    /*                Memory allocation                   */

    /*----------------------------------------------*/
				
				<dp n="d745"/>
suml_lsf=dvector(0,NP-1);
sum2_lsf=dvector(0,NP-1);
/*-------------------------------------------*/
   decision=NOISE;
dec3_flg=0;
max_frame=-(FLOAT64)INT_MAX;
for(i=0;i<L_FRM;i++)

    {

    val=fabs(x[i]);

    if(val>max_frame)

         max_frame=val;

    }
/*-------------------------------------------*/
/*           Calculate the oder VAD_NP prediction error         */
/*-------------------------------------------*/
vad_partial_lpc_gain=1.0;
for(i=0;i<VAD_LPC_ORDER;i++)

     vad_partial_lpc_gain*=(1.0-rc[i]*rc[i]);

     vad_lpc_gain=vad_partial_lpc_gain;

     for(i=VAD_LPC_ORDER;i<NP;i++)

         vad_lpc_gain*=(1.0-sqr(rc[i]));

     vad_lpc_gain=-10.0*log10(vad_lpc_gain+EPSI);
/*-------------------------------------------------------*/
/*           Calculate the average prediction gain and the lag    */
/*                         standard deviation                     */
/*-------------------------------------------------------*/
VAD_mean_std_calc(lag_mem,pitch_gain_mem,&amp;lags_std,&amp;pitch_gain_avg);
pitch_gain_mean=0.8*pitch_gain_mean+0.2*pitch_gain_avg;
				
				<dp n="d746"/>
/*---------------------------------------------*/
/*              Set-up the classification flags           */
/*---------------------------------------------*/
if(pitch_gain_mean>0.7)
   pflag2=1;
else
   pflag2=0;
if((lags_std<1.30)&amp;&amp;(pitch_gain_mean>0.45))

    pflag1=1;
else

    pflag1=0;
pflag=(flag_vad_mem[0]‖pflag2)&amp;&amp;pflag1;
/*----------------------------------------------*/
/*               Calculate the signals energies           */
/*----------------------------------------------*/
val=rxx[0]/(FLOAT64)L_LPC;
norm_energy=10.0*log10(vad_partial_lpc_gain*val+EpSI);
norm_energy=MAX(0.0,norm_energy);
nnorm_energy=10.0*log10(val+EPSI);
nnorm_energy=MAX(10.0,nuorm_energy);
/*----------------------------------------------------*/
/*        Calculate the weighted sum of lsf coefficeints         */
/*----------------------------------------------------*/
add_dvector(lsf,        &amp;vad_lsf_mem[0][0],suml_lsf,0,NP-1);
add_dvector(suml_lsf,&amp;vad_lsf_mem[1][0],suml_lsf,0,NP-1);
wad_dvector(suml_lsf,0.25,&amp;vad_lsf_mem[2][0],0.25,suml_lsf,

                                                       0,NP-1);
add_dvector(&amp;vad_lsf_mem[0][0],&amp;vad_lsf_mem[1][0],sum2_lsf,

                                                       0,NP-1);
				
				<dp n="d747"/>
wad_dvector(sum2_lsf,0.3333,&amp;vad_lsf_mem[2][0],0.3333,sum2_lsf,

                                                      0,NP-1);
/*----------------------------------------------*/
/*                 min_energyimum energies tracking                */
/*----------------------------------------------*/
if(frm_count<65)

    {

    if(norm_energy<min_energy)

       {

        min_energy   =nomm_energy;

        prev_rmin_energy=norm_energy;

        }

    if((frm_count%VAD_MIN_MEM_SIZE)==0)

        {

        i=frm_count/VAD_MIN_MEM_SIZE-1;

        min_energy_mem[i]=min_energy;

        min_energy     =MAX_ENERGY;

        }

    }
if((frm_count%VAD_MIN_MEM_SIZE)==0)

    {

    prev_min_energy=min_energy_mem[0];

    for(i=1;i<VAD_MIN_MEM_SIZE;i++)

        {

        if(min_energy_mem[i]<prev_min_energy)

             prev_min_energy=min_energy_mem[i];

        }

    }
if(frm_count>=65)

    {

    if((frm_count%VAD_MIN_MEM_SIZE)==1)

        {

         min_energy=prev_min_energy;

         next_min_energy=MAX_ENERGY;
				
				<dp n="d748"/>
        }

    if(norm_energy<min_energy)

        min_energy=norm_energy;

    if(norm_energy<next_min_energy)

       next_min_energy=norm_energy;

    if(frm_count%VAD_MIN_MEM_SIZE)==0)

       {

    for(i=0;i<VAD_MIN_MEM_SIZE-1;i++)

        min_energy_mem[i]=min_energy_mem[i+1];

    min_energy_mem[VAD_MIN_MEM_SIZE-1]=next_min_energy;

    prev_min_energy=min_energy_mem[0];

    for(i=1;i<VAD_MIN_MEM_SIZE;i++)

       {

       if(min_energy_mem[i]<prev_ min_energy)

           prev_min_energy=min_energy_mem[i];

       }

     }
   }
/*---------------------------------------------*/
/*         First INIT_FRAME frames parameters calculation        */
/*---------------------------------------------*/
if(frm_count<=INIT_FRAME)

    {

    if(pflag==0&amp;&amp;

              (((max_frame/mean_max<12.0)&amp;&amp;(nnorm_energy<=30.0)&amp;&amp;

                (nnom_energy-norm_enegyy<9.0)&amp;&amp;

                ((rc[0]<-0.55&amp;&amp;vad_lpc_gain<5.0)‖

                (vad_lpc_gain)<2.75))‖(nnorm_energy<=10.0)‖

                ((nnorm_energy<=25.0)&amp;&amp;((rc[0]<-0.55&amp;&amp;

                vad_lpc_gain<5.0)‖(vad_lpc_gain)<2.75)&amp;&amp;

                (max_frame/mean_max<1 2.0))))

    decision=NOISE;
  else
				
				<dp n="d749"/>
       decision=VOICE;

    mean_energy=(mean_energy*((FLOAT64)(frm_count-1))+

                        norm_energy)/(FLOAT64)(frm_count);

    mean_max=(mean_max*((FLOAT64)(frm_count-1))+

                       max_frame)/(FLOAT64)(frm_count);

    w1=(FLOAT64)(frm_count-1);

    w2=1.0;

    wad_dvector(mear_lsf,w1,lsf,w2,mean_lsf,0,NP-1);

    w1=1.0/(FLOAT64)frm_count;

    sca_dvector(mean_lsf,w1,mean_lsf,0,NP-1);

    cpy_dvector(mean_lsf,norm_mean_lsf,0,NP-1);

    }
/*----------------------------------------------*/
/*       First INIT FRAME frames fmal VAD flag set-up           */
/*----------------------------------------------*/
(*flag_vad)=decision;
/*----------------------------------------------*/
/*                   Parameters calculation                      */
/*----------------------------------------------*/
if(frm_count>=INIT_FRAME)

     {

     if(frm_count==INIT_FRAME)

         mean_s_energy=MAX(mean_energy-12.0,0.0);

     /*-------------------------------------*/

     /*         Spectral Distortion Calculation                 */

     /*-------------------------------------*/

     sum2_p  =dvector(0,NP-1);

     sum2_a  =dvector(0,NP);

     temp    =dvector(0,NP-1);
				
				<dp n="d750"/>
/*-------------------------------------------*/
LPC_sftop(sum2_lsf,sum2_p,NP);
LPC_ptoa (sum2_p,sum2_a,NP);
/*-------------------------------------------*/
VAD_itakura_saito(rxx,sum2_a,&amp;spd,NP);
spd/=(EPSI+pderr);
/*-------------------------------------------*/
dif_dvector(lsf,norm_mean_lsf,temp,0,NP-1);
dot_dvector(temp,temp,&amp;norm_cml_lsf_diff,0,NP-1);
dif_dvector(sum1_lsf,mean_lsf,temp,0,NP-1);
dot_dvector(temp,temp,&amp;cml_lsf_diff,0,NP-1);
/*-----------------------------------------*/
free_dvector(sum2_p,0,NP-1);
free_dvector(sum2_a,   0,NP);
free_dvector(temp,     0,NP-1);
/*------------------------------------------*/
if((frm_count==INIT_FRAME)‖((prev_cml_lsf_diff[0]<0.5e-4)

                                        &amp;&amp;(cml_lsf_diff>0.1 e-3)))

         cml_lsf_diff_filt=cml_lsf_diff;
else

         cml_lsf_diff_filt=0.4*cml_lsf_diff+

                                              0.6*cml_lsf_diff_fiilt;
/*-------------------------------------------*/
dec3_flg=0;
/*-------------------------------------------*/
				
				<dp n="d751"/>
if(snr<=5.0)

    nthrs=3.0;
else if(snr<=10.0)

     nthrs=4.7;
else

     nthrs=5.5;
/*---------------------------------------*/
if(pflag==1&amp;&amp;nnorm_energy>10.0)

    decision=VOICE;
else if((norm_energy>=mean_s_energy+6.5)‖

              (cml_lsf_diff>1000.0e-6))

         {

      decision=VOICE;

      count_ext=0;

      }
else if((norm_energy-mean_s_energy)<nthrs)

     decision=NOISE;
else

     {

     decision=VOICE;

     dec3_flg=1;

     count_ext  =0;

     }
/*------------------------------------------*/
if(snr<=5.0)

    onset_trhsd=6.0;
else if(snr<=10.0)

     onset_trhsd=8.0;
else

     onset_trhsd=10.0;
/*------------------------------------------*/

    if((nnorm_energy>0.5*(prev_energy[1]+prev_energy[0])+

         onset_trhsd)‖((nnorm_energy>35.0)&amp;&amp;

         ((spd>2.5)‖(norm_cml_lsf_diff>0.008)‖

         (norm_energy-mean_s_energy>10.0)))){

         onset_flg=1;
				
				<dp n="d752"/>
         tlag=1;

    }

    else {

      if(nnorm_energy<=10.0){

        onset_flg=0;

      }

    }

    if(onset_flg){

       count_onset++;

    }

    if(count_onset==4){

       onset_flg=0;

       count_onset=0;

       count_ext=4;

     }
/*---------------------------------------*/

    if(onset_flg==0&amp;&amp;pflag==0&amp;&amp;

       (((max_frame/mean_max<12.0)&amp;&amp;(nnorm_energy<=30.0)

       &amp;&amp;(nnorm_energy-norm_energy<9.0)&amp;&amp;

       ((rc[0]<-0.55&amp;&amp;vad_lpc_gain<5.0)‖

       (vad_lpc_gain)<2.75))‖(nnorm_energy<=10.0)

       ‖((nnorm_energy<=25.0)&amp;&amp;((rc[0]<-0.55&amp;&amp;

       vad_lpc_gain<5.0)‖(vad_lpc_gain)<2.75)&amp;&amp;

       (max_frame/mean_max<12.0))))

       {

       decision=NOISE;

       flag=0;

           }

    else

        {

    if((prev_energy[0]-nnorm_energy>10.0)&amp;&amp;

          (nnorm_energy<20.0)&amp;&amp;(max_frame/mean_max<12.0))

        {

       decision=NOISE;

       flag=0;

       }
   else
   {

       if(frm_count<=65)
				
				<dp n="d753"/>
           decision=VOICE;

     }

    }

    if(pflag==0&amp;&amp;count_noise>8&amp;&amp;(nnorm_energy<30.0)&amp;&amp;

       (max_frame/mean_max<15.0)&amp;&amp;

       (norm_energy-mean_s_energy<6.5))

    {

    decision=NOISE;

    frag=0;

    }

    else

        {

    if(pflag==0&amp;&amp;count_noise>4&amp;&amp;cml_lsf_diff<900.0e-6

          &amp;&amp;(norm_cml_lsf_diff<3500.0e-6)&amp;&amp;(onset_flg==0)

          &amp;&amp;(max_frame/mean_max<15.0)&amp;&amp;

         (norm_energy-mean_s_energy<6.0))

         {

           decision=NOISE;

           flag=0;

         }

    else if((nnorm_energy>25.0)&amp;&amp;(flag_vad_mem[1]==VOICE)&amp;&amp;

              (flag_vad_mem[0]==VOICE)&amp;&amp;(decision==NOISE)&amp;&amp;

              (norm_cml_lsf_diff>4000.0e-6))

                 decision=VOICE;

    }
/*-----------------------------------------*/

    if(decision==NOISE)

        count_noise++;

    else

        count_noise=0;
/*-----------------------------------------*/
if((norm_cml_lsf_diff>0.0003)&amp;&amp;

    (nnorm_energy-prev_energy[2]<-12.0))

    count_ext=4;
/*-----------------------------------------*/
				
				<dp n="d754"/>
    if(flag==1)

         {

         /*--------------------------------*/

              if(((nnorm_energy>25.0)&amp;&amp;

                   (flag_vad_mem[1]==VOICE)&amp;&amp;

                   (flag_vad_mem[0]==VOICE)&amp;&amp;

                   (decision==NOISE))‖(onset_flg))

                   {

                   count_ext++;

                   decision=VOICE;

                   if(count_ext<=26-0&amp;&amp;snr<=0.0)

                      flag=1;

                   else if(count_ext<=22-0&amp;&amp;snr<=5.0)

                      flag=1;

                   else if(count_ext<=20-0-0&amp;&amp;snr<=6.5)

                      flag=1;

                   else if(count_ext<=16-0-2&amp;&amp;snr<=8.0)

                      flag=1;

                   else if(count_ext<=14-2-2&amp;&amp;snr<=11.0)

                      flag=1;

                   else if(count_ext<=10-2-2&amp;&amp;snr<=14.0)

                      flag=1;

                   else if(count_ext<=8-2-2&amp;&amp;snr<=17.0)

                      flag=1;

                   else if(count_ext<=3&amp;&amp;snr<=21.0)

                      flag=1;

                   else if(count_ext<=1&amp;&amp;snr>21.0)

                      flag=1;

                  else

                      {

                      flag=0;

                      count ext=0;

                      }

                   }

      /*-------------------------------------*/

      }
  else

      {
				
				<dp n="d755"/>
    flag=1;

    count_ext=0;

    }
/*-------------------------------------------------------------------*/
if(decision=NOISE)
   count_ext=0;
/*-------------------------------------------------------------------*/
/*              Compute mean_energy            */
/*-------------------------------------------------------------------*/
if(norm_energy>min_energy+12.0)

    mean_energy=0.9*mean_energy+0.1*norm_energy;
/*-------------------------------------------------------------------*/
/*                    Compute snr                                             */
/*-------------------------------------------------------------------*/
snr=mean_energy-mean_s_energy;
/*-------------------------------------------------------------------*/
/*               Compute the new mean_s_energy                                */
/*-------------------------------------------------------------------*/
if(((norm_energy<MAX(mean_s_energy,min_energy)+3.5)

                                   &amp;&amp;(!pflag))‖decision==NOISE)

     {

     mean_max=MAX(EPSI,0.95*mean_max+(1.0-0.95)*max_frame);

     count_sil++;

     if(count_sil<INIT_COUNT)

         {

         w1=0.75;

         w2=0.60;

         }

     else if(count_sil<INIT_COUNT+10)

         {

         w1=0.85;
				
				<dp n="d756"/>
           w2=0.65;

           }

    else if(count_sil<INIT_COUNT+20)

          {

          w1=0.85;

          w2=0.65;

          }

    else

         {

         w1=0.65;

         w2=0.65;

         }

    wad_dvector(mean_lsf,w2,lsf,(1.0-w2),mean_lsf,

                                                0,NP-1);

    if(nnorm_energy>18.0)

         mean_s_energy=w1*mean_s_energy+

                     (1.0-w1)*norm_energy;

    mean_s_energy=MAX(mean_s_energy,0.0);

    }
/*-------------------------------------------*/
wad_dvector(norm_mean_lsf,0.85,lsf,(1.0-0.85),

                                       norm_mean_lsf,0,NP-1);
/*--------------------------------------------*/
/*        Current frames final VAD flag set-up           */
/*--------------------------------------------*/
(*flag_vad)=decision;
/*--------------------------------------------*/
if((frm_count>64)&amp;&amp;(mear_s_energy+10.0<min_energy)&amp;&amp;

                                                   (!pflag))

     {

        mean_s_energy=MAX(0.5*(min_energy+mean_s_energy),0.0);

        mean_s_energy=0.75*mean_s_energy+

                             0.25*min_energy;

        mean_s_energy=MAX(mean_s_energy,0.0);
				
				<dp n="d757"/>
         count_sil=0;

         }

    else if((frm_count>64)&amp;&amp;(mean_s_energy>min_energy+4.0))

         {

         mean_s_energy=MAX(min_energy,0.0);

         count_sil=0;

         }

       /*---------------------------------------*/

       }

    /*----------------------------------------------------*/

    /*     Save parameters for the processing of the next frame     */

    /*----------------------------------------------------*/

    sfr_dvector(prev_energy,prev_energy,1,0,VAD_MEM_SIZE-1);

    prev_energy[0]=nnorm_energy;

    sfr_dvector(prev_cml_lsf_diff,prev_cml_lsf_diff,1,0,VAD_MEM_SIZE-1);

    prev_cml_lsf_diff[0]=cml_lsf_diff;

    cpy_dvector(vad_lsf_mem[1],vad_lsf_mem[2],0,NP-1);

    cpy_dvector(vad_lsf_mem[0],vad_lsf_mem[1],0,NP-1);

    cpy_dvector(lsf,                vad_lsf_mem[0],0,NP-1);

    dec3_flg_mem=dec3_flg;

    /*---------------------------------------------*/

    free_dvector(sum1_lsf,0,NP-1);

    free_dvector(sum2_lsf,0,NP-1);

    /*---------------------------------------------*/

    return;

    /*---------------------------------------------*/

    }
/*-------------------------------------------------*/
				
				<dp n="d758"/>
/*===========================================================================*/
/*FUNCTION    :  VAD_itakura_saito().                            */
/*---------------------------------------------------*/
/*PURPOSE     :  This function calculate the Itakura Saito       */
/*            distance.                                         */
/*---------------------------------------------------*/
/*INPUT ARGUMENTS:                                                   */
/*  _(FLOAT64 [])r  :input signal autocorrelation.              */
/*  _(FLOAT64 [])a  :LPC filter coefficients.                    */
/*  _(INT16    )P   :filter order.                              */
/*---------------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                  */
/*  _(FLOAT64  *)isd:output Itakura Saito distance.              */
/*-----------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                            */
/*              _None.                                           */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS:  _None.                                          */
/*==============================================================================*/
void VAD_itakura_saito(FLOAT64 r[],FLOAT64 a[],FLOAT64*isd,INT16 P)

    {

    /*--------------------------------------------*/

    INT16  k,m;

    FLOAT64  sum;

    FLOAT64  r_a[20];

    /*-------------------------------------------*/

    for(k=0;k<=P;k++)

        {

        sum=0.0;

        for(m=0;m<=P-k;m++)

            sum=sum+a[m]*a[m+k];

        r_a[k]=sum;

        }

    /*-------------------------------------------*/

    sum=0.0;
				
				<dp n="d759"/>
    for(m=1;m<=P;m++)

        sum=sum+r[m]*r_a[m];

    /*----------------------------------------------------*/

    (*isd)=(r[0]*r_a[0]+2*sum);

    /*----------------------------------------------------*/

    return;

    /*----------------------------------------------------*/

    }
/*--------------------------------------------------------*/
/*===========================*/
/*FUNCTION    :  VAD_mean_std_calc().                            */
/*------------------------------------------------*/
/*PURPOSE     :  This function calculate average prediction     */
/*            gain and the lag standard deviation              */
/*------------------------------------------------*/
/*INPUT ARGUMENTS:                                                */
/*       _(INT16  [])lags_mem:        history of pitch lag.     */
/*       _(FLOAT64[])pitch_gain_mem:history of pitch gain.        */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS:                                                     */
/*       _(FLOAT64  *)l_std:       lag standard deviation.        */
/*       _(FLOAT64  *)pg_mean:       average prediction gain.        */
/*------------------------------------------*/
/*INPUT/OUTPUT ARGUMENTS:                                               */
/*              _None.                                            */
/*------------------------------------------*/
/*RETURN ARGUMENTS;                                                     */
/*             _None.                                              */
/*=====================*/
void VAD_mean_std_calc   (INT16 lags_mem[],FLOAT64 pitch_gain_mem[],

                                            FLOAT64*l_std,FLOAT64*pg_mean)

     {

    /*--------------------------------------------*/
				
				<dp n="d760"/>
    INT16  i;

    FLOAT64 val,sum1,sum2;

    /*--------------------------------------------*/

    sum1=0.0;

    sum2=0.0;

    for(i=0;i<LTP_BUFF_SIZE;i++)

        {

        sum1+=(FLOAT64)lags_mem[i];

        sum2+=pitch_gain_mem[i];

        }

    /*---------------------------------------------*/

    sum1=sum1/(FLOAT64)LTP_BUFF_SIZE;

    /*---------------------------------------------*/

    (*pg_mean)=sum2/(FLOAT64)LTP_BUFF_SIZE;

    /*---------------------------------------------*/

    (*l_std)=0.0;

    for(i=0;i<LTP_BUFF_SIZE;i++)

        {

        val      =(FLOAT64)lags_mem[i]-sum1;

        (*l_std) +=val*val;

         }

    (*l_std)=sqrt((*l_std)/(FLOAT64)(LTP_BUFF_SIZE-1));

    /*-------------------------------------------*/

    return;

    /*------------------------------------------*/

    }
/*----------------------------------------------*/
				
				<dp n="d761"/>
/*======================*/
/*---------------------END---------------------*/
/*=======================*/
				
				<dp n="d762"/>
/*=========================*/
/*=========================*/
/*Conexant System Inc.                                                  */
/*4311 Jamboree Road                                                     */
/*Newport Beach,CA 92660                                                  */
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                                  */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                         */
/*No part of this software may be reproduced in any form or by any      */
/*means or used to make any derivative work(such as transformation      */
/*or adaptation)without the authorisation of Conexant System Inc.       */
/*========================*/
/*PROTOTYPE FILE:lib_vad.h                                                */
/*=====================*/
/*-----------------------------------------------*/
/*-----------------FUNCTIONS---------------------------*/
/*-----------------------------------------------*/
void VAD_init_lib(void);
void VAD_voice_detection(FLOAT64[],FLOAT64[],FLOAT64,INT16[],FLOAT64*,

         FLOAT64[],FLOAT64[],INT64,INT16[],INT16[]);
void VAD_itakura_saito(FLOAT64[],FLOAT64[],FLOAT64*,INT16);
void VAD_mean_std_calc  (INT16[],FLOAT64[],FLOAT64*,FLOAT64*);
/*=========================*/
/*----------------------------END---------------*/
/*======================*/
				
				<dp n="d763"/>
/*==============================*/
/*==========================*/
/*Conexant System Inc.                                               */
/*4311 Jamboree Road                                                  */
/*Newport Beach,CA 92660                                               */
/*-----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                                */
/*-----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                      */
/*No part of this software may be reproduced in any form or by any   */
/*means or used to make any derivative work(such as transformation   */
/*or adaptation)without the authorisation of Conexant System Inc.   */
/*=======================*/
/*PROTOTYPE FILE:main.h                                                */
/*====================*/
/*----------------------------------------------------------*/
/*---------------------------INCLUDE----------------------------*/
/*----------------------------------------------------------*/
#include  <stdio.h>
#include  <stdlib.h>
#include  <math.h>
#include  <string.h>
#include  <malloc.h>
#include  <errno.h>
#include  <memory.h>
#include  <float.h>
#include  <limits.h>
/*-------------------------------------------------------*/
/*---------------------------DEFINE-------------------------*/
/*-------------------------------------------------------*/
#define nint(x)((x>=0)?(INT16)(x+0.5):(INT16)(x-0.5))
#define MAX_n(x,y)((x)>(y))?(x):(y)
#define MIN_n(x,y)((x)<(y))?(x):(y)
#define ABS_n(x)((x)<0)?(-x):(x)
				
				<dp n="d764"/>
/*---------------------------------------------------*/
/*--------------------------DEFINE-----------------------*/
/*---------------------------------------------------*/
#define    EXIT_FAILURE   1
#define    NB_MAX_CHAR      128
#define    NB_ALGO_MAX      100
#define    MAXSENTENCE      100
#define    NB_MAX_VEC       100
/*
#define pI    3.141592653589793115997963468544185161590576171875
#define TWO_PI  6.28318530717958623199592693708837032318115234375
*/
#define   PI 3.141592654
/*===========================*/
/*------------------------END--------------------*/
/*==========================*/
				
				<dp n="d765"/>
/*============================*/
/*==========================*/
/*Conexant System Inc.                                            */
/*4311 Jamboree Road                                               */
/*Newport Beach,CA 92660                                            */
/*-----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                             */
/*-----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                     */
/*No part of this software may be reproduced in any form or by any   */
/*means or used to make any derivative work(such as transformation   */
/*or adaptation)without the authorisation of Conexant System Inc.   */
/*======================*/
/*MAIN PROGRAM:main_dec.c                                             */
/*==========================*/
/*-----------------------------------------------------------*/
/*----------------------------INCLUDE---------------------------*/
/*-----------------------------------------------------------*/
#include"typedef.h"
#include"main.h"
#include"const.h"
#include"glb_var.h"
#include"mcutil.h"
#include"gputil.h"
#include"decoder.h"
#include"lib_io.h"
#include"lib_ini.h"
#include"lib_cpr.h"
#ifsef DIAG_SMV
#include"lib_dia.h"
#endif
				
				<dp n="d766"/>
/*===========================*/
/*---------------------------MAIN-------------------------*/
/*=========================*/
int main(int argc,char*argv[])
{

    /*--------------------------------------------------*/

    /*                      Pointers to I/O files             */

    /*--------------------------------------------------*/

    FILE  *fp_speech_out;

    FILE  *fp_bitstream;

    /*--------------------------------------------------*/

    /*                      I/O buffers                       */

    /*--------------------------------------------------*/

    FLOAT64 dec_sigout[L_FRM];

    INT16   i,switch_flag=1;

    INT16   *s_y;

    INT16   serial[PACKWDSNUM];

    /*--------------------------------------------------*/

    /*               Print copyright information                */

    /*--------------------------------------------------*/
#ifdef VERBOSE

     print_copyight();
#endif

    /*--------------------------------------------------*/

    /*           Check the number of input parameters             */

    /*--------------------------------------------------*/

    if(argc<3)

    {
#ifdef VERBOSE

         printf("\n%s bitstream_file decoded_speech_file\n\n",

                                                                  argv[0]);
				
				<dp n="d767"/>
  #endif

         exit(1);

         }

    /*----------------------------------------------------*/

    /*                 Open IO files                                */

    /*----------------------------------------------------*/

    fp_bitstream=file_open_rb(argv[1]);

    fp_speech_out=file_open_wb(argv[2]);

    if(argc==4)

          switch_flag=atoi(argv[3]);
  #ifdef VERBOSE

         printf("\nExecutable     :%s\n",argv[0]);

         printf("Input bitstream  :%s\n",argv[1]);

         printf("Output speech    :%s\n",argv[2]);
  #ifdef BYTE_SWAP_OUTPUT

         printf("Output is byte-swapped\n");
  #endif
  #endif
  #ifdef DIAGNOSTICS

    /*-----------------------------------------------------*/

    /*               Open DIAGNOSTICS files                        */

    /*-----------------------------------------------------*/

    DIA_dec_open_files();
  #endif

    /*-----------------------------------------------------*/

    /*                   Memory Allocation                         */
				
				<dp n="d768"/>
    /*----------------------------------------------*/

    s_y=svector(0,L_FRM-1);

    INI_allocate_memory();

    /*----------------------------------------------*/

    /*                  Algorithm Initialization              */

    /*----------------------------------------------*/

    INI_init_decoder();
/*==========================*/
/*¤¤¤¤¤¤¤¤¤¤¤SYNTHESIS PART¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*==========================*/

    while((i=fread(serial,sizeof(short),PACKWDSNUM,fp_bitstream))

             ==PACKWDSNUM)

         {

         frm_count++;
#ifdef VERBOSE

          printf("[%ld frame(s),%6.3fsec.]\r",frm_count,

                (FLOAT64)(frm_count*L_FRM)/(FLOAT64)FS);
#endif

      /*---------------------------------------------*/

      /*          Decoding Bitstream                          */

      /*---------------------------------------------*/

      dec_smv_frame(serial,dec_sigout,switch_flag);

      IO_writesamples(fp_speech_out,dec_sigout,s_y,L_FRM);

      }

    /*-------------------------------------------*/

    /*                 Memory Deallocation                   */

    /*-------------------------------------------*/
				
				<dp n="d769"/>
    free_svector(s_y,0,L_FRM-1);

    INI_deallocate_memory();

    /*----------------------------------------------*/

    /*                       Close IO files                */

    /*----------------------------------------------*/

    fclose(fp_bitstream);

    folose(fp_speech_out);
#ifdef DIAGNOSTICS

    /*----------------------------------------------*/

    /*                   Close DIAGNOSTICS files            */

    /*----------------------------------------------*/

    DIA_dec_close_files();
#endif

    printf("\n");

    /*----------------------------------------------*/

    return 0;

    /*----------------------------------------------*/

    }
/*--------------------------------------------------*/
/*=========================*/
/*---------------------------END--------------------------*/
/*=========================*/
				
				<dp n="d770"/>
/*==============================*/
/*==============================*/
/*Conexant System Inc.                                              */
/*4311 Jamboree Road                                                 */
/*Newport Beach,CA 92660                                              */
/*------------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                               */
/*------------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                      */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation    */
/*or adaptation)without the authorisation of Conexant System Inc.   */
/*==========================*/
/*MAIN PROGRAM:main_enc.c                                              */
/*==========================*/
/*---------------------------------------------------------*/
/*----------------------------INCLUDE---------------------------*/
/*---------------------------------------------------------*/
#include"typedef.h"
#include"main.h"
#include"const.h"
#include"glb_var.h"
#include"mcutil.h"
#include"gputil.h"
#include"encoder.h"
#include"lib_ini.h"
#include"lib_io.h"
#include"lib_cpr.h"
#include"lib_ppr.h"
#include"lib_sns.h"
#ifdef DIAG_SMV
#include"lib_dia.h"
#endif
				
				<dp n="d771"/>
/*===========================*/
/*----------------------------MAIN-----------------------*/
/*==========================*/
int main(int argc,char*argv[])

    {

    /*-------------------------------------------*/

    /*                      I/O Files                  */

    /*-------------------------------------------*/

    FILE*fp_speech_in;

    FILE*fp_bitstream;

    FILE*fp_signaling;

    FILE*fp_mode;

    /*-------------------------------------------*/

    /*                  Variables                        */

    /*-------------------------------------------*/

    FLOAT64*px;

    FLOAT64 avg_rate;
//  INT16   flat_flag=0;

    INT16   switch_flag=1;

    INT16   input_samples;

    char   signaling;

    INT16   VoicingClass=0;

    /*-------------------------------------------*/

    /*                    I/O buffers                    */

    /*-------------------------------------------*/

    FLOAT64*sig_in,*signn_buf,*sig_ppr,*sig_out;

    INT16  *sx,*s_y;

    INT16  *serial;

    /*-------------------------------------------*/

    /*              Print copyright information         */

    /*-------------------------------------------*/
				
				<dp n="d772"/>
#ifdef VERBOSE

    print_copyright();
#endif

    /*-----------------------------------------------*/

    /*              Parameters Set-up                       */

    /*-----------------------------------------------*/

    INI_parameters_setup(argc,argv,&amp;fp_speech_in,&amp;fp_bitstream,

                           &amp;fp_mode,&amp;fp_signaling,&amp;smv_mode);
#ifdef DIAG_SMV

    /*-----------------------------------------------*/

    /*               Open DIAGNOSTICS files                 */

    /*-----------------------------------------------*/

    DIA_enc_open_files  ();
#endif

    /*-----------------------------------------------*/

    /*                   Memory Allocation                  */

    /*-----------------------------------------------*/

    s_x=svector(0,L_FRM-1);

    s_y=svector(0,L_FRM-1);

    sig_in    =dvector(0,L_FRM-1);

    signn_buf      =dvector(0,L_FRM+ENH_DELAY-1);

    sig_ppr   =dvector(0,L_PP-1);

    sig_out   =dvector(0,L_FRM-1);

    serial=svector(0,PACKWDSNUM-1);

    INI_allocate_memory();

    /*-----------------------------------------------*/
				
				<dp n="d773"/>
/*                 Algorithm Initialization              */
/*-------------------------------------------*/
INI_init_encoder();
/*-------------------------------------------*/
/*                   Read the input signal               */
/*-------------------------------------------*/
px=sig_in+L_FRM-L_LPCLHD-ENH_DELAY;
IO_readsamples(fp_speech_in,s_x,px,L_LPCLHD+ENH_DELAY);
/*--------------------------------------------*/
/*    Silence enhancement of the Input signal frame     */
/*--------------------------------------------*/
PPR_silence_enhan(px,px,L_LPCLHD+ENH_DELAY);
/*--------------------------------------------*/
/*                   High pass filter at 80 Hz        */
/*--------------------------------------------*/
PPR_highpass(L_FRM,sig_in);
cpy_dvector(sig_in,signn_buf+ENH_DELAY,0,L_FRM-1);
/*--------------------------------------------*/
/*                Input Speech Enhancement            */
/*--------------------------------------------*/
SNS_modified_noise_suprs(VoicingClass,sig_in);
SNS_modified_noise_suprs(VoicingClass,sig_in+L_FRM/2);
cpy_dvector(sig_in+L_FRM-L_LPCLHD,sig_Ppr+L_PP-L_LPCLHD,0,L_LPCLHD-1);
/*------------------------------------*/
/*              Low pass filter for tilt compensation       */
/*------------------------------------*/
px=sig_ppr+L_PP-L_LPCLHD;
PPR_lowpass(px,(INT16)(L_LPCLHD),smv_mode,FlatSp_Flag);
				
				<dp n="d774"/>
/*==========================*/
/*¤¤¤¤¤¤¤¤¤ANALYSIS PART¤¤¤¤¤¤¤¤¤¤¤¤¤*/
/*===========================*/

    /*---------------------------------------*/

    input_samples=L_FRM;

    while(input_samples==L_FRM)

        {

        /*-----------------------------------*/

                frm_count++;

        /*-----------------------------------*/
#ifdef VERBOSE

         printf("[%ld frame(s),%6.3f sec.]\r",frm_count,

                                                 (FLOAT64)(frm_count*L_FRM)/FS);
#endif

         /*-----------------------------------------------------*/

         /*                     Reading the signaling information       */

         /*-----------------------------------------------------*/

         if(fp_signaling!=NULL)

             fread(&amp;signaling,sizeof(char),1,fp_signaling);

         else

             signaling=(char)0;

         /*--------------------------------------------*/

         /*                 Read the input signal             */

         /*--------------------------------------------*/

         input_samples=(INT16)IO_readsamples(fp_speech_in,s_x,sig_in,

                                                                  L_FRM);

         /*---------------------------------------------*/

         /*       Silence enhancement of the Input signal frame       */

         /*---------------------------------------------*/
				
				<dp n="d775"/>
    PPR_silence_enhan(sig_in,sig_in,input_samples);

    /*----------------------------------------------*/

    /*    Zero Padding if necessary for the last frame     */

    /*----------------------------------------------*/

    ini_dvector(sig_in,input_samples,L_FRM-1,0.0);

    PPR_highpass(L_FRM,sig_in);

    cpy_dvector(signn_buf+L_FRM,signn_buf,0,ENH_DELAY-1);

    cpy_dvector(sig_in,signn_buf+ENH_IDELAY,0,L_FRM-1);

    if(FlatSp_Flag==1)

              MIN_GAIN=-14.0;

    /*----------------------------------------*/

    /*              Input Speech Enhancement         */

    /*----------------------------------------*/

    SNS_modified_noise_suprs(VoicingClass,sig_in);

    SNS_modified_noise_suprs(VoicingClass,sig_in+L_FRM/2);

    /*----------------------------------------*/

    /*         Update the pre-processed speech buffer        */

    /*----------------------------------------*/

    cpy_dvector(sig_ppr+L_FRM,sig_ppr,   0,L_PP-L_FRM-1);

    cpy_dvector(sig_in,sig_ppr+L_PP-L_FRM,0,L_FRM-1);

    /*-----------------------------------------------*/

    /*            Low pass filter for tilt compensation          */

    /*-----------------------------------------------*/

    px=sig_ppr+L_PP-L_FRM;

    PPR_lowpass(px,L_FRM,smv_mode,FlatSp_Flag);
#ifdef SCRATCH_PAD_MEM

    ini_dvector(sig_in,0,L_FRM-1,-1.0);

    ini_dvector(signn_buf,0,L_FRM-1,-1.0);
				
				<dp n="d776"/>
#endif

         enc_smv_frame(sig_ppr,serial,sig_out,smv_mode,

                               switch_flag,&amp;FlatSp_Flag,signaling,

                                    &amp;avg_rate,&amp;VoicingClass);
#ifdef DIAG_SMV

         IO_writesamples(fdia_sp_enc,sig_out,s_y,L_FRM);
#endif

         fwrite(serial,sizeof(short),PACKWDSNUM,fp_bitstream);

         }

    /*-----------------------------------------------*/

    /*                     Print the Average bit rate      */

    /*-----------------------------------------------*/

    printf("\n\t\t\taverage_rate=%f\n",avg_rate);

    /*-----------------------------------------------*/

    /*                       Memory Deallocation             */

    /*-----------------------------------------------*/

    free_svector(s_x,0,L_FRM-1);

    free_svector(s_y,0,L_FRM-1);

    free_dvector(sig_in,       0,L_FRM-1);

    free_dvector(signn_buf,0,L_FRM+ENH_DELAY-1);

    free_dvector(sig_ppr,      0,L_PP-1);

    free_dvector(sig_out,      0,L_FRM-1);

    free_svector(serial,0,PACKWDSNUM-1);

    INI_deallocate_memory();

    /*-----------------------------------------------*/

    /*                    Close IO files                        */
				
				<dp n="d777"/>
    /*-------------------------------------------*/

    fclose(fp_speech_in);

    fclose(fp_bitstream);

    if(fp_signaling!=NULL)

        fclose(fp_signaling);
#ifdef DIAG_SMV

    /*-------------------------------------------*/

    /*          Close DIAGNOSTICS files                */

    /*-------------------------------------------*/

    DIA_enc_close_files();
#endif

    /*-------------------------------------------*/
#ifdef VERBOSE

    printf("\n");
#endif

    /*-------------------------------------------*/

    return 0;

    /*-------------------------------------------*/

    }
/*-----------------------------------------------*/
/*========================*/
/*-----------------------END--------------------------*/
/*=======================*/
				
				<dp n="d778"/>
/*=========================*/
/*=========================*/
/*Conexant System Inc.                                            */
/*4311 Jamboree Road                                               */
/*Newport Beach,CA 92660                                           */
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                              */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                          */
/*No part of this software may be reproduced in any form or by any    */
/*means or used to make any derivative work(such as transformation     */
/*oradaptation)without the authorisation of Conexant System Inc.       */
/*==========================*/
/*LIBRARY:mcutil.c                                                        */
/*=========================*/
/*----------------------------------------------------*/
/*-------------------------INCLUDE------------------------*/
/*----------------------------------------------------*/
#include"typedef.h"
#include<malloc.h>
#include<stdio.h>
#include<stdlib.h>
/*----------------------------------------------------*/
/*------------------FUNCTIONS-------------------------------*/
/*----------------------------------------------------*/
/*==========================*/
/*FUNCTIONS  :  nrerror  ()                                 */
/*-------------------------------------------*/
/*PURPOSE    :  Standard error handler.                     */
/*-------------------------------------------*/
/*INPUT ARGUMENTS  :  _(char*)error_text:output string.         */
/*-------------------------------------------*/
/*OUTPUT ARGUMENTS :  _None.                                          */
/*-------------------------------------------*/
/*RETURN ARGUMENTS :  _None.                                          */
/*==========================*/
				
				<dp n="d779"/>
  void nrerror(char error_text[])
  {

       fprintf(stderr,"Run-time error...\n");

       fprintf(stderr,"%s\n",error_text);

       fprintf(stderr,"...now exiting to system...\n");

       exit(1);
  }
  /*-------------------------------------------------------*/
  /*========================*/
  /*FUNCTIONS    :    vector()                                    */
  /*---------------------------------------------*/
  /*PURPOSE     :  Allocate a float vector with subscript range  */
  /*             v[nl,....,nh].                                */
  /*---------------------------------------------*/
  /*INPUT ARGUMENTS  :   _(INT32)nh.                              */
  /*            _(INT32)nh.                                    */
  /*---------------------------------------------*/
  /*OUTPUT ARGUMENTS:    _None.                                    */
  /*---------------------------------------------*/
  /*RETURN ARGUMENTS:_(FLOAT32*):pointer to the allocated vector.*/
  /*=====================*/
  FLOAT32*vector(INT32 nl,INT32 nh)
  {

    FLOAT32 *v;

    v=(FLOAT32*)calloc((unsigned)(nh-nl+1),sizeof(FLOAT32));

    if(!v)nrerror("allocation failure in vector()");

    return v-nl;
}
/*-----------------------------------------------------*/
/*========================*/
/*FUNCTIONS    :    svector()                                      */
/*-----------------------------------------------*/
/*PURPOSE     :     Allocate a short vector with subscript range  */
/*             v[nl,...,nh].                                 */
/*---------------------------------------------------*/
				
				<dp n="d780"/>
/*INPUT ARGUMENTS  :   _(INT32)nl.                                */
/*             _(INT32)nh.                                      */
/*----------------------------------------*/
/*OUTPUT ARGUMENTS :   _None.                                     */
/*----------------------------------------*/
/*RETURN ARGUMENTS :   _(INT16*):pointer to the allocated vector. */
/*=========================*/
INT16*svector(INT32 nl,INT32 nh)
{

    INT16*v;

    v=(INT16*)calloc((unsigned)(nh-nl+1),sizeof(INT16));

    if(!v)nrerror("allocation failure in svector()");

    return v-nl;
}
/*-----------------------------------------------------*/
/*=========================*/
/*FUNCTIONS    :    ivector  ()                                 */
/*------------------------------------------------*/
/*PURPOSE      :     Allocate an int vector with subscript range  */
/*             v[nl,...,nh].                                    */
/*------------------------------------------------*/
/*INPUT ARGUMENTS  :   _(INT32)nl.                                      */
/*              _(INT32)nh.                                        */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS :   _None.                                           */
/*------------------------------------------------*/
/*RETURN ARGUMENTS :   _(INT32*):pointer to the allocated vector.  */
/*======================*/
INT32*ivector(INT32 nl,INT32 nh)
{

    INT32*v;

    v=(INT32*)calloc((unsigned)(nh-nl+1),sizeof(INT32));

    if(!v)nrerror("auocation failure in ivector()");

    return v-nl:
}
				
				<dp n="d781"/>
/*------------------------------------------------------*/
/*==========================*/
/*FUNCTIONS    :    lvector()                                     */
/*-------------------------------------------------*/
/*PURPOSE      :     Allocate a long vector with subscript range  */
/*             v[nl,...,nh].                                  */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS  :   _(INT32)nl.                                */
/*             _(INT32)nh.                                      */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS :   _None.                                      */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS :   _(INT64*):pointer to the allocated vector.  */
/*=========================*/
INT64*lvector(INT32 nl,INT32 nh)
{

    INT64*v;

    v=(INT64*)calloc((unsigned)(nh-nl+1),sizeof(INT64));

    if(!v)nrerror("allocation failure in lvector()");

    return v-nl;
  }
  /*--------------------------------------------------*/
  /*========================*/
  /*FUNCTIONS    :  dvector()                                          */
  /*-----------------------------------------------*/
  /*PURPOSE      :  Allocate a double vector with subscript range      */
  /*             v[nl,...,nh].                                    */
  /*----------------------------------------------*/
  /*INPUT ARGUMENTS  :    _(INT32)nl.                                  */
  /*             _(INT32)nh.                                      */
  /*----------------------------------------------*/
  /*OUTPUT ARGUMENTS :    _None.                                       */
  /*----------------------------------------------*/
  /*RETURN ARGUMENTS  :    _(FLOAT64*):pointer to the allocated vector. */
  /*=========================*/
  FLOAT64*dvector(INT32 nl,INT32 nh)
				
				<dp n="d782"/>
{

    FLOAT64*v;

    v=(FLOAT64*)calloc((unsigned)(nh-nl+1),slzeof(FLOAT64));

    if(!v)nrerror("allocation failure in dvector()");

    return v-nl;
}
/*-----------------------------------------------------*/
/*========================*/
/*FUNCTIONS    :    matrix  ()                                       */
/*-------------------------------------------------*/
/*PURPOSE      :    Allocate a float matrix with subscript range    */
/*             m[nrl,...,nrh][ncl,...,nch].                    */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS  :  _(INT32)nrl(low row).                            */
/*              _(INT32)nrh(high row).                              */
/*              _(INT32)ncl(low column).                            */
/*              _(INT32)nch(high column).                           */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS :  _None.                                          */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS :  _(FLOAT32**):pointer to the allocated           */
/*                        matrix.                        */
/*=========================*/
FLOAT32**matrix(INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch)
{

    INT32 i;

    FLOAT32 **m;

    m=(FLOAT32**)calloc((unsigned)(nrh-nrl+1),sizeof(FLOAT32*));

    if(!m)nrerror("allocation failure 1 in matrix()");

    m-=nrl;

    for(i=nrl;i<=nrh;i++){

          m[i]=(FLOAT32*)calloc((unsigned)(nch-ncl+1),sizeof(FLOAT32));

          if(!m[i])nrerror("allocation failure 2 in matrix()");

          m[i]-=ncl;

    }

    return m;
				
				<dp n="d783"/>
 }
 /*------------------------------------------------------*/
 /*=========================*/
 /*FUNCTIONS    :    smatrix  ()                                   */
 /*------------------------------------------------*/
 /*PURPOSE      :    Allocate a short matrix with subscript range  */
 /*             m[nrl,...,nrh][ncl,...,nch].                 */
 /*------------------------------------------------*/
 /*INPUT ARGUMENTS  :    _(INT32)nrl(low row).                           */
 /*             _(INT32)nrh(high row).                              */
 /*             _(INT32)ncl(low column).                            */
 /*             _(INT32)nch(high column).                           */
 /*------------------------------------------------*/
 /*OUTPUT ARGUMENTS :  _None.                                            */
 /*------------------------------------------------*/
 /*RETURN ARGUMENTS :  _(INT16**):pointer to the allocated matrix.       */
 /*========================*/
 INT16**smatrix(INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch)
 {

    INT32 i;

    INT16 **m;

    m=(INT16 **)calloc((unsigned)(nrh-nrl+1),sizeof(INT16*));

    if(!m)nrerror("allocation failure 1 in smatrix()");

    m-=nrl;

    for(i=nrl;i<=nrh;i++){

          m[i]==(INT16*)calloc((unsigned)(nch-ncl+1),sizeof(INT16));

          if(!m[i])nrerror("allocation failure 2 in smatrix()");

          m[i]-=ncl;

    }

    return m;
}
/*---------------------------------------------------------*/
/*===========================*/
/*FUNCTIONS    :  dmatrix  ()                                             */
/*---------------------------------------------*/
				
				<dp n="d784"/>
/*PURPOSE    :    Allocate a double matrix with subscript range */
/*           m[nrl,...,nrh][ncl,...,nch].                   */
/*----------------------------------------------*/
/*INPUT ARGUMENTS  :  _(INT32)nrl(low row).                        */
/*             _(INT32)nrh(high row).                       */
/*             _(INT32)ncl(low column).                     */
/*             _(INT32)nch(high column).                    */
/*----------------------------------------------*/
/*OUTPUT ARGUMENTS :  _None.                                       */
/*----------------------------------------------*/
/*RETURN ARGUMENTS :  _(FLOAT64**):pointer to the allocated       */
/*                        matrix.                        */
/*==========================*/
FLOAT64 **dmatrix(INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch)
{

    INT32 i;

    FLOAT64**m;

    m=(FLOAT64**)calloc((unsigned)(nrh-nrl+1),sizeof(FLOAT64*));

    if(!m)nrerror("allocation failure 1 in dmatrix()");

    m-=nrl;

    for(i=nrl;i<=nrh;i++){

          m[i]=(FLOAT64 *)calloc((un5igned)(nch-ncl+1),sizeof(FLOAT64));

          if(!m[i])nrerror("allocation failure 2 in dmatrix()");

          m[i]-=ncl;

    }

    return m;
}
/*------------------------------------------------------*/
/*=========================*/
/*FUNCTIONS    :    imatrix  ()                                   */
/*-----------------------------------------------*/
/*PURPOSE      :     Allocate an int matrix with subscript range  */
/*             m[nrl,...,nrh][ncl,...,nch].                   */
/*-----------------------------------------------*/
/*INPUT ARGUMENTS  :    _(INT32)nrl(low row).                          */
/*                _(INT32)nrh(highrow).                            */
/*                _(INT32)ncl(low columnn).                         */
				
				<dp n="d785"/>
/*               _(INT32)nch(high column).                       */
/*-----------------------------------------*/
/*OUTPUT ARGUMENTS :  _None.                                        */
/*-----------------------------------------*/
/*RETURN ARGUMENTS :  _(INT32**):pointer to the allocated matrix.   */
/*===========================*/
INT32**imatrix(INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch)
{

    INT32 i,**m;

    m=(INT32**)calloc((unsigned)(nrh-nrl+1),sizeof(INT32*));

    if(!m)nrerror("allocation failure 1 in imatrix()");

    m-=nrl;

    for(i=nrl;i<=nrh;i++){

          m[i]=(INT32 *)calloc((unsigned)(nch-ncl+1),sizeof(INT32));

          if(!m[i])nrerror("allocation failure 2 in imatrix()");

          m[i]-=ncl;

    }

    return m;
  }
/*----------------------------------------------------------*/
/*==========================*/
/*FUNCTIONS    :  submatrix()                                        */
/*----------------------------------------------*/
/*PURPOSE     :   Allocate a float matrix with subscript range     */
/*            m[nrl,...,nrh][ncl,...,nch].                  */
/*----------------------------------------------*/
/*INPUT ARGUMENTS :  _(INT32)nrl(low row).                         */
/*              _(INT32)nrh(high row).                         */
/*              _(INT32)ncl(low column).                       */
/*              _(INT32)nch(high column).                      */
/*----------------------------------------------*/
/*OUTPUT ARGUMENTS :  _None.                                         */
/*----------------------------------------------*/
/*RETURN ARGUMENTS :  _(FLOAT32**):pointer to the allocated          */
/*                         matrix.                      */
/*=======================*/
				
				<dp n="d786"/>
FLOAT32**submatrix(FLOAT32**a,INT32 oldrl,INT32 oldrh,INT32 oldcl,\

                         INT32 newrl,INT32 newcl)
{

    INT32 i,j;

    FLOAT32**m;

    m=(FLOAT32**)calloc((unsigned)(oldrh-oldrl+1),sizeof(FLOAT32*));

    if(!m)nrerror("allocation failure in submatrix()");

    m-=newrl;

    for(i=oldrl,=newrl;i<=oldrh;i++,j++)m[j]=a[i]+oldcl-newcl;

    return m;
}
/*--------------------------------------------------------*/
/*===========================*/
/*FUNCTIONS    :  s3tensor()                                     */
/*-----------------------------------------------*/
/*PURPOSE     :   Allocate a short ternsor with subscript range */
/*            t[nrl,...,nrh][ncl,...,nch][ndl,...,ndh]. */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS :   _(INT32)nrl.                                 */
/*             _(INT32)nrh.                                  */
/*             _(INT32)ncl.                                  */ 
/*             _(INT32)nch.                                  */
/*             _(INT32)ndl.                                  */
/*             _(INT32)ndh.                                  */
/*----------------------------------------*/
/*OUTPUT ARGUMENTS  :   _None.                                  */
/*----------------------------------------*/
/*RETURN ARGUMENTS  :   _(INT16***):pointer to the allocated tensor. */
/*=========================*/
INT16***s3tensor(INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch,INT32 ndl,INT32 ndh)
{

    INT32 i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1;

    INT16***t;

    t=(INT16***)calloc((uisigned)(nrow+1),sizeof(INT16**));

    if(!t)nrerror("allocation failure 1 in s3tensor()");
				
				<dp n="d787"/>
    t+=1;

    t-=nrl;

    t[nrl]=(INT16**)calloc((unsigned)(nrow*ncol+1),sizeof(INT16*));

    if(!t[nrl])nrerror("allocation failure 2 in s3tensor()");

    t[nrl]+=1;

    t[nrl]-=ncl;

    t[nrl][ncl]=(INT16*)calloc((unsigned)(nrow*ncol*ndep+1),sizeof(INT16));

    if(!t[nrl][ncl])nrerror("allocation failure 3 in s3tensor()");

    t[nrl][ncl]+=1;

    t[nrl][ncl]-=ndl;

    for(j=ncl+1;j<=nch;j++)t[nrl][j]=t[nrl][j-1]+ndep;

    for(i=nrl+1;i<=nrh;i++){

          t[i]=t[i-1]+ncol;

          t[i][ncl]=t[i-1][ncl]+ncol*ndep;

          for(j=ncl+1;j<=nch;j++)t[i][j]=t[i][j-1]+ndep;

    }

    return t;
  }
  /*--------------------------------------------------*/
  /*=========================*/
  /*FUNCTIONS  :  i3tensor()                                       */
  /*--------------------------------------------*/
  /*PURPOSE    :  Allocate an int tensor with subscript range     */
  /*           t[nrl,...,nrh][ncl,...,nch][ndl,...,ndh].  */
  /*-------------------------------------------------*/
  /*INPUT ARGUMENTS :  _(INT32)nrl.                                  */
  /*              _(INT32)nrh.                                */
  /*              _(INT32)ncl.                                */
  /*              _(INT32)nch.                                */
  /*              _(INT32)ndl.                                */
  /*              _(INT32)ndh.                                */
  /*---------------------------------------------*/
  /*OUTPUT ARGUMENTS :  _None.                                    */
  /*-------------------------------------------*/
  /*RETURN ARGUMENTS :  _(INT32***):pointer to the allocated     */
  /*                       tensor.                         */
				
				<dp n="d788"/>
/*===========================*/
INT32***i3tensor(INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch,INT32 ndl,INT32 ndh)
{

    INT32 i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1;

    INT32***t;

    t=(INT32***)calloc((unsigned)(nrow+1),sizeof(INT32**));

    if(!t)nrerror("allocation failure 1 in i3tensor()");

    t+=1;

    t-=nrl;

    t[nrl]=(INT32**)calloc((unsigned)(nrow*ncol+1),sizeof(INT32*));

    if(!t[nrl])nrerror("allocation failure 2 in i3tensor()");

    t[nrl]+=1;

    t[nrl]-=ncl;

    t[nrl][ncl]=(INT32*)calloc((unsigned)(nrow*ncol*ndep+1),sizeof(INT32));

    if(!t[nrl][ncl])nrerror("allocation failure 3 in i3tensor()");

    t[nrl][ncl]+=1;

    t[nrl][ncl]-=ndl;

    for(j=ncl+1;j<=nch;j++)t[nrl][j]=t[nrl][j-1]+ndep;

    for(i=nrl+1;i<=nrh;i++){

          t[i]=t[i-l]+ncol;

          t[i][ncl]=t[i-1][ncl]+ncol*ndep;

          for(j=ncl+1;j<=nch;j++)t[i][j]=t[i][j-1]+ndep;

    }

    return t;
}
/*-----------------------------------------------------*/
/*=========================*/
/*FUNCTIONS    :    l3tensor  ()                                */
/*----------------------------------------------*/
/*PURPOSE    :     Allocate a long tensor with subscript range  */
/*           t[nrl,...,nrh][ncl,...,nch][ndl,...,ndh].    */
/*-------------------------------------------------*/
/*INPUT ARGUMENTS  :  _(INT32)nrl.                                    */
/*              _(INT32)nrh.                                    */
				
				<dp n="d789"/>
/*              _(INT32)ncl.                              */
/*              _(INT32)nch.                              */
/*              _(INT32)ndl.                              */
/*              _(INT32)ndh.                              */
/*----------------------------------------*/
/*OUTPUT ARGUMENTS :    _None.                                 */
/*----------------------------------------*/
/*RETURN ARGUMENTS :    _(INT64***):pointer to the allocated   */
/*                          tensor.                        */
/*=========================*/
INT64***l3tensor(INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch,INT32 ndl,INT32 ndh)
{

    INT32 i,j,nrow=nrh-url+1,ncol=nch-ncl+1,ndep=ndh-ndl+1;

    INT64***t;

    t=(INT64***)calloc((unsigned)(nrow+1),sizeof(INT64**));

    if(!t)nrerror("allocation failure 1 in l3tensor()");

    t+=1;

    t-=nrl;

    t[url]=(INT64**)calloc((unsigned)(nrow*ncol+1),sizeof(INT64*));

    if(!t[url])nrerror("allocation failure 2 in l3tensor()");

    t[url]+=1;

    t[nrl]-=ncl;

    t[url][ncl]=(INT64*)calloc((unsigned)(nrow*ncol*ndep+1),sizeof(INT64));

    if(!t[nrl][ncl])nrerror("allocation failure 3 in l3tensor()");

    t[nrl][ncl]+=1;

    t[nrl][ncl]-=ndl;

    for(j=ncl+1;j<=nch;j++)t[nrl][j]=t[nrl][j-1]+ndep;

    for(i=nrl+1;i<=nrh;i++){

          t[i]=t[i-1]+ncol;

          t[i][ncl]=t[i-1][ncl]+ncol*ndep;

          for(j=ncl+1;j<=nch;j++)t[i][j]=t[i][j-1]+ndep;

    }

    return t;
  }
  /*-------------------------------------------------------*/
				
				<dp n="d790"/>
/*===========================*/
/*FUNCTIONS    :    f3tensor()                                    */
/*--------------------------------------------*/
/*PURPOSE     :     Allocate a float tensor with subscript range  */
/*            t[nrl,..,nrh][ncl,...,nch][ndl,...,ndh].   */
/*--------------------------------------------*/
/*INPUT ARGUMENTS  :   _(INT32)nrl.                                  */
/*              _(INT32)nrh.                              */
/*              _(INT32)ncl.                              */
/*              _(INT32)nch.                              */
/*              _(INT32)ndl.                              */
/*              _(INT32)ndh.                              */
/*----------------------------------------*/
/*OUTPUT ARGUMENTS :   _None.                                   */
/*----------------------------------------*/
/*RETURN ARGUMENTS :   _(FLOAT32***):pointer to the allocated     */
/*                           tensor.                     */
/*===========================*/
FLOAT32***f3tensor(INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch,INT32 ndl,INT32 ndh)
{

    INT32 i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1;

    FLOAT32***t;

    t=(FLOAT32***)calloc((unsigned)(nrow+1),sizeof(FLOAT32**));

    if(!t) nrerror("allocation failure 1 in f3tensor()");

    t+=1;

    t-=nrl;

    t[nrl]=(FLOAT32**)calloc((unsigned)(nrow*ncol+1),sizeof(FLOAT32*));

    if(!t[nrl])nrerror("allocation failure 2 in f3tensor()");

    t[nrl]+=1;

    t[nrl]-=ncl;

    t[nrl][ncl]=(FLOAT32*)calloc((unsigned)(nrow*ncol*ndep+1),sizeof(FLOAT32));

    if(!t[nrl][ncl])nrerror("allocation failure 3 in f3tensor()");

    t[nrl][ncl]+=1;

    t[nrl][ncl]-=ndl;

    for(j=ncl+1;j<=nch;j++)t[nrl][j]=t[nrl][j-1]+ndep;

    for(i=nrl+1;i<=nrh;i++){
				
				<dp n="d791"/>
            t[i]=t[i-1]+ncol;

            t[i][ncl]=t[i-1][ncl]+ncol*ndep;

            for(j=ncl+1;j<=nch;j++)t[i][j]=t[i][j-1]+ndep;

    }

    return t;
  }
  /*-----------------------------------------------------*/
  /*=========================*/
  /*FUNCTIONS    :  d3tensor()                               */
  /*-----------------------------------------------------*/
  /*PURPOSE      :  Allocate a double tensor with subscript range */
  /*             t[nrl,...,nrh][ncl,...,nch][ndl,...,ndh].    */
  /*--------------------------------------*/
  /*INPUT ARGUMENTS  :    _(INT32)url.                         */
  /*                 _(INT32)nrh.                          */
  /*                 _(INT32)ncl.                          */
  /*                 _(INT32)nch.                          */
  /*                 _(INT32)ndl.                          */
  /*                 _(INT32)ndh.                          */
  /*-----------------------------------------*/
  /*OUTPUT ARGUMENTS  :   _None.                             */
  /*-----------------------------------------*/
  /*RETURN ARGUMENTS  :   _(FLOAT64***):pointer to the allocated  */
  /*                           tensor.                     */
  /*============================*/
  FLOAT64***d3tensor(INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch, INT32 ndl,INT32 ndh)
  {

     INT32 i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1;

     FLOAT64***t;

     t=(FLOAT64***)calloc((unsigned)(nrow+1),sizeof(FLOAT64**));

     if(!t)nrerror("allocation failure 1 in d3tensor()");

     t+=1;

     t-=nrl;

     t[nrl]=(FLOAT64**)calloc((unsigned)(nrow*ncol+1),sizeof(FLOAT64*));

     if(!t[nrl])nrerror("allocation failure 2 in d3tensor()");

     t[url]+=1;
				
				<dp n="d792"/>
    t[nrl]-=ncl;

    t[nrl][ncl]=(FLOAT64*)calloc((unsigned)(nrow*ncol*ndep+1),sizeof(FLOAT64));

    if(!t[nrl][ncl])nrerror("allocation failure 3 in d3tensor()");

    t[nrl][ncl]+=1;

    t[nrl][ncl]-=ndl;

    for(j=ncl+1;j<=nch;j++)t[nrl][j]=t[nrl][j-1]+ndep;

    for(i=nrl+1;i<=nrh;i++){

          t[i]=t[i-1]+ncol;

          t[i][ncl]=t[i-1][ncl]+ncol*ndep;

          for(j=ncl+1;j<=nch;j++)t[i][j]=t[i][j-1]+ndep;

    }

    return t;
}
/*-------------------------------------------------------*/
/*=========================*/
/*FUNCTIONS     :    free_vector  ()                      */
/*-------------------------------------------------*/
/*PURPOSE      :   free a float vector allocated with vector().*/
/*-------------------------------------------------*/
/*INPUT ARGUMENTS  :   _(FLOAT32*)v.                               */
/*             _(INT32)nl.                                  */
/*             _(INT32)nh.                                  */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS :  _None.                                       */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS :  _None.                                       */
/*=========================*/
void free_vector(FLOAT32*v,INT32 nl,INT32 nh)
{

    free((char*)(v+nl));
}
/*-------------------------------------------------*/
/*=========================*/
/*FUNCTIONS    :    free_svector  ()                        */
				
				<dp n="d793"/>
/*------------------------------------------------*/
/*PURPOSE    :    free a short vector allocated with svector().*/
/*------------------------------------------------*/
/*INPUT ARGUMENTS  :  _(INT16*)v.                                  */
/*              _(INT32)nl.                          */
/*              _(INT32)nh.                          */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS :   _None.                                      */
/*------------------------------------------------*/
/*RETURN ARGUMENTS :   _None.                                      */
/*=====================*/
void free_svector(INT16*v,INT32 nl,INT32 nh)
{

     free((char*)(v+nl));
}
/*------------------------------------------------*/
/*========================*/
/*FUNCTIONS    :    free_vector()                                 */
/*------------------------------------------------*/
/*PURPOSE      :    free an int vector allocated with ivector().*/
/*------------------------------------------------*/
/*INPUT ARGUMENTS  :   _(INT32*)v.                                 */
/*             _(INT32)nl.                                */
/*             _(INT32)nh.                                */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS  :  _None.                                       */
/*------------------------------------------------*/
/*RETURN ARGUMENTS  :  _None.                                      */
/*=======================================================================================*/
void free_ivector(INT32*v,INT32 nl,INT32 nh)
{

     free((char*)(v+nl));
}
/*------------------------------------------------*/
/*=========================================================================================*/
/*FUNCTIONS    :   free_lvector()                        */
				
				<dp n="d794"/>
/*---------------------------------------------*/
/*PURPOSE    :  free a long vector allocated with lvector().*/
/*---------------------------------------------*/
/*INPUT ARGUMENTS :  _(INT64*)v.                              */
/*             _(INT32)nl.                                 */
/*             _(INT32)nh.                                 */
/*---------------------------------------------*/
/*OUTPUT ARGUMENTS : _None.                                   */
/*---------------------------------------------*/
/*RETURN ARGUMENTS : _None.                                   */
/*=====================*/
void free lvector(INT64*v,INT32 nl,INT32 nh)
{

     free((char*)(v+nl));
}
/*----------------------------------------------*/
/**=======================*/
/*FUNCTIONS    :  free_dvector  ()                              */
/*-----------------------------------------------*/
/*PURPOSE      :  free a double vector allocated with dvector().*/
/*-----------------------------------------------*/
/*INPUT ARGUMENTS  :  _(FLOAT64*)v.                                 */
/*              _(INT32)nl.                                */
/*              _(INT32)nh.                                */
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS : _None.                                          */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS : _None.                                          */
/*========================*/
void free_dvector(FLOAT64*v,INT32 nl,INT32 nh)
{

     free((char*)(v+nl));
}
/*-----------------------------------------------*/
/*========================*/
/*FUNCTIONS    :  free_matrix()                                */
				
				<dp n="d795"/>
/*------------------------------------------------*/
/*PUIRPOSE    :  free a float matrix allocated with matrix().  */
/*------------------------------------------------*/
/*INPUT ARGUMENTS  :  _(FLOAT32**)m.                              */
/*             _(INT32)nrl.                               */
/*             _(INT32)nrh.                               */
/*             _(INT32)ncl.                               */
/*             _(INT32)nch.                               */
/*------------------------------------------------*/
/*OUTpUT ARGUMENTS :   _None.                                     */
/*------------------------------------------------*/
/*RETURN ARGUMENTS :   _None.                                     */
/*=========================*/
void free_matrix(FLOAT32**m,INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch)
{    

     INT32 i;

     for(i=nrh;i>=nrl;i--)free((char*)(m[i]+ncl));

     free((char*)(m+nrl));
}
/*-------------------------------------------------*/
/*========================*/
/*FUNCTIONS    :  free_smatrix()                            */
/*-------------------------------------------------*/
/*PURPOSE      :  free a short matrix allocated with smatrix().*/
/*-------------------------------------------------*/
/*INPUT ARGUMENTS  :  _(INT16**)rn.                                */
/*              _(INT32)nrl.                                 */
/*              _(INT32)nrh.                                 */
/*              _(INT32)ncl.                                 */
/*              _(INT32)nch.                                 */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS :   _None.                                       */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS :    _None.                                       */
/*=========================*/
void free_smatrix(INT16**m,INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch)
{
				
				<dp n="d796"/>
    INT32 i;

    for(i=nrh;i>=nrl;i--)free((char*)(m[i]+ncl));

    free((char*)(m+nrl));
}
/*---------------------------------------------------*/
/*========================*/
/*FUNCTIONS    :  free_dmatrix  ()                              */
/*------------------------------------------------*/
/*PURPOSE      :  free a double matrix allocated with dmatrix().*/
/*------------------------------------------------*/
/*INPUT ARGUMENTS  :  _(FLOAT64**)m.                               */
/*             _(INT32)nrl.                                  */
/*             _(INT32)nrh.                                   */
/*             _(INT32)ncl.                                   */
/*             _(INT32)nch.                                   */
/*------------------------------------------------*/
/*OUTPUT ARGUMENTS  :   _None.                                      */
/*------------------------------------------------*/
/*RETURN ARGUMENTS  :   _None.                                       */
/*========================*/
void free_dmatrix(FLOAT64**m,INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch)
{

     INT32 i;

     for(i=nrh;i>=nrl;i--)free((char*)(m[i]+ncl));

     free((char*)(m+nrl));
}
/*----------------------------------------------------*/
/*========================*/
/*FUNCTIONS    :  free_imatrix  ()                            */
/*--------------------------------------------------*/
/*PURPOSE      :  free an int matrix allocated with imatrix().*/
/*--------------------------------------------------*/
/*INPUT ARGUMENTS  :  _(INT32**)m.                                  */
/*             _(INT32)nrl.                                 */
/*             _(INT32)nrh.                                 */
				
				<dp n="d797"/>
/*                _(INT32)ncl.                         */
/*                _(INT32)nch.                         */
/*----------------------------------------------*/
/*OUTPUT ARGUMENTS:  _None.                                   */
/*----------------------------------------------*/
/*RETURN ARGUMENTS:  _None.                                   */
/*==========================*/
void free imatrix(INT32**m,INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch)
{

     INT32 i;

     for(i=nrh;i>=nrl;i--)free((char*)(m[i]+ncl));

     free((char*)(m+nrl));
}
/*------------------------------------------------------------*/
/*============================*/
/*FUNCTIONS    :  free_submatrix()                              */
/*-------------------------------------------------------*/
/*PURPOSE      :  free a float submatrix allocated with submatrix().*/
/*-------------------------------------------------------*/
/*INPUT ARGUMENTS  :   _(FLOAT32**)b.                                  */
/*             _(INT32)nrl.                                      */
/*             _(INT32)nrh.                                      */
/*             _(INT32)ncl.                                      */
/*             _(INT32)nch.                                      */
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS :   _None.                                        */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS :   _None.                                         */
/*===========================*/
void free_submatrix(FLOAT32**b,INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch)
{

     free((char*)(b+nrl));
}
/*---------------------------------------------------*/
/*========================*/
				
				<dp n="d798"/>
/*FUNCTIONS  :  free_i3tensor ()                              */
/*---------------------------------------------------*/
/*PURPOSE    :  free an int tensor allocated with i3tensor().  */  
/*---------------------------------------------------*/
/*INPUT ARGUMENTS  :   _(INT32*)t.                               */
/*             _(INT32)url.                              */
/*             _(INT32)nrh.                              */
/*             _(INT32)ncl.                              */
/*             _(INT32)nch.                              */
/*             _(INT32)ndl.                              */
/*             _(INT32)ndh.                              */
/*-------------------------------------------------*/
/*OUTPUT ARGUMENTS:  _None.                                */
/*-------------------------------------------------*/
/*RETURN ARGUMENTS:  _None.                                 */
/*=======================*/
void free_i3tensor(INT32***t,INT32 url,INT32 nrh,INT32 ncl,INT32 nch,INT32 ndl,INT32 ndh)
{

     free((char*)(t[url][ncl]+ndl-1));

     free((char*)(t[nrl]+ncl-1));

     free((char*)(t+url-1));
}
/*-------------------------------------------------------*/
/*===========================*/
/*FUNCTIONS  :  free_s3tensor ()                                  */
/*--------------------------------------------------*/
/*PURPOSE    :  free a short tensor allocated with s3tensor(). */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS  :  _(INT16***)t.                               */
/*             _(INT32)nrl.                                    */
/*             _(INT32)nrh.                                    */
/*             _(INT32)ncl.                                    */
/*             _(INT32)nch.                                    */
/*             _(INT32)ndl.                                    */
/*             _(INT32)ndh.                                    */
/*--------------------------------------------------*/
/*OUTPUT ARGUMENTS: _None.                                        */
/*--------------------------------------------------*/
/*RETURN ARGUMENTS: _None.                                        */
				
				<dp n="d799"/>
  /*==========================*/
  void free_s3tensor(INT16***t,INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch,INT32 ndl,INT32 ndh)
  {

       free((char*)(t[nrl][ncl]+ndl-1));

       free((char*)(t[nrl]+ncl-1));

       free((char*)(t+nrl-1));
}
/*--------------------------------------------------------*/
/*=========================*/
/*FUNCTIONS  :  free_l3tensor  ()                                */
/*--------------------------------------------------*/
/*PURPOSE    :  free a long tersor allocated with l3tensor().  */
/*--------------------------------------------------*/
/*INPUT ARGUMENTS  :  _(INT64***)t.                                */
/*             _(INT32)nrl.                                 */
/*             _(INT32)nrh.                                 */
/*             _(INT32)ncl.                                 */
/*             _(INT32)nch.                                 */
/*             _(INT32)ndl.                                 */
/*             _(INT32)ndh.                                 */
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS :  _None.                                  */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS :  _None.                                 */
/*================*/
void free_l3tensor(INT64***t,INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch,INT32 ndl,INT32 ndh)
{

     free((char*)(t[nrl][ncl]+ndl-1));

     free((char*)(t[nrl]+ncl-1));

     free((char*)(t+nrl-1));
}
/*-------------------------------------------------------*/
/*==========================*/
/*FUNCTIONS  :  free_f3tensor ()                               */
/*--------------------------------------------------*/
/*PURPOSE    :  free a float tensor allocated with f3tensor(). */
				
				<dp n="d800"/>
/*----------------------------------------------*/
/*INPUT ARGUMENTS  :  _(FLOAT32***)t.                     */
/*             _(INT32)nrl.                          */
/*             _(INT32)nrh.                          */
/*             _(INT32)ncl.                          */
/*             _(INT32)nch.                          */
/*             _(INT32)ndl.                          */
/*             _(INT32)ndh.                          */
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS:   _None.                              */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS:  _None.                               */
/*=========================*/
void free_f3tensor(FLOAT32***t,INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch,INT32 ndl,INT32 ndh)
{

     free((char*)(t[url][ncl]+ndl-1));

     free((char*)(t[nrl]+ncl-1));

     free((char*)(t+nrl-1));
}
/*------------------------------------------------------*/
/*=======================*/
/*FUNCTIONS  :  free_d3tensor ()                               */
/*--------------------------------------------------*/
/*PURPOSE    :  free a double tensor allocated with d3tensor().*/
/*--------------------------------------------------*/
/*INPUT ARGUMENTS  :  _(FLOAT64***)t.                              */
/*             _(INT32)nrl.                                    */
/*             _(INT32)nrh.                                    */
/*             _(INT32)ncl.                                    */
/*             _(INT32)nch.                                    */
/*             _(INT32)ndl.                                    */
/*             _(INT32)ndh.                                    */
/*----------------------------------------------*/
/*OUTPUT ARGUMENTS:  _None.                                        */
/*----------------------------------------------*/
/*RETURN ARGUMENTS:  _None.                                        */
/*==============================*/
void free_d3tensor(FLOAT64***t,INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch,INT32 ndl,INT32 ndh)
				
				<dp n="d801"/>
    {

        free((char*)(t[nrl][ncl]+ndl-1));

        free((char*)(t[nrl]+ncl-1));

        free((char*)(t+nrl-1));

    }

    /*-----------------------------------------------------------*/

    /*==========================*/

    /*FUNCTIONS  :convert_matrix  ()                                        */

    /*----------------------------------------------------*/

    /*PURPOSE    :allocate a float matrix m[nrl,...,nrh][ncl,...,nch] */

    /*           that points to the matrix declared in the standard  */

    /*           C manner as a[nrow][ncol],where nrow=nrh-nrl+1 and   */

    /*           ncol=nch-ncl+1.The routine should be called with   */

    /*           the address &amp;a[0][0]as the first argument.        */

    /*--------------------------------------------------*/

    /*INPUT ARGUMENTS  :  _(FLOAT32*)a.                               */

    /*             _(INT32)nrl.                                 */

    /*             _(INT32)nrh.                                  */

    /*             _(INT32)ncl.                                 */

    /*             _(INT32)nch.                                  */

    /*-----------------------------------------*/

    /*OUTPUT ARGUMENTS:    _None.                                   */

    /*-----------------------------------------*/

    /*RETURN ARGUMENTS:    _(FLOAT32**)pointer to array of pointers to*/

    /*                       rows.                         */

    /*=========================*/

    FLOAT32**convert_matrix(FLOAT32*a,INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch)

    {

        INT32 i,j,nrow,ncol;

        FLOAT32**m;

        nrow=nrh-nrl+1;

        ncol=nch-ncl+1;

        m=(FLOAT32**)calloc((unsigned)(nrow),sizeof(FLOAT32*));

        if(!m)nrerror("allocation failure in convert_matrix()");

        m-=nrl;

        for(i=0,j=nrl;i<=nrow-1;i++,j++)m[j]=a+ncol*i-ncl;

        return m;

    }
				
				<dp n="d802"/>
  /*-------------------------------------------------*/
  /*========================*/
  /*FUNCTIONS  :free_convert_matrix  ()                               */
  /*-------------------------------------------------*/
  /*PURPOSE    :free a matrix allocated by convert matrix().      */
  /*-------------------------------------------------*/
  /*INPUT ARGUMENTS  :  _(FLOAT32**)b.                                    */
  /*             _(INT32)nrl.                              */
  /*             _(INT32)nrh.                              */
  /*             _(INT32)ncl.                              */
  /*             _(INT32)nch.                              */
  /*---------------------------------------------*/
  /*OUTPUT ARGUMENTS:   _None.                                         */
  /*---------------------------------------------*/
  /*RETURN ARGUMENTS:   _None.                                         */
  /*====================*/
  void free_convert_matrix(FLOAT32**b,INT32 nrl,INT32 nrh,INT32 ncl,INT32 nch)
  {

       free((char*)(b+nrl));
}
/*--------------------------------------------------------*/
/*=========================*/
/*FUNCTIONS    :  pdvector  ()                                    */
/*----------------------------------------------*/
/*PURPOSE      :  Allocate a double a vector ofpointers to     */
/*             double datawith subscript range             */
/*             v[nl,...,nh].                            */
/*------------------------------------------*/
/*INPUT ARGUMENTS  :  _(INT32)nl.                                 */
/*             _(INT32)nh.                                     */
/*------------------------------------------*/
/*OUTPUT ARGUMENTS :   _None.                                     */
/*------------------------------------------*/
/*RETURN ARGUMENTS :   _(FLOAT64*):pointer to the allocated vector.*/
/*===========================*/
				
				<dp n="d803"/>
FLOAT64**pdvector(INT32 nl,INT32 nh)
{

    FLOAT64**v;

    /*-----------------------------------------------*/

    v=(FLOAT64**)calloc((unsigned)(nh-nl+1),sizeof(FLOAT64*));

    if(!v)nrerror("allocation failure in pdvector()");

    /*-----------------------------------------------*/

    return v-nl;

    /*-----------------------------------------------*/
}
/*---------------------------------------------------*/
/*========================*/
/*FUNCTIONS    :  free_pdvector  ()                                */
/*-----------------------------------------------*/
/*PURPOSE     :   free a vector of pointer to double allocated   */
/*           with pdvector().                              */
/*-----------------------------------------------*/
/*INPUT ARGUMENTS  :  _(FLOAT64**)v.                                   */
/*             _(INT32  )nl.                               */
/*             _(INT32  )nh.                               */
/*-----------------------------------------------*/
/*OUTPUT ARGUMENTS:  _None.                                            */
/*-----------------------------------------------*/
/*RETURN ARGUMENTS:  _None.                                            */
/*========================*/
void free_pdvector(FLOAT64**v,INT32 nl,INT32 nh)
{

     /*-------------------------------------------*/

     free((char*)(v+nl));

     /*-------------------------------------------*/
				
				<dp n="d804"/>
    return;

    /*-----------------------------------------------*/
}
/*---------------------------------------------------*/
/*=========================*/
/*----------------------------END--------------------*/
/*=========================*/
				
				<dp n="d805"/>
  /*============================*/
  /*============================*/
  /*Conexant System Inc.                                            */
  /*4311 Jamboree Road                                               */
  /*Newport Beach,CA 92660                                            */
  /*-----------------------------------------------------*/
  /*Copyright(C)2000 Conexant System Inc.                             */
  /*-----------------------------------------------------*/
  /*ALL RIGHTS RESERVED:                                                   */
  /*No part of this software may be reproduced in any form or by any  */
  /*means or used to make any derivative work(such as transforrnation */
  /*or adaptation)without the authorisation of Conexant System Inc.   */
  /*=========================*/
  /*PROTOYPE FILE:mcutil.h                                                 */
  /*============================*/
  /*---------------------------------------------------------*/
  /*------------------------FUNCTIONS-----------------------------*/
  /*---------------------------------------------------------*/
void nrerror          (char[]);
INT16    *svector         (INT32,INT32);
FLOAT32  *vector                 (INT32,INT32);
INT32    *ivector         (INT32,INT32);
INT64    *lvector         (INT32,INT32);
FLOAT64*dvector           (INT32,INT32);
FLOAT32**matrix           (INT32,INT32,INT32,INT32);
INT16     **smatrix       (INT32,INT32,INT32,INT32);
FLOAT64**dmatrix          (INT32,INT32,INT32,INT32);
INT32  **imatrix          (INT32,INT32,INT32,INT32);
FLOAT32**submatrix          (FLOAT32**,INT32,INT32,INT32,INT32,INT32);
INTl6  ***s3tensor          (INT32,INT32,INT32,INT32,INT32,INT32);
INT32  ***i3tensor          (INT32,INT32,INT32,INT32,INT32,INT32);
INT64  ***l3tersor          (INT32,INT32,INT32,INT32,INT32,INT32);
FLOAT32***f3tensor          (INT32,INT32,INT32,INT32,INT32,INT32);
FLOAT64***d3tensor          (INT32,INT32,INT32,INT32,INT32,INT32);
void free_vector          (FLOAT32*,INT32,INT32);
void free_svector         (INT16*,INT32,INT32);
void free_ivector         (INT32*,INT32,INT32);
void free_lvector         (INT64*,INT32,INT32);
void free_dvector         (FLOAT64*,INT32,INT32);
				
				<dp n="d806"/>
void free_matrix        (FLOAT32**,INT32,INT32,INT32,INT32);
void free_smatrix       (INT16**,INT32,INT32,INT32,INT32);
void free_dmatrix       (FLOAT64**,INT32,INT32,INT32,INT32);
void free_im2trix       (INT32**,INT32,INT32,INT32,INT32);
void free_submatrix     (FLOAT32**,INT32,INT32,INT32,INT32);
void free_i3tensor      (INT32***t,INT32,INT32,INT32,INT32,INT32,INT32);
void free_s3tensor      (INT16***t,INT32,INT32,INT32,INT32,INT32,INT32);
void free_l3tensor      (INT64***t,INT32,INT32,INT32,INT32,INT32,INT32);
void free_f3tensor      (FLOAT32***t,INT32,INT32,INT32,INT32,INT32,INT32);
void free_d3tensor      (FLOAT64***t,INT32,INT32,INT32,INT32,INT32,INT32);
FLOAT32**convert_matrix     (FLOAT32*,INT32,INT32,INT32,INT32);
void free_convert_matrix(FLOAT32**,INT32,INT32,INT32,INT32);
FLOAT64         **pdvector    (INT32,INT32);
void free_pdvector  (FLOAT64**,INT32,INT32);
/*=============================*/
/*-----------------------END-------------------*/
/*===========================*/
				
				<dp n="d807"/>
/*=========================*/
/*==========================*/
/*Conexant System Inc.                                            */
/*4311 Jamboree Road                                               */
/*Newporr Beach,CA 92660                                            */
/*-----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                            */
/*-----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                                  */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*===========================*/
/*FILE:typedef.h                                                   */
/*=======================*/
#if defined(_BORLANDC_)‖defined(_WATCOMC_)‖defined(_MSC_VER)‖defined(_ZTC_)‖
defined(_HIGHC_)‖defined(_CYGWIN32_)
typedef long int INT64;
typedef long int INT32;
typedef short int INT16;
typedef unsigrned short int UNS_INT16;
typedef short int FLAG;
typedef double    FLOAT64;
typedef float     FLOAT32;
#elif defined(_sun)
typedef long   INT64;
typedef long   INT32;
typedef short  INT16;
typedef unsigned short UNS_INT16;
typedef int    FLAG;
typedef double FLOAT64;
typedef float  FLOAT32;
#elif defined(_unix_)‖defined(_unix)
typedef long   INT64;
typedef int    INT32;
typedef short  INT16;
typedef unsigned short UNS_INT16;
typedef int    FLAG;
typedef double FLOAT64;
				
				<dp n="d808"/>
typedef float FLOAT32;
#elif defined(VMS)‖defined(_VMS)
typedef long   INT64;
typedef long   INT32;
typedef short  INT16;
typedef unsigned short UNS_INT16;
typedef int    FLAG;
typedef double FLOAT64;
typedef float  FLOAT32;
#else
#error COMPILER NOT TESTED typedef.h needs to be updated,see readme
#endif
/*==========================*/
/*-----------------------END---------------------------*/
/*========================*/
附件B
/*==============================*/
/*==============================*/
/*Conexant System Inc.                              */
/*4311 Jamboree Road                                */
/*Newport Beach,CA 92660                              */
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                 */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                  */
/*No part of this software may be reproduced in any form or by any*/
/*means or used to make any derivative work (such as transformation*/
/*or adaptation)without the authorisation of Conexant System Inc. */
/*=========================*/
/*LIBRARY:gain_vq.ab                                  */
/*========================*/
/*---------------------------------------------------------*/
/*------------------TABLES-------------------------------------*/
/*---------------------------------------------------------*/
/*============================*/
/*============================*/
/*Conexant System Inc.                           */
/*4311 Jamboree Road                             */
/*Newport Beach,CA 92660                           */
/*-------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                 */
/*-------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                 */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work (such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*==========================*/
/*FILE:FLOAT64 gp4_tab                                 */
/*========================*/
FLOAT64 gp4_tab[TAB_SIZE_GVQ_4D][GVQ_VEC_SIZE_4D]={
{  0.60699869,  0.59090763,  0.64920781,  0.64610492},
{  0.68101613,  0.65403889,  0.64210982,  0.63130892},
{  0.63010482,  0.56235514,  0.65643759,  0.75672188},
{  0.68659859,  0.57330071,  0.58744429,  0.81576573},
{  0.64851060,  0.64851060,  0.71451327,  0.71451327},
{  0.77682415,  0.68550346,  0.63967832,  0.64221364},
{  0.60611942,  0.63785293,  0.74037768,  0.76724979},
{  0.70282156,  0.70854395,  0.71397421,  0.70622913},
{  0.60640355,  0.64369532,  0.78733321,  0.81281683},
{  0.79313256,  0.75678142,  0.67673117,  0.64600357},
{  0.78871769,  0.78871769,  0.67719160,  0.67719160},
{  0.78750339,  0.65818283,  0.74410403,  0.76624484},
{  0.68666216,  0.71349168,  0.80131080,  0.81487027},
{  0.81564295,  0.77007419,  0.73645773,  0.73009256},
{  0.87690114,  0.83990779,  0.69391460,  0.62411652},
{  0.78900835,  0.72676490,  0.88398786,  0.66963377},
{  0.93272369,  0.74226864,  0.62990265,  0.75901092},
{  0.76976621,  0.76976621,  0.78405048,  0.78405048},
{  0.87041644,  0.83542384,  0.72726860,  0.65975429},
{  0.98828812,  0.57828812,  0.70041292,  0.80041292},
				
				<dp n="d811"/>
{  0.78642005,  0.77917927,  0.79153969,  0.78921747},
{  0.72998353,  0.72998353,  0.80237917,  0.88237917},
{  0.84850899,  0.79316290,  0.76406702,  0.74795323},
{  0.86473350,  0.82733618,  0.78603639,  0.77772334},
{  0.86598073,  0.86598073,  0.76672185,  0.76672185},
{  0.75717804,  0.76443058,  0.87026008,  0.89448642},
{  0.82990895,  0.82866571,  0.84344056,  0.84482601},
{  0.73643129,  0.73643129,  0.93179791,  0.93179791},
{  0.84091377,  0.84091377,  0.84549563,  0.84549563},
{  0.96705390,  0.93530253,  0.75329477,  0.70990139},
{  0.82417511,  0.88417511,  0.90242800,  0.78242800},
{  0.90565081,  1.00565081,  0.73784063,  0.73784063},
{  0.93696854,  0.89908568,  0.80488500,  0.76745989},
{  0.88864729,  0.87038965,  0.85073556,  0.84218753},
{  0.91005475,  0.86005510,  0.85177958,  0.84228257},
{  0.73978618,  0.82370630,  0.94989275,  0.95972113},
{  0.90821062,  0.90821062,  0.84367096,  0.84367096},
{  0.82123084,  0.84572475,  0.91624881,  0.93452704},
{  0.84262163,  0.90568020,  1.05247535,  0.73518775},
{  0.89073030,  0.89054064,  0.90204609,  0.90276521},
{  0.93915442,  0.91935059,  0.88462629,  0.87035097},
{  0.94939652,  0.86939652,  1.02255193,  0.76255193},
{  1.02270617,  0.90270617,  0.75324621,  0.95324621},
{  1.06002553,  0.97431233,  0.80897117,  0.78133585},
{  0.97983378,  0.97983378,  0.87774763,  0.87774763},
{  0.93569159,  0.93248467,  0.93336567,  0.93152706},
{  1.01454689,  0.97991575,  0.89630971,  0.86870634},
{  0.90992070,  0.90992070,  0.98329006,  0.98329006},
{  0.88442519,  0.91454256,  0.99448626,  1.00440409},
{  0.84818392,  0.87818392,  1.06200101,  1.00200101},
{  0.97346962,  0.96872528,  0.96372065,  0.95989277},
{  0.97243125,  0.97243125,  0.96175669,  0.96175669},
{  1.10743055,  0.93511480,  0.94874981,  0.94701072},
{  1.08620375,  1.04782334,  0.98763661,  0.96029488},
{  1.01282321,  1.01771063,  1.03454061,  1.02876771},
{  1.13502856,  1.06918208,  0.95687290,  0.92553343},
{  0.95295916,  0.98532512,  1.09705441,  1.11982849},
{  1.03699487,  1.03699487,  1.05224994,  1.05224994},
{  0.93430309,  0.93430309,  1.15479496,  1.15479496},
{  1.10604686,  1.08604686,  1.00380677,  1.01380677},
{  1.04618964,  1.07135141,  1.13934841,  1.12350107},
{  1.13404806,  1.11671807,  1.10434958,  1.07915085},
{  1.04548516,  1.11455931,  1.17914527,  1.18008965},
{  1.18984056,  1.19371846,  1.19065201,  1.18269596},
};
				
				<dp n="d812"/>
/*========================*/
/*Conexant System Inc.                            */
/* 4311 Jamboree Road                             */
/*Newport Beach.CA 92660                            */
/*--------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                 */
/*--------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                */
/*No part of this software may be reproduced in any form or by any  */
/*means or used to make any derivative work (such as transformation */
/*or adaptation) without the authorisation of Conexant System Inc.  */
/*==========================*/
/*FILE: FLOAT64 gainVQ_4_1024                                  */
/*===========================*/
FLOAT64 gainVQ_4_1024[MSMAX_4_1024][GVQ_VEC_SIZE_4D]={
{  0.32430000,  0.14200000,  0.08030000,  0.05200000},
{  0.36890000,  0.29580000,  0.19540000,  0.20130000},
{  0.44279383,  0.24252909,  0.20377341,  0.17139738},
{  0.51880000,  0.18810000,  0.13810000,  0.09180000},
{  0.45280000,  0.35830000,  0.26890000,  0.23960000},
{  0.29830000,  0.31750000,  0.37570000,  0.40950000},
{  0.69840000,  0.17180000,  0.11820000,  0.07790000},
{  0.67440000,  0.31330000,  0.27020000,  0.22210000},
{  0.37190000,  0.55970000,  0.40410000,  0.42710000},
{  0.60470000,  0.47560000,  0.33640000,  0.31260000},
{  0.44840000,  0.41050000,  0.52590000,  0.40260000},
{  0.85080000,  0.26840000,  0.22640000,  0.15330000},
{  0.22760000,  0.51290000,  0.47640000,  0.63220000},
{  0.38560000,  0.29260000,  0.65040000,  0.58390000},
{  0.78280000,  0.33410000,  0.33740000,  0.46220000},
{  0.60340000,  0.67610000,  0.39840000,  0.31230000},
{  1.02390000,  0.18590000,  0.12790000,  0.06950000},
{  0.60076348,  0.54890494,  0.49683860,  0.46659198},
{  0.77820000,  0.47490000,  0.50310000,  0.32480000},
{  0.61880000,  0.56990000,  0.54730000,  0.50080000},
{  0.95840000,  0.42240000,  0.33690000,  0.23270000},
{  1.06343087,  0.38532917,  0.30216593,  0.23571217},
{  1.12280000,  0.32130000,  0.20780000,  0.16830000},
{  0.57490000,  0.48290000,  0.51640000,  0.80480000},
{  0.29490000,  0.65830000,  0.67120000,  0.72950000},
{  0.81590000,  0.42290000,  0.69880000,  0.44790000},
{  0.79240000,  0.70420000,  0.39600000,  0.50570000},
{  0.62280000,  0.93010000,  0.45110000,  0.40340000},
{  0.71130000,  0.86330000,  0.55250000,  0.30600000},
{  1.05480000,  0.33040000,  0.51770000,  0.40970000},
{  1.02600000,  0.62390000,  0.40110000,  0.25760000},
{  0.51780000,  0.85420000,  0.57490000,  0.58740000},
{  0.51250000,  0.62920000,  0.86850000,  0.64200000},
{  1.10550000,  0.47540000,  0.42340000,  0.45950000},
{  0.68250000,  0.62950000,  0.90900000,  0.41490000},
{  1.26220000,  0.37640000,  0.34070000,  0.22520000},
{  1.29670000,  0.44760000,  0.23550000,  0.10650000},
{  0.71590000,  0.73030000,  0.74280000,  0.64590000},
{  0.90340000,  0.53960000,  0.70500000,  0.64130000},
{  0.94510000,  0.75910000,  0.56230000,  0.50030000},
{  0.27540000,  0.71640000,  0.60050000,  1.09140000},
{  1.12840000,  0.55510000,  0.69720000,  0.34280000}, 
				
				<dp n="d813"/>
{  0.18930000,  0.48280000,  0.78730000,  1.14680000},
{  0.64500000,  0.62070000,  0.64830000,  1.01460000},
{  0.20740000,  0.50100000,  0.81480000,  1.14820000},
{  1.47870000,  0.23150000,  0.16690000,  0.13280000},
{  0.47060000,  0.86040000,  0.80580000,  0.88090000},
{  0.67860000,  1.12680000,  0.50270000,  0.63850000},
{  0.96731581,  0.75394827,  0.71442682,  0.61492700},
{  1.35010000,  0.45980000,  0.58980000,  0.11360000},
{  1.35030000,  0.45470000,  0.60810000,  0.12860000},
{  0.61140764,  0.86453614,  0.79724552,  0.82890012},
{  0.77440000,  0.93360000,  0.81210000,  0.57180000},
{  1.05750000,  0.63760000,  0.90530000,  0.39800000},
{  1.42720000,  0.51010000,  0.36410000,  0.28800000},
{  1.41080000,  0.63500000,  0.32840000,  0.15920000},
{  1.30280000,  0.60240000,  0,50470000,  0.48850000},
{  0.86310000,  0.59840000,  0.85430000,  0.85140000},
{  1.35490000,  0.60220000,  0.61180000,  0.14980000},
{  1.29950000,  0.26780000,  0.90600000,  0.29370000},
{  1.18350000,  0.90230000,  0.53350000,  0.43230000},
{  0.96680000,  0.76470000,  0.65440000,  0.88850000},
{  1.38390000,  0.71660000,  0.56500000,  0.18200000},
{  1.44150000,  0.63080000,  0.46800000,  0.39010000},
{  1.65950000,  0.27920000,  0.23040000,  0.12250000},
{  0.44480000,  1.19650000,  0.69940000,  0.91650000},
{  0.68310000,  0.95110000,  0.98140000,  0.80990000},
{  0.69990000,  0,71050000,  1.21380000,  0.74870000},
{  1.22750000, .0.82230000,  0.78270000,  0.50450000},
{  1.50050000,  0.59740000,  0.59240000,  0.33230000},
{  1.45128760,  0.70277760,  0.57587383,  0.47212700},
{  1.13050000,  0.70160000,  1.01710000,  0.59460000},
{  1.14200000,  1.01440000,  0.63490000,  0.66370000},
{  0.86640000,  1.00810000,  0.74410000,  0.97030000},
{  0.44500000,  0.77610000,  0.89920000,  1.30200000},
{  0.91890000,  0.76170000,  1.02990000,  0.92350000},
{  0.37840000,  0.95900000,  1.06580000,  1.12020000},
{  1.58210000,  0.73680000,  0.43700000,  0.48940000},
{  0.85980000,  0.65090000,  0.55700000,  1.42030000},
{  1.70680000,  0.61080000,  0.38940000,  0.27490000},
{  0.49260000,  1.05000000,  0.77620000,  1.26730000},
{  0.93960000,  1.25930000,  0.88510000,  0.55820000},
{  0.50170000,  1.05780000,  1.38500000,  0.59250000},
{  1.06890000,  1.05570000,  0.94840000,  0.71110000},
{  1.53540000,  0.60810000,  0.70450000,  0.68800000},
{  0.52570774,  0.88028826,  0.98275945,  1.30471831},
{  0.95020000,  1.23000000,  0.70460000,  0.90070000},
{  1.85160000,  0.37420000,  0.37290000,  0.19740000},
{  1.86507422,  0.42602318,  0.33349988,  0.23033006},
{  1.25050000,  0.69770000,  0.78500000,  1.08440000},
{  0.52900000,  1.32630000,  1.00830000,  0.92290000},
{  1.19690000,  1.35160000,  0.70440000,  0.47200000},
{  0.80740000,  0.66150000,  1.07080000,  1.33480000},
{  1.27090000,  0.89000000,  1.06410000,  0.72190000},
{  0.95280000,  0.93720000,  1.37500000,  0.64020000},
{  0.78310000,  0.92700000,  1.39300000,  0.85560000},
{  0.88230000,  1.10330000,  0.98310000,  1.12380000},
{  1.08538360,  1.26958825,  0.91376555,  0.82118439},
{  0.64900000,  1.09760000,  0.85080000,  1.39930000},
{  0,53500000,  0.84810000,  1.35170000,  1.21860000},
{  1.92030000,  0.48420000,  0.55650000,  0.38520000},
{  0.80070000,  1.37500000,  1.17260000,  0.74470000},
				
				<dp n="d814"/>
{  1.63540000,  0.74520000,  0.83340000,  0.80460000},
{  1.12160000,  0.81130000,  1.27270000,  1.01790000},
{  0.79188218,  0.96816938,  1.40843300,  1.01964496},
{  1.37600000,  0.99530000,  0.78270000,  1.05730000},
{  1.08890000,  1.17530000,  1.17350000,  0.82630000},
{  1.88390000,  0.64200000,  0.55420000,  0.62580000},
{  1.00670000,  1.03950000,  1.43910000,  0.71870000},
{  0.51050000,  1.25330000,  1.23130000,  1.16600000},
{  1.77890000,  0.88140000,  0.70760000,  0.53880000},
{  1.53260000,  1.17190000,  0.72100000,  0.75600000},
{  0.96260000,  1.10560000,  1.16360000,  1.17150000},
{  1.25210000,  1.35480000,  0.75350000,  0.96460000},
{  0.33240000,  0.71980000,  0.92090000,  1.85140000},
{  1.52927093,  0.94387728,  0.98718908,  0.86465217},
{  0.64397105,  1.46149914,  1.05233363,  1.15080731},
{  1.09258166,  1.02600551,  1.01307653,  1.31767539},
{  2.19580000,  0.34580000,  0.20740000,  0.16710000},
{  0.88180000,  1.46700000,  0.90060000,  1.13530000},
{  0.25120000,  0.97960000,  1.20030000,  1.66510000},
{  1.33380000,  1.14500000,  1.21420000,  0.82470000},
{  0.82950000,  0.99190000,  1.07290000,  1.57270000},
{  0.61390000,  1.55190000,  0.97270000,  1.26230000},
{  0.62410000,  0.95810000,  1.63870000,  1.17470000},
{  0.61080000,  1.94840000,  0.85150000,  0.73860000},
{  1.15510000,  1.46050000,  1.16890000,  0.82670000},
{  1.24210000,  1.15240000,  0.87600000,  1.37610000},
{  1.14580000,  1.48500000,  1.15940000,  0.82150000},
{  1.15560000,  1.49260000,  1.16800000,  0.80390000},
{  1.39280000,  0.85790000,  1.39110000,  1.03370000},
{  0.99230000,  1.16470000,  1.51240000,  1.02880000},
{  0.77640000,  1.37070000,  1.29010000,  1.25970000},
{  1.98670000,  1.04510000,  0.75130000,  0.49690000},
{  1.45950000,  1.55160000,  1.06300000,  0.50150000},
{  0.50750000,  1.29680000,  1.35350000,  1.48850000},
{  0.59059745,  1.09122768,  1.02782035,  1.86392129},
{  0.34540000,  0.94370000,  0.87040000,  2.08760000},
{  0.45610000,  1.40740000,  0.92180000,  1.77210000},
{  1.75360000,  1.24960000,  0.94140000,  0.82600000},
{  0.99480000,  1.64830000,  1.30450000,  0.92420000},
{  0.25740000,  1.40250000,  0.87890000,  1.85970000},
{  0.48270000,  0.85850000,  1.53020000,  1.72520000},
{  0.80110000,  1.29470000,  1.25350000,  1.55500000},
{  1.14950000,  1.79370000,  0.87410000,  1.02120000},
{  1.60460000,  0.83720000,  0.97480000,  1.45660000},
{  2.20380000,  0.99360000,  0.62840000,  0.41190000},
{  2.06250000,  0.78580000,  0.94360000,  0.83700000},
{  1.44230000,  1.23800000,  1.18820000,  1.20860000},
{  1.85530000,  0.96690000,  0.99110000,  1.07500000},
{  2.16456006,  0.95165953,  0.75498856,  0.64325462},
{  1.09320000,  1.32460000,  1.35680000,  1.33920000},
{  2.36170000,  0.75890000,  0.50860000,  0.48350000},
{  0.60630000,  1.70190000,  1.23140000,  1.38980000},
{  0.50230000,  1.1 9030000, 1.25370000,  1.86460000},
{  0.99930000,  1.02630000,  1.00470000,  1.91350000},
{  2.50910000,  0.51800000,  0.39210000,  0.26440000},
{  0.78960000,  1.21760000,  1.93660000,  0.96840000},
{  1.09740000,  1.33800000,  1.15750000,  1.59900000},
{  0.71933291,  1.26280819,  1.52180112,  1.58702691},
{  1.04546726,  1.64917411,  1.40294177,  1.17052588},
{  1.34690000,  1.65670000,  1.03860000,  1.31610000},
				
				<dp n="d815"/>
{  0.50090000,  1.30040000,  1.57560000,  1.71970000},
{  2.56780000,  0.30520000,  0.64210000,  0.61340000},
{  0.31740000,  1.37100000,  1.85150000,  1.44820000},
{  0.63090000,  1.39620000,  1.79550000,  1.43480000},
{  1.40330859,  1.13498021,  1.62829863,  1.31339665},
{  2.69822802,  0.53749854,  0.40876870,  0.30352964},
{  2.78430000,  0.22190000,  0.20170000,  0.12030000},
{  1.70740000,  1.07100000,  1.51480000,  1.24820000},
{  0.64810000,  1.43980000,  1.06370000,  2.08260000},
{  1.09190000,  0.93920000,  1.34240000,  2.03280000},
{  2.00280000,  1.22590000,  1.13890000,  1.10010000},
{  1.15600000,  1.10170000,  1.83630000,  1.46950000},
{  0.36520000,  1.11520000,  1.31280000,  2.24210000},
{  0.62980000,  1.79830000,  1.12150000,  1.80860000},
{  1.67550000,  1.63840000,  1.32570000,  1.07460000},
{  0.26770000,  1.28180000,  0.18830000,  2.58420000},
{  2.05420000,  1.33040000,  1.33120000,  0.81850000},
{  0.36900000,  1.54200000,  1.30330000,  2.05770000},
{  1.53350000,  1.44230000,  1.51650000,  1.33600000},
{  0.92410000,  1.48880000,  1.64380000,  1.65800000},
{  1.32010000,  1.46880000,  1.46620000,  1.60380000},
{  0.84550000,  1.25590000,  1.59020000,  1.95220000},
{  2.20280000,  0.62690000,  1.38210000,  1.23260000},
{  2.62860000,  0.86670000,  0.84090000,  0.55930000},
{  1.74521323,  1.68473201,  1.17310799,  1.19609837},
{  1.51660000,  1.31360000,  1.88260000,  1.06480000},
{  0.79670000,  1.90030000,  1.73850000,  1.19910000},
{  0.98680000,  1.96410000,  1.16900000,  1.58870000},
{  2.49300000,  0.93570000,  0.82930000,  0.99100000},
{  1.03560000,  2.49260000,  0.94040000,  0.77390000},
{  0.56790000,  1.71420000,  1.55150000,  1.76090000},
{  0.44640000,  1.28630000,  1.81120000,  2.00020000},
{  1.05501900,  1.35801114,  1.27260523,  2.15449016},
{  1.13112081,  1.67490345,  1.49138960,  1.71113831},
{  1.54680000,  2.19610000,  1.21040000,  0.78050000},
{  2.96060000,  0.49720000,  0.51650000,  0.24180000},
{  1.20280000,  1.53980000,  1.23680000,  2.00120000},
{  1.21350000,  1.88360000,  1.72810000,  1.19320000},
{  2.30360000,  0.95850000,  1.21350000,  1.32840000},
{  0.59556365,  1.84799025,  1.42610766,  1.91755447},
{  0.83321592,  1.40566585,  2.15888097,  1.49523955},
{  2.54450000,  1.24210000,  0.91270000,  0.92510000},
{  2.26382744,  1.11917483,  1.39125540,  1.18438389},
{  0.70850000,  0.89840000,  1.26410000,  2.62000000},
{  2.14970000,  2.02550000,  0.85480000,  0.73730000},
{  1.98930000,  1.70300000,  1.46450000,  1.02370000},
{  1.64300000,  1.07540000,  1.77540000,  1.74840000},
{  0.54818095,  1.29470060,  1.81506779,  2.19994573},
{  0.92708840,  2.44326143,  1.24275146,  1.37688712},
{  0.37490000,  1.30980000,  1.52320000,  2.47770000},
{  1.39060000,  1.65500000,  1.48990000,  1.85690000},
{  0.85390000,  1.46700000,  1.67710000,  2.16850000},
{  0.32570000,  1.00200000,  2.09300000,  2.25460000},
{  2.21400000,  1.30480000,  1.19010000,  1.62460000},
{  0.62790000,  1.82040000,  1.36740000,  2.26360000},
{  1.14380000,  2.56880000,  1.16950000,  1.19580000},
{  1.35690000,  1.50710000,  1.94870000,  1.67750000},
{  0.53382826,  1.34692112,  1.33846227,  2.61907917},
{  0.91950000,  1.87320000,  1.63080000,  1.95190000},
{  1.41370000,  1.99910000,  1.54820000,  1.56130000},
				
				<dp n="d816"/>
{  0.57330000,  1.55750000,  2.19030000,  1.81220000},
{  1.06640000,  1.19880000,  1.09660000,  2.66680000},
{  2.87763286,  1.17630394,  0.87725081,  0.67950354},
{  1.89720000,  1.52950000,  1.72370000,  1.41750000},
{  0.49710000,  2.07990000,  1.74510000,  1.82260000},
{  2.27530000,  1.30140000,  1.61000000,  1.25190000},
{  1.05320000,  2.98950000,  0.94780000,  0.42250000},
{  1.82500000,  0.89410000,  2.29520000,  1.32420000},
{  1.99440000,  2.02900000,  1.25500000,  1.21920000},
{  2.72010000,  1.23850000,  1.31850000,  0.82520000},
{  1.04180000,  1.03520000,  2.39880000,  1.85630000},
{  1.01960000,  1.70500000,  2.27600000,  1.49890000},
{  0.69140000,  1.07550000,  2.71090000,  1.62580000},
{  1.11170000,  1.33550000,  1.82040000,  2.32830000},
{  0.38540000,  1.18850000,  3.11230000,  0.82370000},
{  1.73090000,  1.33730000,  1.05690000,  2.47140000},
{  0.72310000,  2.46130000,  1.27490000,  1.97000000},
{  1.77267981,  1.53066279,  1.77476873,  1.86776062},
{  0.20970000,  2.49020000,  0.95900000,  2.25440000},
{  3.42700000,  0.58010000,  0.48280000,  0.32410000},
{  3.32030000,  0.99090000,  0.54120000,  0.36710000},
{  0.73390000,  1.90270000,  2.19690000,  1.88990000},
{  1.42540000,  1.79240000,  1.59520000,  2.19790000},
{  1.45050000,  1.62280000,  2.53820000,  1.20120000},
{  1.34900000,  2.51420000,  1.32760000,  1.66820000},
{  3.00300000,  1.08510000,  0.79270000,  1.36770000},
{  2.04850000,  1.78870000,  2.04840000,  1.05170000},
{  3.27310000,  0.80220000,  0.90830000,  0.80130000},
{  3.57010000,  0.30230000,  0.14250000,  0.08090000},
{  0.66950000,  2.05640000,  1.59920000,  2.40270000},
{  1.23889924,  1.37970849,  2.03314994,  2.33416827},
{  0.54840000,  1.39700000,  2.05660000,  2.56930000},
{  1.01880000,  2.21560000,  1.85000000,  1.94130000},
{  0.42680000,  1.62100000,  1.50320000,  2.86480000},
{  1.36709992,  1.92118067,  2.22931649,  1.71369806},
{  2.17150000,  1.72310000,  1.62620000,  1.79850000},
{  0.34030000,  2.60550000,  2.19540000,  1.36160000},
{  0.80558445,  1.92562060,  1.92905300,  2.35004900},
{  0.86223532,  2.45299816,  2.09373970,  1.63564470},
{  1.46710000,  2.28960000,  1.90360000,  1.70410000},
{  2.06030000,  2.53950000,  1.37030000,  1.16470000}.
{  1.39681009,  2.23624337,  1.59579505,  2.11859260},
{  0.70220000,  1.77930000,  1.86580000,  2.61670000},
{  1.59210000,  1.65920000,  2.13170000,  2.04110000},
{  2.81710000,  1.21130000,  1.56300000,  1.47370000},
{  3.11440000,  1.62880000,  1.05310000,  0.82840000},
{  3.68599039,  0.60027243,  0.45011433,  0.33293751},
{  1.13830000,  1.64660000,  2.11410000,  2.41100000},
{  0.61210000,  1.89580000,  2.17130000,  2.37840000},
{  0.82010000,  1.75570000,  1.49690000,  2.89000000},
{  1.57880000,  2.22260000,  1.38510000,  2.25820000},
{  2.45254708,  1.52077343,  1.66535997,  1.83881345},
{  1.17305500,  1.30821566,  3.02978788,  1.52576780},
{  0.66534571,  1.41610565,  2.49625697,  2.46286253},
{  0.29560000,  1.14340000,  1.43040000,  3.37700000},
{  2.12390000,  2.11310000,  1.34410000,  2.03950000},
{  1.63091403,  1.31355448,  1.36763493,  2.95784307},  
{  1.09370000,  1.19610000,  1.62170000,  3.13210000},
{  2.16730000,  1.93040000,  2.27320000,  1.25240000},
{  1.53630000,  1.19450000,  2.13630000,  2.63770000},
				
				<dp n="d817"/>
{  2.53430000,  1.14700000,  2.18010000,  1.72400000},
{  1.77780000,  1.73710000,  1.84070000,  2.43220000},
{  1.20260000,  2.24720000,  1.57010000,  2.59170000},
{  0.48600000,  1.61790000,  2.67430000,  2.38210000},
{  1.43140000,  1.96990000,  2.52130000,  1.86980000},
{  2.09620000,  2.25920000,  1.87530000,  1.67370000},
{  1.15910000,  2.57100000,  2.26780000,  1.72330000},
{  1.05110000,  1.59620000,  3.13560000,  1.64660000},
{  3.99570000,  0.36520000,  0.27530000,  0.20870000},
{  3.77120000,  0.70730000,  0.95870000,  0.77500000},
{  1.40570000,  2.26260000,  2.01590000,  2.25500000},
{  0.65045973,  1.51699407,  2.01006662,  3.08315725},
{  0.96940000,  1.94710000,  2.52800000,  2.30090000},
{  3.07564375,  1.96246650,  1.34859928,  1.15172073},
{  0.70370000,  2.90160000,  1.58210000,  2.25630000},
{  0.37930000,  1.39650000,  2.33010000,  3.03640000},
{  3.21830000,  1.50100000,  1.57160000,  1.29830000},
{  0.81130000,  2.10070000,  1.89350000,  2.90340000},
{  1.24050000,  1.51440000,  1.77690000,  3.17980000},
{  1.67270000,  1.55850000,  2.55210000,  2.32360000},
{  0.43120000,  2.29240000,  2.37580000,  2.46470000},
{  0.91179847,  2.20528942,  1.69591433,  2.94367275},
{  0.76980000,  1.47560000,  3.08920000,  2.23530000},
{  0.84540000,  1.46810000,  2.49510000,  2.89170000},
{  0.74922509,  1.32090681,  1.27684752,  3.67788317},
{  0.46110000,  1.39270000,  1.65670000,  3.55550000},
{  1.36650000,  1.44440000,  1.00350000,  3.55690000},
{  3.67050517,  1.23688828,  1.20357381,  1.07900474},
{  1.12660000,  2.68590000,  2.10440000,  2.19800000},
{  1.89750000,  1.58590000,  2.82200000,  1.93260000},
{  2.24697910,  2.38873518,  1.97435359,  1.81077415},
{  0.38450000,  2.16850000,  1.74270000,  3.17540000},
{  4.20690000,  0.42420000,  0.42380000,  0.08250000},
{  4.11470000,  0.71740000,  0.68790000,  0.38480000},
{  1.70090000,  1.85320000,  2.32140000,  2.53040000},
{  2.04930000,  2.25220000,  2.13630000,  2.07340000},
{  2.84720000,  1.82540000,  1.67010000,  1.98800000},
{  1.40590000,  1.39600000,  3.16130000,  2.08190000},
{  0.96535206,  2.12754427,  2.68415919,  2.39247721},
{  1.48550000,  2.21360000,  2.04320000,  2.67020000},
{  0.40140000,  3.23100000,  2.12180000,  1.81980000},
{  3.42710000,  1.05860000,  2.28540000,  0.62540000},
{  0.18650000,  3.17660000,  0.82310000,  2.77610000},
{  0.78310000,  2.85280000,  2.63020000,  1.72540000},
{  0.51340000,  1.68440000,  1.91020000,  3.46540000},
{  0.99250000,  2.07730000,  2.42260000,  2.80170000},
{  1.52534714,  1.61117427,  2.95395695,  2.32829275},
{  1.57610859,  2.18452774,  2.25616952,  2.62507013},
{  0.89851630,  2.76341067,  2.10694623,  2.55056387},
{  2.97550000,  2.50580000,  1.72340000,  1.23640000},
{  1.35510000,  1.77910000,  3.65410000,  1.13780000},
{  1.53930000,  3.26830000,  1.77780000,  2.02230000},
{  0.95750000,  2.91210000,  2.26980000,  2.41370000},
{  0.62880000,  2.55740000,  2.45470000,  2.72430000},
{  4.17300000,  1.06450000,  1.04760000,  0.86520000},
{  1.14310000,  2.37170000,  1.82320000,  3.19750000},
{  1.58370199,  2.96836003,  2.27706073,  2.03240403},
{  2.43176411,  1.82966247,  2.78432482,  1.90889963},
{  1.86490000,  2.69770000,  2.52130000,  1.88470000},
{  2.10760000,  1.56670000,  3.54160000,  1.18690000},
				
				<dp n="d818"/>
{  3.75830000,  1.26570000,  1.94980000,  1.19300000},
{  0.86350000,  2.57800000,  3.12820000,  1.96290000},
{  1.51580000,  1.60850000,  2.22840000,  3.37700000},
{  3.94730000,  1.77810000,  1.28310000,  0.94200000},
{  3.42344413,  1.55540578,  1.09618002,  2.47782213},
{  0.66041540,  2.18915841,  2.58578828,  3.09596781},
{  0.60980000,  2.59460000,  1.37490000,  3.55740000},
{  0.62668390,  1.92562803,  2.11258815,  3.63723237},
{  0.74780000,  1.72330000,  1.88370000,  3.83750000},
{  1.61350000,  1.00520000,  4.01880000,  1.46700000},
{  3.23495541,  1.72163945,  2.59655973,  1.33940018},
{  0.38850000,  1.39810000,  2.51490000,  3.69950000},
{  0.62870000,  1.89250000,  2.70220000,  3.30330000},
{  3.18290000,  2.25710000,  1.91820000,  1.82310000},
{  0.96400000,  1.24870000,  2.82850000,  3.42770000},
{  1.77380000,  2.07210000,  2.52890000,  2.90830000},
{  1.50940000,  2.24310000,  3.07870000,  2.35840000},
{  2.11150000,  2.55510000,  1.75050000,  2.89690000},
{  1.26400000,  2.77440000,  2.62980000,  2.49940000},
{  2.61330000,  1.45850000,  1.97670000,  3.09830000},
{  2.13990000,  1.94870000,  2.85930000,  2.46960000},
{  3.23675679,  1.72320543,  1.97852723,  2.34190916},
{  4.76008462,  0.33310464,  0.27903439,  0.14962236},
{  1.19760000,  2.39550000,  2.64150000,  3.00350000},
{  0.73033089,  1.53066461,  3.39605347,  2.96404732},
{  0.64980000,  4.55530000,  1.04050000,  0.97930000},
{  2.16740000,  1.56460000,  3.43890000,  2.06460000},
{  0.82740000,  1.57650000,  3.51060000,  2.81690000},
{  2.72160000,  3.10920000,  2.08700000,  1.42710000},
{  1.31790000,  1.12640000,  1.24000000,  4.37700000},
{  0.69324727,  2.26567608,  1.45969963,  4.00667818},
{  0.50530000,  2.16930000,  1.40940000,  4.12580000},
{  1.11210000,  2.87040000,  1.88010000,  3.31050000},
{  0.66630000,  2.82910000,  2.45110000,  3.10110000},
{  1.33590000,  2.89490000,  3.68240000,  0.65810000},
{  2.93090000,  2.38840000,  2.07860000,  2.36470000},
{  1.28667958,  2.04826107,  2.65566781,  3.41804337},
{  3.94810000,  1.80510000,  1.66920000,  1.72480000},
{  2.62115775,  1.36101297,  2.48365661,  3.12389449},
{  0.96340000,  2.19290000,  3.22950000,  2.93730000},
{  2.22410000,  3.34520000,  1.92750000,  2.22420000},
{  1.34990000,  2.55940000,  3.38100000,  2.25480000},
{  3.98355945,  1.62050242,  1.86586909,  1.75003931},
{  1.45670000,  1.96900000,  2.46570000,  3.60150000},
{  3.29180000,  0.57080000,  0.94640000,  3.62270000},
{  1.14401268,  2.35151050,  3.56543838,  2.39104454},
{  2.05950000,  3.34370000,  2.61720000,  1.75590000},
{  1.87540000,  1.98800000,  1.73030000,  3.87560000},
{  3.38890000,  1.81050000,  1.78110000,  2.79100000},
{  3.29220000,  1.36330000,  3.16320000,  1.77060000},
{  3.18027283,  1.45944882,  1.71626835,  3.27811030},
{  1.93300775,  2.95380479,  2.14151386,  3.00884031},
{  0.81990000,  2.46050000,  2.15850000,  3.86990000},
{  1.14122290,  3.68786928,  1.67502304,  2.94593763},
{  4.55780000,  1.41040000,  1.67570000,  1.05670000},
{  2.04350000,  2.88820000,  2.26570000,  3.01880000},
{  0.73210000,  1.30000000,  2.88790000,  4.04000000},
{  0.68450000,  3.63810000,  2.57410000,  2.56440000},
{  1.25130000,  2.48210000,  2.80700000,  3.37540000},
{  1.22334247,  2.93218987,  2.87129861,  2.97077885},
				
				<dp n="d819"/>
{  4.15430000,  2.62750000,  1.52140000,  0.87560000},
{  4.00998503,  2.44785350,  1.91086193,  1.26495926},
{  0.96334199,  3.67493280,  2.53065106,  2.55194596},
{  1.86980000,  2.73670000,  3.53870000,  1.97080000},
{  2.09590000,  2.38780000,  2.88250000,  3.00680000},
{  0.51105028,  0.95473004,  4.82149731,  1.76786886},
{  0.79809573,  1.73747912,  3.08641885,  3.79319320},
{  0.61920315,  1.56245166,  2.03613905,  4.54355831},
{  0.80690000,  2.93290000,  2.85130000,  3.20020000},
{  5.07533511,  1.11492899,  0.76600689,  0.58857315},
{  0.88400000,  2.94980000,  3.38330000,  2.65950000},
{  0.83560000,  2.01790000,  2.22550000,  4.28230000},
{  3.26488329,  2.53220768,  2.39822027,  2.31965482},
{  5.15360000,  1.03590000,  0.69850000,  0.30780000},
{  0.47680000,  2.01850000,  2.88800000,  3.95730000},
{  1.86250000,  3.63570000,  2.53310000,  2.32350000},
{  2.32650000,  1.64910000,  3.97760000,  2.15240000},
{  1.31220000,  2.84950000,  2.52880000,  3.51660000},
{  3.73900000,  3.03360000,  1.57910000,  1.71230000},
{  1.03140000,  1.76600000,  4.09070000,  2.77620000},
{  2.55040000,  3.02110000,  3.03810000,  2.02110000},
{  1.56630000,  2.27920000,  2.12510000,  4.20290000},
{  0.80128484,  3.20209641,  2.11458149,  3.80989857},
{  2.75810000,  2.61700000,  2.52250000,  3.01760000},
{  1.56170520,  2.51828258,  2.37504668,  3.94070071},
{  1.32800000,  2.01560000,  3.37940000,  3.59480000},
{  0.81991044,  2.74699922,  2.83105528,  3.74056560},
{  2.58517545,  2.41831906,  3.32046360,  2.63086107},
{  1.22610000,  3.16100000,  1.83930000,  3.94990000},
{  0.58860000,  3.34140000,  1.53090000,  4.08610000},
{  3.21800000,  2.89890000,  2.62590000,  2.25470000},
{  1.53063335,  2.00389576,  3.74615530,  3.22482145},
{  0.73982063,  2.21496390,  2.57762397,  4.32390171},
{  2.78358948,  3.74601756,  2.30742134,  1.93518870},
{  5.43400000,  1.00760000,  0.56080000,  0.46840000},
{  0.62260000,  3.56230000,  4.22540000,  0.41350000},
{  1.02070000,  2.48650000,  2.65140000,  4.11070000},
{  2.19711701,  1.95745934,  3.03561042,  3.64705327},
{  1.27560000,  3.48400000,  2.79200000,  3.10450000},
{  2.38060000,  2.13400000,  3.69000000,  2.71690000},
{  4.05209972,  2.97601237,  1.05845013,  2.20333198},
{  1.41410000,  3.00250000,  3.56970000,  2.76670000},
{  0.78509386,  2.56013083,  3.49976941,  3.50728587},
{  0.32550000,  3.48650000,  3.46410000,  2.75360000},
{  0.59520000,  2.45070000,  2.79830000,  4.20350000},
{  3.87180000,  1.52880000,  2.96370000,  2.40460000},
{  1.40848596,  4.29965314,  2.83277234,  1.85370326},
{  0.86360000,  2.30210000,  2.02710000,  4.67130000},
{  2.08470000,  3.65530000,  2.68660000,  2.69140000},
{  1.29520000,  2.61240000,  2.78910000,  4.00780000},
{  1.33671645,  3.62780768,  3.60451483,  2.09970850},
{  0.58190000,  0.85490000,  5.50760000,  1.03020000},
{  1.83990000,  3.33240000,  2.04680000,  3.74140000},
{  1.37853169,  4.85910095,  2.17229283,  1.59148523},
{  0.57161173,  1.94082970,  4.37862081,  3.10624563},
{  1.75980000,  4.12590000,  2.83200000,  2.24320000},
{  4.82590000,  2.25190000,  2.00940000,  0.89920000},
{  1.69460000,  3.02990000,  3.65540000,  2.82720000},
{  2.09890000,  3.08470000,  3.54600000,  2.63500000},
{  0.87630000,  2.93340000,  3.12870000,  3.78810000},
				
				<dp n="d820"/>
{  2.18650000,  1.79660000,  4.22310000,  2.79610000},
{  1.67344150,  0.81455177,  5.43940756,  0.90626129},
{  0.72940000,  1.75350000,  1.50550000,  5.32680000},
{  2.00440000,  2.88580000,  3.10610000,  3.50850000},
{  1.41916748,  2.63672001,  3.30211908,  3.80230884},
{  0.53660000,  1.74370000,  4.91290000,  2.67730000},
{  3.99540000,  3.24990000,  2.19120000,  2.05650000},
{  3.31361447,  1.99125651,  2.36964801,  3.89028633},
{  1.23957085,  1.68046134,  2.76294455,  4.90581248},
{  0.64230000,  2.47180000,  3.96360000,  3.72930000},
{  0.30620000,  1.85530000,  2.54970000,  5.11440000},
{  4.93780000,  1.02110000,  1.07490000,  3.10510000},
{  5.08416611,  2.69266311,  1.28280505,  1.21614623},
{  1.06202757,  3.23024339,  3.98737130,  3.01629803},
{  1.85270000,  3.64740000,  3.59020000,  2.63670000},
{  0.42090000,  2.28950000,  3.00040000,  4.70910000},
{  6.02390000,  0.55130000,  0.43540000,  0.29940000},
{  2.45192326,  1.27458394,  5.09054783,  1.82353777},
{  2.36859242,  2.87308793,  2.34889970,  4.21827325},
{  6.06878102,  0.52032041,  0.27836222,  0.17747753},
{  0.79655073,  3.61273913,  3.09842639,  3.76228895},
{  0.83310000,  2.82610000,  2.57390000,  4.72600000},
{  5.73680000,  1.78970000,  0.96460000,  0.81660000},
{  0.58407500,  1.84587724,  5.51249561,  1.93870128},
{  5.90110000,  1.47060000,  0.82040000,  0.62560000},
{  5.27372066,  1.95474391,  2.08813292,  1.44696665},
{  4.29324640,  0.99574963,  3.67595988,  2.27814963},
{  1.58583128,  3.50477846,  2.85482397,  3.90040356},
{  2.92780000,  2.06760000,  2.60230000,  4.32290000},
{  2.95790000,  3.14450000,  2.62950000,  3.57840000},
{  0.81834272,  2.87245938,  2.75295959,  4.72288374},
{  2.06730000,  3.19430000,  2.99680000,  3.94410000},
{  0.69103962,  2.09490823,  2.07533947,  5.47096960},
{  1.06787758,  2.54948360,  4.93249276,  2.70387501},
{  0.84177292,  2.34414462,  4.25769786,  3.87569075},
{  2.82920000,  2.28550000,  3.94430000,  3.26140000},
{  2.36390000,  1.86180000,  5.07850000,  2.18120000},
{  0.65489458,  2.25669250,  3.20732270,  4.88338271},
{  1.25106359,  4.65043045,  3.52244164,  2.03890043},
{  1.82056859,  4.33030509,  2.86284938,  3.08333608},
{  4.37190892,  3.22778677,  1.92061395,  2.63155550},
{  2.83983941,  1.25029093,  3.74029839,  4.06793610},
{  6.33440000,  0.20610000,  0.18340000,  0.07240000},
{  1.96460000,  4.14700000,  2.89830000,  3.29460000},
{  2.68902407,  3.36225081,  4.46315484,  1.37878565},
{  1.42930000,  3.63160000,  3.30210000,  3.77640000},
{  0.70630000,  3.54960000,  3.29080000,  4.06750000},
{  2.84011995,  1.63505747,  4.61551440,  2.94856695},
{  3.65141071,  1.33548270,  1.58514901,  4.81007096},
{  0.71878761,  3.18202357,  2.11465505,  5.06695686},
{  1.75150000,  1.18490000,  2.99670000,  5.23270000},
{  4.73153889,  3.11406144,  2.33970423,  1.86251529},
{  4.65127395,  2.01181917,  3.25468045,  2.18044744},
{  3.61183309,  3.54603755,  2.63541011,  2.92819326},
{  0.92680000,  2.20390000,  3.19860000,  5.02150000},
{  2.56503216,  1.58975653,  2.60967534,  5.03269844},
{  3.34320000,  4.03360000,  2.12130000,  3.06690000},
{  2.91820207,  3.26652531,  3.22688812,  3.47625388},
{  1.14890000,  2.56140000,  3.95150000,  4.32590000},
{  2.33193530,  2.78844872,  4.85525658,  2.33572626},
				
				<dp n="d821"/>
{  1.70380383,  1.89138318,  5.20960374,  2.97871515},
{  1.29468463,  2.48073368,  3.68984850,  4.59198055},
{  0.75150000,  2.30010000,  5.12440000,  3.24270000},
{  2.43660000,  4.03490000,  2.78280000,  3.55950000},
{  1.39571596,  2.98717298,  5.31293823,  1.88456673},
{  0.42260000,  2.03090000,  2.70920000,  5.57090000},
{  2.28560000,  3.06910000,  4.07370000,  3.39390000},
{  1.54900000,  3.36760000,  4.40450000,  3.14580000},
{  0.54330000,  2.32260000,  1.63890000,  5.89780000},
{  0.52120000,  1.69440000,  4.77190000,  4.16630000},
{  1.13533825,  4.21336258,  3.35039205,  3.62398879},
{  4.76010000,  2.53950000,  3.16580000,  2.06660000},
{  2.19344627,  3.43219256,  4.03262765,  3.25957476},
{  2.07480000,  3.62880000,  2.53270000,  4.42860000},
{  1.48670000,  1.58540000,  4.75710000,  4.01830000},
{  3.94542427,  1.66762709,  4.60522500,  1.99800769},
{  0.98170000,  3.19900000,  3.54280000,  4.48010000},
{  3.47310000,  3.85340000,  3.04650000,  2.78760000},
{  0.96020000,  3.35330000,  2.66210000,  4.98370000},
{  1.75470000,  2.91190000,  4.25020000,  3.80990000},
{  3.23533192,  1.78075003,  5.13125190,  2.07635214},
{  2.98960000,  3.27590000,  3.47410000,  3.61430000},
{  3.71170000,  3.12140000,  2.24830000,  4.03450000},
{  0.83160540,  5.27080821,  2.34385364,  3.33209484},
{  0.87220000,  3.25440000,  1.70760000,  5.55630000},
{  5.88160000,  1.96120000,  1.98250000,  1.69550000},
{  3.74031025,  2.84627624,  4.31810366,  2.20077353},
{  2.52374471,  2.53443727,  2.06814049,  5.34249457},
{  0.86920000,  2.05700000,  3.87540000,  5.09560000},
{  0.89340000,  4.19870000,  3.46330000,  3.95430000},
{  1.04736786,  3.28184828,  3.80030221,  4.48701367},
{  3.13043324,  4.41084229,  3.63023782,  2.05619319},
{  0.65966102,  2.16674527,  4.18144183,  4.92740563},
{  6.57983288,  1.40124660,  0.96786416,  0.85867058},
{  3.35074877,  2.75183379,  4.48829525,  2.82973677},
{  1.27764018,  3.34726470,  2.68655894,  5.19887799},
{  0.75751911,  1.75396851,  2.25633391,  6.22409454},
{  1.25000000,  4.62890000,  4.33260000,  2.41310000},
{  0.62940000,  3.16160000,  3.43410000,  5.06030000},
{  2.45350000,  3.75020000,  3.84530000,  3.59470000},
{  4.87626497,  2.56036558,  2.45779634,  3.42594829},
{  0.98093726,  2.08646156,  5.44679975,  3.66584299},
{  2.33936922,  2.45815422,  3.16505020,  5.19117839},
{  3.95671149,  4.35419644,  2.86804508,  2.41211706},
{  2.35120000,  2.74980000,  3.49010000,  4.85120000},
{  2.53763044,  2.47313728,  5.71954141,  1.88679211},
{  1.74477118,  3.08104358,  4.47236303,  4.06142477},
{  0.80260000,  2.59630000,  4.23390000,  4.88340000},
{  4.25070000,  2.52830000,  3.79050000,  3.28040000},
{  1.06014378,  4.48295498,  4.21073676,  3.34387977},
{  1.25800000,  5.14240000,  3.26050000,  3.39630000},
{  3.00991094,  4.38850915,  2.93409343,  3.65165489},
{  0.83779322,  3.91360870,  3.29054241,  4.89145670},
{  0.94729704,  2.69844817,  4.97688102,  4.23372361},
{  0.95990000,  3.11660000,  4.86420000,  4.09760000},
{  2.65720000,  2.50210000,  4.66650000,  4.00880000},
{  2.39358827,  4.23570202,  2.73723567,  4.47274600},
{  4.82560000,  3.23690000,  3.64730000,  2.07680000},
{  3.35848505,  2.07937403,  4.26952516,  4.22710761},
{  7.13930000,  0.63680000,  0.68290000,  0.26020000},
				
				<dp n="d822"/>
{  0.86360000,  3.41520000,  2.41750000,  5.83370000},
{  0.88786330,  2.31985683,  3.30707266,  5.93670451},
{  1.35105752,  2.25352076,  6.13801118,  2.79824132},
{  6.46725843,  2.59934414,  1.22993150,  1.52384793},
{  2.83080000,  3.78080000,  3.01180000,  4.59890000},
{  1.98640000,  3.49750000,  3.49800000,  4.92290000},
{  1.25427821,  4.14099769,  5.12550743,  2.80090203},
{  1.79632249,  4.12473829,  3.90350471,  4.19774142},
{  1.74950000,  4.45070000,  3.52330000,  4.27160000},
{  3.36830000,  2.47820000,  1.86270000,  5.71510000},
{  1.16340000,  2.94620000,  4.03690000,  5.26660000},
{  6.08168511,  2.06159119,  2.59760812,  2.46738713},
{  6.00380000,  3.17760000,  2.26150000,  1.69430000},
{  1.87097762,  1.66186174,  5.66704574,  4.01505658},
{  1.13942515,  4.92995903,  3.01265234,  4.49908189},
{  1.13599002,  3.76458773,  4.85215715,  3.99237659},
{  2.43338062,  4.56185058,  4.30232241,  3.12435691},
{  0.98210000,  3.51220000,  4.36150000,  4.78210000},
{  2.21852398,  4.32542442,  5.24655839,  2.01304070},
{  1.89539186,  3.62961827,  3.34033346,  5.24982067},
{  1.55167113,  2.97316140,  2.36098436,  6.25179618},
{  1.27760000,  2.87500000,  3.61290000,  5.76000000},
{  5.08750000,  3.98500000,  3.30870000,  1.85940000},
{  7.27884130,  0.43634440,  1.19087294,   .28602147},
{  5.04580000,  2.67300000,  2.90250000,  3.98090000},
{  0.95598487,  3.57483341,  5.79884845,  3.11644411},
{  2.00200000,  2.84520000,  5.57680000,  3.72390000},
{  0.75802169,  3.49915542,  3.41138838,  5.74028008},
{  0.67849510,  2.00708481,  6.98162116,  2.05146073},
{  7.39726170,  1.25672874,  0.78634411,  0.74244139},
{  1.32780000,  1.33310000,  5.67880000,  4.65880000},
{  3.96910000,  2.51670000,  3.41660000,  4.87720000},
{  0.80357940,  2.88161482,  4.14131463,  5.61858173},
{  0.91250000,  2.10780000,  3.51560000,  6.32990000},
{  0.60779465,  2.80880035,  2.98099351,  6.39145735},
{  2.72247506,  3.12542020,  4.16791135,  4.84392556},
{  1.46740000,  3.82300000,  5.06350000,  3.96880000},
{  0.83620000,  1.59670000,  6.46550000,  3.65070000},
{  0.57500818,  0.94499890,  7.23442796,  2.22807746},
{  2.41430000,  5.02900000,  3.54340000,  3.86070000},
{  3.83043148,  3.53651179,  4.26399631,  3.65112635},
{  0.40580662,  1.69759804,  2.09269962,  7.16427115},
{  7.62126692,  0.61037761,  0.49868253,  0.22652113},
{  1.80006813,  1.51991392,  1.18641710,  7.20856992},
{  0.78890077,  3.49779039,  2.52692026,  6.30751374},
{  1.14190000,  2.39680000,  5.54210000,  4.63100000},
{  6.43706349,  2.32429301,  2.13960614,  2.91797811},
{  4.63790156,  3.35933359,  3.90938881,  3.45367361},
{  7.64850000,  0.75530000,  0.82330000,  0.61570000},
{  1.68271536,  2.27970327,  4.51399560,  5.63405952},
{  4.66340000,  1.92330000,  4.92400000,  3.24680000},
{  0.76463354,  1.11363357,  6.04482209,  4.72046674},
{  0.50380000,  2.46800000,  2.66820000,  6.87490000},
{  2.85130000,  3.28510000,  5.56670000,  3.28950000},
{  0.90860000,  4.61770000,  2.32590000,  5.79640000},
{  1.69079978,  3.16486754,  4.18771878,  5.54553607},
{  2.82496638,  3.59337709,  2.48811001,  5.87756784},
{  0.93202861,  3.91025719,  4.24521168,  5.27086141},
{  1.21270000,  2.95180000,  5.57880000,  4.59080000},
{  0.55659530,  2.91938894,  1.93771385,  7.08849726},
				
				<dp n="d823"/>
{  2.32410000,  4.45640000,  4.91380000,  3.66750000},
{  6.56354517,  3.45828242,  2.40487691,  1.46204629},
{  1.39481420,  1.95864980,  3.39553636,  6.78175799},
{  6.06147968,  2.30430262,  3.85349629,  2.53132522},
{  3.31308290,  3.93501851,  5.24822818,  3.06107242},
{  1.28189201,  3.49630780,  4.91269656,  5.03990293},
{  1.87110000,  4.81960000,  2.42370000,  5.55270000},
{  3.29160000,  1.88870000,  6.52260000,  2.54980000},
{  1.02577027,  6.26717017,  3.02097770,  3.79330646},
{  1.08889792,  4.76053318,  3.12725908,  5.52869854},
{  0.94890142,  2.64725255,  5.18459808,  5.43431448},
{  0.60869645,  1.66104147,  4.96642227,  6.05535654},
{  2.32501156,  4.85889731,  4.09460333,  4.37618124},
{  2.33124361,  4.13115147,  5.03832451,  4.13482425},
{  5.62670000,  3.57940000,  3.63050000,  2.72240000},
{  4.19700000,  2.15840000,  1.59240000,  6.35300000},
{  3.23570000,  2.28700000,  3.77150000,  5.95120000},
{  2.35500000,  1.31420000,  7.47490000,  1.63760000},
{  3.51240000,  3.22170000,  5.28090000,  3.90830000},
{  1.71041317,  2.21460454,  4.07049629,  6.47787010},
{  2.11300000,  3.85200000,  4.84450000,  4.87270000},
{  1.69840000,  2.54980000,  5.29430000,  5.39470000},
{  2.18880000,  4.56550000,  3.92940000,  5.05700000},
{  4.47398373,  4.50340956,  3.58449025,  3.68002318},
{  1.62780000,  4.09750000,  3.93600000,  5.68580000},
{  2.32854646,  4.37697399,  3.44268627,  5.55910428},
{  1.05221393,  5.00173427,  4.36603813,  4.70822559},
{  2.68874890,  2.25631323,  2.77983225,  6.87844782},
{  2.83360000,  4.55100000,  5.06100000,  3.63050000},
{  0.76750000,  5.49700000,  2.76150000,  5.39660000},
{  1.05210876,  5.90140772,  3.95237833,  4.20375004},
{  1.41379518,  4.56902792,  5.73150822,  3.69802958},
{  1.56540000,  4.22360000,  2.95510000,  6.35820000},
{  3.46482515,  2.69167159,  5.57198957,  4.39476063},
{  0.32788487,  4.92846336,  1.00250413,  6.66896778},
{  8.01610000,  1.01500000,  1.24210000,  1.99590000},
{  1.40965071,  3.24859511,  3.79414337,  6.62744235},
{  3.34300000,  5.07500000,  3.52970000,  4.66440000},
{  4.36383328,  0.52545936,  7.03324499,  1.69303124},
{  1.43053111,  3.42535818,  6.06395491,  4.60538222},
{  1.52553424,  4.69652916,  3.97731977,  5.65061263},
{  0.78785547,  3.40374091,  6.81701971,  3.68285553},
{  1.99643828,  1.56993227,  7.74196039,  2.43448988},
{  3.59059653,  1.10493742,  2.43114793,  7.23283747},
{  0.59157348,  2.33388011,  3.11138786,  7.56332882},
{  1.60134200,  4.96999648,  5.00033777,  4.51971684},
{  1.64715460,  3.02527827,  3.09226268,  7.16914776},
{  4.14762195,  5.66690873,  3.93081195,  2.88388851},
{  7.30991321,  2.34282240,  2.01737109,  3.17802929},
{  1.81813544,  5.81146695,  5.04057775,  3.28586763},
{  2.72500000,  4.18810000,  4.01950000,  5.68190000},
{  0.72434022,  4.46930762,  5.73036749,  4.50028370},
{  1.12271355,  2.49240949,  6.45401174,  4.96676666},
{  8.18580000,  1.25740000,  1.11490000,  2.02940000},
{  7.03134055,  1.64326599,  2.00461569,  4.31727359},
{  8.63372164,  0.59648853,  0.25332698,  0.13267083},
{  2.88343302,  5.24472346,  3.57891079,  5.13451082},
{  0.63238137,  2.96357169,  4.46461341,  6.78488039},
{  0.79300000,  3.08870000,  5.52690000,  5.87910000},
{  1.83841929,  3.89459053,  4.37188474,  6.13341834},
				
				<dp n="d824"/>
{  0.91034777,  7.34639828,  3.96714020,  2.21509820},
{  5.63760000,  1.89710000,  2.94260000,  5.62110000},
{  0.78936768,  4.34413774,  4.12190400,  6.34302781},
{  7.96615945,  2.19625988,  1.99605833,  2.13240970},
{  1.98143078,  1.73449291,  4.93402285,  6.77309050},
{  3.14640000,  5.61260000,  4.79230000,  3.79180000},
{  1.69972168,  2.08214425,  3.63080163,  7.63872174},
{  1.32483125,  3.17048114,  5.51070206,  6.08730243},
{  0.70967677,  3.49808735,  3.43704395,  7.40203101},
{  4.62297428,  2.82356685,  3.59430579,  6.12762489},
{  4.53330000,  4.73910000,  3.55300000,  4.92870000},
{  1.22840000,  3.70640000,  4.28130000,  6.81860000},
{  1.34928961,  1.92196756,  1.70876240,  8.46603751},
{  1.42498187,  7.16423478,  4.12999496,  3.11605446},
{  2.40047727,  3.16623823,  4.84382122,  6.43272213},
{  2.48100000,  5.33260000,  4.42190000,  5.22120000},
{  2.50150000,  6.67730000,  3.64890000,  4.23680000},
{  4.74551033,  2.15867910,  5.37583194,  5.10838658},
{  1.82390000,  4.57140000,  4.45490000,  6.27150000},
{  1.72228501,  5.90465699,  4.91117534,  4.63947570},
{  3.20810000,  4.45020000,  3.31560000,  6.51400000},
{  1.56708064,  4.57070311,  3.02755847,  7.15550803},
{  0.68148307,  2.60453842,  5.94508113,  6.42076711},
{  0.86744786,  5.67480038,  3.78103456,  6.05159981},
{  8.27156126,  3.36082584,  1.46801232,  1.50535956},
{  1.40032892,  4.30054766,  5.19078747,  6.08324039},
{  2.60722692,  4.12078931,  5.31474241,  5.71035520},
{  0.64930000,  4.10450000,  6.95650000,  4.43020000},
{  2.28980000,  4.66040000,  4.02230000,  6.51540000},
{  1.27230000,  3.49690000,  5.94890000,  6.08530000},
{  1.37639266,  5.00782932,  5.07692743,  5.81954311},
{  8.84097806,  2.00111843,  1.73112804,  1.37213075},
{  0.77910000,  4.47790000,  2.17170000,  7.91160000},
{  1.43196785,  5.12906569,  5.66872837,  5.34237086},
{  1.39041995,  2.85303302,  4.99406517,  7.35233623},
{  3.08580000,  6.88330000,  3.84090000,  4.18050000},
{  8.42319800,  2.05509723,  3.29452524,  1.76688336},
{  0.92688007,  4.04050755,  5.16138576,  6.73502941},
{  8.07521848,  3.43824000,  2.71793398,  2.34016158},
{  0.76947542,  2.08881931,  4.45080288,  8.07823273},
{  2.39837942,  5.13450154,  4.89299397,  5.83591003},
{  2.85605118,  4.97967334,  5.92350670,  4.70366764},
{  7.22200000,  1.88540000,  1.76530000,  5.60820000},
{  2.71980000,  4.01000000,  6.88780000,  4.41360000},
{  2.51716590,  3.98307107,  6.51702084,  5.07484723},
{  0.94537419,  6.88451592,  2.39514517,  6.04870988},
{  1.09245706,  4.16002330,  6.22830437,  5.79351873},
{  2.35093743,  5.86161935,  3.78206776,  6.07997328},
{  0.94850000,  5.31470000,  5.66010000,  5.48090000},
{  1.18755839,  2.46547989,  7.47799145,  5.30335101},
{  0.72777489,  3.06658013,  4.30110855,  7.94716925},
{  3.82981518,  2.52393877,  7.76001968,  3.23000876},
{  3.61010000,  4.27680000,  5.84660000,  5.12760000},
{  0.53551137,  3.15274769,  2.55147392,  8.67419909},
{  0.97926023,  2.55946697,  3.12285282,  8.66607081},
{  0.55532941,  2.19165307,  6.72824320,  6.50502937},
{  1.83760000,  2.31470000,  2.84280000,  8.71560000},
{  1.83760000,  2.31470000,  2.84280000,  8.71560000},
{  3.32083951,  4.75174962,  4.49785660,  6.26028150},
{  0.65130649,  6.90970999,  5.25399243,  4.17564007},
				
				<dp n="d825"/>
{  3.11438237,  5.83427486   5.23631431,  4.70630209},
{  2.28429836,  3.03809429,  7.56678149,  4.72660390},
{  1.08165983,  3.09801020,  6.00229530,  6.89725278},
{  3.08790000,  2.42480000,  5.68320000,  6.83060000},
{  0.80320364,  4.88645184,  3.23307075,  7.71215730},
{  2.82470000,  5.50430000,  5.11480000,  5.48230000},
{  9.66457469,  0.72241715,  0.73603961,  0.38577852},
{  2.99327170,  5.54300234,  6.26703953,  3.98960049},
{  1.62140000,  5.94360000,  4.16200000,  6.29700000},
{  1.78410000,  5.15330000,  5.85290000,  5.68430000},
{  0.78120200,  1.63672160,  8.38575221,  4.80601352},
{  1.31678939,  8.01834598,  4.34605541,  3.51102864},
{  0.97820851,  4.26692920,  4.31887746,  7.74837962},
{  5.06340000,  4.17620000,  6.01510000,  4.32810000},
{  3.51597902,  6.08494491,  4.29446519,  5.51676685},
{  3.36139114,  3.91637920,  5.72115014,  6.24741169},
{  6.08830000,  5.43630000,  3.61600000,  4.32470000},
{  2.39830000,  6.44330000,  3.75540000,  6.11600000},
{  1.11147149,  4.30328685,  1.82271108,  8.71934150},
{  1.63871436,  3.95275142,  5.45264894,  7.18239961},
{  2.02855085,  5.65075047,  4.64130877,  6.49530022},
{  1.94580000,  3.61490000,  5.67930000,  7.16100000},
{  1.59700000,  5.26450000,  4.68320000,  6.94710000},
{  6.68990000,  1.12770000,  5.68740000,  4.70270000},
{  1.47240000,  6.58020000,  7.51260000,  0.43750000},
{  1.43605682,  3.57129694,  4.86798865,  7.98218446},
{  1.35082975,  4.79978242,  5.08229820,  7.18782116},
{  6.59810000,  5.16070000,  4.99920000,  2.68740000},
{  0.85804042,  2.66036181,  3.79617269,  8.97038032},
{  0.57752720,  3.85584150,  2.82063576,  8.92126344},
{  2.76601934,  2.14587280,  8.29033879,  4.68348890},
{  2.27580364,  4.89175504,  6.71997795,  5.39041896},
{  3.47641496,  4.79028162,  6.81795681,  4.71102312},
{  0.93039801,  2.35470380,  2.03067856,  9.66158653},
{  5.24280269,  5.87342961,  5.03715168,  4.13401730},
{  3.33721370,  2.67548096,  6.40789015,  6.76233708},
{  1.56216251,  3.93947215,  7.00708175,  6.20403383},
{  1.34391255,  7.73137752,  5.14339005,  4.25486324},
{  7.41750178,  3.73637944,  3.08194778,  5.37902423},
{  7.32120000,  6.00560000,  3.62490000,  2.16290000},
{  2.19962531,  6.52325907,  5.40432758,  5.56807852},
{  4.93620000,  4.72110000,  4.68730000,  6.25250000},
{  0.73187601,  6.21119149,  4.09183251,  7.21092005},
{  1.79253652,  3.77408073,  7.68580382,  5.60820558},
{  1.13078036,  5.25850420,  6.01079823,  6.58637956},
{  2.43485111,  5.68917861,  6.85232992,  4.84402754},
{  0.67366505,  5.02560379,  3.47361526,  8.45349077},
{  6.86360000,  5.21520000,  4.96220000,  3.22840000},
{  2.16212799,  1.53191572,  7.40567293,  6.89578635},
{  3.73873971,  3.92260064,  5.06203969,  7.37882615},
{  2.10942410,  3.14277918,  4.37038407,  8.75774237},
{  1.59757456,  6.22510211,  4.05319557,  7.29190653},
{  3.25559742,  4.73046932,  6.86808354,  5.56511651},
{  4.52622292,  2.85841971,  8.69240887,  2.65417944},
{  1.26056004,  6.38198672,  4.94052448,  6.67484228},
{  2.27077447,  3.23092900,  3.31767289,  9.27355446},
{  4.64362250,  5.54476344,  4.24857384,  6.54073713},
{  0.87778876,  6.21262913,  3.32501727,  7.93294120},
{  2.75102335,  4.16448628,  6.81864507,  6.56788614},
{  1.03724763,  4.46209680,  3.36610756,  9.07190901},
				
				<dp n="d826"/>
{ 10.61430744,  1.25248983,  0.79488974,  0.29825722},
{  1.70130689,  5.21562264,  3.88195218,  8.38963395},
{  2.43120000,  3.76240000,  5.84110000,  7.84170000},
{  1.02946661,  3.90428545,  6.27275391,  7.78510770},
{  1.65699034,  8.74949369,  2.90585411,  5.37319588},
{  2.58759134,  6.43089846,  4.54053428,  6.94813984},
{  4.90500000,  4.89560000,  5.64060000,  6.11540000},
{  0.55686275,  9.28114166,  4.00477472,  3.90742606},
{  0.61038329,  4.81204953,  6.88326204,  6.84747708},
{  1.71815125,  4.85510539,  7.30381518,  6.17795442},
{  1.08169894,  2.89362957,  5.80959118,  8.65315647},
{  2.37142070,  7.51711915,  4.55736525,  5.95203251},
{  3.94834328,  2.68050954,  7.56836449,  6.20361178},
{  0.54564044,  3.87758027,  3.78915025,  9.52346278},
{  2.58081047,  2.92320529,  8.86926268,  5.17420821},
{  5.02738528,  6.32462173,  4.26820623,  6.09839784},
{  0.72903170,  3.65300944,  7.51390394,  7.17462046},
{  8.17356086,  5.10349515,  2.83298496,  4.62976344},
{  1.97532238,  4.91565205,  6.22708762,  7.51136992},
{  4.55151377,  5.92192617,  6.06545553,  5.56364263},
{  1.39045819,  5.61386640,  8.47073728,  4.34796448},
{  3.03632675,  4.64320306,  6.10075658,  7.53789117},
{  0.79977125,  3.95429196,  4.90566833,  9.20754096},
{  1.85265733,  6.14864006,  6.64512400,  6.36440196},
{  0.85921269,  2.57878725,  6.54695825,  8.70481673},
{  5.33913754,  4.58169580,  6.78995113,  5.57926637},
{  1.61137513,  4.23667418,  4.59640634,  9.23438768},
{  0.77773039,  5.42284598,  3.34374173,  9.26591404},
{  0.92001029,  5.75573266,  4.85671240,  8.33930244},
{  0.82972835,  2.10488103, 10.90536338,  1.87756289},
{  1.68184517,  7.80682195,  6.38121141,  4.82567879},
{  1.00885512,  5.17437788,  6.03487798,  7.97500318},
{  7.37866048,  5.56609740,  4.51195592,  4.70703726},
{  1.82483053,  3.67395636,  7.54960019,  7.40223826},
{  2.81360015,  3.43055611,  8.08047384,  6.65810927},
{  9.30274846,  3.31031206,  4.83883820,  2.94065967},
{  2.02215437,  8.54068625,  5.46996516,  4.78197345},
{  1.25579314,  5.90596091,  6.42340888,  7.25139056},
{  3.16855201,  1.96299080,  9.27163800,  5.55042314},
{  1.12197104,  3.47627070,  6.03946668,  9.00379796},
{  2.31795965,  4.61985356,  5.71764273,  8.45523545},
{  0.86830400,  3.48560358,  2.79081647, 10.50157611},
{  1.32731682,  4.35604190,  5.57674297,  8.91360522},
{  1.36907020,  6.03370451,  7.31392598,  6.31342063},
{  0.81461105,  5.91799246,  7.21449418,  6.71863286},
{  0.77676785,  8.61742544,  4.51391237,  6.20183459},
{  0.96955818,  2.29484854,  9.56821601,  6.01982002},
{  2.86384706,  4.56902790,  4.56249623,  9.24250741},
{  9.74533365,  1.73357571,  1.57835884,  5.95028919},
{  2.79767056,  8.79170726,  3.56330502,  6.20074132},
{  2.28836879,  2.75465096,  5.61332411,  9.63187411},
{  2.72413650,  6.18191018,  5.53391462,  7.86097490},
{ 11.76160020,  0.63134542,  0.47546805,  0.29555005},
{  1.91094350,  6.07895552,  5.48544428,  8.27568275},
{  1.21370233,  4.32335055,  6.66457502,  8.67477432},
{  1.18594424,  2.78138448,  5.45502842, 10.05371769},
{  2.22929878,  6.14469068,  7.46699295,  6.45298636},
{  2.79591683,  2.83135167,  4.33735740, 10.38711814},
{  0.78747333,  6.39393375,  5.81692357,  8.20503567},
{  0.76370119,  2.78809390,  3.14370946, 11.15474098},
				
				<dp n="d827"/>
{  1.11723835,  4.71483644,  4.66368120,  9.88152823},
{  0.93916682,  6.88785336,  6.77076684,  6.99982520},
{  1.60276368,  3.30514684,  8.77524914,  7.28178295},
{  0.92251764,  3.39023345,  4.43048766, 10.56820176},
{  5.79340376,  2.36312960,  9.56320308,  3.63330121},
{  2.71241676,  3.49872684,  3.53303480, 10.61515174},
{  0.67386409,  6.69675668,  2.95976231,  9.52757871},
{  2.49519916,  7.29936215,  6.10335316,  7.01099285},
{  0.99832686,  2.40880100,  6.42354357,  9.90514258},
{  4.01387376,  6.59162609,  6.09807071,  7.10802951},
{  3.49608352,  4.71858106,  8.28710217,  6.68725791},
{  2.27787473,  4.95617707,  6.63521261,  8.67353220},
{  4.14506250,  3.64127269,  3.89205582, 10.20440879},
{  0.97399178,  6.33869199,  4.56383367,  9.41534855},
{  4.15984043,  9.54777210,  5.48922705,  3.56800194},
{  2.40056464,  5.81852817,  5.71816354,  8.97781973},
{  2.35045777,  6.73328445,  7.98562753,  6.25923663},
{  0.85625841,  6.72016523,  8.18650368,  6.42988217},
{  4.19542367,  5.39098152,  6.31874100,  8.26237198},
{  1.27547780,  5.76620603,  4.99258436,  9.80522343},
{  3.68529387,  4.15915911,  9.86937700,  5.32615633},
{  0.71107447,  4.70978679,  3.77271030, 10.97679112},
{  0.66877494,  5.93834796,  2.38106951, 10.81466644},
{  1.33751968,  5.13029803,  6.53386722,  9.36491156},
{ 12.56307254,  0.93468157,  0.84920832,  0.42348664},
{  1.23085824,  4.25341291,  8.71342657,  8.03306504},
{  0.82949585,  3.82074178,  6.17543646, 10.36898905},
{  1.10644169,  3.89956692,  5.41639199, 10.78030461},
{  1.75701769,  4.30332918,  9.57778642,  6.98441454},
{  2.58670629,  3.61601573,  9.40930720,  7.38252302},
{  1.11711964,  5.33961164,  7.26247097,  8.97399030},
{  1.12884095,  6.31375030,  6.51816011,  8.91813271},
{  1.31484974,  2.18370089, 12.27551106,  2.62253120},
{  1.01443115,  2.54877355, 11.73818233,  4.33309132},
{  0.34774385,  1.82783722,  1.62876661, 12.59549507},
{  0.97994586,  7.28869946,  5.89794637,  8.71481793},
{ 12.11453168,  2.95318899,  2.36450881,  2.08030365},
{  3.20328426,  2.91523634,  4.79849243, 11.16087122},
{  0.39407780,  4.99498194,  2.57332231, 11.61269552},
{  1.99022794,  6.13419229,  7.38379789,  8.40500380},
{  1.40306662,  2.69579878, 10.61501684,  6.69882981},
{  0.74186835,  7.70994201,  4.64414578,  9.25069602},
{  4.89704263,  5.35918710,  8.09906544,  6.99708383},
{  0.92288588,  4.09518940,  3.92972179, 11.59674741},
{  2.42897489,  4.64757197,  7.89471050,  8.96657111},
{  1.38902492,  5.96627182,  7.94008793,  8.35998654},
{  1.86051693,  7.14098385,  7.09990896,  8.12643961},
{  1.96359013,  5.27636059,  7.41503586,  9.21637756},
{  2.24507052,  8.53059177,  5.42855859,  8.06965501},
{  1.36089784,  7.72918602,  7.98738655,  6.85762618},
{  4.98127968,  8.23828278,  7.66412694,  4.72203251},
{  0.81803441,  3.64700350, 10.77046446,  6.63265844},
{  2.64396095,  6.64740820,  5.36249272,  9.73302651},
{  0.85721046,  8.97648757,  5.41140639,  8.01509140},
{  1.42735279,  4.50433704,  8.27851263,  9.27178244},
{  0.58781859,  1.49262189, 12.38415019,  4.64545873},
{  2.65351582,  2.42853441, 11.17485949,  6.31403683},
{  2.04620521,  6.60779533,  7.14834362,  8.97875001},
{  0.80439323,  3.85181763,  2.26196590, 12.61279665},
{  2.92145764,  4.34267811,  6.43522260, 10.53267242},
				
				<dp n="d828"/>
{  2.33482997,  5.15803099,  6.46659454, 10.34054980},
{  1.65316504,  7.47331814,  9.05799951,  6.47094250},
{  0.41531975,  6.32611792,  7.81048780,  9.02794475},
{  0.72163873,  5.22495540,  3.45639623, 11.97224325},
{  2.09052746,  5.11789887,  3.52197500, 11.83862453},
{  0.64174199,  7.23509890,  3.49107988, 10.87245652},
{  0.58136635,  6.03319986,  3.77340852, 11.52051703},
{  1.88847880,  4.00700903,  7.34681808, 10.49367730},
{  1.40901082,  5.45959436,  4.73007662, 11.40544217},
{  0.73776988,  4.83606269,  9.18284567,  8.72715339},
{  3.96879248,  2.18603979,  2.84762095, 12.49903569},
{  3.15568267,  6.13406295,  6.90737855,  9.48656145},
{  0.80374107,  4.65769736,  6.39948760, 11.09516625},
{  2.09661987,  3.39005710, 10.38768437,  7.95667875},
{  0.88332189,  3.59791465,  3.82394388, 12.61316034},
{  1.08942200,  3.27182927,  5.96210209, 11.86106055},
{  1.55847253,  6.22902600,  6.74851950, 10.07945058},
{  0.60905689,  3.35885813, 12.06024258,  5.61285870},
{  1.08382049,  5.48905940,  6.05852153, 10.98325259},
{  3.34331887,  6.47396440,  9.59220445,  6.68259687},
{  1.59318007,  2.09545050,  7.16202899, 11.48541550},
{  1.03897082,  4.38732526,  4.70222853, 12.26779854},
{  1.92798261,  5.11639063,  8.09865625,  9.94129707},
{  0.93720103,  8.05063136,  3.78686375, 10.74107924},
{  0.91119552,  1.81953111,  6.03538728, 12.51843564},
{  2.16380492,  7.70566504,  8.84913274,  7.42392169},
{  1.76924750,  7.78185077,  5.57395979, 10.29984737},
{  1.15987388,  9.05765050,  8.75415366,  6.40474782},
{  1.21371823,  4.84729610,  7.22481775, 11.13905058},
{  1.38288988,  7.46133933,  6.82601120,  9.87555447},
{  1.29664362,  4.30129589,  6.03512857, 12.14216497},
{  0.52458287,  7.00147036,  5.23429062, 11.28921139},
{  1.33509209,  6.23521497,  9.42836940,  8.66014090},
{  1.37643962,  4.17636451,  8.02931336, 11.20717250},
{  6.43419688,  7.68704523,  7.96430106,  6.95934814},
{  1.72236359,  7.06395633,  8.26901970,  9.59938874},
{  1.56927388, 10.37173887,  5.72851106,  8.39896556},
{  1.45839622,  5.78397321,  4.50445026, 12.61358842},
{  3.02747083,  4.17525110, 12.32314067,  6.22746505},
{  2.05146571,  4.41343489,  9.23736091, 10.44153825},
{  5.66453026,  9.06175578,  5.41182386,  8.64337000},
{  1.66093555,  5.57904772,  9.05000208, 10.17884825},
{  3.18681036,  7.89504069,  8.51476704,  8.77388749},
{  1.40298641,  5.16091442,  8.03962112, 11.38025515},
{  1.41520071, 10.44754810,  9.48927862,  4.87137641},
{  1.26011031,  5.96100155,  8.35697698, 11.03176007},
{  4.83543487, 11.84478099,  7.29747421,  4.03998236},
{  0.87323832,  5.89116239,  7.64276889, 11.96499196},
{  1.99570001,  8.78756782,  9.06747983,  8.83198069},
{  1.02235503,  7.76639722,  6.94261495, 11.61034744},
{  1.04732053,  6.97494232,  7.32229666, 11.90627484},
{  0.73854685,  8.17096188,  5.40060392, 12.21403914},
{  2.20843937,  7.57276899,  9.57229093,  9.59665485},
{  1.77535285,  9.00145328,  8.05075125,  9.85487384},
{  2.68551656,  6.70379889,  6.01662021, 12.59967759},
{  1.24885269,  9.81972571,  6.75838303, 10.27901643},
{  0.66894325,  4.60403323,  8.62708990, 12.46731496},
{  1.51766960,  4.82660767,  8.14967773, 12.78600143},
{  1.86877729,  4.64809996,  9.05742322, 12.44275804},
{  2.76648261,  4.64942870,  9.22799940, 12.23678137},
				
				<dp n="d829"/>
{  1.61202857,  8.63397367,  8.87509927, 10.65521375},
{  1.82511547,  6.22777413, 10.73435912, 10.87911384},
{  1.38093430,  6.71588232,  9.28350958, 12.07393045},
{  1.80444067,  6.76445168,  8.12958854, 12.92111925},
{  3.47440527,  7.88500975,  8.59696339, 11.60054876},
{  2.32572109,  7.77723715,  8.46668374, 12.10644316},
{  1.33688750, 10.89975644,  6.29384729, 11.29444386},
{  2.64792469,  9.15374122,  8.45512575, 11.39900161},
{  2.83404531,  9.18932276,  9.77927438, 10.32461184},
{  1.47207345,  9.63668301,  6.51404099, 12.72973192},
{  2.01073179,  8.11557312,  9.57967353, 11.77710059},
{  1.52741425,  6.98063061,  9.30346179, 12.90851820},
{  2.15975449, 11.64209182,  6.12475536, 11.56924015},
{  3.66580372,  9.64803926,  7.39415298, 12.26516569},
{  2.14898470,  7.40531177, 10.12399765, 12.64288098},
{  1.65172109,  9.12415911, 10.26071926, 12.04537711},
{ 11.37380673,  6.17262402, 10.98932460,  7.69678064},
{  1.93257054,  9.82814492, 10.03906878, 12.83940772},
{  3.30729405, 11.02212306, 12.58337589,  8.68245192},
{  4.93277768, 12.49805088, 10.53402702, 11.30795961},
{  7.46673668,  9.95870339, 11.92110909, 11.13530351},
{  1.79166482, 12.16424221, 11.50508223, 12.66257869},
};
/*===========================*/
/*Conexant System Inc.                             */
/*4311 Jamboree Road                               */
/*Newport Beach.CA 92660                              */
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                    */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                     */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation   */
/*or adaptation)without the authorisation of Conexant System Inc.   */
/*=============================*/
/*FILE: FLOAT64 gainVQ_2_128_8_5                             */
/*=============================*/
FLOAT64 gainVQ_2_128_8_5[MSMAX_2_128][GVQ_VEC_SIZE_2D]={
{ 1.13718400, 2.00167200,},
{ 1.15061100, 0.80219900,},
{ 0.98207800, 0.51399000,},
{ 1.10500000, 0.15447500,},
{ 0.11378400, 9.42551300,},
{ 0.94094200, 0.70526500,},
{ 0.80243560, 0.34683600,},
{ 0.13515300, 11.12709900,},
{ 0.75909900, 2.88632700,},
{ 0.82919900, 1.39055100,},
{ 0.54780000, 0.75109900,},
{ 0.64942200, 0.21226600,},
{ 0.66705400, 2.16333100,},
{ 0.63880400, 1.02172900,},
{ 0.22345900, 0.31303700,},
{ 0.27085500, 0.04820600,},
{ 1.15294600, 4.53179200,},
{ 1.16686600, 2.75126500,},
{ 1.18999500, 1.39510700,},
				
				<dp n="d830"/>
{ 1.11778400, 0.58757400,},
{ 1.18887200, 3.80809000,},
{ 1.05657500, 2.13161600,},
{ 1.13064700, 1.15821700,},
{ 1.04200000, 0.40869700,},
{ 1.04338300, 5.44336600,},
{ 0.88449000, 3.34760400,},
{ 0.72784500, 1.94726600,},
{ 0.70959500, 0.80566400,},
{ 0.65729500, 4.38794000,},
{ 0.70740000, 2.66792200,},
{ 0.57385300, 1.50683600,},
{ 0.47064300, 0.58837900,},
{ 0.88597700, 2.27373000,},
{ 1.05926600, 1.16308600,},
{ 0.12943500,13.50132800,},
{ 0.85623100, 0.15288900,},
{ 0.69171100, 1.80786200,},
{ 0.91399200, 0.86047400,},
{ 0.10358200,16.23313000,},
{ 0.68111100, 0.08475100,},
{ 0.31958000, 3.21447800,},
{ 0.62654300, 1.71266600,},
{ 0.16217000, 0.85778800,},
{ 0.38586700, 0.25569800,},
{ 0.25176000, 2.38515800,},
{ 0.43364500, 1.23491300,},
{ 0.05389400, 0.50441900,},
{ 0.10640600, 0.05330000,},
{ 0.84213600, 4.74540700,},
{ 1.14440800, 3.24315600,},
{ 0.80336500, 1.68015100,},
{ 0.55854300, 0.54247600,},
{ 0.89434200, 3.77774700,},
{ 1.01672700, 2.42313600,},
{ 0.84586000, 1.08642000,},
{ 0.90643900, 0.47559100,},
{ 0.33732200, 5.75193400,},
{ 0.62728700, 3.78905800,},
{ 1.05076300, 1.70952200,},
{ 0.48097400, 1.01267000,},
{ 0.31390400, 4.65732500,},
{ 0.55670200, 3.24914600,},
{ 0.38080300, 1.55972500,},
{ 0.42559800, 0.68530300,},
{ 1.09926500, 2.79674000,},
{ 0.95508100, 1.41049800,},
{ 0.78678600, 0.68538000,},
{ 0.95358200, 0.23313000,},
{ 0.92961200, 1.97636200,},
{ 0.75708000, 0.97509800,},
{ 0.68356300, 0.40566400,},
{ 0.51043900, 0.10678230,},
{ 0.53942900, 3.70803200,},
{ 0.57837000, 1.86535700,},
{ 0.35109200, 1.20642100,},
{ 0.45661300, 0.29890300,},
{ 0.61108400, 2.72753900,},
{ 0.49322600, 1.42651300,},
{ 0.24345900, 0.70303700,},
				
				<dp n="d831"/>
{ 0.05047600, 0.12981000,},
{ 1.16051300, 5.56319400,},
{ 0.99243800, 3.29063900,},
{ 0.99072500, 1.99141000,},
{ 1.02200000, 0.79869700,},
{ 1.09807600, 4.16487000,},
{ 0.94571700, 2.61474000,},
{ 0.88639400, 1.28403400,},
{ 0.85020100, 0.57653900,},
{ 0.80787100, 5.79903300,},
{ 0.75617700, 3.83105500,},
{ 0.51556400, 2.39465400,},
{ 0.60559000, 1.20642100,},
{ 0.46290200, 5.67811350,},
{ 0.72930000, 3.37976100,},
{ 0.33557200, 1.97353600,},
{ 0.37945600, 0.95202600,},
{ 0.81490800, 3.26847000,},
{ 0.86360200, 1.76652000,},
{ 0.58850100, 0.88940500,},
{ 0.74833100, 0.45808200,},
{ 0.80934600, 2.36844300,},
{ 0.67389000, 1.19824200,},
{ 0.63538600, 0.54712000,},
{ 0.57660000, 0.21887700,},
{ 0.12176500, 4.18505900,},
{ 0.37830600, 2.25265100,},
{ 0.21637000, 1.49602100,},
{ 0.31155400, 0.54434500,},
{ 0.10000000, 3.25577100,},
{ 0.14343300, 1.80127000,},
{ 0.11508100, 0.98077200,},
{ 0.10320100, 0.30653900,},
{ 0.90839600, 5.76712400,},
{ 0.96277000, 3.76910300,},
{ 0.77146900, 2.04766000,},
{ 0.95915800, 0.98334300,},
{ 0.91656900, 4.61102600,},
{ 0.87191100, 2.95691000,},
{ 0.70257400, 1.49621600,},
{ 0.73999100, 0.65808200,},
{ 0.11899700, 7.01306400,},
{ 0.48773200, 4.70539500,},
{ 0.39770600, 2.79362800,},
{ 0.46171900, 1.68674400,},
{ 0.04775300, 5.83900400,},
{ 0.24515600, 3.71567400,},
{ 0.07214400, 2.04602100,},
{ 0.22776900, 1.16631900,},
};
				
				<dp n="d832"/>
/*=========================*/
/*Conexant System Inc.                             */
/*4311 Jamboree Road                               */
/*Newport Beach,CA 92660                             */
/*---------------------------------------------------*/
/*Copyright(C) 2000 Conexant System Inc.                 */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                        */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.   */
/*=========================*/
/*FILE: FLOAT64 gp3_tab                                */
/*========================*/
FLOAT64 gp3_tab[TAB_SIZE_GVQ_3D][GVQ_VEC_SIZE_3D]={
{ 1.16184904, 1.16859789, 1.13656320,},
{ 1.14613289, 1.06371877, 0.91852525,},
{ 1.00344711, 0.90488701, 0.79197966,},
{ 0.89898517, 0.86585984, 0.57621277,},
{ 0.99149439, 0.97843157, 0.97025005,},
{ 0.89739798, 0.86130891, 0.84842344,},
{ 0.86598496, 0.78195693, 0.74571748,},
{ 0.79213167, 0.68469714, 0.57939861,},
{ 0.99928691, 1.06213737, 1.06047882,},
{ 0.91946603, 0.92523551, 0.93225137,},
{ 0.78015244, 0.80748131, 0.87699716,},
{ 0.72123502, 0.75183948, 0.73110569,},
{ 0.71467869, 1.00925302, 1.04508421,},
{ 0.57918595, 0.91509645, 0.84665658,},
{ 0.58059384, 0.63848156, 0.81308216,},
{ 0.61528823, 0.59858664, 0.56355253,},
};
				
				<dp n="d833"/>
/*==========================*/
/*Conexant System Inc.                              */
/*4311 Jamboree Road                                */
/*Newport Beach,CA 92660                              */
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                  */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                    */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation   */
/*or adaptation)without the authorisation of Conexant System Inc.    */
/*==========================*/
/*FILE: FLOAT64 gainSQ_1_32                                */
/*============================*/
FLOAT64
 0.35254579,
 0.25370548,
 0.02227783,
 0.01000000,
 0.96400353,
 0.75700023,
 0.19593419,
 0.15817945,
 0.55403371,
 0.44012518,
 0.17369569,
 0.13850902,
 2.00929650,
 1.35393237,
 0.28748898,
 0.22267504,
 3.05406901,
 2.75461276,
 0.39066788,
 0.30225533,
 6.52227783,
 5.48564881,
 1.00617023,
 0.86949491,
 4.51286186,
 3.52957861,
 0.66628545,
 0.50710786,
 8.51290000,
 7.51286186,
 2.31398228,
 1.83583729,
};
/*==========================*/
/*=========================*/
/*Conexant System Inc.                       */
/*4311 Jamboree Road                         */
/*Newport Beach,CA 92660                       */
/*---------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.           */
/*---------------------------------------------*/
/*ALL RIGHTS RESERVED:                            */
				
				<dp n="d834"/>
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivatiye work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.   */
/*===========================*/
/*FILE:  FLOAT64 gainSQ_1_64                            */
/*==========================*/
FLOAT64
  0.00500000,
  0.01000000,
  0.01613892,
  0.02227783,
  0.08039343,
  0.13850902,
  0.14834423,
  0.15817945,
  0.16593757,
  0.17369569,
  0.18481494,
  0.19593419,
  0.20930461,
  0.22267504,
  0.23819026,
  0.25370548,
  0.27059723,
  0.28748898,
  0.29487215,
  0.30225533,
  0.32740056,
  0.35254579,
  0.37160684,
  0.39066788,
  0.41539653,
  0.44012518,
  0.47361652,
  0.50710786,
  0.53057078,
  0.55403371,
  0.61015958,
  0.66628545,
  0.71164284,
  0.75700023,
  0.81324757,
  0.86949491,
  0.91674922,
  0.96400353,
  0.98508688,
  1.00617023,
  1.18005130,
  1.35393237,
  1.59488483,
  1.83583729,
  1.92256690,
  2.00929650,
  2.16163939,
  2.31398228,
  2.53429752,
  2.75461276,
  2.90434088,
				
				<dp n="d835"/>
  3.05406901,
  3.29182381,
  3.52957861,
  4.02122024,
  4.51286186,
  4.99925533,
  5.48564881,
  6.00396332,
  6.52227783,
  7.01756985,
  7.51286186,
  8.01288093,
  8.51290000
};
/*=========================*/
/*Conexant Svstem Inc.                              */
/*4311 Jamboree Road                                */
/*Newport Beach,CA 92660                              */
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                   */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                     */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.   */
/*===========================*/
/*FILE:  FLOAT64 gainVQ_2_128                              */
/*==========================*/
FLOAT64 gainVQ_2_128[MSMAX_2_128][GVQ_VEC_SIZE_2D]={
{  0.04775300, 5.83900400},
{  0.05047600, 0.12981000},
{  0.05389400, 0.50441900},
{  0.07200000, 1.43869700},
{  0.07214400, 2.04602100},
{  0.10000000, 3.25577100},
{  0.10320100, 0.30653900},
{  0.10640600, 0.05330000},
{  0.11508100, 0.98077200},
{  0.11899700, 7.01306400},
{  0.12176500, 4.18505900},
{  0.14343300, 1.80127000},
{  0.16217000, 0.85778800},
{  0.21637000, 1.49602100},
{  0.22345900, 0.31303700},
{  0.22776900, 1.16631900},
{  0.24345900, 0.70303700},
{  0.24515600, 3.71567400},
{  0.25176000, 2.38515800},
{  0.27085500, 0.04820600},
{  0.31155400, 0.54434500},
{  0.31390400, 4.65732500},
{  0.31958000, 3.21447800},
{  0.33557200, 1.97353600},
{  0.33732200, 5.75193400},
{  0.35109200, 1.20642100},
{  0.35586700, 0.25569800},
{  0.37830600, 2.25265100},
				
				<dp n="d836"/>
{  0.37945600, 0.95202600},
{  0.38080300, 1.55972500},
{  0.39770600, 2.79362800},
{  0.40290200, 4.07811350},
{  0.42559800, 0.68530300},
{  0.42706300, 2.24952200},
{  0.43364500, 1.23491300},
{  0.45661300, 0.29890300},
{  0.46171900, 1.68674400},
{  0.47064300, 0.58837900},
{  0.48097400, 1.01267000},
{  0.48773200, 4.70539500},
{  0.49322600, 1.42651300},
{  0.50338300, 7.44336600},
{  0.51043900, 0.10678230},
{  0.51556400, 2.39465400},
{  0.53942900, 3.70803200},
{  0.54660000, 0.20287700},
{  0.54780000, 0.75109900},
{  0.55670200, 3.24914600},
{  0.57385300, 1.50683600},
{  0.57837000, 1.86535700},
{  0.58850100, 0.88940500},
{  0.60358200, 0.23313000},
{  0.60559000, 1.20642100},
{  0.61108400, 2.72753900},
{  0.62654300, 1.71266600},
{  0.62728700, 3.78905800},
{  0.63538600, 0.54712000},
{  0.63880400, 1.02172900},
{  0.64942200, 0.21226600},
{  0.65729500, 4.38794000},
{  0.66705400, 2.16333100},
{  0.67111100, 0.05475100},
{  0.67389000, 1.19824200},
{  0.68356300, 0.40566400},
{  0.69171100, 1.80786200},
{  0.69515300, 0.12709900},
{  0.70257400, 1.49621600},
{  0.70740000, 2.66792200},
{  0.70959500, 0.80566400},
{  0.72784500, 1.94726600},
{  0.72930000, 3.37976100},
{  0.73999100, 0.65808200},
{  0.74833100, 0.35808200},
{  0.74943500, 0.50132800},
{  0.75617700, 3.83105500},
{  0.75708000, 0.97509800},
{  0.75909900, 2.88632700},
{  0.77146900, 2.04766000},
{  0.78678600, 0.68538000},
{  0.80243560, 0.34683600},
{  0.80336500, 1.68015100},
{  0.80787100, 5.79903300},
{  0.80934600, 2.36844300},
{  0.81490800, 3.26847000},
{  0.82919900, 1.39055100},
{  0.84213600, 4.74540700},
{  0.84586000, 1.08642000},
{  0.85020100, 0.57653900},
				
				<dp n="d837"/>
{  0.85623100, 0.15288900},
{  0.86360200, 1.76652000},
{  0.87191100, 2.95691000},
{  0.88449000, 3.34760400},
{  0.88597700, 2.27373000},
{  0.88639400, 1.28403400},
{  0.89434200, 3.77774700},
{  0.90643900, 0.47559100},
{  0.90839600, 7.06712400},
{  0.91399200, 0.86047400},
{  0.91656900, 4.61102600},
{  0.92961200, 1.97636200},
{  0.94094200, 0.70526500},
{  0.94108100, 1.41049800},
{  0.94571700, 2.61474000},
{  0.95358200, 0.23313000},
{  0.95915800, 0.98334300},
{  0.96277000, 3.76910300},
{  0.97378400, 1.42551300},
{  0.98207800, 0.51399000},
{  0.99072500, 1.99141000},
{  0.99243800, 3.29063900},
{  1.01672700, 2.42313600},
{  1.03854300, 0.79424600},
{  1.04200000, 0.40869700},
{  1.05657500, 2.13161600},
{  1.05926600, 1.16308600},
{  1.09807600, 4.16487000},
{  1.09926500, 2.79674000},
{  1.10500000, 0.15447500},
{  1.11778400, 0.58757400},
{  1.13064700, 1.15821700},
{  1.13718400, 2.00167200},
{  1.14440800, 3.24315600},
{  1.15061100, 0.80219900},
{  1.15294600, 4.53179200},
{  1.16051300, 5.56319400},
{  1.16686600, 2.75126500},
{  1.18887200, 3.80809000},
{  1.18999500, 1.39510700},
};
/*=========================*/
/*Conexant System Inc.                              */
/*4311 Jamboree Road                                */
/*Newport Beach.CA 92660                              */
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                  */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                   */
/*No part of this software nay be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation   */
/*or adaptation)without the authorisation of Conexant System Inc.   */
/*===========================*/
/*FILE:  FLOAT64 gainVQ_3_256                               */
/*==========================*/
FLOAT64 gainVQ_3_256[MSMAX_3_256][GVQ_VEC_SIZE_3D]={
{  0.18423671, 0.06523999, 0.13390472},
{  0.27552690, 0.09702324, 0.05427950},
				
				<dp n="d838"/>
{  0.43928408, 0.09916646, 0.07929166},
{  0.30334933, 0.18716016, 0.31678128},
{  0.41418666, 0.21261386, 0.15384708},
{  0.37873043, 0.42174574, 0.04961395},
{  0.29147613, 0.29845310, 0.40867354},
{  0.43405077, 0.35567807, 0.26669122},
{  0.53415143, 0.29394379, 0.16766848},
{  0.50717581, 0.11896112, 0.37699809},
{  0.66212668, 0.19329986, 0.10043744},
{  0.54479938, 0.42417890, 0.28406764},
{  0.72548595, 0.35772887, 0.24749989},
{  0.60787704, 0.60357108, 0.11571399},
{  0.44866082, 0.50410116, 0.54628895},
{  0.63617079, 0.44004655, 0.39629087},
{  0.60380713, 0.57881179, 0.23710724},
{  0.57147613, 0.32845310, 0.63867354},
{  0.58377105, 0.62781041, 0.35943653},
{  0.84962970, 0.34766924, 0.25346008},
{  0.70304065, 0.42216057, 0.50275130},
{  0.56733319, 0.77096928, 0.44681334},
{  0.67739743, 0.55274660, 0.62815394},
{  0.50377105, 0.59781041, 0.75943653},
{  1.02493622, 0.30657679, 0.22040604},
{  0.89224001, 0.44816208, 0.47573256},
{  0.78742879, 0.65575239, 0.41906662},
{  0.86962970, 0.52766924, 0.45346008},
{  0.70147613, 0.70845310, 0.63867354},
{  0.56375176, 0.54331588, 0.93399510},
{  0.56880138, 0.85878106, 0.65405398},
{  0.89237889, 0.63875680, 0.73716397},
{  1.21640268, 0.51021986, 0.33177812},
{  1.10769596, 0.60105476, 0.51909185},
{  0.92783571, 0.90203672, 0.42962756},
{  0.91304065, 0.82216057, 0.59275130},
{  0.73462016, 0.87102291, 0.79155967},
{  0.51415143, 0.49394379, 1.21766848},
{  0.80147613, 0.80845310, 0.90867354},
{  0.65577617, 0.84190122, 1.06996396},
{  1.04057248, 0.81830130, 0.74445659},
{  1.50153717, 0.23078537, 0.11994055},
{  0.61337482, 1.28879057, 0.59880559},
{  0.92002052, 0.66569019, 1.10918314},
{  0.86113057, 1.00464835, 0.88498578},
{  1.30843346, 0.78609255, 0.56090355},
{  0.68218806, 1.10235747, 1.02459256},
{  0.80147613, 0.80845310, 1.20867354},
{  1.07221236, 1.07266347, 0.70109317},
{  1.04005621, 0.92340675, 1.07639990},
{  1.67199089, 0.43317129, 0.40693115},
{  0.80769819, 1.03723493, 1.21036557},
{  0.65537261, 0.88560134, 1.42463688},
{  0.84912716, 1.37797097, 0.83138440},
{  0.38727281, 0.81106102, 1.61211439},
{  0.97653020, 1.24782107, 0.97497746},
{  1.68437217, 0.69187863, 0.60223674},
{  1.31480645, 0.82070608, 1.13008054},
{  1.40769819, 0.60723493, 1.21036557},
{  1.06758231, 0.90166400, 1.38433931},
{  1.41916427, 0.61926269, 1.23316072},
{  0.76932084, 1.68403889, 0.70472831},
				
				<dp n="d839"/>
{  1.53994895, 0.92045545, 0.84686607},
{  1.17434557, 1.25676753, 1.08675163},
{  0.71281086, 1.31583463, 1.39405615},
{  1.50787704, 1.35357108, 0.41571399},
{  1.28870929, 1.43696572, 0.74659127},
{  1.34769819, 1.23723493, 1.01036557},
{  1.80304065, 0.92216057, 0.52275130},
{  1.59276987, 1.19748085, 0.65036773},
{  0.84678170, 1.14114978, 1.56930890},
{  2.09205535, 0.42435557, 0.27661303},
{  1.07739708, 1.25581010, 1.37870129},
{  2.03213590, 0.68376401, 0.57647235},
{  2.01481852, 0.45383006, 0.85771860},
{  0.61943236, 1.95135273, 0.91598867},
{  1.04773632, 1.59531164, 1.19066755},
{  0.88978466, 0.85386113, 1.90357651},
{  1.29776536, 0.96049994, 1.61141126},
{  1.72645587, 0.69770038, 1.39133233},
{  0.52462760, 1.59032755, 1.64085701},
{  1.00705056, 1.38018864, 1.62839872},
{  2.27773340, 0.42174080, 0.48770699},
{  1.33914079, 1.44432940, 1.40032266},
{  1.86798260, 1.23959629, 1.04625425},
{  1.60300067, 1.45834785, 1.20724126},
{  1.17075928, 1.17666852, 1.84692307},
{  1.41613105, 1.75303586, 1.06875197},
{  0.92063093, 1.92289980, 1.30647683},
{  0.73106711, 1.10141804, 2.15959529},
{  1.78833214, 1.08633166, 1.44314613},
{  0.93493402, 1.72883883, 1.61840939},
{  0.83214354, 1.44720912, 1.92942400},
{  1.54501647, 1.16781309, 1.67929750},
{  1.11904841, 1.57436071, 1.88570305},
{  1.53104237, 1.66544824, 1.54667736},
{  1.14438336, 1.79996622, 1.75932112},
{  1.47409522, 1.21483017, 2.01998560},
{  0.76523771, 2.00844105, 1.79018034},
{  2.04771424, 1.67904043, 0.96105927},
{  0.54181758, 0.98357105, 2.58609881},
{  1.58307521, 1.51532393, 1.79540195},
{  2.43500575, 1.09257895, 0.95481845},
{  0.97756624, 1.44705987, 2.24968026},
{  1.89166746, 1.35363713, 1.80890663},
{  1.18415143, 2.59394379, 0.80766848},
{  1.36028189, 1.68437713, 2.04041326},
{  0.91784174, 2.60471655, 1.20769601},
{  0.80520427, 1.92410272, 2.25712012},
{  2.98285984, 0.68934076, 0.29605000},
{  1.50266600, 2.22699291, 1.50071492},
{  1.82265397, 1.87159390, 1.65277587},
{  1.09905937, 2.18713881, 1.90143173},
{  2.33704557, 1.33227401, 1.58215136},
{  2.35241303, 1.69726111, 1.26872325},
{  1.04808551, 1.49066820, 2.64982303},
{  1.46152881, 1.57356066, 2.40756748},
{  2.72968460, 1.23697995, 1.20994651},
{  2.83739322, 0.72272909, 139076807},
{  0.82555146, 1.04009950, 3.02533361},
{  1.42045226, 1.95032360, 2.28339356},
{  1.80302484, 1.44216516, 2.45919838},
				
				<dp n="d840"/>
{  2.06483654, 1.93254106, 1.86462136},
{  0.67917774, 2.63766396, 2.02787790},
{  1.02634826, 1.92879555, 2.60863396},
{  1.51872521, 2.44014313, 1.86652849},
{  2.30877821, 1.28190051, 2.22497656},
{  0.79031450, 2.45814359, 2.32354362},
{  1.32523818, 2.24315629, 2.36379872},
{  0.98940812, 2.84402782, 1.83831562},
{  1.31665565, 1.82304671, 2.74329139},
{  1.34359003, 1.38343551, 3.00644318},
{  2.20904779, 1.71167907, 2.23001002},
{  1.74638332, 2.10399175, 2.32626365},
{  2.91613501, 1.69537591, 1.26632829},
{  2.59027791, 1.77278764, 1.82930733},
{  1.88338778, 1.81263020, 2.56862447},
{  0.74785364, 1.55314315, 3.25822094},
{  1.84605625, 2.72422494, 1.86433759},
{  1.38835853, 2.41996170, 2.57619188},
{  1.08143706, 2.79353362, 2.34787684},
{  1.69818444, 1.73420492, 2.96331527},
{  3.43403868, 1.33204645, 1.05436621},
{  0.97007105, 2.32342882, 2.91055973},
{  1.00567140, 1.89901787, 3.20776287},
{  0.87244421, 3.43184209, 1.54058124},
{  1.67492020, 1.53714034, 3.23285723},
{  2.55479938, 2.25417890, 2.01406764},
{  1.34771672, 2.01099296, 3.13226841},
{  2.14304065, 3.02216057, 1.59275130},
{  2.59002574, 1.78610442, 2.55361381},
{  1.32123069, 1.59807627, 3.54650542},
{  1.14300592, 2.57639730, 2.98919441},
{  0.92574076, 2.92308627, 2.74152664},
{  1.57092315, 2.78635648, 2.63951611},
{  3.67927168, 1.24912102, 1.54728078},
{  2.62956938, 2.75787484, 1.75649249},
{  1.95505014, 2.52412798, 2.73521856},
{  0.76806683, 1.46836387, 3.91694578},
{  1.26068455, 2.40119239, 3.29000018},
{  1.25882021, 3.10377934, 2.64643382},
{  2.30050748, 2.41997639, 2.66755866},
{  2.30779695, 1.37761745, 3.38026907},
{  1.38704503, 3.71229947, 1.82595078},
{  1.74924880, 3.12919645, 2.51590930},
{  3.49911398, 1.82501924, 1.95192827},
{  1.22345576, 2.06177866, 3.71631753},
{  1.63398319, 2.49769986, 3.31709109},
{  1.05262452, 2.67912301, 3.51114550},
{  0.93657527, 1.56288763, 4.29946587},
{  2.13113770, 3.61726093, 2.05364738},
{  1.33438889, 3.20149678, 3.15944118},
{  0.94607152, 3.97866725, 2.35162303},
{  1.93477378, 2.25684162, 3.68273848},
{  0.94330124, 2.16329723, 4.12284581},
{  1.33319181, 3.67449053, 2.72883988},
{  2.27147613, 2.74845310, 3.23867354},
{  3.02616395, 3.21716252, 1.94899045},
{  2.10687315, 3.16506001, 2.98488232},
{  4.11022232, 1.91121298, 1.68274465},
{  1.18276551, 2.80005028, 3.81211559},
{  1.09284910, 3.35693149, 3.49793360},
				
				<dp n="d841"/>
{  2.12671584, 3.78197824, 2.46859134},
{  2.74764121, 2.89026903, 3.01791201},
{  1.37550113, 2.20827333, 4.31148037},
{  2.11778891, 2.95016434, 3.55388198},
{  1.28935019, 2.59852102, 4.22368022},
{  1.05655533, 3.86933199, 3.24099202},
{  3.05325444, 2.26440201, 3.63344939},
{  3.55488807, 3.33969512, 2.08366736},
{  3.17581401, 3.51831382, 2.49463722},
{  1.86521202, 2.09247637, 4.56744163},
{  1.39255334, 3.07667470, 4.17908984},
{  1.60100173, 2.00209967, 4.75912864},
{  1.79953418, 4.38145628, 2.60616765},
{  1.20655613, 1.79195012, 4.98432651},
{  1.85141571, 3.85261166, 3.44561621},
{  0.87797111, 2.46051806, 4.83101276},
{  2.24150619, 2.50592028, 4.39812285},
{  0.92794754, 0.81807103, 5.40333244},
{  2.07018808, 1.55683902, 4.90385218},
{  1.00141951, 3.09506090, 4.56081930},
{  2.19703965, 4.54754188, 2.58657205},
{  1.68611482, 3.39861080, 4.28953096},
{  2.40798222, 3.84057596, 3.68363236},
{  4.23562265, 2.98668784, 2.85562416},
{  3.35095885, 2.87943539, 3.95403648},
{  1.34643194, 4.30772377, 3.86555652},
{  1.30196206, 3.00084122, 4.97111829},
{  1.16458645, 2.77589093, 5.32708203},
{  2.42328760, 3.86555792, 4.09438379},
{  1.62105343, 1.41238279, 5.79506793},
{  1.87537181, 4.29252889, 4.03861785},
{  1.94915259, 3.75474761, 4.53646174},
{  2.50906157, 3.56636387, 4.51085622},
{  1.88366421, 2.94629459, 5.22399523},
{  2.41081739, 5.11659616, 2.79322600},
{  1.57313722, 3.07734699, 5.34764738},
{  1.79523161, 4.34349109, 4.33952252},
{  2.31312398, 4.51584051, 4.14916283},
{  2.12061524, 3.13076579, 5.38730521},
{  3.91709002, 3.99447396, 3.52701191},
{  1.09473208, 3.48204765, 5.54351159},
{  3.71693971, 4.77440840, 2.95610900},
{  1.94787704, 2.45357108, 6.01571399},
{  1.43082216, 5.35753324, 3.95445396},
{  2.07996690, 3.37146297, 5.54694918},
{  5.27319185, 3.85749737, 1.99698485},
{  1.50998753, 4.13463484, 5.32020642},
{  0.94796341, 5.95733241, 3.40864161},
{  2.78377105, 2.79781041, 5.95943653},
{  1.20436564, 2.53343719, 6.67055599},
{  4.87726112, 4.61271729, 2.71318600},
{  1.52759187, 5.17921822, 4.83658789},
{  1.39911614, 5.70091947, 4.30338189},
{  3.27962970, 4.44766924, 4.94346008},
{  2.07790477, 4.96770690, 5.11185658},
{  3.52060468, 5.55065264, 3.52497139},
{  2.80842248, 4.77477568, 5.04216093},
{  1.28666983, 3.38891971, 6.66482260},
{  0.84228383, 3.37245381, 6.81756747},
{  2.02498925, 4.21727237, 6.17400158},
				
				<dp n="d842"/>
{  1.60165594, 2.32140376, 7.49358970},
{  1.97479938, 5.85417890, 5.31406764},
{  1.84694789, 3.62386827, 7.09537873},
{  2.30906157, 7.06636387, 3.61085622},
{  1.20894988, 4.11824820, 7.18224848},
{  2.23724030, 4.38107866, 6.83186735},
{  5.05892405, 3.39578378, 6.21487747},
{  2.89229838, 6.11530388, 5.49003500},
{  3.45717581, 3.84896112, 7.37699809},
{  5.44334933, 5.88716016, 4.31678128},
{  1.32060468, 5.05065264, 7.72497139},
{  1.52060468, 7.25065264, 6.12497139},
{  5.97620545, 6.67676201, 3.96381875},
{  4.53928408, 6.49316646, 6.57929166},
};
/*-----------------------------------------------*/
/*=========================*/
/*---------------------END---------------------------*/
/*========================*/
				
				<dp n="d843"/>
/*==========================*/
/*========================*/
/*Conexant SystPem Inc.                         */
/*4311 Jamboree Road                            */
/*Newport Beach.CA 92660                           */
/*-------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.               */
/*-------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                   */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*=========================*/
/*LIBRARY:gauss_bv.tab                                */
/*----------------------------------------------------*/
/*=======================*/
/*----------------------------------------------------*/
/*--------------------------TABLES-------------------------*/
/*----------------------------------------------------*/
				
				<dp n="d844"/>
/*==========================*/
/*Conexant Svstem Inc.                            */
/*4311 Jamboree Road                              */
/*Newport Beach,CA 92660                            */
/*--------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                   */
/*--------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                    */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*==========================*/
/*FILE:double bv                                   */
/*----------------------------------------------------*/
/*===========================*/
double bv[32][40]={
{0.129991, 0.064760,-0.002124, 0.031397,-0.095657,
 0.194382,-0.004066, 0.206616, 0.020785, 0.094439,
-0.186531,-0.096221, 0.139813,-0.088682, 0.058761,
-0.054868,-0.027660,-0.174793,-0.165230, 0.108125,
-0.016666,-0.108074,-0.103980, 0.093234,-0.018041,
 0.051019, 0.036860, 0.080444, 0.037322,-0.173828,
 0.034237, 0.125167, 0.077101,-0.299421,-0.044413,
-0.050372, 0.027321,-0.073190,-0.011473, 0.183516},
{0.097175, 0.029658,-0.109162,-0.009789, 0.015654,
-0.066477,-0.040802, 0.046798, 0.179909,-0.286337,
-0.129516, 0.129213, 0.066188,-0.033189, 0.046677,
-0.115491,-0.120577, 0.035435, 0.175051, 0.085733,
-0.060723, 0.101562,-0.030479,-0.086184,-0.053423,
-0.072980,-0.025941, 0.063914,-0.125523, 0.039384,
 0.130419, 0.015899, 0.080340,-0.007682, 0.233579,
 0.106089,-0.212920, 0.002499,-0.212192, 0.118209},
{0.035485, 0.065157, 0.093618, 0.200062,-0.051137,
-0.029000, 0.062292, 0.106185,-0.147534,-0.079012,
-0.007510,-0.313287, 0.128095,-0.136738, 0.127468,
-0.107670, 0.064600, 0.087097,-0.033680, 0.055832,
-0.027791, 0.054826,-0.145352,-0.100984, 0.157922,
-0.087520, 0.016400,-0.204684,-0.061008,-0.105759,
-0.044183, 0.106015, 0.106175, 0.129473, 0.006966,
 0.048202,-0.140265,-0.066978, 0.141637, 0.096585},
{0.032834,-0.117642, 0.022656, 0.028494,-0.042477,
 0.019769, 0.222683,-0.047178,-0.150082,-0.244569,
-0.074121,-0.066537,-0.110890, 0.175115, 0.080115,
 0.053503, 0.031178,-0.262706, 0.144141,-0.003827,
-0.086824,-0.189568, 0.001631, 0.179950, 0.026267,
 0.069194,-0.022789, 0.085670,-0.142656, 0.079799,
 0.040639,-0.022782, 0.011422, 0.135623,-0.003446,
 0.073037,-0.122266, 0.099223, 0.155886,-0.058467},
{-0.119203,-0.113097, 0.087872,-0.088533,-0.008026,
-0.167421, 0.129201,-0.088686, 0.110136, 0.096386,
-0.016415, 0.040387,-0.035463,-0.041054, 0.143447,
 0.008815,-0.129834, 0.194409,-0.123796, 0.055210,
-0.098973,-0.034145, 0.052178, 0.131509,-0.037693,
 0.044694,-0.023161, 0.005800,-0.141310,-0.012245,
 0.184772,-0.098049,-0.154527, 0.195311, 0.145655,
 0.099465,-0.174075, 0.192918,-0.068933,-0.143525},
{-0.060778, 0.055740, 0.088327, 0.040254,-0.012506,
 0.214823,-0.054211, 0.028580,-0.062578, 0.062803,
				
				<dp n="d845"/>
-0.195928, 0.089170,-0.104766, 0.005199,-0.100068,
-0.119735,-0.191318,-0.090582, 0.039863, 0.070813,
 0.186740, 0.087480,-0.219826,-0.096662, 0.000951,
-0.261450,-0.017906,-0.048780, 0.053088, 0.078009,
 0.115528,-0.005575,-0.009188, 0.176039, 0.218530,
-0.025600, 0.033588,-0.089599, 0.020791, 0.100739},
{-0.076643,-0.003437,-0.013056,-0.079689,-0.071113,
 0.173296,-0.117988,-0.066838,-0.168547,-0.026234,
 0.023480,-0.069835, 0.018212,-0.089650, 0.111504,
-0.019748, 0.062012, 0.203651, 0.027630, 0.118083,
 0.008768,-0.047952,-0.109822,-0.055457, 0.100392,
 0.070526,-0.121105,-0.036054,-0.147873, 0.014376,
 0.081282,-0.092077,-0.299010, 0.053782, 0.307327,
 0.037548, 0.013553, 0.012098, 0.080340, 0.194269},
{0.145778,-0.035171,-0.012813, 0.011288,-0.104526,
 0.107178, 0.002405, 0.149185,-0.034991, 0.159099,
-0.214392, 0.177113,-0.174376,-0.125208,-0.009375,
-0.167677, 0.034455, 0.042755, 0.124278,-0.057184,
 0.029397, 0.011394, 0.059449, 0.051856,-0.119031,
 0.171241,-0.054828,-0.110516,-0.119424, 0.111108,
-0.031403, 0.269853,-0.035512,-0.029505, 0.028640,
-0.138673,-0.043852,-0.180966, 0.095736, 0.017216},
{-0.156350,-0.007272,-0.060885, 0.144463, 0.141658,
 0.060423, 0.041233, 0.076823,-0.103529, 0.026638,
-0.061046, 0.084132,-0.035707, 0.200313, 0.004552,
 0.130998,-0.019343,-0.187960, 0.026747,-0.038128,
-0.175123, 0.011099, 0.015914,-0.057416, 0.143100,
-0.107010,-0.123022,-0.015558, 0.030280,-0.073788,
-0.046136,-0.139745, 0.216388, 0.208324,-0.190284,
 0.207782,-0.118317,-0.050262, 0.048587,-0.052573},
{0.165122, 0.151676,-0.173564,-0.112602,-0.077080,
 0.059202,-0.039395, 0.092122, 0.036914,-0.106747,
 0.026758,-0.075714,-0.061968, 0.171587,-0.179532,
-0.221919, 0.067364,-0.168832,-0.005609, 0.038886,
-0.020248,-0.055190,-0.010993, 0.150090,-0.063108,
 0.080500,-0.061449, 0.076655,-0.072982, 0.148202,
 0.032169, 0.194680, 0.047698, 0.110655, 0.159702,
 0.060739,-0.033952,-0.002372,-0.100670,-0.226797},
{-0.004884, 0.039917, 0.007048,-0.057134,-0.069690,
 0.107883, 0.022693, 0.161403, 0.072354, 0.146004,
-0.179598,-0.051756, 0.091652, 0.187559,-0.218109,
-0.012090, 0.201459,-0.003574,-0.093868,-0.186445,
-0.029635, 0.020643, 0.002809,-0.042532,-0.019091,
 0.051347, 0.083461,-0.199734, 0.053807,-0.091675,
 0.042568,-0.091821, 0.118660, 0.091599,-0.113841,
-0.089584, 0.171276, 0.086920,-0.242580, 0.036581},
{0.063443,-0.111705,-0.161460, 0.057088,-0.150777,
 0.100319, 0.001226,-0.223638, 0.119079,-0.112969,
-0.058934, 0.266023,-0.023775,-0.013164, 0.142328,
 0.184226,-0.061167,-0.083061,-0.105554, 0.081692,
-0.020353, 0.061163, 0.175058, 0.158439,-0.104639,
-0.111540, 0.104562, 0.075431, 0.119800, 0.054572,
-0.203585,-0.113775,-0.072451,-0.034755, 0.021198,
 0.003955,-0.072513, 0.042772, 0.027221,-0.019781},
{-0.035894,-0.147947, 0.130019, 0.151861, 0.063417,
-0.099816, 0.059408,-0.133444, 0.037317, 0.055950,
 0.126182, 0.145038, 0.096625,-0.125091, 0.121556,
-0.107565,-0.111177, 0.334839,-0.021953,-0.046918,
 0.055746,-0.075661, 0.073101,-0.007925,-0.009413,
-0.060847, 0.019674,-0.117516, 0.116550,-0.057020,
				
				<dp n="d846"/>
-0.048908,-0.102843,-0.041116, 0.193840, 0.068291,
-0.231657,-0.087831,-0.039631,-0.108096,-0.031144},
{-0.067140, 0.115233,-0.056616,-0.133510, 0.037545,
-0.141381, 0.016872, 0.159134, 0.023496, 0.094566,
 0.028914,-0.039531, 0.140349,-0.185376, 0.329690,
 0.027097, 0.079849,-0.040461,-0.119043,-0.198733,
 0.161095,-0.155212,-0.082065,-0.014902,-0.116972,
 0.026419, 0.009974,-0.071289, 0.056791,-0.111439,
-0.068277, 0.095871, 0.021713, 0.050967, 0.148007,
 0.056072,-0.006431, 0.039573, 0.077210,-0.188060},
{-0.021627,-0.127239, 0.057710, 0.094173, 0.114361,
-0.093565,-0.053670, 0.119475, 0.019379,-0.038257,
-0.019357, 0.016154, 0.080195,-0.048479,-0.084186,
 0.005792, 0.017708,-0.006798, 0.067724, 0.259880,
 0.119032,-0.133580,-0.042929,-0.189572,-0.092819,
 0.118637, 0.163395, 0.235459,-0.084208, 0.085962,
-0.059652, 0.137989, 0.116113,-0.039734,-0.243977,
-0.009411,-0.125925,-0.111694,-0.046045,-0.156416},
{0.202529,-0.022764,-0.087492,-0.001779,-0.180078,
 0.144326,-0.070131, 0.052585,-0.014719,-0.180407,
-0.105484, 0.022611, 0.112231, 0.048219, 0.096614,
-0.100258, 0.182341, 0.259642, 0.139998,-0.161151,
 0.057568, 0.049277,-0.053023,-0.002871,-0.071218,
 0.032438, 0.019060, 0.092027, 0.018050, 0.007029,
 0.038061,-0.044412,-0.205987, 0.069402,-0.034018,
 0.024287, 0.102516,-0.065164,-0.132652,-0.237199},
{-0.086428, 0.126977, 0.015658, 0.078085, 0.169923,
-0.042330,0.080504,0.184454,-0.116599,-0.101825,
-0.019898, 0.029187,-0.086805,-0.065623,-0.227098,
-0.161420, 0.020457, 0.178183,-0.054298, 0.217385,
-0.023337,-0.090671, 0.092256,-0.118044, 0.226933,
-0.067590,-0.013062, 0.009296,-0.133427, 0.089791,
-0.016346, 0.227444,-0.105377, 0.011219,-0.103441,
-0.063450,-0.008793,-0.016484,-0.086660, 0.051254},
{0.288967,-0.037760,-0.002823,-0.181016, 0.139797,
-0.058906,-0.107586,-0.145766, 0.093240, 0.029793,
-0.217238, 0.181808,-0.058832,-0.080496,-0.060148,
 0.044365,-0.080336, 0.044204, 0.092757, 0.053558,
 0.068310, 0.054278, 0.069427,-0.185461,-0.034244,
-0.020880, 0.144972,-0.173171,-0.003225,-0.046869,
 0.031356, 0.072274, 0.090069,-0.072320,-0.068152,
-0.102144, 0.113796,-0.002896,-0.084489, 0.211787},
{-0.004676, 0.012451,-0.068412,-0.050948, 0.094113,
-0.137877, 0.163079, 0.072970,-0.073769,-0.001954,
-0.079508, 0.132505, 0.085707,-0.066978,-0.009364,
 0.139783,-0.035495,-0.015433,-0.019735,-0.137403,
-0.027935, 0.214683,-0.175540, 0.129600, 0.152334,
-0.171772, 0.110761,-0.080756, 0.109677,-0.064781,
 0.092547, 0.083756, 0.084066,-0.154640,-0.126653,
 0.170413,-0.001756,-0.266171,-0.080608, 0.003719},
{-0.142812, 0.178916, 0.030481,-0.018707,-0.014087,
-0.178494, 0.057415,-0.072685, 0.036600, 0.123870,
-0.160648, 0.053520,-0.049866,-0.076900, 0.146260,
 0.121778,-0.002098,-0.102769,-0.145513,-0.094709,
 0.014600, 0.150337, 0.129071,-0.215866,-0.068744,
-0.032681, 0.158858,-0.167257, 0.043318, 0.160275,
-0.149350, 0.071964, 0.072390,-0.036869,-0.115464,
-0.033315, 0.218166, 0.003469, 0.039092, 0.068452},
{-0.113242, 0.029370, 0.151963,-0.137299, 0.140645,
-0.186259,-0.063780,-0.049865, 0.077783,-0.098684,
				
				<dp n="d847"/>
 0.105277,-0.131765,-0.040499, 0.187960,-0.060280,
 0.168357,-0.180927,-0.073977, 0.016167, 0.119988,
 0.249310, 0.160828, 0.016432,-0.104951,-0.103452,
-0.085361, 0.045284, 0.003648,-0.098853, 0.014016,
-0.158963, 0.053626, 0.102125, 0.110043, 0.032758,
-0.066453, 0.112142,-0.020935, 0.014141,-0.136316},
{-0.142626, 0.116170, 0.156714,-0.046193,-0.092763,
 0.059522, 0.095298,-0.191132, 0.171992, 0.089482,
 0.031693,-0.028470,-0.182267,-0.114526,-0.115156,
-0.087294, 0.101460, 0.134756, 0.211311,-0.072667,
-0.184874, 0.016518, 0.073661, 0.117918,-0.099371,
-0.169612, 0.094926, 0.043618,-0.113961, 0.139652,
-0.032290,-0.042327, 0.049550,-0.030139,-0.105134,
 0.165565,-0.024617,-0.008021,-0.081065, 0.094700},
{0.096715, 0.073130,-0.192145,-0.024840,-0.033337,
-0.146108, 0.030637, 0.013074, 0.053903, 0.179474,
-0.092141,-0.136250,-0.021751,-0.075464, 0.041988,
 0.123680, 0.164398,-0.098024, 0.143563, 0.257533,
 0.011460,-0.139854,-0.170764, 0.002622, 0.077216,
-0.098878, 0.013664, 0.192634,-0.168319,-0.019956,
 0.086204,-0.133177,-0.056676,-0.069633, 0.039126,
 0.024861, 0.200507,-0.017833,-0.072507,-0.058732},
{0.188312, 0.211973,-0.026577,-0.030511,-0.005324,
-0.089297,-0.108139,-0.100579,-0.092361,-0.086512,
-0.176998, 0.033879,-0.072401,-0.108418, 0.254736,
-0.068285, 0.077788, 0.021740,-0.154785, 0.031473,
 0.161897, 0.099157, 0.003835, 0.202560,-0.068410,
-0.028448, 0.166791, 0.157988,-0.081325,-0.096342,
 0.113814,-0.053872,-0.037803, 0.003019,-0.105415,
-0.105963, 0.110935,-0.121537,-0.051934, 0.031338},
{-0.005902,-0.025566, 0.090201,-0.202733,-0.087222,
 0.025591, 0.088656,-0.075759, 0.102605,-0.043815,
 0.098726,-0.172410,-0.058015, 0.136373, 0.073529,
-0.267444,-0.089580,-0.132521,-0.121546, 0.030034,
 0.125941,-0.115521, 0.218909, 0.161758, 0.013384,
 0.090387,-0.053082,-0.045271, 0.031092, 0.002709,
-0.093612, 0.150086,-0.043744, 0.207734, 0.059490,
 0.013707,-0.009697,-0.101506, 0.130092,-0.106058},
{-0.031557,-0.216984,-0.117630, 0.043260, 0.010493,
-0.077562,-0.011722,-0.012750,-0.006706,-0.116933,
-0.037242, 0.043246, 0.189936,-0.001128, 0.348653,
-0.114783, 0.103494, 0.065052, 0.017331, 0.216982,
-0.124355, 0.116175, 0.021859, 0.140445,-0.080528,
-0.021540,-0.059484,-0.039156,-0.003790,-0.013488,
 0.024023, 0.127027,-0.085937, 0.029984, 0.005821,
 0.113871,-0.155281,-0.188480,-0.138627, 0.038015},
{-0.055477,-0.078725,-0.227185,-0.069835,-0.083334,
-0.103103, 0.126817, 0.097232,-0.148670,-0.003821,
-0.014695,-0.006567, 0.220706, 0.003373,-0.233583,
-0.059080, 0.096967, 0.105144, 0.074281, 0.062384,
-0.238312,-0.011260,-0.087787, 0.053234, 0.114154,
-0.087050,-0.067738, 0.054583, 0.087169, 0.026215,
 0.022347,-0.002260, 0.024900,-0.085700, 0.274932,
-0.029898, 0.187180, 0.083484,-0.032945, 0.011922},
{0.060811,-0.013551, 0.132393, 0.173236,-0.134129,
-0.025827, 0.146442,-0.144697,-0.165687,-0.041179,
-0.069049, 0.065456, 0.066934,-0.111799,-0.155041,
 0.017693, 0.018106, 0.011958,-0.101361, 0.135540,
-0.026952,-0.072444,-0.099615, 0.048850, 0.074227,
-0.006388, 0.274960,-0.180664,-0.035351, 0.147379,
				
				<dp n="d848"/>
-0.077568, 0.066921,-0.091179, 0.128088,-0.035639,
-0.050608,-0.081541, 0.011615, 0.254577,-0.114920},
{0.092684,-0.170455,-0.066080,-0.104846, 0.063964,
-0.118125,-0.082160, 0.039378, 0.211586,-0.185354,
-0.185207,-0.020687, 0.064207, 0.086469, 0.054981,
-0.041209, 0.119450, 0.052270,-0.011401,-0.010358,
 0.021328, 0.047320, 0.163357,-0.063909,-0.043402,
-0.037520,-0.080772,-0.077397,-0.043713, 0.170929,
 0.173935,-0.110798, 0.010913,-0.267308, 0.154860,
-0.004086,-0.048883, 0.062513,-0.033936, 0.217462},
{-0.102219,-0.085821, 0.120788,-0.004709, 0.153764,
-0.015832, 0.044615,-0.050922, 0.151970,-0.269232,
-0.103572, 0.024964, 0.075853,-0.028581, 0.045409,
-0.060437, 0.030973,-0.070224, 0.212762,-0.005720,
 0.013756, 0.014138, 0.182639,-0.017510, 0.022836,
-0.192755,-0.200316,-0.034771, 0.217484,-0.066266,
 0.050939, 0.024386,-0.037975, 0.057006,-0.169418,
 0.126019, 0.006018, 0.021719,-0.195182, 0.113427},
{-0.036546, 0.066393,-0.168702, 0.006627,-0.003036,
 0.003457,-0.305420,-0.074054, 0.088384,-0.033983,
-0.021283,-0.202710, 0.144675,-0.032790,-0.047744,
-0.008852, 0.142740, 0.106081, 0.060695,-0.062153,
-0.168554, 0.085919,-0.085650,-0.138377, 0.021096,
-0.215684, 0.191959, 0.063860, 0.009517, 0.035008,
 0.177654, 0.126762, 0.055212,-0.008992, 0.022952,
 0.056175,-0.012106, 0.205292, 0.021328,-0.065147},
{0.169865, 0.014836,-0.046132,-0.082306,-0.043342,
-0.145627,-0.056395,-0.148761,-0.028014, 0.116402,
-0.105617,-0.134907, 0.026502, 0.230587,-0.190304,
-0.022587,-0.063537, 0.080261, 0.000346,-0.228381,
 0.112714, 0.047662, 0.114726, 0.127581,-0.164887,
-0.011701,-0.071580,-0.011703,-0.050086, 0.012629,
 0.172233, 0.024553, 0.097856,-0.045110, 0.028485,
 0.053387, 0.206829, 0.082417, 0.106178,-0.175071}};
/*---------------------------------------------------*/
/*============================================================================================*/
/*----------------------END-----------------------------*/
/*==========================*/
/*==========================*/
/*=========================*/
/*Conexant System Inc.                            */
/*4311 Jamboree Road                              */
/*Newport Beach,CA 92660                            */
/*--------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                    */
/*--------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                     */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation */
/*or adaptation)without the authorisation of Conexant System Inc. */
/*==========================*/
/*LIBRARY:lsf_vq.tab                                  */
/*=========================*/
/*------------------------------------------------*/
/*---------------------TABLES------------------------*/
				
				<dp n="d849"/>
/*------------------------------------------*/
/*=========================*/
/*========================*/
/*Conexant System Inc.                               */
/*4311 Jamboree Road                                 */
/*Newport Beach,CA 92660                              */
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                     */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                      */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant Svstem Inc.  */
/*==========================*/
/*FILE:FLOAT64 B_08k                                   */
/*==========================*/
FLOAT64 B_08k[LP_08k][LQMA_08k][MAXLNp]={
{
{
  0.78697605,  0.84277373,  0.84833453,  0.86612158,  0.89184674,  0.86520149,
0.83213462,  0.82649626,  0.81292217,  0.74918146},
{
  0.48850325,  0.51792467,  0.54458026,  0.57964919,  0.65907100,  0.62423454,
0.57897302,  0.57510412,  0.53272744,  0.49711640},
{
  0.27060547,  0.28492453,  0.30887250,  0.34767876,  0.41578426,  0.39193895,
0.36463786,  0.34570964,  0.31077734,  0.30569519},
{
  0.10931949,  0.11859086,  0.13932375,  0.16531784,  0.19670950,  0.19308363,
0.17434501,  0.16239619,  0.14627386,  0.14728680},
},
};
/*===============================*/
/*===============================*/
/*Conexant System Inc.                               */
/*4311 Jamboree Road                                 */
/*Newport Beach,CA 92660                              */
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                      */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                       */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*============================*/
/*FILE:FLOAT64B_40k                                   */
/*==========================*/
FLOAT64 B_40k[LP_40k][LQMA_40k][MAXLNp]={
{
{
  0.45782564,  0.59002827,  0.73704688,  0.73388197,  0.75903791,  0.74076479,
0.65966007,  0.58070788,  0.52280647,  0.42738207},
{
				
				<dp n="d850"/>
   0.19087084,  0.26721569,  0.38110463,  0.39655069,  0.43984539,  0.42178869,
0.34869783,  0.28691864,  0.23847475,  0.17468375},
{
   0.13428787,  0.16384420,  0.23402430,  0.25625744,  0.29236925,  0.27922926,
0.22702581,  0.18550745,  0.15394289,  0.11524615},
{
   0.10410849,  0.10475287,  0.13371967,  0.16283702,  0.18493450,  0.17783386,
0.14728004,  0.11948265,  0.10261001,  0.08146250},
},
{
{
   0.14936742,  0.25397094,  0.42536339,  0.40318214,  0.39778242,  0.34731435,
0.22773174,  0.17583478,  0.12497067,  0.11001108},
{
   0.09932127,  0.15389237,  0.24021347,  0.24507006,  0.26478926,  0.23018456,
0.15178193,  0.11368182,  0.07674584,  0.06122567},
{
   0.07376684,  0.10618676,  0.16013783,  0.17315564,  0.19320946,  0.16507346,
0.10600940,  0.07680543,  0.05146135,  0.03790307},
{
   0.06434994,  0.08328096,  0.10640056,  0.12536714,  0.13771986,  0.11589609,
0.07617342,  0.05429825,  0.03843949,  0.03049829},
},
};
/*===========================*/
/*==========================*/
/*Conexant System Inc.                             */
/*4311 Jamboree Road                               */
/*Newport Beach,CA 92660                            */
/*--------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                  */
/*--------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                   */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*===========================*/
/*FILE:FLOAT64 B_85k                                   */
/*==========================*/
FLOAT64 B_85k[LP_85k][LQMA_85k][MAXLNp]={
{
{
   0.12600104,  0.20991762,  0.34262841,  0.34478999,  0.36982213,  0.34486193,
0.25866520,  0.19844608,  0.15549710,  0.10873224},
{
   0.09497737,  0.14557657,  0.23054897,  0.24608043,  0.27811978,  0.25669288,
0.18951165,  0.14322552,  0.10976944,  0.07578385},
},
};
/**============================*/
/*=========================*/
/*Conexant System Inc.                         */
/*4311 Jamboree Road                           */
/*Newport Beach,CA 92660                           */
				
				<dp n="d851"/>
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                     */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                      */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*===========================*/
/*FILE:FLOAT64 CBes_08k                               */
/*=========================*/
FLOAT64 CBes_08k[MAXLTT_08k][LMSMAX_08k][MAXLNp]={
{{   0.00269624,  0.00462087,  -0.00621642,  0.00078393,  0.00203606,  -0.00385235,    -
0.00063855,  -0.00073735,  0.00002790,  -0.00040057},
{   -0.00012394,  -0.00089956,  -0.00388915,  -0.00432538,  -0.00236658,  -0.00101884,  -
0.00111489,  -0.00046467,  -0.00063866,  -0.00059119},
{   -0.00091016,  0.00047345,  0.00289452,  0.00103649,  -0.00014311,  -0.00025130,     -
0.00192196,  -0.00149023,  0.00030132,  -0.00024519},
{   -0.00259585,  -0.00289246,  -0.00766695,  -0.00713197,  0.00507416,  0.00050759,    -
0.00035725,  -0.00001324,  0.00003991,  0.00018587},
{   -0.00261708,  -0.00708436,  -0.00241436,  0.00289209,  0.00368781,  0.00275999,
0.00069364,  0.00112643,  0.00040431,  0.00059968},
{   0.00260231,  0.00259305,  0.01015206,  0.01053691,  0.00816243,  0.00244675,
0.00002146,  0.00051176,  -0.00072191,  0.00095204},
{   0.00086895,  0.00419154,  0.00104835,  -0.00633587,  0.00568223,  0.00322531,
0.00133821,  0.00097780,  0.00104668,  0.00127673},
{   -0.00387241,  -0.00378492,  0.00043591,  -0.00710766,  -0.00551754,  -0.00367991,   -
0.00182042,  -0.00122951,  -0.00064698,  -0.00034216},
{   0.00459307,  0.01194545,  0.00266756,  0.00170909,  -0.00010835,  -0.00194941,     -
0.00260933,  -0.00076864,  -0.00036982,  -0.00138988},
{   -0.00180246,  0.00572317,  0.00494218,  -0.00200888,  -0.00363662,  -0.00552244,    -
0.00125745,  -0.00142807,  -0.00116519,  -0.00105954},
{   -0.00700839,  -0.01278847,  -0.00523787,  -0.00443510,  -0.00440996,  -0.00465344,  -
0.00353442,  -0.00161417,  -0.00096975,  -0.00051261},
{   0.00070303,  0.00616162,  -0.00457122,  -0.01058358,  -0.00684058,  -0.00639819,   -
0.00173663,  -0.00185740,  -0.00100444,  -0.00115079},
{   -0.00451619,  -0.00642493,  0.00633218,  0.00433383,  -0.00216043,  -0.00197399,    -
0.00291948,  -0.00146477,  0.00004796,  -0.00008603},
{   -0.00139753,  -0.00327792,  -0.00410406,  0.00047675,  -0.00586987,  -0.00831267,   -
0.00310294,  -0.00191523,  -0.00096847,  -0.00098327},
{   0.00163188,  0.00087564,  0.00403069,  0.00512087,  -0.00835469,  -0.00591542,     -
0.00381267,  -0.00157757,  -0.00049671,  -0.00114209},
{   -0.00415972,  -0.00603362,  -0.00972475,  -0.01204002,  -0.00696619,  -0.00547653,  -
0.00232354,  -0.00129666,  -0.00119452,  -0.00056966},
},
{{  -0.00027304,  -0.00013603,  -0.00068813,  0.00046191,  -0.00018108,  -0.00143655,   -
0.00143265,  -0.00096053,  -0.00029350,  -0.00041718},
{   0.00327783,  -0.00262084,  -0.00072357,  -0.00152624,  -0.00289651,  0.00242678,    -
0.00709684,  -0.00418617,  -0.00134299,  -0.00114547},
{   0.00178766,  0.00272996,  -0.00424907,  -0.00511227,  -0.00350740,  -0.00574813,    -
0.00298479,  -0.00178375,  -0.00080082,  -0.00091910},
{   -0.00257793,  0.00036133,  0.00264883,  -0.00468006,  -0.00843945,  -0.01043396,    -
0.00919476,  -0.00608852,  -0.00215225,  -0.00192788},
{   -0.00275632,  -0.00064226,  -0.00106406,  -0.00928170,  0.00164921,  0.00177093,    -
0.00330921,  -0.00201606,  -0.00095143,  -0.00074924},
{   0.00098576,  0.00333945,  0.00294397,  -0.00296495,  0.00327592,  0.00031042,      -
0.00304436,  -0.00168756,  -0.00096723,  -0.00066603},
{   -0.00081979,  -0.00166735,  0.00165792,  -0.00361096,  -0.00656657,  0.00213311,    -
0.00599592,  0.00224467,  0.00019724,  0.00058344},
				
				<dp n="d852"/>
{   -0.00262302,  -0.00197884,  0.00408661,  0.00254664,  0.00058009,  0.00165419,  -
0.00323605,  -0.00381683,  -0.00056288,  -0.00073670},
{   -0.00525909,  0.00144658,  0.00107922,  -0.00301434,  -0.00120794,  -0.00757923,
0.00258690,  0.00014788,  0.00002495,  -0.00031900},
{   -0.00140917,  -0.00409651,  0.00156973,  -0.00483243,  0.00213094,  -0.00734331,  -
0.00348049,  0.00042759,  -0.00052304,  -0.00025610},
{   -0.00026987,  -0.00162823,  0.00194360,  0.00486534,  -0.00358061,  -0.00978809,
0.00031236,  0.00027704,  -0.00069589,  -0.00070222},
{   -0.00250411,  0.00120978,  -0.00274384,  0.00233910,  0.00139088,  -0.00736257,  -
0.00754632,  -0.00465566,  -0.00148867,  -0.00220448},
{   0.00000985,  0.00354670,  0.00241602,  0.00381914,  -0.00498555,  0.00034259,
0.00007178,  -0.00160886,  -0.00018617,  -0.00073934},
{   -0.00030544,  0.00020933,  0.00356684,  -0.00290166,  -0.00629055,  -0.00501993,  -
0.00710975,  -0.00422976,  -0.00177327,  -0.00156522},
{   -0.00226254,  -0.00391714,  -0.00326461,  -0.00151939,  -0.00365321,  -0.00340561,
0.00355831,  -0.00279590,  -0.00107019,  -0.00087203},
{   -0.00319889,  0.00356115,  -0.00255526,  -0.00187794,  -0.00567546,  -0.00040661,  -
0.00596883,  -0.00525175,  -0.00086633,  -0.00158737},
},
{{  0.00007492,  0.00274526,  0.00053401,  0.00097771,  0.00018040,  -0.00303219,  -
0.00170872,  -0.00089653,  -0.00020116,  -0.00062042},
{   -0.00201631,  -0.00125767,  -0.00196945,  -0.00464759,  -0.00288294,  -0.00428708,  -
0.00183602,  -0.00071289,  -0.00093030,  -0.00067826},
{   -0.00223623,  -0.00171246,  -0.00046686,  0.00170002,  0.00244198,  0.00108873,
0.00191275,  0.00055247,  0.00040544,  0.00017678},
{   -0.00149753,  -0.00154993,  0.00079974,  0.00221293,  -0.00553476,  -0.00346923,  -
0.00211231,  -0.00154997,  -0.00037169,  -0.00069879},
{   0.00289225,  -0.00045208,  0.00151539,  -0.00150161,  -0.00144310,  -0.00308428,
0.00211248,  0.00132638,  0.00017002,  0.00056742},
{   -0.00114496,  0.00024257,  0.00315614,  -0.00436637,  -0.00261428,  0.00296444,  -
0.00371535,  -0.00308495,  -0.00033931,  -0.00035859},
{   0.00047727,  0.00066667,  -0.00498548,  -0.00147002,  -0.00211159,  0.00158957,  -
0.00093119,  -0.00238958,  -0.00021992,  -0.00044901},
{   -0.00071416,  -0.00142483,  -0.00099961,  -0.00030932,  0.00108240,  -0.00304381,  -
0.01041545,  -0.00518788,  -0.00149510,  -0.00175121},
{   0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{   0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{   0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{   0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{   0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{   0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{   0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{   0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000
0.00000000,  0.00000000,  0.00000000,  0.00000000},
};
/*================================================================================================*/
/*=================================================================================*/
/*Conexant System Inc.                  */
/*4311 Jamboree Road                    */
/*Newport Beach,CA 92660                     */
				
				<dp n="d853"/>
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                     */
/*----------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                      */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*=======================*/
/*FILE:FLOAT64 CBes_40k                               */
/*========================*/
FLOAT64 CBes_40k[MAXLTT_40k][LMSMAX_40k][MAXLNp]={
{{  0.00842379,   0.00868718,  0.01533677,   0.00423439,   -0.00886805,   -0.02132286,  -
0.03152681,  -0.01975061,  -0.01152093,  -0.01341948},
{   0.02528175,   0.04259634,   0.03789221,   0.01659535,   -0.00266498,   -0.01529545,  -
0.01653101,  -0.01528401,  -0.01047642,  -0.01127117},
{   0.00995479,  0.00363859,   0.00806370,   0.00822096,   0.00620995,   -0.00070450,  -
0.01144342,  -0.01579542,  -0.00221153,  -0.00294104},
{   0.01825004,   0.02545979,   0.04466266,   0.02836983,   0.01316085,   0.00027194,  -
0.00400197,  -0.00838218,  -0.00375841,  -0.00973750},
{   0.00296122,  -0.00108515,   -0.01175420,   -0.01975204,   -0.02622812,   -0.03646736,  -
0.04191239,  -0.02314044,  -0.01950957,  -0.00848902},
{   0.01074297,   0.00681698,   0.00056120,   -0.00407483,   -0.01399303,   -0.02157338,  -
0.01318401,  -0.01868371,  -0.02269936,  -0.00789793},
{   0.00161361,   -0.00204469,   -0.00577466,   -0.00520582,   -0.01194833,   -0.01701884,  -
0.02718566,  -0.03396933,  0.00356014,  0.00207288},
{   0.00128185,  0.00071461,   -0.00353124,   -0.00421683,   -0.00402716,   -0.01095437,  -
0.01997320,  -0.01228136,  -0.01038306,  -0.01511933},
{   0.01263317,   0.00885365,   0.00553783,   0.00332289,   0.00051954,   -0.00463222,  -
0.00479201,  -0.00059580,  -0.00296811,  -0.00742176},
{   0.02932750,  0.05512251,   0.05469747,   0.03776658,   0.02375761,   0.01262417,
0.00718223,  0.00132870,  0.00011158,  -0.00513680},
{   0.00642743,  0.00434195,  0.02734756,  0.02479522,  0.01571155,  0.01283758,
0.01229307,  0.01044734,  0.00897595,  0.00630824},
{   0.01460256,   0.03932975,   0.06822591,   0.05302119,   0.04169594,   0.03078633,
0.02255555,  0.01244313,  0.00953978,  0.00142364},
{   -0.00287700,  -0.00594367,  -0.00427960,  -0.00935634,  -0.01810575,  -0.01295170,  -
0.00769887,  -0.00571883,  -0.00874120,  -0.01136659},
{   0.01008734,  0.01526783,   0.00777807,   0.00070427,   0.00135748,   -0.00536141,  -
0.01289474,  -0.01106339,  -0.01607998,  -0.02069269},
{   -0.00328972,  -0.00552321,  -0.00318850,  -0.00178185,  -0.00147855,  -0.00051298,  -
0.00279881,  0.00132960,  -0.00017352,  -0.00197559},
{   0.00121992,   -0.00434412,   0.01514515,   0.01817932,   0.01049800,   0.00520725,
0.00023122,  -0.00368011,  -0.00530645,  -0.00881600},
{   0.00199953,  -0.00256907,  -0.01114171,  -0.02208218,  -0.03765710,  -0.02107483,  -
0.00931923,  -0.01498688,  0.00281978,  0.00017816},
{   0.02318353,   0.02670253,   0.01494551,   -0.00435182,   -0.01874850,   -0.02816325,  -
0.02151003,  -0.01875342,  -0.01056712,  -0.01030210},
{   0.00593350,   -0.00144199,   -0.00319629,   0.00534692,   -0.00410015,   -0.00689996,  -
0.00585349,  -0.01388552,  0.00983518,  0.00370328},
{   0.02103832,    0.01958430,   0.01633620,   0.00746899,   -0.00235633,   -0.00929591,  -
0.00554876,,  -0.00612474,  -0.00324632,  -0.00700581},
{   0.00234866,  -0.00352786,  -0.02131325,  -0.03497021,  -0.05395155,  -0.05653978,  -
0.02600962,  -0.01502758,  -0.00980138,  0.00243400},
{   0.01568001,   0.01102804,  -0.00170998,  -0.02008550,  -0.03923722,  -0.04625200,  -
0.02200445,  -0.01343909,  -0.00778321,  -0.00400345},
{   -0.00585802,  -0.01166306,  -0.02076399,  -0.01569569,  -0.02319850,  -0.02849718,  -
0.03356291,  -0.04020848,  -0.00730455,  0.00321833},
				
				<dp n="d854"/>
{   0.00185346,   0.00678275,  -0.00153838,  -0.01371849,  -0.01459743,  -0.02278911,   -
0.03180223,  -0.01313531,  -0.01769927,  -0.01864802},
{   0.00821169,  0.00139332,  -0.00460277,  -0.01685032,  -0.02524833,  -0.00457010,
0.00196353,  -0.00415526,  0.00912706,  0.00274897},
{   0.03471515,  0.03244906,  0.01761282,  0.00942270,  0.00084999,  -0.00060117,
0.00424733,  0.00201139,  0.00120962,  -0.00201383},
{   0.00874697,   0.00243208,  -0.00304610,  0.00436503,  0.00711522,  0.00403357,
0.00297985,  -0.00013373,  0.00316739,  -0.00155733},
{   0.03284353,  0.04366651,  0.03130752,  0.02318913,  0.01642637,  0.01414287,
0.01412819,  0.01325717,  0.00966138,  0.00557574},
{   -0.00897348,  -0.01645486,  -0.02303920,  -0.02958479,  -0.04569751,  -0.01492066,  -
0.01361113,  -0.01301319,  -0.00757028,  0.00636876},
{   -0.00187898,  0.00446579,  -0.00080704,  -0.00978002,  -0.02210903,  -0.02856633,  -
0.00962606,  -0.01269407,  -0.00658807,  -0.00520677},
{  -0.00446633,  -0.01073344,  -0.02048699,  -0.03419970,  -0.02140272,  -0.00647786,  -
0.00772629,  -0.00141074,  0.00209371,  0.00587952},
{   0.00902524,   0.00471972,  -0.00531728,  -0.00875254,  0.00077703,  -0.00500107,  -
0.00748311,  -0.00872906,  -0.01258366,  -0.01533540},
{   0.00084134,  -0.00457492,  0.00907268,  -0.00166421,  -0.00738630,  -0.01300070,  -
0.01171425,  -0.00534867,  -0.00189046,  -0.00597370},
{   0.00495534,  0.02747202,  0.02105600,  0.01350886,  0.00672681,  0.00692694,
0.00961278,  0.00731403,  0.00734680,  0.00074704},
{   -0.01085449,  0.00040259,  0.01902320,  0.01121839,  0.01057293,  0.00799889,
0.00903296,  0.00546843,  0.00715537,  -0.00173898},
{   0.00891381,  0.01614815,  0.05052174,  0.03900262,  0.02759091,  0.02061948,
0.01293547,  0.00629289,  0.00473463,  -0.00084806},
{   -0.01427083,  -0.02305916,  -0.02815308,  -0.02282330,  -0.02653827,  -0.01853194,  -
0.01096763,  -0.00407586,  -0.00043150,  0.01353875},
{   0.00451472,  -0.00037789,  -0.00521137,  -0.00857891,  -0.01433970,  -0.02416975,  -
0.02263041,  0.00545231,  0.00509081,  -0.00233034},
{   -0.00732576, -0.01382500,  -0.02440248,  -0.00600805,  -0.00823324,  -0.01648982,  -
0.00672027,  -0.01575532,  0.00458639,  0.00142685},
{   -0.00584221,  0.00239261,   0.00002187,  -0.00722194,  -0.00486836,  -0.00676743,  -
0.00609408,  -0.00910835,  -0.00233031,  -0.00402547},
{   0.00156682,  0.00529745,  0.01074526,  0.01358844,  0.01228688,  0.01451921,
0.00886985,  0.00921486,  0.00922770,  0.01278627},
{   0.02888988,  0.04401362,  0.04449791,  0.03793522,  0.03615802,  0.03507046,
0.02857499,  0.02323810,  0.01532404,  0.01091717},
{   -0.00673575,  0.00708902,  0.04383843,  0.03175772,  0.02881380,  0.02740709,
0.02920017,  0.02384121,  0.01895719,  0.00803623},
{   0.02514915,  0.05928013,  0.07204149,  0.06324505,  0.05974481,  0.05096021,
0.04377068,  0.03425910,  0.02087256,  0.01162497},
{   -0.00748868, -0.01403437,  -0.01834467,  -0.02220715,  -0.01698717,  0.00975040,
0.01151622,  0.00725551,  0.00642775,  0.00104778},
{   0.00209732,  0.00931211,   0.00439910,  0.00138879,  0.01378028,  0.00911980,
0.00353992,  0.00010052,  0.00002712,  -0.00501547},
{   -0.00165095,  -0.00688923,  -0.01339332,  -0.01799657,  0.00760584,  0.02621803,
0.02225676,  0.01309325,  0.01073847,  0.0333487},
{   0.01340580,  0.00737926,  0.00937836,  0.00955465,  0.02491769,  0.02088644,
0.01809767,  0.01206103,  0.00688650,  -0.00225557},
{   -0.00280285, -0.01027851,  -0.02114079,  -0.03232847,  -0.05019914,  -0.01541405,
0.01040407,  0.00488665,  0.00735409,  0.00230072},
{   0.01769232,  0.01286728,  0.00509533,  -0.00385545,  -0.01360630,  -0.01065628, -
0.00099360,  -0.00752588,  0.00392812,  0.00249821},
{   -0.00287736, -0.00927581,  -0.01141761,  0.00494131,  -0.00006858,  0.00383888,
0.00928349,  0.00680291,  0.01299393,  0.00903792},
{   0.01338085,  0.00684954,  0.02016501,  0.01396750,  0.00394469,  0.00215369,
0.00532778,  0.00390260,  0.00729791,  0.00281916},
{   -0.00782735,  -0.01769183,  -0.03956412,  -0.04925343,  -0.06255674,  -0.04770456,  -
0.01246839,  -0.00352283,  -0.00008778,  0.00496558},
				
				<dp n="d855"/>
{   -0.00043147,  -0.00420665,  -0.01525085,  -0.01865562,  -0.02901928,  -0.04225189,  -
0.01238412,  0.00284584,  -0.00262297,  -0.00200952},
{   -0.01897721,  -0.03002013,  -0.04202603,  -0.04157439,  -0.01953528,  -0.00909125,  -
0.00557029,  0.00296829,  0.00837520,  0.02272494},
{   -0.00430169,  -0.00701750,  -0.01399148,  -0.01425799,  -0.01951155,  -0.02099896,  -
0.00401286,  -0.00855452,  0.00210266,  0.00148451},
{   0.00089308,  -0.00573222,  -0.00687366,  -0.01404191,  -0.02040077,  0.01115878,
0.00754778,  0.00379226,  0.00494852,  -0.00162361},
{   0.02273135,  0.02268721,  0.02202985,  0.01772318,  0.01595899,  0.01831229,
0.02009693,  0.01988832,  0.01756866,  0.01336297},
{   -0.00802140,  -0.01147725,  0.01735733,  0.01614599,  0.01890368,  0.02527107,
0.02535296,  0.02521981,  0.01936066,  0.00964759},
{   0.01101261,  0.02459861,  0.03007775,  0.03132783,  0.02500170,  0.03112715,
0.02820242,  0.02555671,  0.01990715,  0.01604691},
{   -0.01044815,  -0.02010963,  -0.03231533,  -0.05076033,  -0.04215723,  -0.01116070,  -
0.00748550,  0.00002613,   0.00462318,   0.01521166},
{   0.00336939,  -0.00304703,  -0.00880680,  -0.01591634,  -0.02904755,  -0.02472976,
0.01099256,  0.00917770,   0.00472864,   0.00252114},
{   -0.01183996,  -0.02066113,  -0.03460361,  -0.04184939,  -0.01041113,  -0.00188617,  -
0.00098410,   0.00161789,   0.00375380,   0.01394438},
{   -0.00039830,  -0.00466744,  -0.01262580,  -0.02111370,  0.00587910,  0.01104953,
0.00437385,  -0.00111574,  -0.00144865,  -0.00880168},
{   -0.00912855,  -0.00967373,  0.00714008,   0.00163746,  -0.00275357,  -0.00691492,  -
0.00575918,  -0.00602136,  -0.00407011,  -0.00454880},
{   -0.00255543,  0.00614921,   0.03687539,  0.01820347,  0.00124175,  -0.00730685,  -
0.00935798,  -0.01262178,  -0.00737867,  -0.01012977},
{   -0.01333849, -0.01591748,  0.00305090,  0.01086912,  0.01047755,  0.00849883,
0.00303463,  0.00222270,  0.00134141,  -0.00025796},
{   -0.00936362, -0.01047446,  0.03651876,  0.03415287,  0.02215632,  0.01364159,
0.00618621,  0.00076102,  0.00062994,  -0.00592997},
{   -0.00648855,  -0.01113029,  -0.02130286,  -0.02415974,  -0.00906372,  -0.02048675,  -
0.01897523,  -0.00729972,  -0.01465304,  -0.00324484},
{   -0.00073009,  -0.00478232,  -0.00809012,  -0.00674682,  -0.00699652,  -0.01274285,  -
0.01476475,  -0.02101635,  -0.02841145,  -0.00256900},
{   -0.01541940,  -0.02257801,  -0.01269042,  -0.00663735,  -0.01383393,  -0.01014917,  -
0.00815281,  -0.00144199,  -0.00101933,  0.00214340},
{   -0.00430707,  -0.01008551,  -0.00538098,  0.01127611,  0.00180862,  -0.00383903,  -
0.01162061,  -0.01239840,  -0.02236644,  -0.01754571},
{   0.00250399, -0.00145059,  0.00744185,  0.00239925,  0.00187795,  0.00368643,
0.00341092,  0.00234075,  0.00295276,  0.00274923},
{   0.02220381,  0.02667705,  0.03016336,  0.02484058,  0.02302165,  0.01687465,
0.01248381,  0.00801419,  0.00575512,  -0.00123957},
{   -0.01289551,  -0.01948192,  0.00749604,  0.03972999,  0.02799627,  0.03095827,
0.02682699,  0.01926759,   0.01536589,  0.00359824},
{   -0.00694105,  -0.00274076,  0.06283919,  0.05831478,  0.04446961,  0.03475004,
0.02466616,  0.01660218,  0.01015739,  0.00001262},
{   -0.00663293,  -0.01124560,  -0.02072134,  -0.02087353,  0.00350779,  -0.00267171,  -
0.00781240,  -0.00568940,  -0.00619713,  -0.00664816},
{   0.00052805,  -0.00203616,  -0.00862252,  -0.00794312,  0.01109699,  0.00296591,  -
0.00783946,  -0.00642006,  -0.01293148,  -0.01997245},
{   -0.01385446, -0.02235013,  -0.02005617,  0.00658714,  0.00311085,  0.00396594,  -
0.00201973,  0.00017492,   0.00070455,  0.00196768},
{   0.00312050,  -0.00502734,  -0.00391517,  0.02334708,  0.01492120,  0.00609770,  -
0.00166321,   -0.00414391,  0.00144125,  -0.00101720},
{   -0.00548185,  -0.00927002,  -0.00735945,  -0.01104572,  -0.01737564,  -0.02531887,  -
0.02824219,  -0.00834746,  -0.00524587,  -0.00124403},
{   0.00458493,   0.01671853,  0.00619380,  -0.00362342,  -0.01016732,  -0.01291563,  -
0.00905806,  -0.00497735,  0.00129131,  -0.00231415},
{   -0.01024597,  -0.01324182,  -0.00754560,  -0.00682415,  -0.00605662,  -0.00314351,  -
0.00866384,  -0.00828965,  -0.00057488,  0.00290604},
				
				<dp n="d856"/>
{    0.00035898,  0.00655540,  0.00886062,  0.00948731,  0.00050215,  -0.00606058,-
0.00747207,  -0.00688271,  -0.00352236,  -0.00803250},
{   -0.00793173,  -0.01967196,  -0.04026658,  -0.03192191,  -0.04031043,  -0.04440686,-
0.03706285,  -0.01990808,  -0.00593113,  -0.00039715},
{   -0.00635586,  -0.01153473,  -0.02387486,  -0.02909210,  -0.04337326,  -0.05288439,-
0.01514696,  -0.00500377,  -0.00569617,  0.00585471},
{   -0.01430856,  -0.02562646,  -0.04221961,  -0.01853589,  -0.01402970,  -0.02227550,-
0.02219039,  -0.02338731,  -0.00807786,  0.00288073},
{   -0.00998135,  -0.01806646,  -0.02136027,  -0.00730465,  -0.01160051,  -0.01000576,-  
0.01280801,  -0.01978523,  -0.02645340,  0.00062405},
{   -0.00361873,  -0.00711001,  -0.01113611,  -0.01442181,  0.00048802,  -0.00555145,-
0.00999573,  -0.01397199,  0.00258458,  -0.00163856},
{    0.01608025,  0.02072329,  0.00865589,  0.00419188,  0.00587315,  0.00650795,
0.00746960,  0.00493725,  0.00530017,  0.00091609},
{   -0.00258830,  -0.00860751,  -0.01643995,  -0.00330272,  0.01669732,  0.00724283,
0.00455523,  -0.00064296,  -0.00070869,  -0.00461911},
{    0.00045132,  0.01927470,  0.02936541,  0.02556292,  0.02449298,  0.01514524,
0.00763378,  -0.00025992,  -0.00107520,  -0.00837104},
{   -0.00807614,  -0.01468184,  -0.03526087,  -0.05143390,  -0.01592930,  -0.01986599,-
0.02407442,  -0.01347152,  -0.00877064,  -0.00363455},
{    0.00179084,  -0.00207469,  -0.02147562,  -0.03247891,  -0.00458303,  -0.00969956,-
0.01977553,  -0.00722409,  -0.01118867,  -0.01567662},
{   -0.01156613,  -0.01882328,  -0.02689507,  -0.02577053,  -0.00530313,  -0.00582166,-
0.00599250,  -0.00717979,  -0.00327482,  0.01205451},
{   -0.00629756,  -0.01144468,  -0.01480162,  -0.01132932,  0.00363022,  0.00554277,-
0.00203589,  -0.00919722,  -0.01756165,  -0.00323606},
{   -0.00505869,  -0.01212584, -0.01604989,  0.01406907,  0.00703596,  -0.00003723,-
0.00630506,  -0.01217800,  0.00493628,  -0.00140540},
{    0.01614992,  0.01499725,  0.01847138,  0.01780286,  0.01376991,  0.00696326,-
0.00071808,  -0.00218387,  0.00076887,  -0.00600070},
{   -0.00922172,  -0.01839712,  -0.01718859,  0.02629952,  0.03169211,  0.02054630,
0.01191487,  0.00581676,  0.00289883,  -0.00428161},
{    0.00130289,  -0.00293433,  0.01502302,  0.03529064,  0.04162203,  0.02984230,
0.01820698,  0.01010425,  0.00515796,  -0.00325531},
{   -0.00803390,  -0.01768812,  -0.04490980,  -0.03476464,  0.00128782,  -0.00700112,-
0.00889952,  -0.00925927,  -0.01047435,  -0.01210404},
{   -0.00224388,  -0.00885128,  -0.01431027,  0.00056043,  -0.00175653,  -0.00957837,-
0.00213878,  -0.00217443,  -0.00787601,  -0.01324443},
{   -0.00942789, -0.02489036,  -0.04548997,  0.00419906,  -0.00204955,  -0.00847809,-
0.00757134,  -0.01278104,  0.00092336,  -0.00456560},
{   -0.00862279,  -0.01784181,  -0.03137311,  -0.01016528,  0.02029932,  0.01087722,
0.00126383,  -0.00187619,  -0.00820948,  -0.01128958},
{   -0.00214451, -0.01012148,  -0.00815792,  0.03032796,  0.02118089,  0.01465145,
0.01434881,  0.00924109,  0.01234463,  0.00621214},
{    0.01901068,  0.02546003,  0.03184928,  0.02975200,  0.03929600,  0.03399356,
0.02994347,  0.02317742,  0.01472360,  0.00403768},
{   -0.00706920, -0.01106330,  0.02697666,  0.04237599,  0.04876120,  0.05446952,
0.04454959,  0.03625874,  0.02458257,  0.01328984},
{    0.00584135,  0.02277180,  0.05493147,  0.04792701,  0.05513066,  0.05228310,
0.04242706,  0.03760509,  0.02533449,  0.01376458},
{   -0.00832225,  -0.01877720,  -0.04596338,  -0.05353089,  0.00746299,  0.02192792,
0.01409321,  0.00663039,  0.00261977,  -0.00681113},
{    0.00048273, -0.00539747,  -0.00945376,  0.00004885,  0.02869582,  0.02042802,
0.00703972,  0.00314249,  -0.00177051,  -0.00789829},
{   -0.01064635,  -0.02694699,  -0.04942587,  -0.00398838,  0.02460442,  0.01967373,
0.01925711,  0.01424337,  0.01004813,  0.00270193},
{   -0.00332860,  -0.01091961,  -0.01848431,  -0.00486287,  0.04553311,  0.03898003,
0.02721398,  0.02015112,  0.01086293,  0.00201390},
{   -0.00652335, -0.01144519,  -0.01534182,  -0.01807526,  -0.02371538,  -0.00915732,
0.00588846,  -0.00487463,  -0.00623341,  0.00441392},
				
				<dp n="d857"/>
{   0.00716741,  0.00382678,  -0.00052349,  -0.00409624,  -0.01208226,  -0.01751940,
0.00470209,  0.00223712,  -0.00350926,  -0.00490031},
{   -0.01538645,  -0.02243737, -0.00924649,  0.00355542,  0.00165311,  0.00918893,
0.00653865,  0.00877182,  0.00712893,  0.00802341},
{   -0.00267666,  -0.00919867,  0.00496288,  0.01178975,  0.00884084,  0.01289639,
0.01257300,  0.00820578,  0.00408443,  0.00147009},
{   -0.01264225,  -0.02720729,  -0.05722194,  -0.03947146,  -0.03242657,  -0.03326879,-
0.00982578,  -0.00860058,  -0.00088398,  0.00086213},
{   -0.00386645,  -0.01399853,  -0.03824488,  -0.02228856,  -0.02298534,  -0.03454881,-
0.00544705,  -0.01098026,  -0.01050510,  -0.00581305},
{   -0.01967032,  -0.03639457,  -0.04382661,  0.00038419,  0.00103522,  0.00788552,
0.00487504,  0.00554907,  0.00846038,  0.00736618},
{   -0.01839912,  -0.02937407, -0.03617522,  -0.01499036,  -0.00692504,  0.00184427,-
0.00044529,  0.00611089,  0.00796965,  0.01773673},
{   -0.00683449,  -0.01304168, -0.02052076,  -0.01609455,  -0.00102776,  -0.00319254,
0.01275266,  0.00963052,  0.00370009,  -0.00121833},
{   0.01103437,  0.00541947,  0.00506780,  -0.00383360,  -0.00847884,  0.00753648,
0.01370641,  0.01064539,  0.01309200,  0.00628886},
{   -0.00977018,  -0.01846998, -0.02291703,  0.00347842,  0.01944544,  0.01631708,
0.02954462,  0.02392258,  0.01608993,  0.00555268},
{   0.00848938,  0.00893435,  0.01777669,  0.01872626,  0.02955171,  0.03076567,
0.03584935,  0.02911589,  0.01758367,  0.00627147},
{   -0.01398691,  -0.02483689,  -0.05063277,  -0.06137782,  -0.01182542,  -0.00872281,-
0.00491626,  -0.00299305,  -0.00062419,  0.00398992},
{   -0.00631871,  -0.01176534, -0.02465955,  -0.03502781,  0.00645603,  0.01117879,
0,00357097,  0.00024658,  -0.00036118,  -0.00601290},
{   -0.01238566, -0.02782555, -0.06269483, -0.04600188,  0.00970197,  0.00648747,
0.00596559,  0.00457740,  0.00247241,  -0.00273583},
{   -0.00773967, -0.01358329, -0.02234491, -0.02257646, 0.02203643, 0.02084404,
0.01128873,  0.00604494,  0.00035335,  -0.00668373},
},
{{  0.00589332,  0.00462334,  -0.00937151,  -0.01478366,  0.00674597,  0.00164302,-
0.00890749,  -0.00091839,  0.00487032,  0.00012026},
{   -0.00346857,  -0.00100200,  -0.00418711,  -0.01512477,  -0.00104209,  -0.00491133,-
0.00209555,  0.00045850,  0.00023339,  0.00567173},
{   -0.00028271,   0.00224414,  0.00099960,  -0.01264817,  0.00158111,  0.00022627,-
0.01842169,  -0.01055957,  0.00042331,  -0.00405902},
{   -0.00390851,  -0.00352008,  -0.00207375,  0.00120978,  -0.00464186,  -0.00376280,-
0.00221930,  -0.01267883,  -0.00542772,  0.00871528},
{   -0.00382147,  -0.00416908,  -0.00485174,  -0.00203840,  0.00230541,  0.01428577,-
0.00348975,  -0.00203438,  0.00540564,  0.00212166},
{   -0.00658368,  -0.00562053, -0.00032279, -0.00877305,  -0.00793305,  0.00320924,-
0.00170063,  0.00284923,  0.00552278,  0.00194940},
{   -0.00306744,  -0.00298506,  0.00275083,  -0.00903488,  -0.00722304,  0.00779413,-
0.00659414,  -0.01601075,  0.00131982,  -0.00042380},
{   -0.00248310,  -0.00449444,   0.00566261,  -0.00065823,  -0.00872763,  -0.00130268,-
0.01288316,  -0.00693877,  -0.01220849,  -0.01360034},
{   -0.00072128,  0.00231367,  0.00035512,  -0.01551778,  0.00432592,  0.00565027,
0.00593031,  0.00810666,  0.00899915,  0.00625029},
{   -0.00066179, -0.00173624, -0.00431518, -0.00780679, -0.00602446, -0.00298258,
0.00230417,  0.01526494,  0.00530183,  0.00378699},
{   0.01420960,  0.01196404,  -0.00294391,  -0.00888598,  0.00196835,  0.00379997,-
0.00358727,  -0.00099442,  0.00276169,  0.00178194},
{   0.00321848,  0.00710562,   0.00119961,  -0.00705532,  -0.00591387,  -0.00790931,-
0.00594289,  -0.00112852,  -0.00141542,  0.00020474},
{   0.00158007,  0.00075190, -0.00438742, -0.00815969,  -0.01423721,  0.00789778,-
0.00626154,  -0.00721660,  0.00986720,  0.00544411},
{   0.00053880,  0.00193110, -0.00320550, -0.01120683,  -0.01402005,  -0.00860931,-
0.00088470,  0.00359764,  0.00639980,  0.00638517},
				
				<dp n="d858"/>
{   0.00514671,  0.00724043,  0.00484854,  -0.00241769,  -0.00502971,  0.00567643,-
0.00615547,  -0.01736942,  0.00360319,  0.00082512},
{   -0.00123535,  0.00317582,   0.00109983,  -0.00277902,  -0.00785073,  -0.00623414,-
0.00634773,  -0.00697720,  -0.00355725,  -0.00067376},
{   -0.00232563,  0.00140314,  -0.00001979,  -0.00260601,  0.00649245,  0.00124911,-
0.00845958,  -0.01423763,  0.00877591,  0.00516649},
{   -0.00033112,  -0.00053678,  -0.00671801,  0.00048873,  -0.00504141,  -0.00520921,-
0.01312229,  -0.01582773,  0.01416822,  0.00967165},
{   -0.00111536,   -0.00099037,  0.00077595,  0.00925548,  0.00657777,  -0.00082887,-
0.02043111,  -0.02532625,  -0.00004947,  0.00413641},
{   0.00223668,  0.00440574,  -0.00389912,  -0.00163039,  -0.00531277,  -0.01246551,-
0.00572137,  -0.01703647,  0.00128153,  -0.00021183},
{   -0.00489011,   -0.00537238,  0.00466282,  0.00913929,  0.00263062,  0.00055262,-
0.00633866,  -0.00173384,  0.00295317,  0.00492165},
{   -0.00518055,   -0.00184590,  -0.00615225,  -0.00513941,  -0.00640695,  -0.00674303,-
0.00939142,  -0.00503372,  -0.00261001,  0.00054585},
{   0.00342481,  0.00123740,  0.00395662,  0.01448936,  -0.00232972,  -0.00130577,-
0.00847327,  -0.01335209,  0.00276921,  -0.00077323},
{   -0.00054923,  -0.00210083,  0.01190224,  0.00837311,  -0.00532849,  -0.01568541,-
0.02727868,  -0.01972403,  -0.00978498,  -0.00572220},
{   0.00127495,  -0.00040612,  -0.00190491,  -0.00183223,  0.00169595,  0.00266085,
0.00532158,  0.00218445,  0.00658819,  0.00644266},
{   0.00234860,  0.00330952,  -0.00328322,  -0.00849035,  -0.00205267,  -0.00707072,-
0.00859310,  0.01122104,  0.01656984,  0.01134028},
{   0.00280211,  0.00477070,  0.00686869,  0.00053437,  -0.00232578,  -0.00783250,-
0.02164326,  0.00027012,  0.01494755,  0.00888127},
{   -0.00069263,  -0.00203166,  0.00079744,  -0.00185686,  -0.00644126,  -0.01254378,-
0.02563748,  0.00489706,  0.00806657,  0.00414407},
{   0.00050861,  -0.00178828,  0.00750363,  0.00202558,  -0.00285327,  0.00807892,-
0.01136765,  0.00086126,  0.01255455,  0.00718041},
{   -0.00388121,  0.00019894,  0.01275788,  -0.01009612,  -0.01482093,  -0.00157354,-
0.00274766,  0.00461392,  0.00591598,  0.00479990},
{   0.00389949,   0.00561890,  0.00164381,  0.00179842,  -0.01061784,  -0.00488127,
0.00294474,  -0.00246773,  0.00633013,  0.00082486},
{   -0.00182684,   0.00331154,  0.01501940,  -0.00102040,  -0.01454819,  -0.01631174,-
0.00713666,  -0.00529551,  0.00133896,  -0.00110141},
{   0.00707108,  0.00404909,  -0.00897539,  -0.00171521,  -0.00538120,  0.00675914,
0.00805150,  0.00315939,  0.00552084,  0.00303929},
{   0.00097440,  0.00046715,  -0.01037887,  -0.00704198,  -0.00189990,  -0.01032341,
0.00730091,  0.00133774,  0.00755266,  0.00594051},
{   -0.00429144,  -0.00107703,  -0.00272150,  0.00592237,  0.00373714,  -0.00153810,-
0.00265470,  -0.00380070,  0.00191190,  -0.00334290},
{   -0.00249022,  -0.00255174,  -0.00161664,  0.00646709,  -0.00455495,  -0.01892915,-
0.00189057,  -0.00146743,  0.00201011,  0.00303839},
{   0.00307047,  0.00152128,  0.00274522,  -0.00813843,  -0.00637170,  0.02161188,
0.00769219,  0.00422507,  0.01083575,  0.00554388},
{   -0.00026886,  0.00146906,  0.00690360,  -0.00233633,  -0.00743382,  0.00197966,
0.00461441,  -0.00077399,  0.00622981,  0.00926711},
{   -0.00095175,  -0.00300642,  0.00349728,  0.00973936,  0.00130663,  0.01672464,
0.00214381,  -0.00479473,  0.00021323,  -0.00504992},
{   -0.00796774,  -0.00777454,  0.01472064,  0.00419640,  0.00009850,  -0.00227039,-
0.00413390,  -0.00745379,  -0.00530568,  -0.00508610},
{   -0.00234006,  0.00776935,  0.00056224,  -0.00061124,  -0.00076573,  0.00180958,
0.00268168,  0.00534481,  0.00376392,  0.00642912},
{   0.00198816,  0.00290657,  0.00129810,  -0.00500597,  -0.01289560,  -0.02129240,
0.00221555,  0.01412627,  0.00494994,  0.00218721},
{   0.00723649,  0.00496646,  0.00543579,  -0.00103025,  0.00171306,  0.00331929,
0.00035451,  0.01023642,  0.00581490,  0.00815197},
{   0.00084689,  0.00051713,  0.00802087,  0.00446553,  -0.00621724,  -0.00873814,-
0.00885721,  0.00624454,  -0.00380893,  -0.00302404},
				
				<dp n="d859"/>
{   -0.00243724, -0.00216389,  -0.00117648,  -0.00252831,  -0.01632920,  0.00478344,
0.01074398,  0.00398316,  0.00820569,  0.00334913},
{   0.00486904,  0.00644839,  0.01191909,  0.00233043,  -0.01100158,  -0.00947657,
0.00863266,  0.01294053,  0.01078684,  0.00924624},
{   0.00463246,  0.00231681,  0.01278480,  0.00716155,  0.00188431,  0.00390487,-
0.00117313,  -0.00118873,  0.00141110,  -0.00260139},
{   -0.00759524,  -0.00214592,  0.01757851,  0.00191647,  -0.00642818,  -0.00735460,
0.01055379,  0.00696078,  -0.00141687,  -0.00544053},
{   0.00157257,  -0.00417419,  -0.01018863,  0.01614394,  0.00408876,  0.00277369,
0.00445860,  -0.00524322,  0.00999605,  0.00688280},
{   0.00487436,  0.00148844,  -0.00299441,  0.00966635,  -0.00545120,  -0.01094305,
0.00934612,  0.00000377,  0.01068280,  0.01285382},
{   0.00610992,  0.00526033,  -0.00074024,  0.00850982,  0.00886539,  0.00381742,-
0.00354831,  -0.00656414,  0.00863265,  0.00417819},
{   0.00136375,  0.00410255,  0.00605260,  0.00491661,  0.00043020,  -0.01139207,-
0.00163925,  -0.00745387,  0.00095721,  0.00119725},
{   0.00166585,  0.00142636,  -0.00379524,  0.00486954,  0.00892121,  0.00957308,
0.00322862,  0.00561332,  0.00188950,  0.00386129},
{   -0.00357255,  -0.00403382, -0.00152553,  0.00568588,  -0.00278822,  0.00284068,
0.00261788,  0.00745671,  0.00662131,  0.01260820},
{   -0.00156450,  -0.00201631,  0.00324050,  0.02500402,  0.00272701,  0.00027856,
0.00547226,  0.00365120,  0.00179261,  -0.00147760},
{   0.00029645,  -0.00428110,  0.00888215,  0.00687383,  -0.01547752,  0.00437531,-
0.00116347,  -0.00941400,  0.00762043,  0.00402898},
{   -0.00251414,  -0.00204373,  -0.00289258,  -0.00308742,  0.00311107,  0.01010143,
0.01046861,  0.01386760,  0.01371189,  0.01189869},
{   0.00085058,  0.00284917,  0.00433633,  0.00378226,  -0.00066686,  -0.01165624,
0.00075283,  0.01762876,  0.00938403,  0.00269279},
{   0.00116966,  0.00140161,  0.00644003,  0.00630100,  0.00481016,  0.00067718,
0.00302025,  -0.00006228,  0.01579197,  0.01360116},
{   -0.00129828,  -0.00112730,  0.00413839,  0.01474563,  0.00591950,  -0.00769547,-
0.01692050,  0.00026673,  0.00314501,  0.00088163},
{   0.00050192,  -0.00019614,  0.00523667,  0.00906082,  -0.00532943,  0.01006419,
0.00564608,  0.01186492,  0.00969477,  0.00395468},
{   -0.00472998,  -0.00313090,  0.00439118,  0.00022579,  -0.00887046,  -0.00911719,
0.00020407,  0.01041237,  0.01523070,  0.01085361},
{   0.00119451,  0.00284162,  0.00615884,  0.01153521,  0.00517547,  0.00277399,
0.00832575,  0.00779691,  0.00324772,  0.00351751},
{   -0.00519556,  -0.00295172,  0.02525489,  0.01798212,  -0.00438738,  -0.01222669,-
0.00900323,  -0.00185156,  0.00339578,  0.00260920},
{   -0.00270637,  -0.00222864,  -0.00539474,  -0.01321067,  0.00789722,  0.00313879,-
0.00453286,  0.00561428,  -0.00475956,  -0.00890697},
{   -0.00118036,  -0.00042033,  -0.00719468, -0.01000462,  -0.00682112,  0.00535234,
0.00235443,  -0.00474756,  -0.00545839,  0.00110324},
{   -0.00225500,   -0.00171062,  -0.00466855,  -0.00747594,  0.01389486,  0.00992659,-
0.00695008,  -0.02006762,  -0.01364416,  -0.00078982},
{   -0.00085803,  0.00410182,  -0.00196015,  -0.00639579,  0.00078628,  -0.00226078,-
0.00861787,  -0.01373490,  -0.02391058,  -0.00808851},
{   -0.00063885,  -0.00001952,  -0.00743163,  -0.01553771,  0.01422720,  0.01936474,
0.00728046,  -0.00008372,  -0.00367349,  -0.00708286},
{   -0.00143970,  -0.00178368,  -0.00273734,  -0.00958149,  -0.01110954,  0.01782250,
0.00774218,  -0.00147129,  -0.01449725,  -0.01403554},
{   -0.00070646,  0.00159104,  0.00274791,  -0.00326417,  0.01380166,  0.01596148,
0.00444873,  -0.00546512,  -0.01887057,  -0.01582117},
{   -0.00144073,  -0.00261082,  0.00273428,  -0.00317007,  -0.00558809,  0.01255326,
0.00109155,  -0.01208593,  -0.02965142,  -0.00191764},
{   0.00283848,  0.00393704,  -0.00296926,  -0.00944444,  0.00507323,  0.00666967,
0.00841999,  0.00754188,  -0.00201340,  -0.00680120},
{   0.00480224,  0.00081276,  -0.01865624,  -0.00093591,  0.00293862,  -0.00865280,
0.00171235,  0.00781937,  -0.00444062,  -0.00614202},
				
				<dp n="d860"/>
{   0.00445001,  0.00326413,  -0.01123814,  -0.00595242,  0.01485198,  0.00558687,-
0.00356026,  -0.00424684,  -0.01156887,  -0.01361932},
{   -0.00001678,  0.00143093,  -0.00345284,  -0.00553204,  0.00216156,  -0.01013138,-
0.01031674,  0.00521731,  -0.00806113,  -0.01077367},
{   -0.00184428,  0.00471354,  0.00859489,  -0.01317721,  0.00266957,  0.00773321,
0.00466730,  -0.00016286,  -0.00560587,  -0.00721775},
{   -0.00150527,  0.00246554,  -0.00357066,  -0.00724693,  -0.00780699,  -0.01201075,
0.00866401,  0.00266341,  -0.01053797,  -0.00947744},
{   0.00630638,   0.00710376,  0.00061292,  0.00335619,  0.00813022,  0.01010773,
0.00259815,  -0.00391783,  -0.00935298,  -0.01174642},
{   0.00342893,  0.00256425,  -0.00293257,  0.00447207,  -0.00452771,  -0.01078035,-
0.00152854,  -0.00582106,  -0.02093782,  -0.01548175},
{   0.00174264,  0.00486940,   0.00101490,  -0.00369979,  0.00914580,  -0.00046007,
0.00393674,  -0.00514304,  -0.00502874,  -0.00318928},
{   0.00367157,  0.00164282,  -0.00259170,  -0.00102131,  -0.00130364,  -0.00405688,-
0.00361148,  0.00155262,  -0.00264098,  0.00186231},
{   0.00379067,  0.00092008,  -0.01490638,  0.00899597,  0.00682106,  -0.00394004,-
0.00989744,  -0.01493545,  -0.00413015,  -0.00533970},
{   0.00324614,  -0.00281525,  -0.00637901,  0.00571717,  -0.00898235,  0.00195685,-
0.00582317,  -0.01132263,  -0.00403691,  -0.00861630},
{   -0.00529028,  -0.00491416,  0.00404015,  -0.00201376,  0.00941126,  0.00059865,-
0.01008402,  -0.00255501,  -0.00695912,  -0.00756088},
{   -0.00119706,  -0.00423473,  -0.00828492,  -0.00284703,  -0.00058170,  -0.00458320,-
0.00889183,  -0.00170038,  -0.01224148,  -0.00964573},
{   0.00188817,  0.00283448,   0.00026518,  0.01441261,  0.01227742,  0.00509984,-
0.00687448,  -0.01384025,  -0.01981324,  -0.01406364},
{   -0.00053697,  0.00136264,   0.01095638,  0.00811139,  0.00453491,  -0.00084917,-
0.01580995,  -0.02585460,  -0.03501521,  -0.01882424},
{   -0.00161777, -0.00076829, -0.00361048, -0.00596857, 0.01843197, 0.00988164,
0.00150586,  0.00012576,  0.00777538,  0.00518969},
{   -0.00210784, -0.00409224, -0.00920995, 0.00092189, 0.00542201, -0.00211517,-
0.00765625,  0.00629464,  0.00842455,  0.00411284},
{   0.00003792,  0.00222472,  0.00228015,  0.00100784,  0.01260415,  0.00201989,-
0.01000386,  0.00598743,  0.00253893,  -0.00282166},
{   0.00507067,  0.00480165,  -0.00272484,  0.00565289,  0.00121260,  -0.00570415,-
0.01959834,  -0.00317788,  -0.00411844,  -0.00695937},
{   -0.00376294,  0.00059416,  0.01423623,  0.00080375,  0.00643702,  0.00686370,-
0.00313787,  -0.00987418,  -0.00299491,  -0.00249963},
{   -0.00806457,  0.00222565,  0.00504739,  -0.00636976,  -0.00098179,  -0.00726277,-
0.00505596,  -0.00341247,  -0.00422603,  -0.00245231},
{   -0.00067223,   0.00090078,  0.00075010,  -0.00162500,  0.00183818,  0.00897492,-
0.00282313,  -0.00134597,  -0.00390676,  -0.00756619},
{   0.00171542,  0.00674575,  0.00696047,  0.00121510,  -0.00079761,  -0.00280685,-
0.00419458,  -0.00418100,  -0.00817770,  -0.01188108},
{   -0.00480908, -0.00299589, -0.00693984, -0.00437097,  -0.00048672,  0.00064401,
0.00503113,  0.00470563,  0.00008420,  0.00227688},
{   -0.00010864, -0.00080145,  -0.00089350,  -0.00030148,  -0.01136001,  -0.01489977,
0.00793012,  0.00084201,  -0.00747283,  0.00764944},
{   -0.00175219,  -0.00341623,  -0.00793373,  0.00795065,  0.01151782,  0.00477091,
0.00103290,  -0.00150988,  -0.01301039,  -0.01109959},
{   -0.00213945,  -0.00034159,  -0.00073789,  0.00375862,  0.00220275,  -0.00676203,-
0.00223236,  -0.00809945,  -0.02018789,  0.00074251},
{   -0.00192672, -0.00173695,  -0.00081662,  -0.00184874,  -0.00358986,  0.01475006,
0.01613872,  0.00823781,  -0.00473629,  -0.00807271},
{   0.00345772,  0.00341053,  0.00500926,  -0.00330046,  -0.01186972,  0.01181906,
0.00440546,  0.00265077,  -0.00258333,  -0.00760893},
{   -0.00042330,  0.00083297,  0.00375033,  0.00502954,  0.00372912,  0.00148808,
0.01280970,  0.00292874,  -0.01416698,  -0.01890834},
{   0.00113566,  0.00249418,   0.00389607,  -0.00536590,  -0.01420978,  -0.00016841,
0.00287547,  -0.00624030,  -0.01628379,  -0.00581503},
				
				<dp n="d861"/>
{   -0.00135987,  0.00077581,  0.00264995,  -0.00236121,  0.00861954,  0.00648555,
0.01697403,  0.01659641,  0.00547484,  -0.00009327},
{   -0.00262019, -0.00285140, -0.00443122,  -0.00008469,  -0.00708718,  -0.01345062,
0.02067079,  0.01735198,  0.00351791,  -0.00193104},
{   -0.00385576, -0.00350660, -0.00083694,   0.00705176,  0.00994210,  0.00368093,
0.00642495,  0.01024715,  0.00118806,  -0.00376492},
{   0.00622286,  0.00543629,  -0.00045749,  0.00418943,  -0.00317214,  -0.01015493,
0.01309732,  0.00753043,  -0.00646111,  -0.00717690},
{   0.00083145,  0.00045971,  -0.00461627,  -0.01645929,  -0.014586680,  0.01870089,
0.02118257,  0.00993928,  0.00277086,  -0.00044704},
{   0.00482793,  0.00551503,  0.00208811,  -0.00565857,  -0.01268429,  -0.00426449,
0.02459712,  0.01985106,  0.00847906,  0.00460058},
{   0.00293454,  0.00421160,  0.00457712,  0.00374468,  0.00332494,  0.01346970,
0.01175397,  0.00792934,  0.00201689,  -0.00183101},
{   0.00120334,  0.00415760,  0.00695187,  0.00696322,  -0.00317111,  0.00161058,
0.00970844,  0.00009515,  -0.00806091,  -0.00043975},
{   -0.00187667,  -0.00216523,  -0.00190075,  0.00979870,  0.00245961,  -0.00083074,
0.01583148,  0.00805848,  0.00650797,  0.00323620},
{   -0.00197460,  -0.00480332,  -0.00926156,  0.00782345,  -0.00159864,  -0.00761256,
0.01016645,  0.00047921,  -0.01013106,  -0.00271237},
{   -0.00114979,  -0.00094748,  0.00052070,  0.00669376,  0.01050549,  0.00668137,
0.00315455,  -0.00712109,  -0.00558144,  0.00578709},
{   0.00320088,  0.00416886,   0.00593271,  0.00483418,  0.00568066,  0.00139672,-
0.00959812,  -0.01323612,  -0.00508168,  -0.00319184},
{   -0.00440848,  -0.00146257,  0.00310220,  0.00221527,  0.00519237,  0.00742201,
0.00520584,  0.00481628,  -0.00233592,  0.00289503},
{   -0.00286947,  -0.00476632,  0.00102804,  0.00037028,  -0.00499286,  -0.00369873,
0.00335549,  0.00450933,  -0.00478313,  -0.00727082},
{   0.00562573,  0.00177228,  -0.00388755,  0.01529287,  0.00637977,  -0.00311580,
0.00524145,  -0.00226732,  -0.01257961,  0.00160312},
{   0.00824527,  0.00640849,  0.00417142,  0.00499035,  -0.00196902,  -0.00136031,-
0.00185235,  -0.00845783,  -0.01908885,  -0.00931572},
{   0.00315259, 0.00242346,  -0.00524211, -0.00194243,  0.01131435,  -0.00315874,
0.01082409,  0.01283626,  0.00487072,  0.00186936},
{   -0.00668040, -0.00354932, -0.00117341, -0.00226992,  -0.00022671,  -0.00666072,
0.00314488,  0.00734916,  0.00425614,  0.00164093},
{   -0.00389583,  0.00205666,  0.01156000,  0.00378337,  0.00388467,  0.00191016,
0.00226343,  0.00715162,  0.00447477,  0.00145831},
{   0.00260564,  0.00776913,  0.00295654,  0.00507983,  0.00280605,  -0.00262448,-
0.00087415,  0.00308014,  -0.00047010,  -0.00550276},
{   -0.00400435,  -0.00461726, 0.00647083, -0.00632126,  0.00578397,  0.01191517,
0.00167871,  0.01065949,  0.00598003,  0.00123230},
{   -0.00172116,  0.00293152,  0.00458923,  -0.00446042,  -0.00402144,  -0.00537020,
0.01255438,  0.01025417,  0.00081987,  -0.00211946},
{   0.00098726,  0.00151129,  0.00213603,  0.01091075,  0.01596006,  0.01027042,
0.00492642,  0.00288748,  -0.00109633,  -0.00508732},
{   -0.00137552,  -0.00354111,  0.00880722,  0.01614140,  -0.00039181,  0.00028126,
0.00048723,  -0.00412099,  -0.01187375,  -0.01250538},
},
{{  -0.00071405,  0.00244371,  0.00235739,  -0.00329369,  0.00472867,  -0.00361321,-
0.00584670,  0.00863128,  0.00145642,  -0.00441746},
{   0.00242589, -0.00430711,  -0.00122645,  -0.00464764,  -0.00017887,  -0.00471663,
0.00181162,  0.00249980,  -0.00276848,  -0.00485697},
{   -0.00126161,  0.00092104,  0.00405563,  0.00014858,  -0.00389621,  -0.00436458,
0.00588222,  0.00666140,  0.00160434,  -0.00355981},
{   0.00144272, -0.00099722,  -0.00329538,  0.00173437,  -0.00306283,  0.00373708,
0.00877845,  0.00397062,  -0.00065690,  -0.00004783},
{   -0.00005275,  -0.00144138,  -0.00384176,  -0.00446236,  0.00088025,  0.00069624,
0.00766217,  -0.00227704,  0.00487439,  -0.00176593},
				
				<dp n="d862"/>
{   -0.00139297,  0.00141438,  -0.00012646,  -0.01026693,  -0.00010281,  -0.00277474,-
0.00025676,  -0.00333147,  -0.00272379,  -0.00301211},
{   -0.00001482,  0.00462141,  0.00170302,  0.00056160,  0.00010522,  -0.00055656,
0.00580159,  -0.00135691,  0.00699179,  -0.00022409},
{   -0.00209273,  0.00036039,  -0.00388741,  -0.00210837,  0.00414685,  -0.00550009,
0.00800933,  -0.00162490,  -0.00075248,  -0.00143789},
{   0.00221342,  -0.00070693,  0.00305034,  -0.00100824,  0.00209771,  0.00433956,-
0.01006429,  0.00335628,  -0.00422019,  -0.00190244},
{   0.00110913,  0.00340343,  -0.00021330,  -0.00231460,  -0.00372496,  -0.00103889,-
0.00204804,  0.00150248,  -0.00867284,  -0.00012270},
{   0.00129154,  0.00225690,  0.00307610,  -0.00457771,  -0.00260350,  0.00704766,-
0.00038185,  0.00136466,  -0.00074573,  -0.00661474},
{   -0.00197707,  0.00190446,  0.00129311,  -0.00202580,  0.00168859,  0.00202957,
0.00764207,  0.00343175,  -0.00841492,  -0.00689243},
{   -0.00106230,  -0.00290282,  0.00301179,  -0.00342316,  0.00541939,  0.00276419,-
0.00096920,  -0.00704790,  0.00021120,  -0.00488600},
{   -0.00335184,  -0.00011723,  -0.00134520,  0.00234701,  0.00275337,  -0.00243280,-
0.00553081,  -0.00189510,  -0.00558213,  -0.00439766},
{   -0.00138223,  -0.00078722,  -0.00307855,  -0.00120769,  -0.00597490,  0.00077555,
0.00204629,  -0.00278627,  -0.00509984,  -0.00917128},
{   -0.00085738,  0.00296249,  -0.00100328,  0.00620823,  -0.00194594,  -0.00477741,
0.00408894,  -0.00431777,  -0.00362229,  -0.00545227},
{   0.00316502,  -0.00496468,  0.00196254,  0.00170085,  -0.00353618,  0.00161267,-
0.00450792,  0.00475622,  0.00559953,  0.00043379},
{   0.00053033,  -0.00215320,  -0.00123736,  0.00400112,  -0.00279937,  -0.00382983,-
0.00922124,  0.00920321,  -0.00189296,  -0.00641793},
{   0.00052374,  .0.00024094,  0.00074222,  0.00121188,  -0.01308354,  0.00365845,-
0.00019892,  0.00285161,  0.00119182,  -0.00210593},
{   0.00304271,  0.00045754,  -0.00242181,  0.00326300,  0.00404964,  0.00162161,
0.00036536,  0.00577343,  -0.00083931,  -0.00692977},
{   -0.00226510,  -0.00217357,  -0.00177951,  0.00056309,  -0.00247590,  -0.00393503,-
0.00087352,  -0.00385851,  0.00499243,  0.00317747},
{   -0.00333292,  0.00237891,  0.00005875,  -0.00045224,  -0.00577007,  -0.00489336,-
0.00492713,  -0.00252844,  0.00232674,  -0.00355871},
{   -0.00180577,  0.00152251, -0.00168650, -0.00373161,  -0.00494445,  0.00070000,
0.00429748,  0.00264468,  0.00510881,  0.00414298},
{   0.00057352, 0.00182813,  -0.00478781,  -0.00132287,  -0.00291248,  -0.00582607,
0.00036611,  0.00615309,  -0.00063952,  -0.00043562},
{   -0.00182077,  -0.00052387,  0.00205275,  0.00439155,  0.00206254,  0.00666979,-
0.00737222,  -0.00041091,  0.00380985,  -0.00242852},
{   0.00014505,  -0.00015497,  0.00061676,  0.01102116,  0.00142684,  0.00011530,-
0.00312628,  -0.00115247,  -0.00199428,  0.00034276},
{   -0.00117950, -0.00018668,  -0.00688237,  0.00558761,  -0.00323614,  0.00541723,-
0.00055777,  0.00037185,  0.00298021,  -0.00413622},
{   -0.00268489,  -0.00092316,  0.00159680,  0.00503780,  0.00394093,  0.00242255,
0.00621897,  0.00128319,  0.00007167,  -0.00303362},
{   -0.00135406,  0.00132612,  -0.00225185,  0.00350878,  0.00389900,  0.00171999,-
0.00146560,  -0.01126312,  0.00449526,  0.00062508},
{   0.00057295,  0.00202047,  0.00151283,  0.00312576,  -0.00383849,  -0.00182327,-
0.01048760,  0.00046503,  0.00309555,  0.00301733},
{   -0.00609476,  0.00199366,  0.00169769,  0.00046054,  -0.00149788,  0.00247156,
0.00418583,  -0.00524517,  0.00147818,  -0.00181362},
{   -0.01003447,  0.01292732,  0.00144356,  0.00014990,  -0.00020365,  -0.00069182,
0.00181901,  0.00113486,  0.00113268,  -0.00250931},
{   0.00006361,  -0.00181203,  0.00862741,  0.00068174,  0.00059483,  -0.00396821,-
0.00204192,  -0.00122617,  -0.00279883,  -0.00399060},
{   0.00181692,  0.00040708,  0.00331578,  0.00298869,  0.00229580,  -0.00470435,
0.00041688,  0.00701320,  -0.00684961,  0.00460646},
{   -0.00266523,  -0.00105798,  -0.00115075,  -0.00481424,  0.00159800,  0.00371013,
0.00172283,  0.00560712,  0.00009891,  -0.00254009},
				
				<dp n="d863"/>
{   -0.00096200, -0.00239708, -0.00072227, 0.00067105, 0.00463245, -0.00181151,
0.00337878,  0.00842315,  0.00288416,  0.00323331},
{   0.00569136,  0.00077628,  0.00039776,  0.00048030,  -0.00188477,  -0.00314697,-
0.00222859,  -0.00447499,  -0.00134527,  -0.00279319},
{   -0.00153154,  0.00040495,  0.00152195,  0.00070061,  0.00138840,  -0.01182738,-
0.00063394,  -0.00060032,  -0.00145040,  0.00350855},
{   0.00161879,  0.00168494,  0.00016532,  -0.00457719,  0.00575290,  0.00392115,
0.00266311,  0.00249840,  0.00499373,  0.00343679},
{   -0.00070075,  0.00073156,  0.00065334,  0.00149705,  0.01170892,  -0.00197723,-
0.00141944,  -0.00046048,  0.00095963,  0.00180512},
{   -0.00156776,  0.00045531,  0.00268804,  0.00243883,  -0.00464246,  0.00566962,-
0.00172435,  -0.00532991,  -0.00755432,  0.00530406},
{   0.00030268,  -0.00185108,  -0.00129334,  0.00272568,  0.00062491,  -0.00097022,
0.00302455,  -0.00348647,  -0.01446303,  0.00783601},
{   -0.00159285,  -0.00020812,  0.00015774,  -0.00097503,  0.00055084,  0.01284415,
0.00377701,  -0.00068963,  0.00427403,  -0.00037142},
{   -0.00056554,  -0.00072153,  0.00399038,  -0.00497191,  -0.00216464,  0.00230184,
0.00514089,  0.00188768,  -0.00145550,  0.00582894},
{   0.00014005,  0.00159032,  0.00329557,  -0.00328601,  -0.00164245,  -0.00200642,-
0.00427870,  -0.00869724,  -0.00082951,  0.00278987},
{   0.00148181,  0.00041916,  -0.00309927,  0.00000661,  0.00384593,  -0.00416487,-
0.00532559,  -0.00516995,  -0.00491788,  0.00837744},
{   0.00181614,  0.00144269,  -0.00413538,  -0.00380312,  -0.00057933,  0.00520384,
0.00350609,  -0.00557332,  -0.00211640,  -0.00159629},
{   0.00066935,  0.00251700,  0.00184908,  0.00313305,  0.00486335,  0.00320866,
0.00053516,  -0.00308264,  -0.00540642,  -0.00227221},
{   -0.00056760,  -0.00509891,  0.00312949,  0.00258167,  -0.00347055,  0.00168554,
0.00454403,  0.00083750,  -0.00395094,  -0.00462307},
{   -0.00172296,  -0.00043749,  0.00021821,  0.00597557,  -0.00575854,  -0.00305225,
0.00185040,  0.00412548,  -0.00124724,  0.00677852},
{   -0.00155956,  -0.00139261,  0.00127855,  -0.00271569,  -0.00503071,  0.00013262,-
0.00702389,  0.00286641,  -0.00334405,  0.00905613},
{   -0.00018965,  0.00035757,  -0.00072086,  -0.00143142,  -0.00076345,  0.00185087,-
0.00587735,  0.01505721,  0.00708978,  0.00160281},
{   0.00153159,  -0.00074015,  0.00455896,  0.00502158,  -0.00181818,  0.00142143,
0.00367497,  -0.00577837,  0.00397397,  0.00346490},
{   0.00219679,  0.00016825,  0.00112885,  -0.00123956,  -0.00506878,  -0.00586318,
0.00599759,  -0.00257719,  -0.00168635,  0.00893136},
{   -0.00259072,  0.00143377,  0.00410598,  0.00032354,  0.00259146,  0.00057327,-
0.00177219,  0.00040267,  0.00496435,  0.00746802},
{   0.00120161, 0.00134208,  -0.00114094,  0.00600306,  0.00122526,  -0.00577037,-
0.00099565,  0.00334876,  0.00698501,  0.00215005},
{   -0.00056736,  -0.00167842, -0.00069670,  0.00355302,  0.00308114,  0.00556195,
0.00242661,  -0.00140627,  0.00151165,  0.01229007},
{   0.00083364,  0.00285861,  -0.00243291,  0.00164170,  0.00263424,  -0.00090010,
0.00697612,  0.00302630,  -0.00104099,  0.00985203},
{   -0.00017316,  0.00009661,  -0.00299242,  -0.00102654,  0.00586767,  0.00604661,-
0.00028475,  0.00204755,  -0.00628829,  0.00215750},
{   -0.00014705,  0.00171547,  0.00258157,  0.00347264,  -0.00015150,  0.00627925,
0.00319688,  0.00698722,  0.00121685,  0.00472592},
{   0.00179634,  0.00126112,  -0.00073379,  0.00063915,  -0.00368064,  0.00718675,-
0.00185159,  -0.00631904,  0.00912638,  0.00622665},
{   0.00036801,  0.00043860,  -0.00172184,  -0.00545561,  -0.00089735,  -0.00376398
0.00148660,  0.00088411,  0.00278433,  0.01309199},
{   -0.00233412,  0.00492067,  -0.00200138,  -0.00302371,  0.00154279,  0.00258392,-
0.00437544,  -0.00206242,  -0.00059180,  0.00151697},
{   0.01100540,  0.01627034,  0.00098453,  -0.00264300,  -0.00342966,  -0.00000160,-
0.00029849,  0.00180940,  0.00122892,  0.00238391},
{   0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
				
				<dp n="d864"/>
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
				
				<dp n="d865"/>
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
				
				<dp n="d866"/>
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
},
};
/*====================================================================================*/
/*====================================================================================*/
/*Conexant System Inc.                             */
/*4311 Jamboree Road                               */
/*Newport Beach,CA 92660                              */
/*----------------------------------------------------*/
/*Copyright(C)2000 Conexant System Inc.                   */
/*--------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                    */
/*No part of this software may be reproduced in any form or by any */
/*means or used to make any derivative work(such as transformation  */
/*or adaptation)without the authorisation of Conexant System Inc.  */
/*====================================================================================*/
/*FILE:FLOAT64 CBes_85k                                */
/*====================================================================================*/
FLOAT64C Bes_85k[MAXLTT_85k][LMSMAX_85k][MAXLNp]={
{{   0.03011250,  0.05271740,  0.06473784,  0.06435282,  0.06452657,  0.06279520,
0.05773527,  0.04953492,  0.03258218,  0.02518716},
{    0.01602284,  0.01223286,  0.02716675,  0.01515761,  -0.00130077,  -0.00532771,
0.00089903,  0.00036138,  0.00272831,  -0.00395430},
{    0.02401271,  0.03914647,  0.03915858,  0.01749331,  -0.00316505,  -0.01593492,-
0.02332304,  -0.01928769,  -0.01089091,  -0.01175246},
{    -0.01300759,  -0.00840161,  0.00682484,  -0.00081947,  -0.00651557,  -0.00812344,-
0.00999762,  -0.00801675,  -0.00511146,  -0.00416989},
{    -0.01818762,  -0.03192724,  -0.06456176,  -0.04615027,  -0.00055719,  -0.00821339,-
0.00290679,  -0.00506395,  -0.00036802,  -0.00223339},
{    0.04702580,  0.05568841,  0.04484019,  0.02967458,  0.01458701,  0.00945917,
0.00722793,  0.00571889,  0.00149213,  -0.00247952},
{    -0.01485766, -0.01597556,  0.00778368,  0.01287732,  0.01335396,  0.01226611,
0.01049375,  0.00863086,  0.00659185,  0.00144317},
{    0.01027236,  0.02730616,  0.04024012,  0.02727445,  0.00988789,  0.00395820,
0.00281685,  -0.00016378,  0.00442352,  -0.00260261},
{    0.01018086,  0.02317232,  0.01823444,  0.01381079,  0.01110116,  0.00731025,
0.00224764,  0.00064606,  0.00224514,  -0.00374675},
{    0.03440958,  0.04813170,  0.04772426,  0.03918479,  0.03828848,  0.04482698,
0.04793362,  0.04624364,  0.03528126,  0.02795062},
{    0.02012151,  0.02798955,  0.01690498,  -0.00162132,  -0.01795221,  -0.02033811,-
0.00304788,  0.00318819,  0.00300105,  -0.00068904},
{    -0.00771849,  -0.01042661,  0.02415417,  0.02101670,  0.00511120,  -0.00259045,-
0.01164459,  -0.01753263,  -0.01833297,  -0.01582638},
{    0.03093007,  0.02841266,  0.01851041,  0.01255380,  -0.00055904,  -0.00770237,-
0.00354944,  -0.00713726,  -0.01158101,  -0.01336380},
{    0.01250769,  0.01073677,  0.04218614,  0.03936715,  0.02331104,  0.01263867,-
0.00130949,  -0.00833368,  -0.00515605,  -0.00890725},
{    0.02999284,  0.03533733,  0.02511555,  0.01201614,  0.00337246,  0.00922871,
0.01583742,  0.01541255,  0.01296229,  0.00790224},
{    -0.01170270,  -0.01799777,  -0.03459895,  -0.04037440,  -0.00093168,  -0.00201978,-
0.01253730,  -0.00295387,  -0.00802624,  -0.00664753},
				
				<dp n="d867"/>
{   -0.00726885,  -0.01627472,  -0.01522945,  0.03430538,  0.02169323,  0.01089532,-
0.00154582,  -0.00739393,  0.00585284,  -0.00078346},
{   -0.00436114,  -0.01237267,  -0.02091931,  -0.00244249,  0.01246437,  0.00270874,-
0.00687659,  -0.00651871,  -0.01814616,  -0.02330265},
{   0.03517674,  0.06355752,  0.06857296, 0.05938929,  0.04741369,  0.03893724,
0.02726384,  0.01966913,  0.01129379,  0.00478196},
{   -0.01860181,  -0.02677876,  -0.04407154,  -0.04095438,  -0.01009746,  -0.01626406,-
0.01253701,  -0.00731142,  -0.00220656,  0.01567101},
{   0.01698267,  0.01310731,  0.00257197,  -0.01257890,  -0.03301049,  -0.03748283,-
0.01335818,  -0.01974036,  -0.01923884,  -0.00554617},
{   -0.01302456,  -0.02004788,  -0.03292591,  -0.02055095,  0.02059680,  0.01219580,-
0.00013659,  -0.00557743,  -0.00905106,  -0.00933003},
{   -0.00101468,  0.01573975,  0.01522490,  0.00440810,  -0.00745773,  -0.01547614,-
0.01712205,  -0.01281291,  -0.00291117,  -0.00745792},
{   -0.00645665, -0.00803376,  0.03718368,  0.03703527,  0.02560332,  0.02060903,
0.01271667,  0.00626016,  0.00721148,  -0.00046866},
{   0.00969971,  0.00507633,  -0.00469157,  -0.00353471,  0.01129945,  0.00162597,-
0.00787840,  -0.00714222,  -0.01077091,  -0.01917782},
{   -0.00921545,  -0.01537870,  -0.01341638,  -0.01877411,  -0.00679339,  0.01005825,-
0.00052251,  -0.00884878,  -0.01748464,  -0.01358666},
{   -0.02241539,  -0.03247605,  -0.03701199,  -0.01090514,  -0.00887298,  0.00529690,-
0.00127800,  0.00405804,  0.00659569,  0.01933625},
{   0.00600397,  0.01074139,  0.02092690,  0.01970426,  0.01176908,  0.01359934,
0.01409811,  0.01382651,  0.01320097,  0.01301970},
{   0.01141765,  0.00585173,  0.00099689,  -0.01003275,  0.00167233,  0.01809863,
0.01718491,  0.01680690,  0.01478071,  0.00556505},
{   0.00532323,  0.02795015,  0.06817748,  0.06100996,  0.05743580,  0.05354041,
0.04499788,  0.03264736,  0.02017310,  0.00922294},
{   -0.02035650,  -0.03006271,  -0.04684134,  -0.03358747,  -0.02235513,  -0.01916831,-
0.00595318,  -0.00071390,  -0.00137424,  0.01494029},
{   -0.00390696,  -0.00736702,  -0.01984008,  -0.02822155,  0.00327165,  0.00343909,-
0.00602792,  -0.00782717,  -0.00570698,  -0.01439530},
{   -0.00083505, -0.00797647,  -0.01183219,  -0.00060675,  -0.00978943,  -0.01842960,-
0.00060424,  0.00138312,  -0.00990396,  -0.01301919},
{   -0.00153786,  0.00594700,  0.01742534,  0.01203318,  0.00432435,  0.00026490,
0.00152903,  0.00261276,  0.00144338,  -0.00298043},
{   0.02514795,  0.02694397,  0.03251137,  0.02791743,  0.02189767,  0.01664660,
0.01392899,  0.01020858,  0.00946374,  0.00251344},
{   0.01100263,  0.01767290,  0.01081835,  -0.00842438,  -0.02354175,  -0.03362519,-
0.03553471,  -0.00317026,  0.00153320,  -0.00582507},
{   0.01299545,  0.02093436,  0.03195115,  0.03015983,  0.02262512,  0.02771440,
0.02669818,  0.02707517,  0.02510345,  0.01691998},
{   0.01109239,  0.00726528,  0.01170571,  0.01399126,  0.02465632,  0.01511573,
0.00541503,  0.00142378,  -0.00097093,  -0.00882481},
{   -0.01941829,  -0.02760284,  -0.03358766,  -0.01196969,  -0.01694781,  -0.01634516,-
0.01319709,  -0.00584112,  -0.00097540,  0.01214821},
{   -0.02107221, -0.02948952, -0.04896206, -0.05545068,  -0.01814541,  -0.01060619,-
0.00334635,  0.00268116,  0.00045516,  0.01809656},
{   -0.01400252, -0.02253890,  -0.04613798,  -0.05388472,  0.00707619,  0.01867959,
0.00765829,  0.00198822,  -0.00470518,  -0.01022938},
{   -0.00148627,  -0.00099175,  0.00560137,  -0.00668187,  0.00030117,  -0.00039004,-
0.00639128,  -0.01024137,  -0.00170219,  -0.00524556},
{   -0.00549896,  -0.01470279,  -0.01695822,  0.02198312,  0.03669617,  0.02463584,
0.01276040,  0.00736205,  0.00005241,  -0.00473827},
{   -0.00132779,  -0.00278557,  0.02514555,  0.02374663,  0.02009989,  0.02808080,
0.03082887,  0.03087115,  0.02409034,  0.01348647},
{   -0.01058509,  -0.01658262,  -0.02338305,  -0.00972392,  0.00553297,  -0.00333131,
0.00588576,  0.00111411,  -0.00029098,  -0.00373132},
{   0.00160918,  -0.00536342,  -0.01461500,  -0.00612135,  0.02269393,  0.01788420,
0.00592269,  0.00065486,  -0.00379472,  -0.01142680},
				
				<dp n="d868"/>
{   -0.00735894,  -0.01347182,  -0.02349130,  -0.02205992,  0.02751215,  0.02381083,
0.00992716,  0.00358035,  -0.00636554,  -0.01445333},
{   -0.00259622,  -0.00664229,  -0.01866048,  -0.03590918,  -0.05839927,  -0.06065164,-
0.01983147,  0.00600777,  0.00351924,  0.00449450},
{   0.03019245,  0.04180980,  0.04242800,  0.03707932,  0.02969960,  0.02907674,
0.02621267,  0.02268569,  0.01544914,  0.00888835},
{   0.00410478,  -0.00530070,  -0.00295468,  0.02816624,  0.01664470,  0.00777464,
0.00692805,  -0.00028335,  0.00294711,  0.00261301},
{   -0.01128064,  -0.01882569,  -0.01409550,  0.01270598,  0.00521923,  0.01708157,
0.01549205,  0.01315745,  0.01284490,  0.00551201},
{   0.01235582,  0.00495826,  0.00768318,  0.01105327,  -0.00329601,  -0.00357798,
0.00325452,  0.00012424,  0.00501045,  0.00643709},
{   0.01030086,  0.00438282,  -0.00311851, -0.02076026,  -0.04378026,  -0.04024490,
0.00518616,  0.01327369,  0.00583413,  0.00260305},
{   0.01585195,  0.02158346,  0.01265352,  -0.00225988,  -0.01537653,  -0.02523274,-
0.02858671,  -0.01981777,  -0.02753662,  -0.02470708},
{   -0.00405472, -0.00972641, 0.00833755,  0.00837587,  0.00118455,  0.00982980,
0.00623398,  0.00759464,  0.00871849,  0.00594262},
{   -0.01145855,  -0.01827606,  -0.01906050,  -0.01321846,  -0.01659787,  -0.00515321,-
0.01575232,  -0.02756877,  -0.03799206,  -0.00151852},
{   0.00720446,  -0.00064353,  -0.00701769,  -0.02430002,  -0.03349658,  0.00705156,
0.00874910,  0.00186248,  0.00901299,  0.00015126},
{   -0.01518806,  -0.02321451,  -0.02690132,  0.00534415,  -0.00308821,  -0.00432329,-
0.00601155,  -0.01009555,  -0.01496766,  -0.01130705},
{   -0.01550506,  -0.02653400,  -0.03852672,  0.01008836,  0.01733050,  0.01204091,
0.01458971,  0.00882104,  0.00848728,  0.00131771},
{   -0.01295495,  -0.02006295,  -0.03745275,  -0.03024400,  -0.01406475,  -0.02456492,-
0.00740866,  -0.60919721,  -0.00415596,  0.00474972},
{   -0.01664452,  -0.02405961,  -0.03649393,  -0.03646140,  -0.01100296,  -0.00245895,-
0.00755079,  -0.01214057,  -0.01077375,  0.01126263},
{   -0.00108388,  -0.00662234,  -0.02067877,  -0.03852748,  -0.05961239,  -0.02435135,-
0.00623433,  -0.00902003,  0.00759261,  0.00276482},
{   -0.01724702,  -0.02611390,  -0.03652935,  -0.03780674,  -0.03761547,  -0.01849779,-
0.01307332,  -0.00332941,  0.00083897,  0.01835804},
{   0.01208979,  0.00809377,  0.01689381,  0.01941724,  0.00720310,  -0.00476103,-
0.01467246,  -0.01450666,  -0.00270332,  -0.00725360},
{   0.00980247,  0.01559737,  0.00594148,  0.00019967,  -0.00062672,  -0.01000914,-
0.01451608,  -0.01143174,  -0.01193905,  -0.01828814},
{   -0.00311454,  -0.01203376,  -0.00927907,  0.02078032,  0.00360031,  -0.00034344,-
0.00832342,  -0.00936971,  0.00192210,  -0.00672316},
{   -0.01379369,  -0.02012157,  -0.02470930,  -0.02980865,  -0.03913091,  -0.00703542,-
0.00668963,  -0.00621541,  -0.00767146,  0.00501472},
{   -0.01307473,  -0.02603028,  -0.05475627,  -0.03679790,  0.02162444,  0.01966973,
0.01865785,  0.01710904,  0.01237958,  0.00370059},
{   0.00064712,  -0.00558789,  -0.01323406,  -0.01583633,  -0.03346232,  -0.03305713,
0.01043219,  0.00799608,  0.00367465,  -0.00077605},
{   -0.01743761,  -0.02261109,  -0.03091739,  -0.02751019,  -0.02026401,  -0.01742175,-
0.02580788,  -0.02763544,  -0.01051019,  0.01002048},
{   0.00216431,  -0.00560940,  -0.01900158,  -0.04152299,  -0.05988942,  -0.02922351,
0.01788276,  0.01381030,  0.01100524,  0.00877503},
{   -0.01828726,  -0.02442716,  -0.01062820,  0.00049875,  -0.00510124,  0.00221065,
0.00191559,  0.00275880,  0.00074190,  0.00944648},
{   -0.00879868,  -0.01598313,  -0.03004215,  -0.04948885,  -0.04196567,  -0.01983909,-
0.01370329,  -0.00427476,  0.00082035,  0.01297109},
{   -0.00230832,  -0.01010282,  -0.01668657,  -0.03198117,  -0.03699492,  0.01269478,
0.01377988,  0.00820876,  0.00580972,  -0.00152692},
{   0.01551234,  0.03419445,  0.06055726,  0.04707260,  0.03313935,  0.02368624,
0.01430269,  0.00668846,  0.00691489,  0.00056254},
{   0.01406692,  0.01449025,  0.02394177,  0.02399262,  0.03079103,  0.02573220,
0.02140991,  0.01309781,  0.00779774,  -0.00239127},
				
				<dp n="d869"/>
{   -0.00828736,  -0.01743047,  0.00335240,  0.04816538,  0.03638020,  0.03234748,
0.02652692,  0.01796155,  0.01503502,  0.00549014},
{   0.00094473,  -0.00491647,  0.00128189,  0.01052383,  0.03986395,  0.03560681,
0.02404924,  0.01677403,  0.00763441,  -0.00199493},
{   -0.01506920,  -0.02351502, -0.04035310, -0.04043075, -0.00847623, 0.00878313,
0.00972518,  0.00819359,  0.00632904,  0.00339077},
{   0.01785404,  0.02207023,  0.03441687,  0.03255487,  0.04601287,  0.04152598,
0.04282719,  0.03719784,  0.02088540,  0.01024143},
{   0.01931626,  0.01456799,  0.00936344,  0.00110318,  -0.01440516,  -0.01437875,-
0.01424618,  -0.02355264,  0.00183293,  -0.00067569},
{   0.00521639,  -0.00179269, -0.00175685, 0.01034082,  -0.00307994,  -0.00944490,-
0.01447315,  -0.02104899,  0.00289221,  -0.00373207},
{   -0.00685119,  0.00469486,  0.00447692,  -0.00819117,  -0.02000782,  -0.02240418,-
0.01177251,  -0.01311489,  0.00040491,  -0.00407311},
{   0.02359967,  0.03214284,  0.05067474,  0.05064540,  0.03918985,  0.04448732,
0.03853463,  0.03322630,  0.02812674,  0.02336996},
{   -0.00315399,  0.00029074,  -0.00602774,  -0.01695521,  -0.00750983,  -0.01427804,
0.02487497,  -0.01355392,  -0.01422887,  -0.02043397},
{   0.01021442,  0.00593011,  -0.00854369,  -0.03200625,  -0.05616386,  -0.05552187,-
0.02617807,  -0.02123191,  -0.01014762,  0.00017089},
{   -0.00357899,  -0.01168453,  -0.02003192,  0.00360176,  -0.00698634,  -0.01205097,
0.00501530,  -0.00571256,  0.00716748,  0.00642730},
{   -0.00204187,  0.00754425,  -0.00122054,  -0.01452030,  -0.02381772,  -0.02974159,-
0.02443919,  -0.02145534,  -0.02556043,  -0.01726765},
{   -0.01225962,  -0.02021357,  -0.03276307,  0.00077601,  0.00339980,  -0.00682563,-
0.01438413,  -0.02362521,  0.00510472,  -0.00030699},
{   -0.01243222, -0.02180635, -0.03374801, -0.00552771,  0.03324926,  0.03598020,
0.02254258,  0.01346735,  0.00006868,  -0.00653802},
{   0.01148091,  0.00692796,   0.00040312,  -0.00436061,  -0.01726674,  -0.02679639,-
0.00256074,  0.00092198,  -0.00728032,  -0.00945666},
{   -0.00178888,  -0.00688681,  -0.01213265,  -0.02513887,  -0.03796508,  -0.00819531,-
0.01296614,  -0.01487822,  -0.01910969,  -0.01537065},
{   -0.00725535,  -0.01262777, -0.01183104, -0.00983393,  -0.01670010,  -0.00293400,-
0.00771642,  -0.00212860,  0.00386644,  0.00120922},
{   0.00164142,  -0.00392946,  -0.01381401,  -0.00515787,  0.00254924,  -0.00942431,-
0.01478234,  -0.02189020,  -0.03120124,  -0.00938677},
{   -0.00637770,  -0.01406334,  -0.02198870,  -0.00809124,  0.04237495,  0.04494788,
0.03299125,  0.02381818,  0.01366707,  0.00592031},
{   -0.00854519, -0.01460363, -0.02844237, -0.02588072,  -0.04063413,  -0.03740634,
0.00128514,  0.00170535,  0.00151977,  0.00167284},
{   -0.01347334, -0.02291845, -0.04127466, -0.06185673,  -0.03481773,  -0.01543559,-
0.00855813,  0.00127078,  0.00279083,  0.01982719},
{   -0.00883732,  -0.01775697, -0.03452937,  -0.03890479,  -0.05133868,  -0.05444499,-
0.02467414,  -0.00827826,  -0.00632791,  0.00470165},
{   0.01947562,  0.01480394,  0.00585211,  -0.01157039,  -0.02573721,  -0.00361897,
0.00770904,  0.00117448,  0.01013551,  0.00533763},
{   -0.00797957,  -0.01335512,  -0.02556722,  -0.02463242,  -0.00471432,  -0.01441015,-
0.01478523,  -0.00963687,  -0.01951507,  -0.00599849},
{   -0.01014364,  -0.01336506,  -0.00756888,  -0.02085792,  -0.03437920,  -0.03380901,-
0.01522635,  -0.01085877,  -0.00407099,  -0.00059958},
{   -0.01191418, -0.01893562, -0.02285608, -0.02175026,  -0.01437801,  0.00862057,
0.01242598,  0.01037422,  0.00881772,  0.00301240},
{   -0.00410227,  -0.00810982,  -0.02082509,  -0.02673533,  -0.02102781,  -0.03371932,-
0.03125568,  -0.00162297,  -0.00621962,  -0.00958948},
{   -0.00236826,  -0.00528324,  -0.01688967, -0.02665562,  -0.04625641,  -0.04899277,-
0.01293267,  -0.00471950,  -0.00579889,  0.00382789},
{   -0.00829334, -0.01601839, -0.02981488, -0.04926722,  -0.02466496,  0.00312334,
0.01756506,  0.01017462,  0.00301230,  -0.00031275},
{   -0.00314835,  -0.00971408,  -0.00126585,  0.00084833,  -0.01365008,  -0.01221557,-
0.02038756,  -0.01962756,  -0.02820450,  -0.02680765},
				
				<dp n="d870"/>
{   -0.00652397, -0.01336956, -0.03077461, -0.04977855, -0.06644036, -0.02418368,-
0.00439690,  0.00168036,  0.00799340,  0.00870391},
{   -0.00459352,  -0.00907604,  -0.02068476,  -0.01752188,  -0.03509759,  -0.02897723,-
0.02242144,  -0.02913997,  0.00318966,  -0.00091595},
{   0.01107762,  0.00546846,  -0.00001276,  -0.00142842,  -0.01076665,  -0.02078226,-
0.02919168,  -0.02466836,  -0.03191429,  -0.02349747},
{   0.00783465,  -0.00042958, -0.00136463, -0.00608877,  -0.02410140,  -0.00715177,-
0.00640987,  -0.01457449,  0.00913402,  0.00152079},
{   -0.01546191,  -0.01851968,  -0.00669892,  -0.01056069,  -0.01249849,  -0.01381879,-
0.01374939,  -0.00900376,  -0.00739429,  -0.00470642},
{   0.00078318,  0.00203456,  -0.00457136,  -0.01985878,  -0.03592355,  -0.04690434,-
0.02895935,  0.00293128,  -0.00121505,  -0.00717597},
{   -0.01212653,  -0.01986692,  -0.02324829,  0.00367052,  -0.01032869,  -0.01729308,-
0.03407878,  -0.02295738,  -0.00829270,  -0.00252379},
{   -0.00904510,  -0.01094450,  -0.01829106, -0.03299925,  -0.04246203,  -0.02987120,-
0.03013587,  -0.02375396,  -0.01112768,  0.00806776},
{   0.00371073,  0.01192758,  0.04487591,  0.04961298,  0.04469640,  0.03739255,
0.02788493,  0.01888919,  0.01006733,  0.00055537},
{   -0.00414876,  -0.00806971,  -0.01853441,  -0.00784140,  -0.01284125,  -0.02142337,-
0.01870911,  -0.02863545,  -0.00013891,  -0.00452064},
{   0.00370482,  -0.00028583,  -0.01043066,  -0.01367416,  -0.02846861,  -0.03863164,-
0.01679499,  -0.01875735,  -0.02837507,  -0.00521203},
{   -0.01149320, -0.02138073, -0.01879618,  0.02580091,  0.03158101,  0.03076868,
0.04075558,  0.03485110,  0.02587197,  0.01424616},
{   -0.01344467,  -0.02008154,  -0.02874508, -0.01984988,  -0.03087705,  -0.03726973,-
0.01732255,  -0.01355235,  -0.01306657,  0.00834000},
{   0.00017944,  -0.00749797,  -0.00950584,  -0.01971890,  -0.03880470,  -0.05068581,-
0.05707708,  -0.00602932,  -0.00093686,  0.00151256},
{   -0.00657895,  -0.01276092,  -0.00663745,  -0.01018639,  -0.02569065,  -0.03611357,-
0.04709358,  -0.01963325,  -0.02213332,  -0.00364810},
{   -0.00891231,  -0.00896874,  0.04729117,  0.04958298,  0.04900047,  0.05114494,
0.04291088,  0.03529066,  0.02325801,  0.01218071},
{   -0.00625101, -0.01361953, -0.02559423, -0.03223054,  0.00838412,  0.03074426,
0.02326855,  0.01143200,  0.00726839,  -0.00254345},
{   0.00962416,  0.00578797,  -0.00469408,  -0.02098031,  -0.03970154,  -0.02410071,-
0.01945893,  -0.02555644,  0.06279541,  -0.00276733},
{   0.00016594,  -0.00399601,  -0.00731727, -0.00585359,  -0.01695927,  -0.02650291,-
0.04236752,  -0.05179219,  -0.00927053,  0.00223535},
{   -0.01137819,  -0.01841432,  -0.02863844,  -0.02549466,  -0.00272539,  0.03105273,
0.04129874,  0.02703469,  0.01674746,  0.00882358},
{   -0.01240696, -0.02050348, -0.03230916, -0.01847850,  0.02493462,  0.01658082,
0.01950329,  0.01626036,  0.01239434,  0.00368862},
{   0.00400441,  0.00044364,  -0.00439758,  -0.01272883,  -0.02737488,  -0.03568903,-
0.05039078,  -0.01931315,  0.00614772,  -0.00059630},
},
{{  0.00006111,  -0.00011239,  -0.00091541,  -0.00171992,  0.01263544,  0.01320593,
0.01204569,   0.01293225,   0.00666364,   0.00402353},
{   0.00779445,  0.00696512,  -0.00184068,  0.00596820,  0.01118068,  0.00710638,
0.00466814,  0.00030543,  -0.00416637,  -0.00506631},
{   -0.00775987,  -0.00470163,  0.02876918,  0.01544713,  0.00472025,  0.00233966,-
0.00091549,  -0.00172232,  -0.00574072,  -0.00729726},
{   -0.00192205,  -0.00209183,  0.00072963,  -0.00370971,  -0.01469616,  -0.01831928,
0.01060567,  0.00841196,  -0.00113362,  -0.00135248},
{   0.00727874,  0.00550317,  0.00265535,  0.00347190,  -0.00348257,  -0.00700786,
0.01453249,  0.01124473,  0.00636632,  0.00507658},
{   -0.00370169, -0.00578109, -0.01054631,  0.00237922,  0.00610875,  0.00382378,
0.01112889,  0.01061231,  0.00444948,  0.00172272},
{   -0.01082310,  -0.00343578,  0.00088772,  -0.00179936,  0.00486192,  0.00272746,
0.00364738,  0.00156064,  -0.00077856,  -0.00162852},
				
				<dp n="d871"/>
{    0.00827082,  0.00679115, -0.00515113, -0.01458570,  0.00622652,  0.00687030,
0.00124702,  0.00308527,  0.00723321,  0.00498593},
{    0.00033643,  0.00105011,  0.00317059,  0.00722382,  0.00500150,  0.00323058,
0.01981710,  0.01102549,  -0.00303191,  -0.00663890},
{    0.00236747,  0.00370410,  -0.00666410,  -0.01274279,  -0.01239504,  -0.01568273,-
0.01086512,  -0.00400080,  -0.00089377,  0.00181257},
{    0.00276404,  0.00157884,  0.00686494,  0.01048618,  0.00795789,  0.01655090,
0.00799517,  0.00421079,  0.00749205,  0.00227781},
{   -0.00212620,  -0.00277584, 0.00272206,  0.01528548,  0.01589311,  0.00970912,
0.00469392,  0.00593647,  0.00104566,  -0.00224531},
{    0.00005560, -0.00071041, -0.00280654, -0.00394772,  -0.00535340,  -0.00398863,
0.02467535,  0.02212432,  0.01059736,  0.00534966},
{    0.00464703,  0.00474611,  0.00196303,  -0.00845117,  -0.00736551,  0.01393551,
0.01622437,  0.00953056,  0.00301761,  -0.00005419},
{    0.00047992,  -0.00137581,  0.00480373,  0.02034039,  0.00168192,  -0.00273659,
0.00600385,  0.00154407,  -0.00004413,  0.00158964},
{   -0.00111287,  0.00035244,  -0.00680570,  -0.01735569,  -0.00251611,  -0.00534775,
0.00351667,  0.00680632,  -0.00068295,  -0.00082886},
{    0.00748514,  0.0056068,  0-0.00091863,  0.00920877,  0.00118810,  -0.00632105,
0.00962053,  -0.00702395,  0.00190340,  -0.00024475},
{   -0.00250611,  -0.00404516,  -0.00747983,  0.01095903,  0.00795864,  0.00282929,
0.00388997,  -0.00170172,  -0.01516082,  -0.01499629},
{   -0.00382775, -0.00496896, -0.00872420, -0.00897827, -0.01372950, 0.00223387,
0.00948376,  0.00437347,  0.00551626,  0.00429765},
{   -0.00068027,  -0.00054087,  -0.00137117,  -0.01218331,  -0.01646237,  -0.00125409,-
0.00512591,  -0.00259414,  0.00019934,  -0.00152469},
{    0.01072110,  0.01216315,  0.00858058,  0.00496877,  0.00387715,  0.00465455,
0.00295036,  0.00223345,  0.00185529,  0.00004801},
{    0.00296041,  0.00674527,  0.00374328,  -0.00204315,  -0.00721346,  -0.00780599,
0.00719436,  0.00024193,  -0.01220476,  -0.01078088},
{   -0.00216296, -0.00253576, -0.01080409, -0.01403971,  0.01317200,  0.01261837,
0.00193829,  0.00045172,  0.00132059,  -0.00249276},
{    0.00922137,  0.01014334,   0.00260340,  -0.00465584,  -0.00515572,  -0.00850082,-
0.00859783,  -0.00459811,  -0.00840030,  -0.00796677},
{   -0.00801438,  -0.00425278,  0.01495038,  -0.00190038,  -0.00985608,  -0.01157529,-
0.00885614,  -0.00304473,  0.00181800,  0.00099605},
{   -0.00490201,  -0.00762224,  0.00040365,  0.00582002,  -0.00073916,  0.01154589,
0.00012161,  -0.00446718,  0.00332097,  0.00016409},
{   0.00137264,  0.00074422,  0.02283779,  0.01073287,  -0.00116295,  -0.01058273,-
0.00316988,  0.00677347,  0.00575176,  0.00257174},
{    0.00319146,  -0.00045188,  -0.01012620,  -0.00021037,  -0.00441827,  -0.01132391,
0.00311417,  -0.00315884,  -0.01255682,  -0.00397431},
{    0.00171563, -0.00111647, -0.00583420,  0.01095067,  0.00858833,  0.00692717,
0.00873388,  0.00136371,  0.01266588,  0.00897107},
{   0.00042425, -0.00141434,  -0.00204316,  -0.00825233,  -0.00419762,  0.01843774,
0.00776467,  0.00399437,  0.01425773,  0.00899603},
{    0.00198198,  0.00052505,  0.00305308,  0.00190291,  -0.01278992,  -0.00529606,
0.00142837,  -0.00523604,  0.00823206,  0.00641433},
{    0.00407774,  0.00128382,  -0.01316027,  -0.00600687,  0.00007500,  -0.00346172,-
0.00039881,  0.00485414,  0.00543620,   0.00280821},
{    0.00088827,  0.00372026,  0.00085106,  -0.00512459,  0.00587403,  0.00079244,-
0.00147824,  0.00452383,  -0.00429125,  -0.00514253},
{   -0.00288860, -0.00282246, -0.00094926, -0.00396700, -0.00478751,  0.01771119,
0.01499634,  0.00307891,  -0.00983328,  -0.01055430},
{   -0.00321458,  0.00689814,  0.00937494,  -0.00267765,  0.00449666,  0.00131638,
0.00049454,  -0.00173761,  0.00155754,  0.00049179},
{    0.00243335,  0.00346759,  -0.00851574,  -0.01570546,  0.00138322,  0.00309032,-
0.00448764,  -0.01035466,  -0.01368467,  -0.01006367},
{   -0.00445209,  -0.00451981,  0.00775260,  0.00538409,  0.00259379,  0.01130075,
0.01159070,  0.01239608,  0.01218984,  0.00879261},
				
				<dp n="d872"/>
{   -0.00161021,  0.00070235,  -0.00059480,  0.00445431,  0.00396118,  -0.00732553,
0.00000194,  0.00135627,  -0.00251368,  -0.00203525},
{   -0.00651984,  -0.00550594,  -0.00499920,  -0.00484211,  -0.00506232,  -0.00662786,-
0.00706928,  -0.00334101,  -0.01055323,  -0.00690449},
{    0.00457578,  0.00388137,  0.00548547,  0.00933548,  0.01001904,  0.00163964,
0.00450871,  0.01572982,  0.01107527,  0.00528513},
{   -0.00466753, -0.00445362, -0.00337934, -0.00944068,  0.00200823,  0.00377579,-
0.00386050,  0.00763733,  0.01127368,  0.00761098},
{    0.00228387,  0.00262173,  -0.00174080, -0.00116707,  0.01802132,  0.01001005,-
0.00421486,  -0.01083893,  0.00535106,  0.00251343},
{   -0.00226686,  -0.00219198, -0.00696038, -0.00326018, -0.00700208, -0.01000534,
0.00590006,  -0.00019387,  0.01364628,  0.01164173},
{   -0.00525566,  -0.00589099,  -0.01282020, -0.00218846,  -0.00069747,  -0.00377804,-
0.00281350,  -0.00928819,  -0.00206454,  0.00166221},
{   -0.00648441, -0.00834980,  0.00047410,  0.00544467,  -0.00151490,  -0.00721561,
0.00421142,  0.01267029,  0.00553720,  0.00203413},
{   -0.00319906,  -0.00153334,  -0.00319572,  0.00124053,  0.00867730,  0.00469551,-
0.00579935,  -0.01876245,  -0.02031045,  -0.00047261},
{    0.00153075,  0.00203053,  0.01557594,  0.00248293,  -0.00568021,  0.00992088,
0.00651748,  0.00288808,  -0.00400202,  -0.00632845},
{    0.00486833,  0.00291524,  0.00857085,  0.00288218,  -0.00243590,  0.00758656,-
0.00270442,  0.00120835,  0.01880961,  0.01357284},
{   -0.00011043,  0.00233758,  0.00924841,  -0.00813434,  -0.01069492,  -0.00390450,
0.00359210,  0.01126875,  0.00746396,  0.00485185},
{   -0.00494091,  -0.00523131,  0.01230702,  0.01752272,  0.00766125,  -0.00318486,-
0.01345777,  -0.00804930,  0.00290803,  0.00083750},
{    0.00032569,  0.00009018,   0.01225586,   0.00569636,  -0.00705480,  -0.01384848,-
0.01169237,  -0.01071170,  -0.01027119,  -0.00767364},
{    0.00280051,  0.00710533,   0.00490902,   0.00336591,  0.00371334,  -0.00447382,-
0.01473072,  -0.01935226,  -0.02067918,  -0.01008544},
{    0.00612606,  0.00452334,  0.00281361,  -0.00371625,  -0.00823255,  0.00377597,-
0.00722384,  -0.01549285,  0.00240305,  -0.00039173},
{   -0.00188299,  -0.00288016,  -0.00945697,  -0.00819146,  0.00376693,  -0.00310810,-
0.01815127,  -0.01087037,  -0.00275809,  -0.00523949},
{    0.00302839,  0.00234366,   0.00453269,   0.01641155,  0.01357589,  0.00569236,-
0.00491735,  -0.00780978,  -0.00900474,  -0.00804208},
{   -0.00080239, -0.00316640, -0.00369995,  0.00115340,  -0.00644417,  -0.01160044,-
0.02211991,  0.00383138,  0.00405909,  0.00056062},
{    0.00174899,  0.00438349,   0.00367090,  -0.00111571,  0.01566313,  0.01579812,
0.00417576,  -0.00456289,  -0.01404146,  -0.01288739},
{    0.00718619,  0.00681000,   0.01045663,   0.01057205,  0.00363275,  0.00126916,-
0.00035579,  -0.00555201,  -0.01126034,  -0.00898206},
{    0.00405121,  0.00357693,  0.00265770,  -0.00375096,  -0.00505171,  -0.01364679,-
0.01345036,  0.01153075,  0.01532976,  0.00847445},
{   -0.00043160,  -0.00087914,   0.00860999,  0.00148947,  0.00531393,  0.00352189,-
0.01237297,  -0.00004966,  -0.00106361,  -0.00556562},
{   -0.00056662,  -0.00212456, -0.00117172,  0.00762109,  0.00219673,  -0.00025564,-
0.01128915,  -0.01699960,  0.01354709,  0.01176087},
{   -0.00408654,  -0.00096384,  -0.00423818,  -0.00744231,  -0.00876295,  -0.01304774,-
0.01141891,  -0.01555846,  -0.01246216,  0.00585658},
{   -0.00039385,  0.00025901,   0.00353937,   0.00203476,  -0.00176971,  0.00209237,-
0.00340730,  -0.01026764,  -0.02600074,  -0.02177020},
{    0.00243314,  0.00343546,  0.00161754,  -0.00371032,  -0.00350422,  -0.00970857,-
0.02319258,  -0.02738033,  0.00899502,  0.00814799},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
				
				<dp n="d873"/>
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
				
				<dp n="d874"/>
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0,00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
				
				<dp n="d875"/>
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
};     
{{   0.00007302,  -0.00074506,  0.00167535,  -0.00200298,  -0.01561921,  0.00467142,
0.00250590,  -0.00179108,  0.00045385,  -0.00218648},
{    0.00093298, -0.00177509,  0.01404716,  0.00543233,  0.00031596,  0.00291425,-
0.00009707,  0.00167511,  0.00182873,  0.00219560},
{   -0.00174480,  0.00007287,  -0.00089953,   -0.01199317,  -0.00050311,  -0.00556124,-
0.00281232,  -0.00270383,  -0.00114969,  -0.00214721},
{   -0.00262070,  0.00748139, -0.00280502, -0.00136286,  -0.00078590,  0.00175876,-
0.00098000,  0.00457380,  0.00355523,  0.01034175},
{    0.00074436,  -0.00115665,  0.00189529,  0.01157575,  0.00224026,  -0.00212844,-
0.00306117,  0.00230632,  -0.00278911,  0.00703257},
{    0.00390810,  0.00046965,  -0.00695795,  0.00670060,  0.00287957,  0.00210736,
0.00370070,  0.00504010,  0.00404556,  0.00019377},
{    0.00189179,  0.00096211,  0.00210929,  0.00010549,  -0.00104655,  0.01168018,-
0.00070392,  0.00279664,  0.00885825,  0.00387118},
{   -0.00079471,  -0.00199071,  0.00625236,  0.00278785,  -0.00271890,  0.00075786,
0.00309626,  -0.00618918,  0.00809770,  0.01078922},
{    0.00013985,  -0.00141381,  -0.00365764,  0.00326014,  -0.00874184,  0.00148973,-
0.00651280,  -0.00398857,  0.00748833,  0.00190015},
{    0.00696733,  0.01084724,  0.00240300,  -0.00150848,  -0.00300501,  -0.00039626,-
0.00258365,  -0.00025108,  -0.00054973,  0.00145405},
{   -0.00023407,  -0.00239894,  0.00102984,  0.00612422,  -0.00136156,  0.00867489,
0.00206586,  0.00942366,  0.00106978,  -0.00561362},
{    0.00234993, -0.00051945,  -0.00417579,  -0.00371189,  0.00167682,  -0.00557327,
0.00565083,  0.01242620,  -0.00050916,  -0.00199941},
{   -0.00188685,  -0.00077652, 0.00330529, -0.00125596, -0.00501212, -0.00913486,-
0.00240911,  0.00818219,  0.00350082,  0.00295110},
{   -0.00076638,  0.00183468,  0.00532269,  -0.00322180,  0.00552090,  0.00256412,
0.00336437,  0.00908956,  0.00331912,  -0.00190910},
{    0.00111320, -0.00037587, -0.00024503,  0.00402914,  0.00237231,  -0.00271156,-
0.01232017,  0.01351714,  0.01213235,  0.00516090},
{    0.00210448,  0.00546874,  -0.00340875,  0.00102174,  0.00582430,  -0.00256006,-
0.00435470,  -0.00040125,  0.00165970,  -0.00364914},
{    0.00126084,  0.00040107, -0.00141030, -0.00645370, -0.00571476,  0.00271883,
0.00332637,  0.00396915,  0.00628144,  0.00809955},
{    0.00117079,  0.00059576,  -0.00014311,  -0.00465681,  -0.00591142,  -0.00478553,-
0.00138077,  -0.00704582,  -0.01184659,  0.00882896},
{    0.00138973,  0.00123652,  0.00304817,  -0.00507302,  0.00288668,  -0.00338459,-
0.01331825,  0.00027167,  0.00470983,  0.00387003},
{    0.00076815,  0.00155115,  0.00291000,  0.00703008,  0.00621193,  0.00485275 ,
0.00301572,  -0.00341427,  0.00549137,  0.00287316},
{    0.00033265, -0.00047441, -0.00019610, -0.00024157,  0.01414834,  0.00262556,-
0.00205734,  0.00161241,  0.00131464,  0.00131441},
{   -0.00378284, -0.00044598, -0.00380424, -0.00331107,  0.00360503,  -0.00291761,-
0.00829789,  0.00941720,  0.00051424,  -0.00585368},
{    0.00195321,  0.00184592,  -0.00126926,  0.00055559,  -0.00055360,  -0.00721628,
0.00243223,  -0.00459577,  0.01175538,  0.01116091},
{   -0.00023710,  0.00162962,  -0.00275466,  -0.00136286,  0.00636333,  0.00927344,
0.00845523,  0.00355330,  -0.00205688,  -0.00505345},
{    0.00427265,  0.00381217,  -0.00033214,  0.00105652,  -0.00486730,  0.00089909,
0.00048308,  -0.00797174,  0.00324721,  -0.00023383},
{    0.00026448, -0.00067842,  0.00107705,  0.00333172,  0.00195835,  0.00189156,
0.00951886,  0.00930392,  0.00693669,  0.00857660},
{    0.00407814,  0.00285434,  0.00269327,   0.00424816,  0.00462708,  0.00521001,
0.00096518,  0.00184609,  -0.00404653,  -0.00582069},
{    0.00051601,  0.00244371,  0.00807730,  -0.00659189,  0.00075139,  0.00120002,-
0.00067461,  -0.00520723,  0.00006501,  -0.00106395},
				
				<dp n="d876"/>
{    0.00154864,  0.00175935, 0.00137842,  0.00332717,  -0.00770257,  -0.00281735,
0.00898536,  0.00426355,  0.00356744,  -0.00048447},
{   -0.00110883,  -0.00025148,  0.00118848, -0.00870558,  0.00650556,  0.00586968,
0.00271981,  -0.00453412,  0.00242571,  0.00849993},
{    0.00070532,  -0.00025072,  0.00366505,  -0.00167716,  -0.00296136,  0.01020369,
0.00688567,  0.00095235,  -0.01077141,  0.00293674},
{    0.00269407,  0.00092414,  -0.00878398,   0.00160851,  -0.00639129,  -0.00094266,
0.00082998,  -0.00270264,  -0.00442263,  -0.00888590},
{   -0.00278214,  0.00287601,  -0.00500381,  -0.00138864,  -0.00284296,  -0.00735792,
0.00637880,  -0.00326541,  0.00157648,  -0.00131956},
{    0.00363546,  0.00214577,  0.00414674,  0.00266734,  -0.00079453,  -0.00406520,
0.00712001,  0.00206326,  -0.00523273,  0.01149989},
{   -0.00000026,  -0.00386427,  0.00640634,  0.00261276,  0.00277903,  -0.00013026,-
0.01273183,  0.00959437,  -0.00109646,  -0.00530037},
{    0.00349409,  0.00059023,  -0.00230930,  0.00261091,  -0.00124556,  -0.00746849,-
0.01029008,  0.00287435,  -0.00605374,  -0.00529882},
{    0.00353078,  0.00009537,  0.00405514,  -0.00273642,  -0.00681506,  0.00089121,-
0.00769497,  0.00918448,  0.00100596,  -0.00354415},
{   -0.00048915,  0.00219592,  0.00196135,  0.00371528,  0.00049757,  -0.00921692,
0.00952075,  0.00796835,  -0.00439759,  -0.00914252},
{    0.00099541,  -0.00179639, -0.00422007,  0.00144744,  -0.00122703,  0.00894285,
0.00517048,  -0.00422113,  0.00026459,  0.01125521},
{    0.00284500,  0.00255142,  -0.00501236,  -0.00399376,  0.00453097,  -0.00045817,
0.00396111,  -0.00344911,  -0.01026568,  0.00482538},
{   -0.00325499,  0.00057240,  -0.00117489,  -0.00668998,  -0.00387262,  0.00826259,
0.00012935,  -0.00535898,  -0.00161315,  -0.00518571},
{   -0.00204424,  -0.00205964,  -0.00267784,  -0.00085138,  0.00334009,  -0.00839914,-
0.00136307,  -0.00173559,  -0.00516495,  0.01164448},
{   -0.00410270,  0.00939750,   0.00385454,   0.00290060,  0.00194424,  0.00206843,
0.00582770,  -0.00159821,  -0.00199349,  -0.00404345},
{    0.00129409,  -0.00184888,  -0.00259575,  -0.00257605,  0.00297719,  0.00723570,-
0.00858313,  -0.00202067,  -0.00340528,  -0.00772488},
{   -0.00235071, -0.00109572, -0.00477851, -0.00437243,  0.00461958,  0.00073576,-
0.00018923,  0.00108088,  0.00900257,  0.00726468},
{   -0.00078569,  0.00304111,   0.00186742,  -0.00410820,  0.00456433,  -0.00060262,-
0.00330057,  -0.00122075,  -0.01093924,  -0.00844479},
{    0.00095778,  0.00049767,  0.00293670,   0.00335490,  0.00341477,  0.00244888,-
0.00308668,  -0.01163045,  -0.01418884,  0.00720374},
{    0.00026347,  -0.00164608,  -0.00094501,  0.00772980,  0.00046633,  -0.00128056,
0.00689654,  -0.00084991,  -0.01277967,  -0.00052741},
{   -0.00065633,  0.00272296,   0.00456446,   0.00488337,  -0.00292273,  -0.00487562,-
0.00687198,  -0.00517779,  -0.00174580,  -0.00346636},
{    0.00260815,  -0.00641491, -0.00095775, -0.00226445, -0.00283377, -0.00246661,-
0.00611697,  -0.00409055,  0.00354730,  0.00338705},
{   -0.00099595,  0.00094685,  -0.00331898,  -0.00146973,  0.00179052,  -0.00139797,-
0.00709227,  -0.01524743,  0.00441790,  0.00173202},
{   -0.00408121,  0.00089766,  0.00094466,  0.00325065,  0.00672033,  -0.00019249,
0.00589924,  0.00322853,  -0.00242561,  0.00219359},
{   -0.00257228,  -0.00179791,  -0.00268333, -0.00031574,  -0.00571698,  -0.00369395,-
0.00741923,  -0.00260730,  -0.00501607,  0.00224587},
{   -0.00113380,  -0.00073103,  -0.00428704,  0.00683978,  0.00594497,  0.00372150,-
0.00044871,  -0.00602975,  -0.00321987,  -0.00597447},
{    0.00341457,  0.00178256, -0.00503937, -0.00927698,  0.00228853,  0.00247928,-
0.00337487,  0.00382129,  0.00237729,  -0.00228635},
{   -0.00621084,  0.00386607,  0.00249559,  0.00131394,  0.00261413,  0.00158248,-
0.00461110,  -0.00825484,  0.00388321,  0.00049303},
{   -0.00071191, -0.00404093, -0.00406227, -0.00362297, -0.00396032, -0.00054434,
0.00823714,  0.00458085,  -0.00313846,  -0.00720971},
{   -0.00317347, -0.00411505, 0.00155333, -0.00082595,  0.00270407,  0.00844264,
0.00193732,  0.00016764,  0.00304433,  0.00055788},
				
				<dp n="d877"/>
{   -0.00530220,  0.00236141,  0.00160612,  -0.00435760,  -0.00325925,  -0.00106870,
0.01171124,  0.00597055,  0.00152771,  -0.00160379},
{   -0.00380354, -0.00248355, -0.00205986,  0.00649275,  -0.00148701,  -0.00123465,
0.00469793,  0.00036483,  0.00663194,  0.00243151},
{   -0.00319243,  -0.00320118,  0.00582574,  -0.00058566,  -0.00096663,  -0.00345346,
0.00008310,  -0.00664409,  -0.00607386,  -0.00673633},
{   -0.01462694,  0.01047577,  0.00080652,  -0.00036210,  0.00012141,  -0.00213070,
0.00368270,  0.00243329,  0.00218546,  -0.00253235},
{    0.00057512, -0.00450090, -0.01124568, -0.00049298,  0.00071818,  -0.00244420,-
0.00243412,  0.00051171,  -0.00145560,  -0.00282889},
{   -0.01118169,   0.00200960,  0.01001314,   0.00019961,  0.00375019,  0.00144620,-
0.00168001,  -0.00091153,  -0.00359078,  -0.00690694},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
				
				<dp n="d878"/>
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.000000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
				
				<dp n="d879"/>
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
},
{{   0.00086208,  -0.00248842,  0.00084186,  -0.00446845,  0.00190942,  -0.00295110,-
0.00414520,  0.00622425,  0.00301297,  -0.00225570},
{   -0.00066277,  -0.00156242,  -0.00188648,  -0.00068226,  0.00362849,  0.00524252,
0.00329070,  0.00544285,  0.00084142,  -0.00328989},
{    0.00028247,  -0.00016973,  0.00049755,  -0.00255812,  -0.00450452,  0.00681138,-
0.00044480,  0.00599771,  0.00111314,  0.00478895},
{    0.00041410,  0.00081556,  -0.00343059,  -0.00451393,  -0.00500038,  -0.00225441,
0.00018195,  0.00143104,  0.00177757,  -0.00128368},
{   -0.00079673,  0.00159853,  -0.00034292,  0.00129426,  -0.00007302,  0.00546219,
0.00665160,  -0.00060734,  0.00546493,  0.00373903},
{    0.00068656,  0.00111316, -0.00008834,  0.00168500,  -0.00013310,  -0.01042266,
0.00157247,  0.00014180,  0.00170112,  0.00146082},
{   -0.00166456,  -0.00053325,  0.00240356,  -0.00180217,  0.00300015,  -0.00312061,
0.00658243,  -0.00067789,  0.00694877,  0.00108795},
{    0.00118114,  -0.00008417, -0.00656243, 0.00095065,  0.00071917,  -0.00153054,-
0.00386470,  -0.00257462,  0.00007614,  0.00225336},
{    0.00094708, -0.00160821, 0.00629218,  0.00066733,  0.00448857,  -0.00283788,
0.00022201,  0.00142664,  0.00163499,  -0.00287178},
{   -0.00443331,  0.00103346, -0.00057657, -0.00053597,  -0.00097487,  0.00332860,-
0.00072481,  -0.00027174,  0.00542735,  -0.00107210},
{   -0.00153246,  0.00126305,  0.00037245,  0.00417289,  -0.00493101,  -0.00290573,
0.00475200,  -0.00247545,  0.00169144,  -0.00189035},
{    0.00632485,  0.00086394,  -0.00243321,  -0.00106806,  0.00089774,  0.00107041,
0.00100679,  -0.00003992,  -0.00117692,  -0.00043792},
{   -0.00623386,  0.01390054,  0.00108531,  -0.00192767,  -0.00132562,  0.00104818,-
0.00054211,  -0.00030534,  -0.00020025,  -0.00258714},
{   -0.00113192, -0.00035026, -0.00059348,  0.00129056,  -0.00149712,  -0.00082094,-
0.00071770,  0.00970785,  0.00744038,  0.00238955},
{    0.00123799,  0.00207061,  -0.00115538,  -0.00289553,  0.00056005,  -0.00391641,
0.00717160,  0.00382398,  -0.00122682,  -0.00377559},
{    0.00077307,  0.00142555,  0.00109648,  -0.00464006,  0.00533187,  -0.00510332,
0.00023855,  -0.00328482,  -0.00074710,  -0.00460103},
{    0.00238819,  -0.00135793,  -0.00201387, 0.00387475,  -0.00317698,  -0.00222894,
0.00021505,  0.00525476,  0.00104911,  -0.00520327},
{    0.00065771,  -0.00098232,  0.00319080, -0.00011477,  -0.00132514,  -0.00374788,
0.00162312,  0.00722737,  -0.00459214,  0.00172425},
{   -0.00080202,  0.00335683,  0.00240561,  -0.00084930,  -0.00253268,  -0.00320793,
0.00148629,  0.00474258,  0.00404238,  -0.00205515},
				
				<dp n="d880"/>
{   -0.00084023,  -0.00062754,  0.00305737,  -0.00277919,  -0.00390684,  0.00155093,
0.00464761,  0.00169321,  -0.00112743,  -0.00660412},
{   -0.00176868,  0.00027891,  -0.00201939,  -0.00235603,  -0.00009332,  -0.00457865,-
0.00467367,  0.00322558,  0.00020224,  0.00584177},
{    0.00086051,  -0.00472371,  0.00225357,  0.00169834,  -0.00099507,  0.00166508,
0.00349894,  -0.00397513,  0.00081766,  0.00088133},
{   -0.00135226,  -0.00102119,  0.00024682,  0.00058089,  0.00708151,  0.00338386,-
0.00097824,  -0.00454912,  0.00067067,  0.00050568},
{   -0.00166578,  -0.00031528,  0.00204148,  0.00423986,  0.00002128,  0.00552738,
0.00293300,  0.00102631,  -0.00392290,  0.00005823},
{    0.00247632,  0.00008008,  0.00181157,  0.00039791,  -0.00424684,  -0.00178287,
0.00106831,  -0.00164437,  0.00466169,  0.00536029},
{    0.00125419,  0.00000370,  -0.00230147,  0.00086239,  -0.00376812,  0.00998392,
0.00183310,  -0.00260948,  0.00012972,  -0.00325000},
{   -0.00129835,  -0.00040074, 0.00347131, -0.00240826,  -0.00210135,  0.00023977,-
0.00514458,  0.00096217,  0.00482401,  0.00448526},
{   -0.00020902,  0.00260007,  0.00052125,  -0.00445330,  -0.00314753,  0.00350929,
0.00163139,  -0.00557720,  0.00211181,  0.00226549},
{    0.00095971,  0.00192905,  0.00138940,  -0.00149907,  0.00434330,  0.00299268,-
0.00050098,  0.00685241,  0.00339234,  0.00214265},
{    0.00111410,  0.00147469,  -0.00261147,  0.00385966,  -0.00161462,  0.00069539,
0.00429436,  0.00372510,  -0.00357642,  0.00732019},
{    0.00006076,  0.00042616, -0.00290309, -0.00079895,  0.00620516,  -0.00348487,
0.00376823,  0.00253090,  0.00253809,  0.00324418},
{   -0.00012903,  0.00245457,  -0.00379365,  0.00290667,  0.00212028,  0.00266207,-
0.00094542,  0.00127099,  0.00286725,  -0.00536799},
{   -0.00009478, -0.00029151, -0.00049341,  0.00888911,  0.00214375,  0.00061872,
0.00143956,  0.00142848,  0.00333705,  0.00056408},
{    0.00222409,  -0.00002446,  -0.00149917,  0.00325262,  0.00276110,  -0.00310332,
0.00352549,  -0.00657974,  -0.00242479,  0.00296384},
{   -0.00134549,  0.00274138,  -0.00217626,  0.00018026,  0.00211455,  0.00533394,-
0.00307828,  -0.00164653,  -0.00277337,  0.00667706},
{    0.00064191, -0.00189750,  -0.00206915, -0.00192326,  -0.00156328,  -0.00116744,
0.00750298,  0.00038875,  -0.00034884,  0.00670989},
{   -0.00064076,  0.00027328,  -0.00032465, -0.00764104,  0.00273591,  0.00193690,
0.00167687,  0.00269155,  -0.00268331,  0.00124151},
{   -0.00203748,  0.00145185,  -0.00306498,  0.00044752,  -0.00373806,  0.00209342,-
0.00038828,  0.00603700,  -0.00437354,  -0.00275224},
{    0.00024120,  -0.00048565, -0.00123779,  0.00499967,  -0.00281858,  0.00397071,-
0.00330131,  -0.00607967,  0.00298967,  0.00235291},
{    0.00196641,  0.00056098,  -0.00177490, -0.00194885,  0.00203612,  -0.00067509,-
0.00565878,  0.00424678,  -0.00609632,  0.00238902},
{    0.00014292,  -0.00202034, -0.00166715, -0.00079566, -0.00315657, -0.00596721,-
0.00141144,  -0.00552633,  0.00226848,  -0.00208710},
{    0.00093111, -0.00165178,  -0.00032798,  0.00295016,  0.00195668,  0.00147907,-
0.00431917,  0.00469877,  -0.00039486,  0.00895634},
{    0.00122796,  0.00203197,  0.00268342,  0.00095639,  -0.00378623,  0.00180324,-
0.00269705,  -0.00036101,  -0.00557186,  -0.00079306},
{    0.00180834,  0.00084937,  0.00222321,  0.00285031,  0.00249971,  0.00239334,
0.00671113,  0.00031736,  0.00160739,  -0.00415138},
{   -0.00174145,  0.00091289,  -0.00316276,  -0.00256852,  0.00151101,  0.00104166,
0.00534198,  -0.00497542,  -0.00067080,  -0.00337438},
{   -0.00097879,  0.00144201,  0.00080518,  0.00356054,  0.00239883,  -0.00256869,-
0.00483024,  0.00850655,  -0.00034326,  -0.00500386},
{   -0.00212114, -0.00127095,  -0.00140703,  0.00327541,  0.00122228,  -0.00489747,
0.00317885,  0.00162179,  -0.00275859,  -0.00532159},
{    0.00025401,  0.00014398,  0.00298840,  0.00243957,  0.00166451,  0.00629781,-
0.00537736,  0.00110198,  0.00363840,  -0.00101688},
{   -0.00202005,  0.00235003,  0.00217112,  0.00022358,  0.00312872,  -0.00218539,
0.00335181,  0.00012472,  -0.00442290,  0.00491788},
				
				<dp n="d881"/>
{   -0.00202496,  0.00038179,  0.00070388,  -0.00313552,  0.00304247,  0.00196510,-
0.00682258,  0.00062708,  -0.00069537,  -0.00433244},
{   -0.00024116,  -0.00111487,  0.00232351,  0.00340867,  0.00186041,  -0.00438451,-
0.00575372,  -0.00318147,  -0.00328493,  0.00097041},
{    0.00147860,  0.00312901,  0.00014157,  0.00339818,  0.00150767,  -0.00205441,-
0.00322139,  -0.00185155,  0.00341243,  0.00366935},
{    0.00018523, 0.00192453,  -0.00110424,  0.00024090,  -0.00346463,  -0.00066422,-
0.00953683,  0.00067760,  0.00292052,  -0.00150136},
{    0.00056105,  0.00009368,  0.00118450,  -0.00227920,  0.00227109,  -0.00205330,-
0.00230305,  -0.00634465,  0.00179672,  0.01198107},
{    0.00215523, -0.00042082, -0.00175150,  -0.00358539,  0.00279677,  0.00336525,-
0.00016516,  -0.00443252,  0.00674258,  0.00099186},
{   -0.00142919,  0.00124386,  0.00293935,  0.00149501,  -0.00001751,  -0.00030417,-
0.00203712,  -0.00892448,  0.00199036,  -0.00334775},
{    0.00185580,  -0.00063800,  0.00416852,  -0.00335500,  0.00154925,  0.00345948,-
0.00107564,  -0.00527175,  -0.00310700,  -0.00329016},
{   -0.00096271,  -0.00176145,  -0.00088351,  -0.00397697,  -0.00203621,  0.00308198,-
0.00394513,  -0.00270040,  -0.00509416,  0.00386696},
{    0.00073146,  -0.00078403,  0.00206517,  -0.00050691,  0.00247155,  0.00521481,
0.00314152,  0.00015458,  -0.00658762,  0.01286261},
{   -0.00177727,  -0.00088440,  0.00112403,  0.00121361,  -0.00446313,  -0.00190805,
0.00097416,  -0.00196491,  -0.00458979,  0.00926580},
{   -0.00063716,  -0.00074135,  -0.00320684,  0.00060174,  0.00146160,  -0.00175724,
0.00095403,  -0.00052926,  -0.01098564,  0.00521625},
{    0.00147074,  -0.00242869,  -0.00034958,  0.00151139,  -0.00105102,  0.00117536,-
0.00341839,  -0.00116328,  -0.00521109,  -0.00834604},
{   -0.00089161,  0.00169236,   0.00070051,  -0.00300855,  -0.00261332,  -0.00489216,-
0.00078356,  -0.00301007,  -0.00620281,  -0.00242624},
{    0.00009583,  0.00150178,  -0.00007453,   0.00239520,  0.00522328,  0.00147270,
0.00167806,  -0.00123525,  -0.00775452,  -0.00448655},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
				
				<dp n="d882"/>
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
				
				<dp n="d883"/>
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
{    0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.00000000,
0.00000000,  0.00000000,  0.00000000,  0.00000000},
},
};
/*------------------------------------------*/
/*=====================*/
/*---------------------END---------------------*/
/*==============================*/
				
				<dp n="d884"/>
/*=================================*/
=*/
/*=============================*/
/*Conexant system Inc.                                               */
/*4311 Jamboree Road                                                 */
/*Newport Beach,CA 92660                                             */
/*-------------------------------------------------------------------*/
/*Copyright(C) 2000 Conexant system Inc.                             */
/*-------------------------------------------------------------------*/
/*ALL RIGHTS RESERVED:                                               */
/*No part of this software may be reproduced in any form or by any   */
/*means or used to make any derivative work  (such as transformation */
/*or adaptation)without the authorisation of Conexant system Inc.    */
/*==============================*/
/*LIBRARy:tracks.tab                                                 */
/*=================================*/
/*---------------------------------------------------------------------------
*/
/*----------------------------TABLES-----------------------------------------
*/
/*---------------------------------------------------------------------------
*/
static INT16 srchpuls[12]={0,1,2,3,4,6,5,7,0,7,1,6};
/*-------------------------------------------------------------------*/
/*==============13 bits FCB=======*/
/*-------------------------------------------------------------------*/
/*-------------------------------------------------------------------*/
/*    2 pulses CB  :  2pulses × 5bits/pulse +2 signs = 12 bits      */
/*-------------------------------------------------------------------*/
static INT16 track_2_5_0[2][32]={

    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 20, 22, 24, 26,

    28,  30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52},

    {1, 3, 5, 7, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25,

    27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51}};
/*-------------------------------------------------------------------*/
/*    3 pulses CB  :  3 pulses × 2 bits/pulse + 3 signs = 9 bits    */
/*-------------------------------------------------------------------*/
static  INT16 track_3_2_0[3][4]={

           {0, 3, 6, 9},{1, 4, 7, 10},{2, 5, 8, 11}
};
/*-------------------------------------------------------------------*/
/*    1 pulse CB  :  1 pulse × 3 bits/pulse + 1 signs = 4 (3) bits  */
/*-------------------------------------------------------------------*/
static  INT16 track_1_3_0[1][8]={

        {0, 5, 11, 17, 23, 29, 35, 41}
};
/*-------------------------------------------------------------------*/
				
				<dp n="d885"/>
/*============================15 bits FCB================================*/
/*-----------------------------------------------------------------------*/
/*-----------------------------------------------------------------------*/
/*    2 pulses CB  :  2pulses × 6.5bits/pulse + 1 sign = 14 bits        */
/*-----------------------------------------------------------------------*/
static INT16 track_2_7_1[2][80]={

    {0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10,  11,  12,  13,  14,  15,

     16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,  27,  28,  29,  30,  31,

     32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,  43,  44,  45,  46,  47,

     48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,  59,  60,  61,  62,  63,

     64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,  75,  76,  77,  78,  79},

    {0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10,  11,  12,  13,  14,  15,

     16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,  27,  28,  29,  30,  31,

     32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,  43,  44,  45,  46,  47,

     48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,  59,  60,  61,  62,  63,

     64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,  75,  76,  77,  78,  79}
};
/*-----------------------------------------------------------------------*/
/*   1 pulse CB  :  1 pulse × 4 bits/pulse + 1 signs=5 (4) bits         */
/*-----------------------------------------------------------------------*/
static INT16 track_1_4_0[1][16]={

    {0, 4, 8, 12, 16, 20, 24, 28, 33, 38, 43, 48, 53, 58, 63, 68}
};
/*-----------------------------------------------------------------------*/
/*===============30 bits FCB==============*/
/*-----------------------------------------------------------------------*/
/*-----------------------------------------------------------------------*/
/*   8 pulses CB  :  6p × 3b + 2p ×  4b+ 4b signs = 30 bits            */
/*-----------------------------------------------------------------------*/
static  INT16 track_8_4_0[8][16]={

    {0, 5, 10, 15, 20, 25, 30, 35, 2, 7, 12, 17, 22, 27, 32, 37},

    {1, 6, 11, 16, 21, 26, 31, 36, 0, 0, 0, 0, 0, 0, 0, 0},

    {3, 8, 13, 18, 23, 28, 33, 38, 0, 0, 0, 0, 0, 0, 0, 0},

    {4, 9, 14, 19, 24, 29, 34, 39, 0, 0, 0, 0, 0, 0, 0, 0},

    {0, 5, 10, 15, 20, 25, 30, 35, 2, 7, 12, 17, 22, 27, 32, 37},

    {1, 6, 11, 16, 21, 26, 31, 36, 0, 0, 0, 0, 0, 0, 0, 0},

    {3, 8, 13, 18, 23, 28, 33, 38, 0, 0, 0, 0, 0, 0, 0, 0},

    {4, 9, 14, 19, 24, 29, 34, 39, 0, 0, 0, 0, 0, 0, 0, 0}
};
/*-----------------------------------------------------------------------*/
/*==========22 bits FCB================*/
/*-----------------------------------------------------------------------*/
/*-----------------------------------------------------------------------*/
/*   5 pulses CB  : 3p × 4b + 2p × 3b + 3b signs = 21 bits             */
/*-----------------------------------------------------------------------*/
				
				<dp n="d886"/>
static short track_5_4_0[5][16]={

    {0, 5, 10, 15, 20, 25, 30, 35, 2, 7, 12, 17, 22, 27, 32, 37},

    {1, 6, 11, 16, 21, 26, 31, 36, 3, 8, 13, 18, 23, 28, 33, 38},

    {4, 9, 14, 19, 24, 29, 34, 39, 0, 0, 0, 0, 0, 0, 0, 0},

    {1, 6, 11, 16, 21, 26, 31, 36, 3, 8, 13, 18, 23, 28, 33, 38},

    {4, 9, 14, 19, 24, 29, 34, 39, 0, 0, 0, 0, 0, 0, 0, 0},
};
/*-------------------------------------------------------------------*/
/*    5 pulses CB  :  5p × 3b + 5b signs = 20 bits                  */
/*-------------------------------------------------------------------*/
static short track_5_3_2[5][8]={

    {0,  1,  2,  3,  4,  6,  8,  10},

    {5,  9,  13, 16, 19, 22, 25, 27},

    {7,  11, 15, 18, 21, 24, 28, 32},

    {12, 14, 17, 20, 23, 26, 30, 34},

    {29, 31, 33, 35, 36, 37, 38, 39}
};
/*-------------------------------------------------------------------*/
/*    5 pulses CB  :  5p × 3b + 5b signs = 20 bits                  */
/*-------------------------------------------------------------------*/
static  short  track_5_3_1[5][8]={

    {0,  1,  2,  3,  4,  5,  6,  7},

    {8,  9,  10, 11, 12, 13, 14, 15},

    {16, 17, 18, 19, 20, 21, 22, 23},

    {24, 25, 26, 27, 28, 29, 30, 31},

    {32, 33, 34, 35, 36, 37, 38, 39}
};
/*---------------------------------------------------------------------------
*/
/*================================
*/
/*----------------------------------END------------------------------------
*/
/*=================================
*/

Claims (64)

1.一种可变速率语音压缩系统(10),用于处理语音信号(18),其特征在于可变速率语音压缩系统包括:
编码系统(12),可用于获取语音信号的帧的参数和对参数进行编码,所述编码系统包括:
帧处理模块(44、72、76、82、86),可用于对表示帧的参数进行编码,作为速率选择和类型分类的函数,速率选择包括第一速率和第二速率中之一,而类型分类包括第一类型(152、184)和第二类型(154、186)中之一,帧处理模块包括音调预处理模块(322),可用于修改语音信号而改进编码;以及
子帧处理模块(70、74、80、84),可用于对表示帧的子帧的参数进行编码,作为速率选择和类型分类的函数;
所述类型分类表示语音信号的一个或多个特征,编码系统(12)对语音信号进行编码,作为速率和类型分类的函数,以优化编码。
2.如权利要求1所述的可变速率语音压缩系统,其特征在于,音调预处理模块可用于执行语音信号的连续时间扭曲。
3.如权利要求1或2所述的可变速率语音压缩系统,其特征在于,音调预处理模块可用于修改语音信号,作为语音信号等级表征的函数。
4.如权利要求1或2所述的可变速率语音压缩系统,其特征在于,音调预处理模块可用于执行语音信号的波形内插。
5.如权利要求1所述的可变速率语音压缩系统,其特征在于,帧处理模块包括内插模块(338),当类型分类是第一类而且速率选择是第一速率时它可用于选择内插路径,帧处理模块可用于对短期预测器参数进行编码,作为内插路径的函数。
6.如权利要求1所述的可变速率语音压缩系统,其特征在于,帧处理模块包括预测器交换机模块(336),当速率选择是第二速率时它可用于选择预测器系数,帧处理模块可用于对短期预测器参数进行编码,作为预测器系数的函数。
7.如权利要求1所述的可变速率语音压缩系统,其特征在于,当类型分类是第二类时,帧处理模块可用于对短期预测器参数、开环音调滞后、自适应密码本增益和固定密码本进行编码。
8.如权利要求1或7所述的可变速率语音压缩系统,其特征在于,帧处理模块包括3维/4维开环VQ模块(454),当类型分类是第二类时,3维/4维开环VQ模块(454)可用于用预增益量化表对自适应密码本增益进行编码。
9.如权利要求1或7所述的可变速率语音压缩系统,其特征在于,帧处理模块包括3维/4维VQ增益密码本(492),当类型分类是第二类时,3维/4维VQ增益密码本可用于用延迟增益量化表对固定密码本增益进行编码。
10.如权利要求1所述的可变速率语音压缩系统,其特征在于,当类型分类是第一类时,子帧处理模块可用于对闭环音调滞后、固定密码本作用、自适应密码本增益进行编码。
11.如权利要求1所述的可变速率语音压缩系统,其特征在于,子帧处理模块可用于搜索固定密码本(390),以确定子帧的固定密码本作用,当速率选择是第一速率而且类型分类是第一类时,固定密码本包括3个5脉冲密码本(160)。
12.如权利要求1或11所述的可变速率语音压缩系统,其特征在于,子帧处理模块可用于搜索固定密码本(390),以确定子帧的固定密码本作用,当速率选择是第一速率而且类型分类是第二类时,固定密码本包括一个8脉冲密码本(162)。
13.如权利要求1所述的可变速率语音压缩系统,其特征在于,子帧处理模块可用于搜索固定密码本(390),以确定子帧的固定密码本作用,当速率选择是第二速率而且类型分类是第一类时,固定密码本包括2脉冲密码本(192)、3脉冲密码本(194)以及高斯密码本(195)。
14.如权利要求1或13所述的可变速率语音压缩系统,其特征在于,子帧处理模块可用于搜索固定密码本(390),以确定子帧的固定密码本作用,当速率选择是第二速率而且类型分类是第二类时,固定密码本包括2脉冲密码本(196)和3脉冲密码本(197)。
15.如权利要求1或13所述的可变速率语音压缩系统,其特征在于,子帧处理模块可用于执行固定密码本的增强,增强包括注入高频噪声、结合附加脉冲和滤波中的至少一个。
16.如权利要求1所述的可变速率语音压缩系统,其特征在于,当速率选择是第一速率和第二速率中之一而且类型分类是第一类时,子帧处理模块可用于确定子帧的量化增益矢量,量化的增益矢量表示自适应密码本增益和固定密码本增益的联合编码。
17.如权利要求1所述的可变速率语音压缩系统,其特征在于,第一速率是每秒8.5千位,而第二速率是每秒4.0千位。
18.一种可变速率语音压缩系统(10),用于处理语音信号(18),其特征在于,可变速率语音压缩系统包括:
编码系统(12),可用于获取语音信号的帧的参数并对参数进行编码,所述编码系统包括:
子帧处理模块(70、74、80、84),可用于对表示帧的子帧的参数进行编码,作为速率选择和类型分类的函数,速率选择包括第一速率和第二速率中之一,而类型分类包括第一类型(152、184)和第二类型(154、186)中之一,子帧处理模块包括:
增益量化部分(366),当类型分类是第一类时,它可用于对自适应密码本增益和固定密码本增益进行联合编码;以及
帧处理模块(44、72、76、82、86),可用于对表示的帧的参数进行编码,作为速率选择和类型分类的函数,帧处理模块包括:
3维/4维开环VQ模块(454),当类型分类是第二类时,它可用于对自适应密码本增益进行编码;以及
3维/4维增益密码本(492),当类型分类是第二类时,帧处理模块可用于用3维/4维VQ增益密码本对固定密码本增益进行编码;
所述类型分类表示语音信号的一个或多个特征,编码系统(12)对语音信号进行编码,作为速率和类型分类的函数,以优化编码。
19.如权利要求18所述的可变速率语音压缩系统,其特征在于,子帧处理模块进一步包括自适应密码本部分(362),当类型分类是第一类时,它可用于产生闭环音调滞后。
20.如权利要求18或19所述的可变速率语音压缩系统,其特征在于,子帧处理模块进一步包括开环音调估计模块(316),当类型分类是第二类时,它可用于产生开环音调滞后。
21.如权利要求18或19所述的可变速率语音压缩系统,其特征在于,帧处理模块包括音调预处理模块(322),它可用于修改语音信号,以改进编码。
22.如权利要求18所述的可变速率语音压缩系统,其特征在于,帧处理模块包括内插模块(338),当类型分类是第一类而且速率选择是第一速率时,它可用于选择内插路径,帧处理模块可用于对短期预测器参数进行编码,作为内插路径的函数。
23.如权利要求18所述的可变速率语音压缩系统,其特征在于,帧处理模块包括预测器交换机模块(336),当速率选择是第二速率时,它可用于产生预测器系数,帧处理模块可用于对短期预测器参数进行编码,作为预测器系数的函数。
24.一种用可变速率语音压缩系统(10)处理语音信号(18)的方法,其特征在于,所述方法包括以下步骤:
a)从语音信号帧中获取参数;
b)选择速率,作为所获取参数的函数;
c)选择类型分量,包括第一类(152、184)和第二类(154、186),作为所获取参数的函数,所述类型分类表示语音信号的一个或多个特征并用于优化对语音信号的处理;
d)当类型分类是第一类时,对每个子帧的自适应密码本增益和固定密码本增益进行联合编码;以及
e)当类型分类是第二类时,对该帧的自适应密码本增益和固定密码本增益进行独立编码。
25.如权利要求24所述的方法,其特征在于,进一步包括:
f)当类型分类是第一类时,对帧的多个子帧中每一个的闭环音调滞后进行编码;
g)当类型分类是第二类时,对表示帧的开环音调滞后进行编码。
26.如权利要求24或25所述的方法,其特征在于,a)包括执行音调预处理以修改语音信号的步骤。
27.如权利要求24所述的方法,其特征在于,b)包括选择速率,作为模式信号的函数的步骤。
28.如权利要求24所述的方法,其特征在于,b)包括:
执行开环速率选择;以及
执行最后速率选择,作为开环速率选择、帧的表征以及半速率信令标志的函数。
29.如权利要求24所述的方法,其特征在于,进一步包括:
f)当类型分类是第一类而且速率选择是全速率时,选择内插路径,对短期预测器参数进行编码。
30.如权利要求24所述的方法,其特征在于,进一步包括:
f)当选择的速率是半速率时,选择预测器系数组;以及
g)对短期预测器参数进行编码,作为所选择的预测器系数组的函数。
31.如权利要求24所述的方法,其特征在于,e)包括用预增益量化表对自适应密码本增益进行编码。
32.如权利要求24或31所述的方法,其特征在于,e)包括用延迟增益量化表对固定密码本增益进行编码。
33.如权利要求24所述的方法,其特征在于,进一步包括:
f)选择作为半速率的速率;
g)把高频噪声注入固定密码本;
h)把附加脉冲结合到固定密码本中;以及
i)对固定密码本作用进行编码。
34.如权利要求24所述的方法,其特征在于,b)包括选择每秒8.5千位和每秒4千位之一。
35.一种可变速率语音压缩系统(10),用于处理语音信号(18),其特征在于,可变速率语音压缩系统包括:
编码系统(12),可用于确定语音信号的速率选择和类型分类,编码系统包括:
线频谱频率预测误差量化表,可选择作为速率选择的函数,线频谱频率预测误差量化表与语音信号的短期预测器参数的编码相关联;
2维增益量化表,当类型分类是第一类(152、184)时,它与自适应密码本增益和固定密码本增益的联合编码相关联;
预增益量化表,可选择作为速率选择的函数,当类型分类是第二类时(154,186),预增益量化表与自适应密码本增益的编码相关联;
延迟增益量化表,可选择作为速率选择的函数,当类型分类是第二类时,延迟增益量化表与固定密码本增益的编码相关联;以及
所述类型分类表示语音信号的一个或多个特征,编码系统(12)对语音信号进行编码,作为速率和类型分类的函数,以优化编码;
与编码系统通信的解码系统(16),解码系统(16)可用于用线频谱频率预测误差量化表以及2维增益量化表、预增益量化表和延迟增益量化表中的至少一个对语音信号进行解码,作为速率选择和类型分类的函数。
36.如权利要求35所述的可变速率语音压缩系统,其特征在于,当速率选择是全速率时,线频谱频率预测误差量化表包括4级(156)。
37.如权利要求36所述的可变速率语音压缩系统,其特征在于,第一级包括128个量化矢量。
38.如权利要求35所述的可变速率语音压缩系统,其特征在于,当速率选择是半速率时,线频谱频率预测误差量化表包括3级(188)。
39.如权利要求38所述的可变速率语音压缩系统,其特征在于,第一级和第二级的每一个包括128个量化矢量,而第三级包括64个量化矢量。
40.如权利要求39所述的可变速率语音压缩系统,其特征在于,第一级包括表示为{0.00842379,0.00868718,0.01533677,0.00423439,-0.00886805,-0.02132286,-0.03152681,-0.01975061,-0.01152093,-0.01341948}的第一量化矢量和表示为{0.02528175,0.04259634,0.03789221,0.01659535,-0.00266498,-0.01529545,-0.01653101,-0.01528401,-0.01047642,-0.01127117}的第二量化矢量。
41.如权利要求39所述的可变速率语音压缩系统,其特征在于,第二级包括表示为{0.00589332,0.00462334,-0.00937151,-0.01478366,0.00674597,0.00164302,-0.00890749,-0.00091839,0.00487032,0.00012026}的第一量化矢量和表示为{-0.00346857,-0.00100200,-0.00418711,-0.01512477,-0.00104209,-0.00491133,-0.00209555,0.00045850,0.00023339,0.00567173}的第二量化矢量。
42.如权利要求39所述的可变速率语音压缩系统,其特征在于,第三级包括表示为{-0.00071405,0.00244371,0.00235739,-0.00329369,0.00472867,-0.00361321,-0.00584670,0.00863128,0.00145642,-0.00441746}的第一量化矢量和表示为{0.00242589,-0.00430711,-0.00122645,-0.00464764,-0.00017887,-0.00471663,0.00181162,0.00249980,-0.00276848,-0.00485697}的第二量化矢量。
43.如权利要求35所述的可变速率语音压缩系统,其特征在于,对于语音信号的帧的至少两个子帧中的每一个,编码系统可用于用2维增益量化表对固定密码本增益和自适应密码本增益进行联合编码。
44.如权利要求35所述的可变速率语音压缩系统,其特征在于,2维增益量化表包括两个要素中每一个的128个量化矢量。
45.如权利要求35所述的可变速率语音压缩系统,其特征在于,当速率选择是全速率时,2维增益量化表包括表示为{1.13718400,2.00167200}的第一量化矢量和表示为{1.15061100,0.80219900}的第二量化矢量。
46.如权利要求35所述的可变速率语音压缩系统,其特征在于,当速率选择是全速率时,预增益量化表包括64个矢量。
47.如权利要求35所述的可变速率语音压缩系统,其特征在于,当速率选择是半速率时,预增益量化表包括16个矢量。
48.如权利要求35所述的可变速率语音压缩系统,其特征在于,当速率选择是全速率时,预增益量化表包括表示为{0.60699869,0.59090763,0.64920781,0.64610492}的第一矢量和表示为{0.68101613,0.65403889,0.64210982,0.63130892}的第二矢量。
49.如权利要求35所述的可变速率语音压缩系统,其特征在于,当速率选择是半速率时,预增益量化表包括表示为{1.16184904,1.16859789,1.13656320}的第一矢量和表示为{1.14613289,1.06371877,0.91852525}的第二矢量。
50.如权利要求35所述的可变速率语音压缩系统,其特征在于,当速率选择是全速率时,延迟增益量化表包括1024个矢量。
51.如权利要求35所述的可变速率语音压缩系统,其特征在于,当速率选择是半速率时,延迟增益量化表包括256个矢量。
52.如权利要求35所述的可变速率语音压缩系统,其特征在于,当类型分类是第二类和速率选择是全速率时,编码系统可用于用延迟增益量化表和多个预测系数进行编码。
53.如权利要求35所述的可变速率语音压缩系统,其特征在于,预测器系数包括表示为{0.7,0.6,0.4,0.2}的第一预测器系数、表示为{0.4,0.2,0.1,0.05}的第二预测器系数、表示为{0.3,0.2,0.075,0.025}的第三预测器系数、和表示为{0.2,0.075,0.025,0.0}的第四预测器系数。
54.如权利要求35所述的可变速率语音压缩系统,其特征在于,当速率选择是半速率时,延迟增益量化表包括表示为{0.18423671,0.06523999,0.13390472}的第一矢量和表示为{0.27552690,0.09702324,0.05427950}的第二矢量。
55.如权利要求35所述的可变速率语音压缩系统,其特征在于,编码系统进一步包括与短期预测器参数的编码相关联的线频谱频率预测器系数表,线频谱频率预测器系数表包括第一组预测器系数和第二组预测器系数,当速率选择是半速率时,编码系统可选择第一和第二组预测器系数。
56.如权利要求35所述的可变速率语音压缩系统,其特征在于,第一组预测器系数包括表示为{0.45782564,0.59002827,0.73704688,0.73388197,0.75903791,0.74076479,0.65966007,0.58070788,0.52280647,0.42738207}的第一矢量和表示为{0.19087084,0.26721569,0.38110463,0.39655069,0.43984539,0.42178869,0.34869783,0.28691864,0.23847475,0.17468375}的第二矢量。
57.如权利要求35所述的可变速率语音压缩系统,其特征在于,第二组预测器系数包括表示为{0.14936742,0.25397049,0.42536339,0.40318214,0.39778242,0.34731435,0.22773174,0.17583478,0.12497067,0.11001108}的第一矢量和表示为{0.09932127,0.15389237,0.24021347,0.24507006,0.25478926,0.23018456,0.15178193,0.11368182,0.07674584,0.06122567}的第二矢量。
58.一种用于处理语音信号的语音压缩系统,其特征在于,所述语音压缩系统包括:
一个编码系统,用于选择对语音信号编码的速率,作为语音信号表征的函数;
所述编码系统用于选择类型分类,它包括第一类型和第二类型中的一个;
当选择第一速率时,所述编码系统用于对语音信号进行编码,作为速率和类型分类的函数;
当选择第二速率时,所述编码系统用于对语音信号进行编码,作为速率的函数,而不考虑类型分类;以及
当选择第一速率且类型分类是第二类型时,所述编码系统用于对自适应密码本增益和固定密码本增益进行编码,其中自适应密码本增益被独立于固定密码本增益进行编码;
所述类型分类表示语音信号的一个或多个特征,编码系统(12)对语音信号进行编码,作为速率和类型分类的函数,以优化编码。
59.如权利要求58所述的语音压缩系统,其特征在于,当选择第一速率且类型分类是第一类型时,所述编码系统用于对自适应密码本增益和固定密码本增益进行联合编码。
60.如权利要求59所述的语音压缩系统,其特征在于,对于语音信号的多个子帧中的每一个,对被联合编码的自适应密码本增益和固定密码本增益进行编码。
61.如权利要求60所述的语音压缩系统,其特征在于,自适应密码本增益和固定密码本增益代表语音信号帧。
62.如权利要求58所述的语音压缩系统,其特征在于,当选择第一速率时,被编码的语音信号包括第一部分和第二部分,所述第一部分代表在帧基础上的语音信号的参数,所述第二部分代表在子帧基础上的语音信号的参数。
63.如权利要求62所述的语音压缩系统,其特征在于,所述编码系统包括起始帧处理模块和激励处理模块,当帧的类型分类是第一类型时,所述起始帧处理模块用于产生被编码的语音信号的第一部分,所述激励处理模块用于产生被编码的语音信号的第二部分。
64.如权利要求62所述的语音压缩系统,其特征在于,所述编码系统包括起始帧处理模块和激励处理模块,当帧的类型分类是第二类型时,所述起始帧处理模块用于产生被编码的语音信号的第一部分,所述激励处理模块用于产生被编码的语音信号的第一部分的一部分和被编码的语音信号的第二部分。
CNB008159408A 1999-09-22 2000-09-15 多模式语音编码器 Expired - Fee Related CN1245706C (zh)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
US15532199P 1999-09-22 1999-09-22
US60/155,321 1999-09-22
US09/574,396 2000-05-19
US09/574,396 US6782360B1 (en) 1999-09-22 2000-05-19 Gain quantization for a CELP speech coder

Publications (2)

Publication Number Publication Date
CN1451155A CN1451155A (zh) 2003-10-22
CN1245706C true CN1245706C (zh) 2006-03-15

Family

ID=26852220

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB008159408A Expired - Fee Related CN1245706C (zh) 1999-09-22 2000-09-15 多模式语音编码器

Country Status (8)

Country Link
EP (1) EP1214706B9 (zh)
JP (2) JP4176349B2 (zh)
KR (1) KR100488080B1 (zh)
CN (1) CN1245706C (zh)
AT (1) ATE272885T1 (zh)
AU (1) AU7486200A (zh)
BR (1) BRPI0014212B1 (zh)
DE (1) DE60012760T2 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8451915B2 (en) 2007-03-21 2013-05-28 Samsung Electronics Co., Ltd. Efficient uplink feedback in a wireless communication system
CN104505097A (zh) * 2011-02-15 2015-04-08 沃伊斯亚吉公司 检索激励的固定贡献的量化增益的设备和方法
CN105074820A (zh) * 2013-02-21 2015-11-18 高通股份有限公司 用于确定内插因数组的系统和方法
US9911425B2 (en) 2011-02-15 2018-03-06 Voiceage Corporation Device and method for quantizing the gains of the adaptive and fixed contributions of the excitation in a CELP codec

Families Citing this family (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100463418B1 (ko) * 2002-11-11 2004-12-23 한국전자통신연구원 Celp 음성 부호화기에서 사용되는 가변적인 고정코드북 검색방법 및 장치
FR2867649A1 (fr) * 2003-12-10 2005-09-16 France Telecom Procede de codage multiple optimise
JP4846712B2 (ja) * 2005-03-14 2011-12-28 パナソニック株式会社 スケーラブル復号化装置およびスケーラブル復号化方法
US7177804B2 (en) * 2005-05-31 2007-02-13 Microsoft Corporation Sub-band voice codec with multi-stage codebooks and redundant coding
CN101371295B (zh) * 2006-01-18 2011-12-21 Lg电子株式会社 用于编码和解码信号的设备和方法
KR20100006492A (ko) * 2008-07-09 2010-01-19 삼성전자주식회사 부호화 방식 결정 방법 및 장치
US8712764B2 (en) 2008-07-10 2014-04-29 Voiceage Corporation Device and method for quantizing and inverse quantizing LPC filters in a super-frame
KR101170466B1 (ko) 2008-07-29 2012-08-03 한국전자통신연구원 Mdct 영역에서의 후처리 방법, 및 장치
JP2010122617A (ja) * 2008-11-21 2010-06-03 Yamaha Corp ノイズゲート、及び収音装置
JP2010160496A (ja) * 2010-02-15 2010-07-22 Toshiba Corp 信号処理装置および信号処理方法
US9047875B2 (en) 2010-07-19 2015-06-02 Futurewei Technologies, Inc. Spectrum flatness control for bandwidth extension
US9026434B2 (en) * 2011-04-11 2015-05-05 Samsung Electronic Co., Ltd. Frame erasure concealment for a multi rate speech and audio codec
CN104517612B (zh) * 2013-09-30 2018-10-12 上海爱聊信息科技有限公司 基于amr-nb语音信号的可变码率编码器和解码器及其编码和解码方法
JP5981408B2 (ja) * 2013-10-29 2016-08-31 株式会社Nttドコモ 音声信号処理装置、音声信号処理方法、及び音声信号処理プログラム
CN106463134B (zh) 2014-03-28 2019-12-13 三星电子株式会社 用于对线性预测系数进行量化的方法和装置及用于反量化的方法和装置
KR102400540B1 (ko) 2014-05-07 2022-05-20 삼성전자주식회사 선형예측계수 양자화방법 및 장치와 역양자화 방법 및 장치
CN109979470B (zh) * 2014-07-28 2023-06-20 瑞典爱立信有限公司 椎体矢量量化器形状搜索
US10109284B2 (en) * 2016-02-12 2018-10-23 Qualcomm Incorporated Inter-channel encoding and decoding of multiple high-band audio signals
US10373630B2 (en) * 2017-03-31 2019-08-06 Intel Corporation Systems and methods for energy efficient and low power distributed automatic speech recognition on wearable devices
WO2019068915A1 (en) * 2017-10-06 2019-04-11 Sony Europe Limited AUDIO FILE ENVELOPE BASED ON RMS POWER IN SUB-WINDOW SEQUENCES
CN108122552B (zh) * 2017-12-15 2021-10-15 上海智臻智能网络科技股份有限公司 语音情绪识别方法和装置
CN113593521B (zh) * 2021-07-29 2022-09-20 北京三快在线科技有限公司 语音合成方法、装置、设备及可读存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3353852B2 (ja) * 1994-02-15 2002-12-03 日本電信電話株式会社 音声の符号化方法
US5701390A (en) * 1995-02-22 1997-12-23 Digital Voice Systems, Inc. Synthesis of MBE-based coded speech using regenerated phase information

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8451915B2 (en) 2007-03-21 2013-05-28 Samsung Electronics Co., Ltd. Efficient uplink feedback in a wireless communication system
CN101636995B (zh) * 2007-03-21 2015-11-25 三星电子株式会社 无线通信系统中的高效上行链路反馈
CN105357155A (zh) * 2007-03-21 2016-02-24 三星电子株式会社 收发控制信息的方法和装置
US9521019B2 (en) 2007-03-21 2016-12-13 Samsung Electronics Co., Ltd. Efficient uplink feedback in a wireless communication system
CN105357155B (zh) * 2007-03-21 2019-05-03 三星电子株式会社 收发控制信息的方法和装置
CN104505097A (zh) * 2011-02-15 2015-04-08 沃伊斯亚吉公司 检索激励的固定贡献的量化增益的设备和方法
US9911425B2 (en) 2011-02-15 2018-03-06 Voiceage Corporation Device and method for quantizing the gains of the adaptive and fixed contributions of the excitation in a CELP codec
CN104505097B (zh) * 2011-02-15 2018-08-17 沃伊斯亚吉公司 检索激励的固定贡献的量化增益的设备和方法
US10115408B2 (en) 2011-02-15 2018-10-30 Voiceage Corporation Device and method for quantizing the gains of the adaptive and fixed contributions of the excitation in a CELP codec
CN105074820A (zh) * 2013-02-21 2015-11-18 高通股份有限公司 用于确定内插因数组的系统和方法
CN105074820B (zh) * 2013-02-21 2019-01-15 高通股份有限公司 用于确定内插因数组的系统和方法

Also Published As

Publication number Publication date
JP2005338872A (ja) 2005-12-08
EP1214706B9 (en) 2005-01-05
KR20020033819A (ko) 2002-05-07
EP1214706A1 (en) 2002-06-19
KR100488080B1 (ko) 2005-05-06
CN1451155A (zh) 2003-10-22
EP1214706B1 (en) 2004-08-04
AU7486200A (en) 2001-04-24
BR0014212A (pt) 2003-06-10
BRPI0014212B1 (pt) 2016-07-26
DE60012760D1 (de) 2004-09-09
ATE272885T1 (de) 2004-08-15
JP2003513296A (ja) 2003-04-08
JP4176349B2 (ja) 2008-11-05
DE60012760T2 (de) 2005-08-04

Similar Documents

Publication Publication Date Title
CN1245706C (zh) 多模式语音编码器
CN1205603C (zh) 在用于宽带信号编码的代数码本中索引脉冲位置和符号的方法和设备
CN1240049C (zh) 语音编码系统
CN1229775C (zh) 宽带语音和音频信号解码器中的增益平滑
CN100338648C (zh) 在基于线性预测的语音编码解码器中有效帧删除隐藏的方法和器件
CN1296888C (zh) 音频编码装置以及音频编码方法
CN1242380C (zh) 利用原型波形的周期性语音编码
CN1131507C (zh) 音频信号编码装置、解码装置及音频信号编码·解码装置
CN1160703C (zh) 语音编码方法和装置以及声音信号编码方法和装置
CN1331826A (zh) 可变速率语音编码
CN1145142C (zh) 矢量量化方法和语音编码方法及其装置
CN1338096A (zh) 用于分析-合成celp型语音编码的自适应窗
CN1286086C (zh) 用于估算语音信号之语音帧中背景噪声的方法和设备
CN100346392C (zh) 编码设备、解码设备、编码方法和解码方法
CN1165892C (zh) 对宽带信号进行解码时的周期性增强的方法和设备
CN1703737A (zh) 在自适应多速率宽带(amr-wb)和多模式可变比特率宽带(vmr-wb)编解码器之间互操作的方法
CN1957398A (zh) 在基于代数码激励线性预测/变换编码激励的音频压缩期间低频加重的方法和设备
CN1156303A (zh) 语音编码方法和装置以及语音解码方法和装置
CN1890713A (zh) 用于数字信号压缩编码的多脉冲字典的索引间的编码转换
CN1898724A (zh) 语音/乐音编码设备及语音/乐音编码方法
CN1216367C (zh) 数据处理装置
CN1465149A (zh) 发送设备及方法、接收设备及方法和发送/接收设备
CN1808569A (zh) 话音编码器,正交检索方法和celp话音编码方法
CN1242860A (zh) 话音信号编码器和话音信号解码器
CN1667703A (zh) 编码域中的音频增强

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: The American state of Massachusetts

Patentee after: Marion bide Technology Co.,Ltd.

Address before: California, USA

Patentee before: Mindspeed Technologies, Inc.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20180409

Address after: The American state of Massachusetts

Patentee after: Magnesium Microwave Technology Co.,Ltd.

Address before: The American state of Massachusetts

Patentee before: Marion bide Technology Co.,Ltd.

Effective date of registration: 20180409

Address after: California, USA

Patentee after: Mindspeed Technologies, Inc.

Address before: California, USA

Patentee before: Conexant Systems, Inc.

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20060315

Termination date: 20190915