fixed-point: second check-point on quant_energy_mono()
This commit is contained in:
parent
43b3537d38
commit
d03162010e
1 changed files with 10 additions and 4 deletions
|
@ -107,16 +107,22 @@ static void quant_energy_mono(const CELTMode *m, celt_ener_t *eBands, celt_word1
|
||||||
for (i=0;i<m->nbEBands;i++)
|
for (i=0;i<m->nbEBands;i++)
|
||||||
{
|
{
|
||||||
int q2;
|
int q2;
|
||||||
float offset = Q8_1*(error[i]+QCONST16(.5f,8))*frac[i];
|
float offset2;
|
||||||
|
celt_word16_t offset = (error[i]+QCONST16(.5f,8))*frac[i];
|
||||||
/* FIXME: Instead of giving up without warning, we should degrade everything gracefully */
|
/* FIXME: Instead of giving up without warning, we should degrade everything gracefully */
|
||||||
if (ec_enc_tell(enc, 0) - bits +EC_ILOG(frac[i])> budget)
|
if (ec_enc_tell(enc, 0) - bits +EC_ILOG(frac[i])> budget)
|
||||||
break;
|
break;
|
||||||
q2 = (int)floor(offset);
|
#ifdef FIXED_POINT
|
||||||
|
/* Has to be without rounding */
|
||||||
|
q2 = offset>>8;
|
||||||
|
#else
|
||||||
|
q2 = (int)floor(Q8_1*offset);
|
||||||
|
#endif
|
||||||
if (q2 > frac[i]-1)
|
if (q2 > frac[i]-1)
|
||||||
q2 = frac[i]-1;
|
q2 = frac[i]-1;
|
||||||
ec_enc_uint(enc, q2, frac[i]);
|
ec_enc_uint(enc, q2, frac[i]);
|
||||||
offset = ((q2+.5)/frac[i])-.5;
|
offset = (Q8*(q2+.5)/frac[i])-QCONST16(.5f,8);
|
||||||
oldEBands[i] += DB_SCALING*6.*offset;
|
oldEBands[i] += PSHR32(MULT16_16(DB_SCALING*6,offset),8);
|
||||||
/*printf ("%f ", error[i] - offset);*/
|
/*printf ("%f ", error[i] - offset);*/
|
||||||
}
|
}
|
||||||
for (i=0;i<m->nbEBands;i++)
|
for (i=0;i<m->nbEBands;i++)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue