summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2016-07-29 13:47:07 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2016-07-29 13:47:07 -0400
commiteb9e9b33fab666e5e8d6215b0f83e5d4c98fbcff (patch)
tree68ce8abe40d75783d494e54abb03e1870f58eb24
parent7226cfbf0b173fdf542f0a5b03b75273b44cff55 (diff)
downloadopus-stereo_masking1.tar.gz
biasing quantizationstereo_masking1
-rw-r--r--celt/bands.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/celt/bands.c b/celt/bands.c
index 2cc6d918..554d0824 100644
--- a/celt/bands.c
+++ b/celt/bands.c
@@ -762,12 +762,13 @@ static void compute_theta(struct band_ctx *ctx, struct split_ctx *sctx,
{
if (encode)
{
+ int qoffset = itheta > 8192 ? 16384/(qn+1) : -16384/(qn+1);
if (!stereo || ctx->theta_round == 0)
itheta = (itheta*(opus_int32)qn+8192)>>14;
else if (ctx->theta_round < 0)
- itheta = (itheta*(opus_int32)qn)>>14;
+ itheta = IMAX(0, (itheta*(opus_int32)qn+qoffset)>>14);
else
- itheta = (itheta*(opus_int32)qn+16383)>>14;
+ itheta = IMIN(qn, (itheta*(opus_int32)qn+16383+qoffset)>>14);
}
/* Entropy coding of the angle. We use a uniform pdf for the
time split, a step for stereo, and a triangular one for the rest. */