Commit 1b36d6c8 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Complexity setting now controls two-pass coarse energy quantization

parent 020ef4f8
...@@ -743,7 +743,8 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, c ...@@ -743,7 +743,8 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, c
ALLOC(error, C*st->mode->nbEBands, celt_word16); ALLOC(error, C*st->mode->nbEBands, celt_word16);
quant_coarse_energy(st->mode, st->start, st->end, effEnd, bandLogE, quant_coarse_energy(st->mode, st->start, st->end, effEnd, bandLogE,
oldBandE, nbCompressedBytes*8, st->mode->prob, oldBandE, nbCompressedBytes*8, st->mode->prob,
error, enc, C, LM, nbAvailableBytes, st->force_intra, &st->delayedIntra); error, enc, C, LM, nbAvailableBytes, st->force_intra,
&st->delayedIntra, st->complexity >= 4);
ec_enc_bit_prob(enc, shortBlocks!=0, 8192); ec_enc_bit_prob(enc, shortBlocks!=0, 8192);
......
...@@ -183,7 +183,7 @@ static void quant_coarse_energy_impl(const CELTMode *m, int start, int end, ...@@ -183,7 +183,7 @@ static void quant_coarse_energy_impl(const CELTMode *m, int start, int end,
void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
const celt_word16 *eBands, celt_word16 *oldEBands, int budget, const celt_word16 *eBands, celt_word16 *oldEBands, int budget,
const celt_int16 *prob, celt_word16 *error, ec_enc *enc, int _C, int LM, const celt_int16 *prob, celt_word16 *error, ec_enc *enc, int _C, int LM,
int nbAvailableBytes, int force_intra, int *delayedIntra) int nbAvailableBytes, int force_intra, int *delayedIntra, int two_pass)
{ {
const int C = CHANNELS(_C); const int C = CHANNELS(_C);
int intra; int intra;
...@@ -216,8 +216,11 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, ...@@ -216,8 +216,11 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
ALLOC(error_intra, C*m->nbEBands, celt_word16); ALLOC(error_intra, C*m->nbEBands, celt_word16);
CELT_COPY(oldEBands_intra, oldEBands, C*end); CELT_COPY(oldEBands_intra, oldEBands, C*end);
quant_coarse_energy_impl(m, start, end, eBands, oldEBands_intra, budget, if (two_pass || intra)
prob, error_intra, enc, C, LM, 1, max_decay); {
quant_coarse_energy_impl(m, start, end, eBands, oldEBands_intra, budget,
prob, error_intra, enc, C, LM, 1, max_decay);
}
if (!intra) if (!intra)
{ {
...@@ -241,7 +244,7 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, ...@@ -241,7 +244,7 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
quant_coarse_energy_impl(m, start, end, eBands, oldEBands, budget, quant_coarse_energy_impl(m, start, end, eBands, oldEBands, budget,
prob, error, enc, C, LM, 0, max_decay); prob, error, enc, C, LM, 0, max_decay);
if (ec_enc_tell(enc, 3) > tell_intra) if (two_pass && ec_enc_tell(enc, 3) > tell_intra)
{ {
*enc = enc_intra_state; *enc = enc_intra_state;
*(enc->buf) = buf_intra_state; *(enc->buf) = buf_intra_state;
......
...@@ -51,7 +51,7 @@ void quant_prob_free(const celt_int16 *freq); ...@@ -51,7 +51,7 @@ void quant_prob_free(const celt_int16 *freq);
void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
const celt_word16 *eBands, celt_word16 *oldEBands, int budget, const celt_word16 *eBands, celt_word16 *oldEBands, int budget,
const celt_int16 *prob, celt_word16 *error, ec_enc *enc, int _C, int LM, const celt_int16 *prob, celt_word16 *error, ec_enc *enc, int _C, int LM,
int nbAvailableBytes, int force_intra, int *delayedIntra); int nbAvailableBytes, int force_intra, int *delayedIntra, int two_pass);
void quant_fine_energy(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, ec_enc *enc, int _C); void quant_fine_energy(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, ec_enc *enc, int _C);
......
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