Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2016-07-27 05:34:33 +0300
committerJean-Marc Valin <jmvalin@jmvalin.ca>2016-07-27 05:34:50 +0300
commita638ac041c576c31ab89cebf741b6ec4d4703026 (patch)
treee9ca380a48ed3f9a14e914ab09d0c47f0ac36455
parent6e98aed2a80eb96b520471bbb2a37b4aa0810597 (diff)
Fixes buffering of raw bits
-rw-r--r--celt/bands.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/celt/bands.c b/celt/bands.c
index 9a476fc2..088295e3 100644
--- a/celt/bands.c
+++ b/celt/bands.c
@@ -1350,7 +1350,6 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
VARDECL(celt_norm, X_save2);
VARDECL(celt_norm, Y_save2);
VARDECL(celt_norm, norm_save2);
- VARDECL(unsigned char, bytes_save);
int resynth_alloc;
celt_norm *lowband_scratch;
int B;
@@ -1395,7 +1394,6 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
ALLOC(X_save2, resynth_alloc, celt_norm);
ALLOC(Y_save2, resynth_alloc, celt_norm);
ALLOC(norm_save2, resynth_alloc, celt_norm);
- ALLOC(bytes_save, resynth_alloc, unsigned char);
lowband_offset = 0;
ctx.bandE = bandE;
@@ -1513,6 +1511,7 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
unsigned cm, cm2;
int nstart_bytes, nend_bytes, save_bytes;
unsigned char *bytes_buf;
+ unsigned char bytes_save[1275];
/* Make a copy. */
cm = x_cm|y_cm;
ec_save = *ec;
@@ -1536,11 +1535,10 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
OPUS_COPY(Y_save2, Y, N);
if (effective_lowband != -1)
OPUS_COPY(norm_save2, norm+effective_lowband, N);
- nstart_bytes = ec_range_bytes(&ec_save);
- nend_bytes = ec_range_bytes(&ec_save2);
- bytes_buf = ec_get_buffer(&ec_save2) + nstart_bytes;
+ nstart_bytes = ec_save.offs;
+ nend_bytes = ec_save.storage;
+ bytes_buf = ec_save.buf+nstart_bytes;
save_bytes = nend_bytes-nstart_bytes;
- celt_assert(save_bytes <= resynth_alloc && save_bytes >= 0);
OPUS_COPY(bytes_save, bytes_buf, save_bytes);
/* Restore */