diff options
author | Jean-Marc Valin <jmvalin@amazon.com> | 2023-11-08 01:46:38 +0300 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@amazon.com> | 2023-11-08 02:10:50 +0300 |
commit | 222662dac8bfbc2d764142d178b91f9d928f56cc (patch) | |
tree | 377c0fb53ac7238c43d433b28d1dbf2a5950f26b /silk | |
parent | 4e104555e98c8227464f02ee388d983d387612b6 (diff) |
DRED: quantize scale and dead zone to 8 bits
Diffstat (limited to 'silk')
-rw-r--r-- | silk/dred_decoder.c | 2 | ||||
-rw-r--r-- | silk/dred_encoder.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/silk/dred_decoder.c b/silk/dred_decoder.c index c1489f3c..0d22f468 100644 --- a/silk/dred_decoder.c +++ b/silk/dred_decoder.c @@ -45,7 +45,7 @@ static int sign_extend(int x, int b) { return (x ^ m) - m; } -static void dred_decode_latents(ec_dec *dec, float *x, const opus_uint16 *scale, const opus_uint8 *r, const opus_uint8 *p0, int dim) { +static void dred_decode_latents(ec_dec *dec, float *x, const opus_uint8 *scale, const opus_uint8 *r, const opus_uint8 *p0, int dim) { int i; for (i=0;i<dim;i++) { int q; diff --git a/silk/dred_encoder.c b/silk/dred_encoder.c index fb184103..b567a223 100644 --- a/silk/dred_encoder.c +++ b/silk/dred_encoder.c @@ -223,7 +223,7 @@ void dred_compute_latents(DREDEnc *enc, const float *pcm, int frame_size, int ex } } -static void dred_encode_latents(ec_enc *enc, const float *x, const opus_uint16 *scale, const opus_uint16 *dzone, const opus_uint8 *r, const opus_uint8 *p0, int dim) { +static void dred_encode_latents(ec_enc *enc, const float *x, const opus_uint8 *scale, const opus_uint8 *dzone, const opus_uint8 *r, const opus_uint8 *p0, int dim) { int i; int q[IMAX(DRED_LATENT_DIM,DRED_STATE_DIM)]; float xq[IMAX(DRED_LATENT_DIM,DRED_STATE_DIM)]; @@ -233,7 +233,7 @@ static void dred_encode_latents(ec_enc *enc, const float *x, const opus_uint16 * /* This is split into multiple loops (with temporary arrays) so that the compiler can vectorize all of it, and so we can call the vector tanh(). */ for (i=0;i<dim;i++) { - delta[i] = dzone[i]*(1.f/1024.f); + delta[i] = dzone[i]*(1.f/256.f); xq[i] = x[i]*scale[i]*(1.f/256.f); deadzone[i] = xq[i]/(delta[i]+eps); } @@ -272,7 +272,7 @@ int dred_encode_silk_frame(const DREDEnc *enc, unsigned char *buf, int max_chunk &ec_encoder, enc->initial_state, dred_state_quant_scales_q8 + state_qoffset, - dred_state_dead_zone_q10 + state_qoffset, + dred_state_dead_zone_q8 + state_qoffset, dred_state_r_q8 + state_qoffset, dred_state_p0_q8 + state_qoffset, DRED_STATE_DIM); @@ -291,7 +291,7 @@ int dred_encode_silk_frame(const DREDEnc *enc, unsigned char *buf, int max_chunk &ec_encoder, enc->latents_buffer + (i+enc->latent_offset) * DRED_LATENT_DIM, dred_latent_quant_scales_q8 + offset, - dred_latent_dead_zone_q10 + offset, + dred_latent_dead_zone_q8 + offset, dred_latent_r_q8 + offset, dred_latent_p0_q8 + offset, DRED_LATENT_DIM |