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-29 20:47:07 +0300
committerJean-Marc Valin <jmvalin@jmvalin.ca>2016-07-30 00:32:29 +0300
commited6e3aff3a4eecf01364886547d02fa962efdcad (patch)
tree7f2cc986aa0c7e299312bf13aefdd32bd97e993d
parent54ba3f4f00a90229d1c2f6bd356626999bda1572 (diff)
biasing quantization
-rw-r--r--celt/bands.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/celt/bands.c b/celt/bands.c
index 82d17311..086f5bf2 100644
--- a/celt/bands.c
+++ b/celt/bands.c
@@ -742,11 +742,15 @@ static void compute_theta(struct band_ctx *ctx, struct split_ctx *sctx,
if (encode)
{
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;
- else
- itheta = (itheta*(opus_int32)qn+16383)>>14;
+ } else {
+ int qoffset = itheta > 8192 ? 16384/(qn+1) : -16384/(qn+1);
+ if (ctx->theta_round < 0)
+ itheta = IMAX(0, (itheta*(opus_int32)qn+qoffset)>>14);
+ else
+ 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. */