diff options
author | Jean-Marc Valin <jmvalin@amazon.com> | 2022-12-21 11:30:31 +0300 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@amazon.com> | 2023-06-16 20:01:26 +0300 |
commit | 8bbfb2ec479624f80c60a3fc1b0180f0bf36a922 (patch) | |
tree | a17417af6cda5a8abd9de34e2550ebb3d4b85906 /silk | |
parent | 6b124314887b7b02d2f128ce4126ee0dc29da25d (diff) |
Controlling DRED on the encode side
Diffstat (limited to 'silk')
-rw-r--r-- | silk/dred_encoder.c | 4 | ||||
-rw-r--r-- | silk/dred_encoder.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/silk/dred_encoder.c b/silk/dred_encoder.c index 9e9077f8..5ab56ed1 100644 --- a/silk/dred_encoder.c +++ b/silk/dred_encoder.c @@ -74,7 +74,7 @@ void dred_process_silk_frame(DREDEnc *enc, const opus_int16 *silk_frame) enc->latents_buffer_fill = IMIN(enc->latents_buffer_fill+1, DRED_NUM_REDUNDANCY_FRAMES); } -int dred_encode_silk_frame(DREDEnc *enc, unsigned char *buf, int max_frames, int max_bytes) { +int dred_encode_silk_frame(DREDEnc *enc, unsigned char *buf, int max_chunks, int max_bytes) { const opus_uint16 *dead_zone = DRED_rdovae_get_dead_zone_pointer(); const opus_uint16 *p0 = DRED_rdovae_get_p0_pointer(); const opus_uint16 *quant_scales = DRED_rdovae_get_quant_scales_pointer(); @@ -90,7 +90,7 @@ int dred_encode_silk_frame(DREDEnc *enc, unsigned char *buf, int max_frames, int ec_enc_init(&ec_encoder, buf, max_bytes); dred_encode_state(&ec_encoder, enc->state_buffer); - for (i = 0; i < enc->latents_buffer_fill-1; i += 2) + for (i = 0; i < IMIN(2*max_chunks, enc->latents_buffer_fill-1); i += 2) { q_level = (int) floor(0.5f + DRED_ENC_Q0 + 1.f * (DRED_ENC_Q1 - DRED_ENC_Q0) * i / (DRED_NUM_REDUNDANCY_FRAMES - 2)); offset = q_level * DRED_LATENT_DIM; diff --git a/silk/dred_encoder.h b/silk/dred_encoder.h index a32cfa97..662cedd6 100644 --- a/silk/dred_encoder.h +++ b/silk/dred_encoder.h @@ -51,6 +51,6 @@ void dred_deinit_encoder(DREDEnc *enc); void dred_process_silk_frame(DREDEnc *enc, const opus_int16 *silk_frame); -int dred_encode_silk_frame(DREDEnc *enc, unsigned char *buf, int max_frames, int max_bytes); +int dred_encode_silk_frame(DREDEnc *enc, unsigned char *buf, int max_chunks, int max_bytes); #endif |