summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2012-06-11 14:37:44 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-06-11 14:37:44 -0400
commit99aaff5233b45fd886edffd9a047b85b81a09a53 (patch)
treefb1870a61f1f82411293b66786b090592faf6668 /doc
parent783ecbff0c86e48d64930328f9c4c34f2608707f (diff)
downloadopus-99aaff5233b45fd886edffd9a047b85b81a09a53.tar.gz
opus_compare.m was outdated
Diffstat (limited to 'doc')
-rw-r--r--doc/opus_compare.m79
1 files changed, 0 insertions, 79 deletions
diff --git a/doc/opus_compare.m b/doc/opus_compare.m
deleted file mode 100644
index 72739aaf..00000000
--- a/doc/opus_compare.m
+++ /dev/null
@@ -1,79 +0,0 @@
-%% Tests bit-stream compliance for the Opus codec
-%% x: Signal from the Opus reference implementation (float or fixed)
-%% y: Signal from the decoder under test
-%% stereo: 0 for mono, 1 for stereo
-function [err, NMR] = opus_compare(x, y, stereo)
-
-% Bands on which we compute the pseudo-NMR (Bark-derived CELT bands)
-b = 2*[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,34,40,48,60,78,100];
-d = diff(b);
-
-% Per-band SNR threshold
-T = 50-.7*[1:21];
-
-% Noise floor
-N = 10 .^ ((10-0.6*[1:21])/10);
-
-% Error signal
-e=x-y;
-
-%Add a +/- 1 dead zone on the error
-e = e - min(1, max(-1, e));
-
-% Compute spectrum of original and error
-if (stereo)
- X=(abs(specgram(x(1:2:end),480))+abs(specgram(x(2:2:end),480)))/2;
- E=(abs(specgram(e(1:2:end),480))+abs(specgram(e(2:2:end),480)))/2;
-else
- X=abs(specgram(x,480));
- E=abs(specgram(e,480));
-endif
-
-% Group energy per band
-for k=1:21
- Xb(k,:) = sum(X(b(k)+1:b(k+1),:).^2)/d(k)+1;
- Eb(k,:) = sum(E(b(k)+1:b(k+1),:).^2)/d(k)+1;
-end
-
-% Frequency masking (low to high) with 10 dB/Bark slope
-Xb = filter(1, [1, -.1], Xb);
-% Frequency masking (high to low) with 15 dB/Bark slope
-Xb(end:-1:1,:) = filter(1, [1, -.03], Xb(end:-1:1,:));
-
-% Temporal masking with 5 dB/5 ms slope
-Xb = filter(1, [1, -.3], Xb')';
-
-% NMR threshold
-T0 = ones(length(Eb), 1)*(10.^((T)/10));
-
-% Time-frequency SNR
-NMR = (Xb./Eb)';
-
-%Picking only errors in the 90th percentile
-tmp = Eb(:);
-thresh = sort(tmp)(round(.90*length(tmp)));
-weight = Eb'>thresh;
-
-printf("Average pseudo-NMR: %3.2f dB\n", mean(mean(10*log10(NMR))));
-
-if (sum(sum(weight))<1)
- printf("Mismatch level: below noise floor\n");
- err = -100;
-else
- M = (T0./NMR) .* weight;
-
- err = 10*log10(sum(sum(M)) / sum(sum(weight)));
-
- printf("Weighted mismatch: %3.2f dB\n", err);
-endif
-
-printf("\n");
-
-if (err < 0)
- printf("**Decoder PASSES test (mismatch < 0 dB)\n");
-else
- printf("**Decoder FAILS test (mismatch >= 0 dB)\n");
-endif
-
-
-