Commit 617af25e authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Cleaning up intra_decision()

parent ca6533cd
......@@ -883,7 +883,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, c
/* Don't use intra energy when we're operating at low bit-rate */
intra_ener = st->force_intra || (!has_pitch && st->delayedIntra && nbAvailableBytes > st->end);
if (shortBlocks || intra_decision(bandLogE, st->oldBandE, effEnd))
if (shortBlocks || intra_decision(bandLogE, st->oldBandE, st->start, effEnd, st->mode->nbEBands, C))
st->delayedIntra = 1;
else
st->delayedIntra = 0;
......
......@@ -53,17 +53,19 @@ static const celt_word16 pred_coef[4] = {29440, 26112, 21248, 16384};
static const celt_word16 pred_coef[4] = {29440/32768., 26112/32768., 21248/32768., 16384/32768.};
#endif
/* FIXME: Implement for stereo */
int intra_decision(celt_word16 *eBands, celt_word16 *oldEBands, int len)
int intra_decision(celt_word16 *eBands, celt_word16 *oldEBands, int start, int end, int len, int C)
{
int i;
int c, i;
celt_word32 dist = 0;
for (i=0;i<len;i++)
for (c=0;c<C;c++)
{
celt_word16 d = SUB16(eBands[i], oldEBands[i]);
dist = MAC16_16(dist, d,d);
for (i=start;i<end;i++)
{
celt_word16 d = SUB16(eBands[i+c*len], oldEBands[i+c*len]);
dist = MAC16_16(dist, d,d);
}
}
return SHR32(dist,2*DB_SHIFT) > 2*len;
return SHR32(dist,2*DB_SHIFT) > 2*C*(end-start);
}
int *quant_prob_alloc(const CELTMode *m)
......
......@@ -54,7 +54,7 @@ void quant_prob_free(int *freq);
void compute_fine_allocation(const CELTMode *m, int *bits, int budget);
int intra_decision(celt_word16 *eBands, celt_word16 *oldEBands, int len);
int intra_decision(celt_word16 *eBands, celt_word16 *oldEBands, int start, int end, int len, int C);
void quant_coarse_energy(const CELTMode *m, int start, int end, const celt_word16 *eBands, celt_word16 *oldEBands, int budget, int intra, int *prob, celt_word16 *error, ec_enc *enc, int _C, int LM, celt_word16 max_decay);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment