?? g729a_taming.c
字號:
#include "../Common/typedef.h"
#include "../Include/G729A_basic_op.h"
#include "../Include/G729A_oper_32b.h"
#include "../Include/G729A_ld8a.h"
#include "../Include/G729A_tab_ld8a.h"
static Word32 G729AL_exc_err[4];
void G729AInit_exc_err(void)
{
Word16 i;
for(i=0; i<4; i++) G729AL_exc_err[i] = 0x00004000L;
}
Word16 G729Atest_err(Word16 T0, Word16 T0_frac)
{
Word16 i, t1, zone1, zone2, flag;
Word32 L_maxloc, L_acc;
if(T0_frac > 0) {
t1 = G729Aadd_s(T0, 1);
}
else {
t1 = T0;
}
i = G729Asub_s(t1, (G729A_L_SUBFR+G729A_L_INTER10));
if(i < 0) {
i = 0;
}
zone1 = G729A_tab_zone[i];
i = G729Aadd_s(t1, (G729A_L_INTER10 - 2));
zone2 = G729A_tab_zone[i];
L_maxloc = -1L;
flag = 0 ;
for(i=zone2; i>=zone1; i--) {
L_acc = G729AL_sub(G729AL_exc_err[i], L_maxloc);
if(L_acc > 0L) {
L_maxloc = G729AL_exc_err[i];
}
}
L_acc = G729AL_sub(L_maxloc, G729A_L_THRESH_ERR);
if(L_acc > 0L) {
flag = 1;
}
return(flag);
}
void G729Aupdate_exc_err(Word16 gain_pit, Word16 T0)
{
Word16 i, zone1, zone2, n;
Word32 L_worst, L_temp, L_acc;
Word16 hi, lo;
L_worst = -1L;
n = _ssub(T0, G729A_L_SUBFR);
if(n < 0)
{
hi = G729AL_exc_err[0] >> 16;
lo = (Word16)_ssub(_sshvr(G729AL_exc_err[0], 1), _smpy(hi, 16384));
L_temp = _sadd(_smpy(hi, gain_pit), _smpy(_smpy(lo, gain_pit)>>16, 1));
L_temp = _sshl(L_temp, 1);
L_temp = _sadd(0x00004000L, L_temp);
L_acc = _ssub(L_temp, L_worst);
if(L_acc > 0L)
{
L_worst = L_temp;
}
hi = L_temp >> 16;
lo = (Word16)_ssub(_sshvr(L_temp, 1), _smpy(hi, 16384));
L_temp = _sadd(_smpy(hi, gain_pit), _smpy(_smpy(lo, gain_pit)>>16, 1));
L_temp = _sshl(L_temp, 1);
L_temp = _sadd(0x00004000L, L_temp);
L_acc = _ssub(L_temp, L_worst);
if(L_acc > 0L)
{
L_worst = L_temp;
}
}
else
{
zone1 = G729A_tab_zone[n];
i = _ssub(T0, 1);
zone2 = G729A_tab_zone[i];
for(i = zone1; i <= zone2; i++)
{
hi = G729AL_exc_err[i] >> 16;
lo = (Word16)_ssub(_sshvr(G729AL_exc_err[i], 1), _smpy(hi, 16384));
L_temp = _sadd(_smpy(hi, gain_pit), _smpy(_smpy(lo, gain_pit)>>16, 1));
L_temp = _sshl(L_temp, 1);
L_temp = _sadd(0x00004000L, L_temp);
L_acc = _ssub(L_temp, L_worst);
if(L_acc > 0L) L_worst = L_temp;
}
}
for(i=3; i>=1; i--)
{
G729AL_exc_err[i] = G729AL_exc_err[i-1];
}
G729AL_exc_err[0] = L_worst;
return;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -