Skip to content

Commit

Permalink
Fix f5b9fa0: cleanup high-band fine energy+PVQ
Browse files Browse the repository at this point in the history
  • Loading branch information
jmvalin committed Nov 29, 2024
1 parent 7c23781 commit 85526a7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
22 changes: 13 additions & 9 deletions celt/celt_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1342,18 +1342,22 @@ int celt_decode_with_ec_dred(CELTDecoder * OPUS_RESTRICT st, const unsigned char
qext_bits = ((opus_int32)qext_bytes*8<<BITRES) - ec_tell_frac(dec) - 1;
clt_compute_extra_allocation(mode, qext_mode, start, end, NULL, NULL,
qext_bits, extra_pulses, extra_quant, C, LM, &ext_dec, 0);
if (qext_bytes > 0)
if (qext_bytes > 0) {
unquant_fine_energy(mode, start, end, oldBandE, fine_quant, extra_quant, &ext_dec, C);
if (qext_mode) {
ec_enc foo_enc;
ec_enc_init(&foo_enc, NULL, 0);
int zeros[21] = {0};
ALLOC(qext_collapse_masks, C*NB_QEXT_BANDS, unsigned char);
unquant_fine_energy(qext_mode, 0, NB_QEXT_BANDS, qext_oldBandE, NULL, &extra_quant[nbEBands], &ext_dec, C);
quant_all_bands(0, qext_mode, 0, NB_QEXT_BANDS, X, C==2 ? X+N : NULL, qext_collapse_masks,
if (qext_mode) {
VARDECL(int, zeros);
VARDECL(unsigned char, qext_collapse_masks);
ec_dec dummy_dec;
ALLOC(zeros, nbEBands, int);
ALLOC(qext_collapse_masks, C*NB_QEXT_BANDS, unsigned char);
ec_dec_init(&dummy_dec, NULL, 0);
OPUS_CLEAR(zeros, end);
unquant_fine_energy(qext_mode, 0, NB_QEXT_BANDS, qext_oldBandE, NULL, &extra_quant[nbEBands], &ext_dec, C);
quant_all_bands(0, qext_mode, 0, NB_QEXT_BANDS, X, C==2 ? X+N : NULL, qext_collapse_masks,
NULL, &extra_pulses[nbEBands], shortBlocks, spread_decision, dual_stereo, intensity, zeros,
qext_bytes*(8<<BITRES), 0, &ext_dec, LM, codedBands, &st->rng, 0,
st->arch, st->disable_inv, &foo_enc, zeros, 0);
st->arch, st->disable_inv, &dummy_dec, zeros, 0);
}
}
#endif

Expand Down
26 changes: 15 additions & 11 deletions celt/celt_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -2526,18 +2526,22 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
clt_compute_extra_allocation(mode, qext_mode, start, end, bandLogE, qext_bandLogE,
qext_bits, extra_pulses, extra_quant, C, LM, &ext_enc, 1);
OPUS_COPY(error_bak, error, C*nbEBands);
if (qext_bytes > 0)
if (qext_bytes > 0) {
quant_fine_energy(mode, start, end, oldBandE, error, fine_quant, extra_quant, &ext_enc, C);
if (qext_mode) {
quant_fine_energy(qext_mode, 0, NB_QEXT_BANDS, qext_oldBandE, qext_error, NULL, &extra_quant[nbEBands], &ext_enc, C);
ec_enc foo_enc;
ec_enc_init(&foo_enc, NULL, 0);
int zeros[21] = {0};
ALLOC(qext_collapse_masks, C*NB_QEXT_BANDS, unsigned char);
quant_all_bands(1, qext_mode, 0, NB_QEXT_BANDS, X, C==2 ? X+N : NULL, qext_collapse_masks,
qext_bandE, &extra_pulses[nbEBands], shortBlocks, st->spread_decision,
dual_stereo, st->intensity, zeros, qext_bytes*(8<<BITRES),
0, &ext_enc, LM, codedBands, &st->rng, st->complexity, st->arch, st->disable_inv, &foo_enc, zeros, 0);
if (qext_mode) {
VARDECL(int, zeros);
VARDECL(unsigned char, qext_collapse_masks);
ec_enc dummy_enc;
ALLOC(zeros, nbEBands, int);
ALLOC(qext_collapse_masks, C*NB_QEXT_BANDS, unsigned char);
ec_enc_init(&dummy_enc, NULL, 0);
OPUS_CLEAR(zeros, end);
quant_fine_energy(qext_mode, 0, NB_QEXT_BANDS, qext_oldBandE, qext_error, NULL, &extra_quant[nbEBands], &ext_enc, C);
quant_all_bands(1, qext_mode, 0, NB_QEXT_BANDS, X, C==2 ? X+N : NULL, qext_collapse_masks,
qext_bandE, &extra_pulses[nbEBands], shortBlocks, st->spread_decision,
dual_stereo, st->intensity, zeros, qext_bytes*(8<<BITRES),
0, &ext_enc, LM, codedBands, &st->rng, st->complexity, st->arch, st->disable_inv, &dummy_enc, zeros, 0);
}
}
#endif

Expand Down

0 comments on commit 85526a7

Please sign in to comment.