diff options
author | Jean-Marc Valin <jmvalin@amazon.com> | 2023-05-09 09:45:19 +0300 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@amazon.com> | 2023-06-16 20:01:31 +0300 |
commit | 7d4aeb756f2bf6d8b6119f66acc7954b8651258c (patch) | |
tree | e68c9c2d37b527afc716922227c88401b3afb880 /silk | |
parent | d7e1bd507f2f1bdec0487133036f135801abcb71 (diff) |
Fix DRED PVQ for case when K=0 on a split
Diffstat (limited to 'silk')
-rw-r--r-- | silk/dred_coding.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/silk/dred_coding.c b/silk/dred_coding.c index e6f65f7f..56d8961f 100644 --- a/silk/dred_coding.c +++ b/silk/dred_coding.c @@ -36,6 +36,7 @@ #include "celt/vq.h" #include "celt/cwrs.h" #include "celt/laplace.h" +#include "os_support.h" #define LATENT_DIM 80 #define PVQ_DIM 24 @@ -46,7 +47,10 @@ static void encode_pvq(const int *iy, int N, int K, ec_enc *enc) { celt_assert(N==24 || N==12 || N==6); fits = (N==24 && K<=9) || (N==12 && K<=16) || (N==6); /*printf("encode(%d,%d), fits=%d\n", N, K, fits);*/ - if (fits) encode_pulses(iy, N, K, enc); + if (fits) { + if (K > 0) + encode_pulses(iy, N, K, enc); + } else { int N2 = N/2; int K0=0; @@ -90,7 +94,12 @@ static void decode_pvq(int *iy, int N, int K, ec_dec *dec) { celt_assert(N==24 || N==12 || N==6); fits = (N==24 && K<=9) || (N==12 && K<=16) || (N==6); /*printf("encode(%d,%d), fits=%d\n", N, K, fits);*/ - if (fits) decode_pulses(iy, N, K, dec); + if (fits) { + if (K > 0) + decode_pulses(iy, N, K, dec); + else + OPUS_CLEAR(iy, N); + } else { int N2 = N/2; int K0; |