summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Buethe <jbuethe@amazon.com>2023-03-17 14:01:33 +0000
committerJan Buethe <jbuethe@amazon.com>2023-03-17 14:01:33 +0000
commitac436d82f5fa768de663520e39bf944380a3b535 (patch)
tree8d2917a954d96ade870044daedf7612b4deb6a86
parent08476da7b35dd06005dbbe2c90adf2f80c28b423 (diff)
downloadopus-ac436d82f5fa768de663520e39bf944380a3b535.tar.gz
bugfix (silk offset)
-rw-r--r--opus_calibration/eval.ipynb151
-rw-r--r--opus_calibration/results.txt37
-rw-r--r--silk/decode_core.c2
-rw-r--r--src/opus_demo.c4
4 files changed, 3 insertions, 191 deletions
diff --git a/opus_calibration/eval.ipynb b/opus_calibration/eval.ipynb
deleted file mode 100644
index 1cc47764..00000000
--- a/opus_calibration/eval.ipynb
+++ /dev/null
@@ -1,151 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [],
- "source": [
- "import numpy as np\n",
- "import matplotlib.pyplot as plt"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 14,
- "metadata": {},
- "outputs": [],
- "source": [
- "x = np.genfromtxt('results.txt', delimiter=\" \")\n",
- "x.sort(0)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 27,
- "metadata": {},
- "outputs": [],
- "source": [
- "# some smoothing\n",
- "ex = np.exp(x[:, 1])\n",
- "ex_smooth = ex.copy()\n",
- "ex_smooth[1:-1] = (ex[1:-1] + ex[0:-2] + ex[2:]) / 3\n",
- "ex_smooth[0] = (ex[0] + ex[1]) / 2\n",
- "ex_smooth[-1] = (ex[-1] + ex[-2]) / 2\n",
- "y_smooth = np.log(ex_smooth)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 45,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n"
- ]
- }
- ],
- "source": [
- "# restrict bitrate range\n",
- "bitrates = list(x[:, 0])\n",
- "mos = list(x[:, 1])\n",
- "stop_idx = bitrates.index(22000) + 1\n",
- "\n",
- "bitrates = bitrates[:stop_idx]\n",
- "mos = mos[:stop_idx]\n",
- "\n",
- "\n",
- "num_bitrates = 100\n",
- "a, b = mos[0], mos[-1]\n",
- "points = a + (b - a) * np.arange(num_bitrates) / (num_bitrates - 1)\n",
- "\n",
- "sample_bitrates = np.interp(points, mos, bitrates)\n",
- "\n",
- "print(f\"\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 46,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "array([ 6000, 6059, 6119, 6178, 6237, 6296, 6356, 6415, 6474,\n",
- " 6520, 6556, 6592, 6628, 6664, 6700, 6736, 6772, 6808,\n",
- " 6844, 6880, 6916, 6952, 6988, 7028, 7071, 7114, 7157,\n",
- " 7199, 7242, 7285, 7327, 7370, 7413, 7455, 7498, 7527,\n",
- " 7556, 7584, 7613, 7642, 7670, 7699, 7728, 7756, 7785,\n",
- " 7813, 7842, 7871, 7899, 7928, 7956, 7985, 8039, 8121,\n",
- " 8202, 8284, 8366, 8447, 8533, 8625, 8718, 8810, 8903,\n",
- " 8995, 9119, 9244, 9369, 9495, 9569, 9640, 9712, 9783,\n",
- " 9855, 9926, 9998, 10162, 10329, 10495, 10691, 10888, 11108,\n",
- " 11359, 11562, 11704, 11846, 11988, 12299, 12678, 13126, 13519,\n",
- " 13750, 13980, 14521, 15223, 15708, 16108, 17163, 17817, 19010,\n",
- " 20000], dtype=int32)"
- ]
- },
- "execution_count": 46,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "sample_bitrates.round().astype(np.int32)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 47,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "100"
- ]
- },
- "execution_count": 47,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "len(sample_bitrates)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "torch",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.9.12"
- },
- "orig_nbformat": 4
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}
diff --git a/opus_calibration/results.txt b/opus_calibration/results.txt
deleted file mode 100644
index 81339960..00000000
--- a/opus_calibration/results.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-10000 3.6769871171800843
-10500 3.764050840421487
-11000 3.837912642015452
-11500 3.8958699466617963
-12000 3.998301962253095
-12500 4.042832948476001
-13000 4.074064341513559
-13500 4.109692211369522
-14000 4.172784194388159
-14500 4.1984370021723
-15000 4.219923239627867
-15500 4.238952635505424
-16000 4.283401744056294
-16500 4.297923285239222
-17000 4.310123987780273
-17500 4.327046328221872
-18000 4.354865359896012
-18500 4.36331783299531
-19000 4.373523086688597
-19500 4.38536238245685
-20000 4.4028386414506056
-20500 4.412652008406079
-21000 4.420093487843909
-21500 4.426490423333554
-22000 4.441486788160018
-22500 4.447735896195902
-23000 4.454637068968553
-23500 4.458733846231834
-24000 4.4704071631419255
-6000 1.5247552916597167
-6500 1.7700358156029505
-7000 2.1739995701015755
-7500 2.514612697159668
-8000 3.0225791815886365
-8500 3.2006033440582624
-9000 3.357733997073186
-9500 3.473776563129959
diff --git a/silk/decode_core.c b/silk/decode_core.c
index 073f5731..c69d4244 100644
--- a/silk/decode_core.c
+++ b/silk/decode_core.c
@@ -155,7 +155,7 @@ void silk_decode_core(
fwrite(&itmp, sizeof(itmp), 1, fperiod);
/* offset */
- tmp = offset_Q10 / (1U << 10);
+ tmp = (float) offset_Q10 / (1U << 10);
fwrite(&tmp, sizeof(tmp), 1, foffset);
}
diff --git a/src/opus_demo.c b/src/opus_demo.c
index b24af3e3..5972d51c 100644
--- a/src/opus_demo.c
+++ b/src/opus_demo.c
@@ -207,11 +207,11 @@ static OpusDecoder *ms_opus_decoder_create(opus_int32 Fs, int channels, int *err
}
#endif
-#define COMPLEXITY_MIN 10
+#define COMPLEXITY_MIN 0
#define COMPLEXITY_MAX 10
#define PACKET_LOSS_PERC_MIN 0
-#define PACKET_LOSS_PERC_MAX 0
+#define PACKET_LOSS_PERC_MAX 50
#define PACKET_LOSS_PERC_STEP 5
#define NUM_BITRATES 100