Changing some constants to float
This commit is contained in:
parent
8a6ce05931
commit
ae01e119cb
2 changed files with 9 additions and 11 deletions
|
@ -59,10 +59,10 @@ static const celt_word16 transientWindow[16] = {
|
||||||
17896, 20868, 23687, 26258, 28492, 30314, 31662, 32489};
|
17896, 20868, 23687, 26258, 28492, 30314, 31662, 32489};
|
||||||
#else
|
#else
|
||||||
static const float transientWindow[16] = {
|
static const float transientWindow[16] = {
|
||||||
0.0085135, 0.0337639, 0.0748914, 0.1304955,
|
0.0085135f, 0.0337639f, 0.0748914f, 0.1304955f,
|
||||||
0.1986827, 0.2771308, 0.3631685, 0.4538658,
|
0.1986827f, 0.2771308f, 0.3631685f, 0.4538658f,
|
||||||
0.5461342, 0.6368315, 0.7228692, 0.8013173,
|
0.5461342f, 0.6368315f, 0.7228692f, 0.8013173f,
|
||||||
0.8695045, 0.9251086, 0.9662361, 0.9914865};
|
0.8695045f, 0.9251086f, 0.9662361f, 0.9914865f};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ENCODERVALID 0x4c434554
|
#define ENCODERVALID 0x4c434554
|
||||||
|
@ -973,7 +973,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, c
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
max_decay = MIN32(QCONST16(16,DB_SHIFT), SHL32(EXTEND32(nbAvailableBytes),DB_SHIFT-3));
|
max_decay = MIN32(QCONST16(16,DB_SHIFT), SHL32(EXTEND32(nbAvailableBytes),DB_SHIFT-3));
|
||||||
#else
|
#else
|
||||||
max_decay = .125*nbAvailableBytes;
|
max_decay = MIN32(16.f, .125f*nbAvailableBytes);
|
||||||
#endif
|
#endif
|
||||||
quant_coarse_energy(st->mode, st->start, st->end, bandLogE, st->oldBandE, nbCompressedBytes*8, intra_ener, st->mode->prob, error, enc, C, LM, max_decay);
|
quant_coarse_energy(st->mode, st->start, st->end, bandLogE, st->oldBandE, nbCompressedBytes*8, intra_ener, st->mode->prob, error, enc, C, LM, max_decay);
|
||||||
/* Variable bitrate */
|
/* Variable bitrate */
|
||||||
|
@ -1150,7 +1150,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const float * pcm, floa
|
||||||
if (optional_resynthesis != NULL) {
|
if (optional_resynthesis != NULL) {
|
||||||
ret=celt_encode_with_ec(st,in,in,frame_size,compressed,nbCompressedBytes, enc);
|
ret=celt_encode_with_ec(st,in,in,frame_size,compressed,nbCompressedBytes, enc);
|
||||||
for (j=0;j<C*N;j++)
|
for (j=0;j<C*N;j++)
|
||||||
optional_resynthesis[j]=in[j]*(1/32768.);
|
optional_resynthesis[j]=in[j]*(1.f/32768.f);
|
||||||
} else {
|
} else {
|
||||||
ret=celt_encode_with_ec(st,in,NULL,frame_size,compressed,nbCompressedBytes, enc);
|
ret=celt_encode_with_ec(st,in,NULL,frame_size,compressed,nbCompressedBytes, enc);
|
||||||
}
|
}
|
||||||
|
@ -1559,7 +1559,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict p
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
ac[0] += SHR32(ac[0],13);
|
ac[0] += SHR32(ac[0],13);
|
||||||
#else
|
#else
|
||||||
ac[0] *= 1.0001;
|
ac[0] *= 1.0001f;
|
||||||
#endif
|
#endif
|
||||||
/* Lag windowing */
|
/* Lag windowing */
|
||||||
for (i=1;i<=LPC_ORDER;i++)
|
for (i=1;i<=LPC_ORDER;i++)
|
||||||
|
@ -1568,7 +1568,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict p
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
ac[i] -= MULT16_32_Q15(2*i*i, ac[i]);
|
ac[i] -= MULT16_32_Q15(2*i*i, ac[i]);
|
||||||
#else
|
#else
|
||||||
ac[i] -= ac[i]*(.008*i)*(.008*i);
|
ac[i] -= ac[i]*(.008f*i)*(.008f*i);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1896,7 +1896,7 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da
|
||||||
ret=celt_decode_with_ec(st, data, len, out, frame_size, dec);
|
ret=celt_decode_with_ec(st, data, len, out, frame_size, dec);
|
||||||
if (ret==0)
|
if (ret==0)
|
||||||
for (j=0;j<C*N;j++)
|
for (j=0;j<C*N;j++)
|
||||||
pcm[j]=out[j]*(1/32768.);
|
pcm[j]=out[j]*(1.f/32768.f);
|
||||||
|
|
||||||
RESTORE_STACK;
|
RESTORE_STACK;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -68,14 +68,12 @@ static void find_best_pitch(celt_word32 *xcorr, celt_word32 maxcorr, celt_word16
|
||||||
Syy = MAC16_16(Syy, y[j],y[j]);
|
Syy = MAC16_16(Syy, y[j],y[j]);
|
||||||
for (i=0;i<max_pitch;i++)
|
for (i=0;i<max_pitch;i++)
|
||||||
{
|
{
|
||||||
float score;
|
|
||||||
if (xcorr[i]>0)
|
if (xcorr[i]>0)
|
||||||
{
|
{
|
||||||
celt_word16 num;
|
celt_word16 num;
|
||||||
celt_word32 xcorr16;
|
celt_word32 xcorr16;
|
||||||
xcorr16 = EXTRACT16(VSHR32(xcorr[i], xshift));
|
xcorr16 = EXTRACT16(VSHR32(xcorr[i], xshift));
|
||||||
num = MULT16_16_Q15(xcorr16,xcorr16);
|
num = MULT16_16_Q15(xcorr16,xcorr16);
|
||||||
score = num*1./Syy;
|
|
||||||
if (MULT16_32_Q15(num,best_den[1]) > MULT16_32_Q15(best_num[1],Syy))
|
if (MULT16_32_Q15(num,best_den[1]) > MULT16_32_Q15(best_num[1],Syy))
|
||||||
{
|
{
|
||||||
if (MULT16_32_Q15(num,best_den[0]) > MULT16_32_Q15(best_num[0],Syy))
|
if (MULT16_32_Q15(num,best_den[0]) > MULT16_32_Q15(best_num[0],Syy))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue