--- Begin Message ---
Package: release.debian.org
Severity: normal
User: [email protected]
Usertags: unblock
Hi,
Please (preapprove) unblock(ing) package opus
So after meditating in depth on the pros and cons of going either way,
and carefully reviewing the proposed changes today, I think I'm convinced
enough that updating this will be the least pain path to really punt the
final decision to you with an actual preapproval request :)
The following is a pre-reviewed and sanitised debdiff between the
0.9.14+20120615-1 package in sid/wheezy and 1.0.1-1 from experimental,
to try and make doing that as painless as possible.
I've pruned out the hunks that are noisy and irrelevant (like msvc build
files), that are noisy and repetitive but otherwise trivial and correct
no-ops (like the restrict portability fix), which should leave you just the
things actually changing in code paths we do use to cast more eyes over.
I've annotated what I removed and why, and details of the reason for each
change that remains. (I can post a raw debdiff too if you like, but both
package versions are already in the distro archives to grab that from)
There are two main reasons to consider this for Wheezy.
- A growing number of apps are relying on the extra ctls that were added
late, just before the 1.0.1 release. These are "new features", and I'd
normally say "too bad, use experimental or bpo", but due to the way the
timing of the RFC publication occurred, it looks like we probably will
otherwise be the only distro that ships without them now.
The changes related to adding those are relatively simple, and aren't
intrusive to other code, so they are on the "fairly safe" side in so
far as any change ever is safe.
- There are some real bugfixes in this too. I've noted those in the diff
below. While a well behaved app, driven by sane users, probably shouldn't
hit most of them, it is possible that a user could request a configuration
that would result in corrupted bit streams if they don't do sufficient
sanity checking of their own (which historically most people and apps tend
to be pretty poor at).
These are possibly the more directly important things to pull, but a couple
of them also account for the more difficult to review part of the changes
included here too.
The third reason of course is we minimise any later diff if we need to pull
patches for other problems too. The bitstream and API are stable, so any
breakage for existing users will be considered a serious bug by upstream and
the 1.0.x branch is supposed to be a strictly bugfix only branch now.
Up until we talked about this the other day, I'd basically been pushing back
against people pressing me to update this for Wheezy. But after considering
everything I know up to this point, and having reviewed the changes myself,
I think the best recommendation that I can make to the release team is that
we do pull this as a candidate for Wheezy now. It's had far more external
testing than the version we currently are shipping, I'm confident that us
updating to it shouldn't cause any problems, and that we'll have the full
support of upstream for a fast resolution if we should shake out any problems
with it.
If you agree with that, I'll push the package in experimental to unstable so
we can proceed with a real unblock (for what should be 1.0.1-2 then).
Thanks!
Ron
diff -Nru opus-0.9.14+20120615/AUTHORS opus-1.0.1/AUTHORS
--- opus-0.9.14+20120615/AUTHORS 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/AUTHORS 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Email address updates only
diff -Nru opus-0.9.14+20120615/celt/arch.h opus-1.0.1/celt/arch.h
--- opus-0.9.14+20120615/celt/arch.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/arch.h 2012-10-18 15:43:35.000000000 +1030
@@ -188,6 +188,7 @@
#define MULT16_16_P15(a,b) ((a)*(b))
#define MULT16_16_P13(a,b) ((a)*(b))
#define MULT16_16_P14(a,b) ((a)*(b))
+#define MULT16_32_P16(a,b) ((a)*(b))
#define DIV32_16(a,b) (((opus_val32)(a))/(opus_val16)(b))
#define DIV32(a,b) (((opus_val32)(a))/(opus_val32)(b))
diff -Nru opus-0.9.14+20120615/celt/bands.c opus-1.0.1/celt/bands.c
--- opus-0.9.14+20120615/celt/bands.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/bands.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: s/restrict/OPUS_RESTRICT/ only.
Needed for portability to compilers that don't support restrict.
No actual change to the code for us from that after preprocessing.
diff -Nru opus-0.9.14+20120615/celt/bands.h opus-1.0.1/celt/bands.h
--- opus-0.9.14+20120615/celt/bands.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/bands.h 2012-10-18 15:43:35.000000000 +1030
SUMMARY: s/restrict/OPUS_RESTRICT/ only.
diff -Nru opus-0.9.14+20120615/celt/celt.c opus-1.0.1/celt/celt.c
--- opus-0.9.14+20120615/celt/celt.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/celt.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: removed hunks that just do s/restrict/OPUS_RESTRICT/
Remainder adds the LSB_DEPTH ctl, and a const correctness fix
@@ -156,6 +156,7 @@
int signalling;
int constrained_vbr; /* If zero, VBR can do whatever it likes with the rate */
int loss_rate;
+ int lsb_depth;
/* Everything beyond this point gets cleared on a reset */
#define ENCODER_RESET_START rng
@@ -266,6 +267,7 @@
st->vbr = 0;
st->force_intra = 0;
st->complexity = 5;
+ st->lsb_depth=24;
opus_custom_encoder_ctl(st, OPUS_RESET_STATE);
@@ -1823,6 +1825,20 @@
st->stream_channels = value;
}
break;
+ case OPUS_SET_LSB_DEPTH_REQUEST:
+ {
+ opus_int32 value = va_arg(ap, opus_int32);
+ if (value<8 || value>24)
+ goto bad_arg;
+ st->lsb_depth=value;
+ }
+ break;
+ case OPUS_GET_LSB_DEPTH_REQUEST:
+ {
+ opus_int32 *value = va_arg(ap, opus_int32*);
+ *value=st->lsb_depth;
+ }
+ break;
case OPUS_RESET_STATE:
{
int i;
@@ -2825,7 +2841,7 @@
const char *opus_strerror(int error)
{
- static const char *error_strings[8] = {
+ static const char * const error_strings[8] = {
"success",
"invalid argument",
"buffer too small",
diff -Nru opus-0.9.14+20120615/celt/celt.h opus-1.0.1/celt/celt.h
--- opus-0.9.14+20120615/celt/celt.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/celt.h 2012-10-18 15:43:35.000000000 +1030
SUMMARY: s/restrict/OPUS_RESTRICT/ only.
diff -Nru opus-0.9.14+20120615/celt/celt.vcxproj opus-1.0.1/celt/celt.vcxproj
--- opus-0.9.14+20120615/celt/celt.vcxproj 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/celt.vcxproj 2012-10-18 15:43:35.000000000 +1030
SUMMARY: MSVC project file changes, not for us.
diff -Nru opus-0.9.14+20120615/celt/celt.vcxproj.filters opus-1.0.1/celt/celt.vcxproj.filters
--- opus-0.9.14+20120615/celt/celt.vcxproj.filters 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/celt.vcxproj.filters 2012-10-18 15:43:35.000000000 +1030
SUMMARY: MSVC project file changes, not for us.
diff -Nru opus-0.9.14+20120615/celt/cwrs.c opus-1.0.1/celt/cwrs.c
--- opus-0.9.14+20120615/celt/cwrs.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/cwrs.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: log2_frac optimization from Simon Hosie back in Aug 2011.
(commit 66d429ab5367b0111b936473e43a2bf9a3232d09)
@@ -48,8 +48,9 @@
l=EC_ILOG(val);
if(val&(val-1)){
/*This is (val>>l-16), but guaranteed to round up, even if adding a bias
- before the shift would cause overflow (e.g., for 0xFFFFxxxx).*/
- if(l>16)val=(val>>(l-16))+(((val&((1<<(l-16))-1))+(1<<(l-16))-1)>>(l-16));
+ before the shift would cause overflow (e.g., for 0xFFFFxxxx).
+ Doesn't work for val=0, but that case fails the test above.*/
+ if(l>16)val=((val-1)>>(l-16))+1;
else val<<=16-l;
l=(l-1)<<frac;
/*Note that we always need one iteration, since the rounding up above means
diff -Nru opus-0.9.14+20120615/celt/fixed_debug.h opus-1.0.1/celt/fixed_debug.h
--- opus-0.9.14+20120615/celt/fixed_debug.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/fixed_debug.h 2012-10-18 15:43:35.000000000 +1030
SUMMARY: removed hunks that just do s/long long/opus_int64/ for portability
Remainder adds a fixed-point math operation needed for the _GAIN ctl
@@ -47,6 +47,8 @@
/** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */
#define MULT16_32_Q16(a,b) ADD32(MULT16_16((a),SHR32((b),16)), SHR32(MULT16_16SU((a),((b)&0x0000ffff)),16))
+#define MULT16_32_P16(a,b) MULT16_32_PX(a,b,16)
+
#define QCONST16(x,bits) ((opus_val16)(.5+(x)*(((opus_val32)1)<<(bits))))
#define QCONST32(x,bits) ((opus_val32)(.5+(x)*(((opus_val32)1)<<(bits))))
@@ -459,6 +461,39 @@
return res;
}
+#define MULT16_32_PX(a, b, Q) MULT16_32_PX_(a, b, Q, __FILE__, __LINE__)
+static inline int MULT16_32_PX_(int a, opus_int64 b, int Q, char *file, int line)
+{
+ opus_int64 res;
+ if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
+ {
+ fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d in %s: line %d\n\n", Q, (int)a, (int)b, file, line);
+#ifdef FIXED_DEBUG_ASSERT
+ celt_assert(0);
+#endif
+ }
+ if (ABS32(b)>=((opus_int64)(1)<<(15+Q)))
+ {
+ fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n\n", Q, (int)a, (int)b,file, line);
+#ifdef FIXED_DEBUG_ASSERT
+ celt_assert(0);
+#endif
+ }
+ res = ((((opus_int64)a)*(opus_int64)b) + (((opus_val32)(1)<<Q)>>1))>> Q;
+ if (!VERIFY_INT(res))
+ {
+ fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d in %s: line %d\n\n", Q, (int)a, (int)b,(int)res, file, line);
+#ifdef FIXED_DEBUG_ASSERT
+ celt_assert(0);
+#endif
+ }
+ if (Q==15)
+ celt_mips+=4;
+ else
+ celt_mips+=5;
+ return res;
+}
+
#define MULT16_32_Q15(a,b) MULT16_32_QX(a,b,15)
#define MAC16_32_Q15(c,a,b) (celt_mips-=2,ADD32((c),MULT16_32_Q15((a),(b))))
diff -Nru opus-0.9.14+20120615/celt/fixed_generic.h opus-1.0.1/celt/fixed_generic.h
--- opus-0.9.14+20120615/celt/fixed_generic.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/fixed_generic.h 2012-10-18 15:43:35.000000000 +1030
@@ -39,6 +39,9 @@
/** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */
#define MULT16_32_Q16(a,b) ADD32(MULT16_16((a),SHR((b),16)), SHR(MULT16_16SU((a),((b)&0x0000ffff)),16))
+/** 16x32 multiplication, followed by a 16-bit shift right (round-to-nearest). Results fits in 32 bits */
+#define MULT16_32_P16(a,b) ADD32(MULT16_16((a),SHR((b),16)), PSHR(MULT16_16((a),((b)&0x0000ffff)),16))
+
/** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 bits */
#define MULT16_32_Q15(a,b) ADD32(SHL(MULT16_16((a),SHR((b),16)),1), SHR(MULT16_16SU((a),((b)&0x0000ffff)),15))
diff -Nru opus-0.9.14+20120615/celt/float_cast.h opus-1.0.1/celt/float_cast.h
--- opus-0.9.14+20120615/celt/float_cast.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/float_cast.h 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Preprocessor guard condition tweaks for MSVC, not for us.
diff -Nru opus-0.9.14+20120615/celt/kiss_fft.c opus-1.0.1/celt/kiss_fft.c
--- opus-0.9.14+20120615/celt/kiss_fft.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/kiss_fft.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Convert some double constants to float.
(commit 37f56593a20242a08b5315d3b78820f6dc060996)
I'll prune these hunks from other files, but they
all basically just look like the one below.
@@ -559,7 +559,7 @@
st->nfft=nfft;
#ifndef FIXED_POINT
- st->scale = 1./nfft;
+ st->scale = 1.f/nfft;
#endif
if (base != NULL)
{
diff -Nru opus-0.9.14+20120615/celt/_kiss_fft_guts.h opus-1.0.1/celt/_kiss_fft_guts.h
--- opus-0.9.14+20120615/celt/_kiss_fft_guts.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/_kiss_fft_guts.h 2012-10-18 15:43:35.000000000 +1030
SUMMARY: drop an unused define instead of converting from long long
@@ -48,7 +48,6 @@
#include "arch.h"
-# define SAMPPROD long long
#define SAMP_MAX 2147483647
#define TWID_MAX 32767
#define TRIG_UPSCALE 1
diff -Nru opus-0.9.14+20120615/celt/mdct.c opus-1.0.1/celt/mdct.c
--- opus-0.9.14+20120615/celt/mdct.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/mdct.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: s/restrict/OPUS_RESTRICT/ only.
diff -Nru opus-0.9.14+20120615/celt/mdct.h opus-1.0.1/celt/mdct.h
--- opus-0.9.14+20120615/celt/mdct.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/mdct.h 2012-10-18 15:43:35.000000000 +1030
SUMMARY: s/restrict/OPUS_RESTRICT/ only.
diff -Nru opus-0.9.14+20120615/celt/pitch.c opus-1.0.1/celt/pitch.c
--- opus-0.9.14+20120615/celt/pitch.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/pitch.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: s/restrict/OPUS_RESTRICT/ only.
diff -Nru opus-0.9.14+20120615/celt/pitch.h opus-1.0.1/celt/pitch.h
--- opus-0.9.14+20120615/celt/pitch.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/pitch.h 2012-10-18 15:43:35.000000000 +1030
SUMMARY: s/restrict/OPUS_RESTRICT/ only.
diff -Nru opus-0.9.14+20120615/celt/tests/test_unit_mathops.c opus-1.0.1/celt/tests/test_unit_mathops.c
--- opus-0.9.14+20120615/celt/tests/test_unit_mathops.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/tests/test_unit_mathops.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: test suite fix, not part of the library code.
Remove C99ism in celt/tests/test_unit_mathops.c w/ fixed point build.
Use exact integer operations to confirm the value returned is the correct one.
@@ -209,10 +209,20 @@
opus_val32 x;
for (x=1;x<=268435455;x+=127)
{
- opus_val32 error = abs(celt_ilog2(x)-(int)floor(log2(x)));
- if (error!=0)
+ opus_val32 lg;
+ opus_val32 y;
+
+ lg = celt_ilog2(x);
+ if (lg<0 || lg>=31)
{
- printf("celt_ilog2 failed: celt_ilog2(x)!=floor(log2(x)) (x = %d, error = %d)\n",x,error);
+ printf("celt_ilog2 failed: 0<=celt_ilog2(x)<31 (x = %d, celt_ilog2(x) = %d)\n",x,lg);
+ ret = 1;
+ }
+ y = 1<<lg;
+
+ if (x<y || (x>>1)>=y)
+ {
+ printf("celt_ilog2 failed: 2**celt_ilog2(x)<=x<2**(celt_ilog2(x)+1) (x = %d, 2**celt_ilog2(x) = %d)\n",x,y);
ret = 1;
}
}
diff -Nru opus-0.9.14+20120615/celt/vq.c opus-1.0.1/celt/vq.c
--- opus-0.9.14+20120615/celt/vq.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/celt/vq.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: s/restrict/OPUS_RESTRICT/ only.
diff -Nru opus-0.9.14+20120615/config.h.in opus-1.0.1/config.h.in
--- opus-0.9.14+20120615/config.h.in 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/config.h.in 2012-10-18 15:43:35.000000000 +1030
SUMMARY: autoconf, comment text and unused define removal changes only
diff -Nru opus-0.9.14+20120615/configure opus-1.0.1/configure
--- opus-0.9.14+20120615/configure 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/configure 2012-10-18 15:43:35.000000000 +1030
SUMMARY: autoconf generated configure, nothing to see here
diff -Nru opus-0.9.14+20120615/configure.ac opus-1.0.1/configure.ac
--- opus-0.9.14+20120615/configure.ac 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/configure.ac 2012-10-18 15:43:35.000000000 +1030
SUMMARY: autoconf tweaking. Mostly harmless.
Better version reporting, better comments.
No longer enables stack-protector by default,
so we do that in debian/rules now instead.
diff -Nru opus-0.9.14+20120615/debian/changelog opus-1.0.1/debian/changelog
--- opus-0.9.14+20120615/debian/changelog 2012-11-18 19:38:58.000000000 +1030
+++ opus-1.0.1/debian/changelog 2012-11-18 19:38:58.000000000 +1030
@@ -1,3 +1,14 @@
+opus (1.0.1-1) experimental; urgency=low
+
+ * The RFC 6716 release.
+ * Cherry pick be0d8c5ee1 to fix the build system breakage from -rc3.
+ * Add the stack protector flags to /rules which got dropped from the
+ upstream build system in -rc3 too.
+ * Pushed to experimental for the new libav which needs the gain ctls.
+ Closes: #690563
+
+ -- Ron Lee <[email protected]> Thu, 18 Oct 2012 10:38:53 +1030
+
opus (0.9.14+20120615-1) unstable; urgency=low
* Add extern "C" protection to opus_multistream.h.
diff -Nru opus-0.9.14+20120615/debian/rules opus-1.0.1/debian/rules
--- opus-0.9.14+20120615/debian/rules 2012-11-18 19:38:58.000000000 +1030
+++ opus-1.0.1/debian/rules 2012-11-18 19:38:58.000000000 +1030
@@ -21,6 +21,9 @@
HARD_CFLAGS = -Wformat=2
HARD_LDFLAGS = -z now
+ifneq (,$(filter-out $(DEB_HOST_ARCH), alpha hppa arm))
+ HARD_CFLAGS += -fstack-protector --param ssp-buffer-size=4
+endif
ifneq (,$(filter-out $(DEB_HOST_ARCH), ia64 hppa avr32))
HARD_LDFLAGS += -z relro
endif
@@ -100,7 +103,8 @@
$(MAKE) -C $(objdir) install-opus DESTDIR=$(CURDIR)/debian/tmp
touch $@
-install-indep: build-indep
+install-indep: install-indep-stamp
+install-indep-stamp: build-indep
dh_testdir
$(MAKE) -C $(objdir) install-docs DESTDIR=$(CURDIR)/debian/tmp
touch $@
diff -Nru opus-0.9.14+20120615/doc/build_draft.sh opus-1.0.1/doc/build_draft.sh
--- opus-0.9.14+20120615/doc/build_draft.sh 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/doc/build_draft.sh 2012-10-18 15:43:35.000000000 +1030
SUMMARY: tweaks to tools for building the IETF draft documents.
Not for us.
diff -Nru opus-0.9.14+20120615/doc/build_oggdraft.sh opus-1.0.1/doc/build_oggdraft.sh
--- opus-0.9.14+20120615/doc/build_oggdraft.sh 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/doc/build_oggdraft.sh 2012-10-18 15:43:35.000000000 +1030
SUMMARY: tweaks to tools for building the IETF draft documents.
Not for us.
diff -Nru opus-0.9.14+20120615/doc/draft-spittka-payload-rtp-opus.xml opus-1.0.1/doc/draft-spittka-payload-rtp-opus.xml
--- opus-0.9.14+20120615/doc/draft-spittka-payload-rtp-opus.xml 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/doc/draft-spittka-payload-rtp-opus.xml 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Opus RTP payload IETF RFC draft. Not for us.
diff -Nru opus-0.9.14+20120615/doc/draft-terriberry-oggopus.xml opus-1.0.1/doc/draft-terriberry-oggopus.xml
--- opus-0.9.14+20120615/doc/draft-terriberry-oggopus.xml 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/doc/draft-terriberry-oggopus.xml 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Ogg Opus IETF RFC draft. Not for us.
diff -Nru opus-0.9.14+20120615/doc/Makefile.am opus-1.0.1/doc/Makefile.am
--- opus-0.9.14+20120615/doc/Makefile.am 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/doc/Makefile.am 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Only install opus_*.3 manpages. Fixes 'make distcheck'.
@@ -26,7 +26,7 @@
done
$(INSTALL) -d $(DESTDIR)$(mandir)/man3
- cd man && find man3 -type f \
+ cd man && find man3 -type f -name opus_*.3 \
-exec $(INSTALL_DATA) \{} $(DESTDIR)$(mandir)/man3 \;
clean-local:
diff -Nru opus-0.9.14+20120615/doc/Makefile.in opus-1.0.1/doc/Makefile.in
--- opus-0.9.14+20120615/doc/Makefile.in 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/doc/Makefile.in 2012-10-18 15:43:35.000000000 +1030
SUMMARY: autoconf (re)generated version of the above
diff -Nru opus-0.9.14+20120615/.gitignore opus-1.0.1/.gitignore
--- opus-0.9.14+20120615/.gitignore 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/.gitignore 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Probably should be dropped from the package entirely. Not for us.
diff -Nru opus-0.9.14+20120615/include/opus_custom.h opus-1.0.1/include/opus_custom.h
--- opus-0.9.14+20120615/include/opus_custom.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/include/opus_custom.h 2012-10-18 15:43:35.000000000 +1030
SUMMARY: s/restrict/OPUS_RESTRICT/ only.
diff -Nru opus-0.9.14+20120615/include/opus_defines.h opus-1.0.1/include/opus_defines.h
--- opus-0.9.14+20120615/include/opus_defines.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/include/opus_defines.h 2012-10-18 15:43:35.000000000 +1030
SUMMARY: defines OPUS_RESTRICT and the LSB, GAIN and SAMPLE_RATE ctls.
Also lots of documentation improvements (purely documentation
hunks omitted here)
@@ -84,6 +84,18 @@
# endif
# endif
+#if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
+# if OPUS_GNUC_PREREQ(3,0)
+# define OPUS_RESTRICT __restrict__
+# elif (defined(_MSC_VER) && _MSC_VER >= 1400)
+# define OPUS_RESTRICT __restrict
+# else
+# define OPUS_RESTRICT
+# endif
+#else
+# define OPUS_RESTRICT restrict
+#endif
+
/**Warning attributes for opus functions
* NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out
* some paranoid null checks. */
@@ -126,8 +139,13 @@
#define OPUS_GET_SIGNAL_REQUEST 4025
#define OPUS_GET_LOOKAHEAD_REQUEST 4027
/* #define OPUS_RESET_STATE 4028 */
+#define OPUS_GET_SAMPLE_RATE_REQUEST 4029
#define OPUS_GET_FINAL_RANGE_REQUEST 4031
#define OPUS_GET_PITCH_REQUEST 4033
+#define OPUS_SET_GAIN_REQUEST 4034
+#define OPUS_GET_GAIN_REQUEST 4045
+#define OPUS_SET_LSB_DEPTH_REQUEST 4036
+#define OPUS_GET_LSB_DEPTH_REQUEST 4037
/* Macros to trigger compilation errors when the wrong types are provided to a CTL */
#define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x))
@@ -190,132 +208,230 @@
+/** Gets the sampling rate the encoder or decoder was initialized with.
+ * This simply returns the <code>Fs</code> value passed to opus_encoder_init()
+ * or opus_decoder_init().
+ * @param[out] x <tt>opus_int32 *</tt>: Sampling rate of encoder or decoder.
+ * @hideinitializer
+ */
+#define OPUS_GET_SAMPLE_RATE(x) OPUS_GET_SAMPLE_RATE_REQUEST, __opus_check_int_ptr(x)
@@ -428,16 +561,62 @@
+/** Configures the depth of signal being encoded.
+ * This is a hint which helps the encoder identify silence and near-silence.
+ * @see OPUS_GET_LSB_DEPTH
+ * @param[in] x <tt>opus_int32</tt>: Input precision in bits, between 8 and 24
+ * (default: 24).
+ * @hideinitializer */
+#define OPUS_SET_LSB_DEPTH(x) OPUS_SET_LSB_DEPTH_REQUEST, __opus_check_int(x)
+/** Gets the encoder's configured signal depth.
+ * @see OPUS_SET_LSB_DEPTH
+ * @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and
+ * 24 (default: 24).
+ * @hideinitializer */
+#define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x)
+/**@}*/
+
+/** @defgroup opus_decoderctls Decoder related CTLs
+ * @see opus_genericctls, opus_encoderctls, opus_decoder
+ * @{
+ */
+
+/** Configures decoder gain adjustment.
+ * Scales the decoded output by a factor specified in Q8 dB units.
+ * This has a maximum range of -32768 to 32767 inclusive, and returns
+ * OPUS_BAD_ARG otherwise. The default is zero indicating no adjustment.
+ * This setting survives decoder reset.
+ *
+ * gain = pow(10, x/(20.0*256))
+ *
+ * @param[in] x <tt>opus_int32</tt>: Amount to scale PCM signal by in Q8 dB units.
+ * @hideinitializer */
+#define OPUS_SET_GAIN(x) OPUS_SET_GAIN_REQUEST, __opus_check_int(x)
+/** Gets the decoder's configured gain adjustment. @see OPUS_SET_GAIN
+ *
+ * @param[out] x <tt>opus_int32 *</tt>: Amount to scale PCM signal by in Q8 dB units.
+ * @hideinitializer */
+#define OPUS_GET_GAIN(x) OPUS_GET_GAIN_REQUEST, __opus_check_int_ptr(x)
+
/**@}*/
/** @defgroup opus_libinfo Opus library information functions
diff -Nru opus-0.9.14+20120615/include/opus.h opus-1.0.1/include/opus.h
--- opus-0.9.14+20120615/include/opus.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/include/opus.h 2012-10-18 15:43:35.000000000 +1030
SUMMARY: documentation tweaks only.
diff -Nru opus-0.9.14+20120615/Makefile.am opus-1.0.1/Makefile.am
--- opus-0.9.14+20120615/Makefile.am 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/Makefile.am 2012-10-18 15:43:35.000000000 +1030
SUMMARY: build system tweaks, mostly harmless and uninteresting for us.
Pander to non-gnu makes that don't support -C
diff -Nru opus-0.9.14+20120615/Makefile.draft opus-1.0.1/Makefile.draft
--- opus-0.9.14+20120615/Makefile.draft 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/Makefile.draft 1970-01-01 09:30:00.000000000 +0930
SUMMARY: this file was renamed to Makefile.unix.
We don't use either of them, and they probably could
be just dropped from the package tarball entirely.
diff -Nru opus-0.9.14+20120615/Makefile.in opus-1.0.1/Makefile.in
--- opus-0.9.14+20120615/Makefile.in 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/Makefile.in 2012-10-18 15:43:35.000000000 +1030
SUMMARY: autoconf generated, nothing to see here.
diff -Nru opus-0.9.14+20120615/Makefile.unix opus-1.0.1/Makefile.unix
--- opus-0.9.14+20120615/Makefile.unix 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/Makefile.unix 2012-10-18 15:43:35.000000000 +1030
SUMMARY: this file was renamed from Makefile.draft above.
We don't use either of them, and they probably could
be just dropped from the package tarball entirely.
diff -Nru opus-0.9.14+20120615/opus.m4 opus-1.0.1/opus.m4
--- opus-0.9.14+20120615/opus.m4 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/opus.m4 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Adds XIPH_PATH_OPUS macro for autoconf users who aren't
using pkg-config. Copypasta from the libogg macro, but
probably nothing does or should really use it anyhow.
diff -Nru opus-0.9.14+20120615/opus.sln opus-1.0.1/opus.sln
--- opus-0.9.14+20120615/opus.sln 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/opus.sln 2012-10-18 15:43:35.000000000 +1030
SUMMARY: More msvc project goop that's not for us.
diff -Nru opus-0.9.14+20120615/README opus-1.0.1/README
--- opus-0.9.14+20120615/README 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/README 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Just doc tweaks.
diff -Nru opus-0.9.14+20120615/silk/API.h opus-1.0.1/silk/API.h
--- opus-0.9.14+20120615/silk/API.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/silk/API.h 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Dead code removal from internal headers.
(this is the internal SILK api, not public API exports)
@@ -121,6 +121,7 @@
opus_int32 *nSamplesOut /* O Number of samples decoded */
);
+#if 0
/**************************************/
/* Get table of contents for a packet */
/**************************************/
@@ -130,6 +131,7 @@
const opus_int nFramesPerPayload, /* I Number of SILK frames per payload */
silk_TOC_struct *Silk_TOC /* O Type of content */
);
+#endif
#ifdef __cplusplus
}
diff -Nru opus-0.9.14+20120615/silk/dec_API.c opus-1.0.1/silk/dec_API.c
--- opus-0.9.14+20120615/silk/dec_API.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/silk/dec_API.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Dead code removal (other half of the patch above).
@@ -340,6 +340,7 @@
return ret;
}
+#if 0
/* Getting table of contents for a packet */
opus_int silk_get_TOC(
const opus_uint8 *payload, /* I Payload data */
@@ -357,7 +358,7 @@
return -1;
}
- silk_memset( Silk_TOC, 0, sizeof( Silk_TOC ) );
+ silk_memset( Silk_TOC, 0, sizeof( *Silk_TOC ) );
/* For stereo, extract the flags for the mid channel */
flags = silk_RSHIFT( payload[ 0 ], 7 - nFramesPerPayload ) & ( silk_LSHIFT( 1, nFramesPerPayload + 1 ) - 1 );
@@ -371,3 +372,4 @@
return ret;
}
+#endif
diff -Nru opus-0.9.14+20120615/silk/fixed/apply_sine_window_FIX.c opus-1.0.1/silk/fixed/apply_sine_window_FIX.c
--- opus-0.9.14+20120615/silk/fixed/apply_sine_window_FIX.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/silk/fixed/apply_sine_window_FIX.c 2012-10-18 15:43:35.000000000 +1030
@@ -41,7 +41,7 @@
/* Matlab code for table:
for k=16:9*4:16+2*9*4, fprintf(' %7.d,', -round(65536*pi ./ (k:4:k+8*4))); fprintf('\n'); end
*/
-static opus_int16 freq_table_Q16[ 27 ] = {
+static const opus_int16 freq_table_Q16[ 27 ] = {
12111, 9804, 8235, 7100, 6239, 5565, 5022, 4575, 4202,
3885, 3612, 3375, 3167, 2984, 2820, 2674, 2542, 2422,
2313, 2214, 2123, 2038, 1961, 1889, 1822, 1760, 1702,
diff -Nru opus-0.9.14+20120615/silk/fixed/silk_fixed.vcxproj opus-1.0.1/silk/fixed/silk_fixed.vcxproj
--- opus-0.9.14+20120615/silk/fixed/silk_fixed.vcxproj 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/silk/fixed/silk_fixed.vcxproj 2012-10-18 15:43:35.000000000 +1030
SUMMARY: More msvc project goop that's not for us.
diff -Nru opus-0.9.14+20120615/silk/fixed/silk_fixed.vcxproj.filters opus-1.0.1/silk/fixed/silk_fixed.vcxproj.filters
--- opus-0.9.14+20120615/silk/fixed/silk_fixed.vcxproj.filters 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/silk/fixed/silk_fixed.vcxproj.filters 2012-10-18 15:43:35.000000000 +1030
diff -Nru opus-0.9.14+20120615/silk/float/silk_float.vcxproj opus-1.0.1/silk/float/silk_float.vcxproj
--- opus-0.9.14+20120615/silk/float/silk_float.vcxproj 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/silk/float/silk_float.vcxproj 2012-10-18 15:43:35.000000000 +1030
diff -Nru opus-0.9.14+20120615/silk/float/silk_float.vcxproj.filters opus-1.0.1/silk/float/silk_float.vcxproj.filters
--- opus-0.9.14+20120615/silk/float/silk_float.vcxproj.filters 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/silk/float/silk_float.vcxproj.filters 2012-10-18 15:43:35.000000000 +1030
diff -Nru opus-0.9.14+20120615/silk/log2lin.c opus-1.0.1/silk/log2lin.c
--- opus-0.9.14+20120615/silk/log2lin.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/silk/log2lin.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Fixes an overflow in silk_log2lin() that was triggered only in debug mode
(commit f6c26e00005127bc6127618e8367fa815d755032)
@@ -47,7 +47,7 @@
frac_Q7 = inLog_Q7 & 0x7F;
if( inLog_Q7 < 2048 ) {
/* Piece-wise parabolic approximation */
- out = silk_ADD_RSHIFT( out, silk_MUL( out, silk_SMLAWB( frac_Q7, silk_SMULBB( frac_Q7, 128 - frac_Q7 ), -174 ) ), 7 );
+ out = silk_ADD_RSHIFT32( out, silk_MUL( out, silk_SMLAWB( frac_Q7, silk_SMULBB( frac_Q7, 128 - frac_Q7 ), -174 ) ), 7 );
} else {
/* Piece-wise parabolic approximation */
out = silk_MLA( out, silk_RSHIFT( out, 7 ), silk_SMLAWB( frac_Q7, silk_SMULBB( frac_Q7, 128 - frac_Q7 ), -174 ) );
diff -Nru opus-0.9.14+20120615/silk/silk_common.vcxproj opus-1.0.1/silk/silk_common.vcxproj
--- opus-0.9.14+20120615/silk/silk_common.vcxproj 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/silk/silk_common.vcxproj 2012-10-18 15:43:35.000000000 +1030
SUMMARY: More msvc project goop that's not for us.
diff -Nru opus-0.9.14+20120615/silk/silk_common.vcxproj.filters opus-1.0.1/silk/silk_common.vcxproj.filters
--- opus-0.9.14+20120615/silk/silk_common.vcxproj.filters 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/silk/silk_common.vcxproj.filters 2012-10-18 15:43:35.000000000 +1030
diff -Nru opus-0.9.14+20120615/src/opus_decoder.c opus-1.0.1/src/opus_decoder.c
--- opus-0.9.14+20120615/src/opus_decoder.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/src/opus_decoder.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Implementation for the new (decoder side) ctls.
Fix to avoid large stack buffers.
@@ -45,6 +45,7 @@
#include "os_support.h"
#include "structs.h"
#include "define.h"
+#include "mathops.h"
struct OpusDecoder {
int celt_dec_offset;
@@ -52,6 +53,7 @@
int channels;
opus_int32 Fs; /** Sampling rate (at the API level) */
silk_DecControlStruct DecControl;
+ int decode_gain;
/* Everything beyond this point gets cleared on a reset */
#define OPUS_DECODER_RESET_START stream_channels
@@ -226,6 +228,8 @@
RESTORE_STACK;
return OPUS_BUFFER_TOO_SMALL;
}
+ /* Limit frame_size to avoid excessive stack allocations. */
+ frame_size = IMIN(frame_size, st->Fs/25*3);
/* Payloads of 1 (2 including ToC) or 0 trigger the PLC/DTX */
if (len<=1)
{
@@ -503,6 +507,18 @@
}
}
+ if(st->decode_gain)
+ {
+ opus_val32 gain;
+ gain = celt_exp2(MULT16_16_P15(QCONST16(6.48814081e-4f, 25), st->decode_gain));
+ for (i=0;i<frame_size*st->channels;i++)
+ {
+ opus_val32 x;
+ x = MULT16_32_P16(pcm[i],gain);
+ pcm[i] = SATURATE(x, 32767);
+ }
+ }
+
if (len <= 1)
st->rangeFinal = 0;
else
@@ -842,6 +858,17 @@
st->frame_size = st->Fs/400;
}
break;
+ case OPUS_GET_SAMPLE_RATE_REQUEST:
+ {
+ opus_int32 *value = va_arg(ap, opus_int32*);
+ if (value==NULL)
+ {
+ ret = OPUS_BAD_ARG;
+ break;
+ }
+ *value = st->Fs;
+ }
+ break;
case OPUS_GET_PITCH_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
@@ -856,6 +883,28 @@
*value = st->DecControl.prevPitchLag;
}
break;
+ case OPUS_GET_GAIN_REQUEST:
+ {
+ opus_int32 *value = va_arg(ap, opus_int32*);
+ if (value==NULL)
+ {
+ ret = OPUS_BAD_ARG;
+ break;
+ }
+ *value = st->decode_gain;
+ }
+ break;
+ case OPUS_SET_GAIN_REQUEST:
+ {
+ opus_int32 value = va_arg(ap, opus_int32);
+ if (value<-32768 || value>32767)
+ {
+ ret = OPUS_BAD_ARG;
+ break;
+ }
+ st->decode_gain = value;
+ }
+ break;
default:
/*fprintf(stderr, "unknown opus_decoder_ctl() request: %d", request);*/
ret = OPUS_UNIMPLEMENTED;
diff -Nru opus-0.9.14+20120615/src/opus_demo.c opus-1.0.1/src/opus_demo.c
--- opus-0.9.14+20120615/src/opus_demo.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/src/opus_demo.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Internal test app tweaks, not of interest for us.
diff -Nru opus-0.9.14+20120615/src/opus_demo.vcxproj opus-1.0.1/src/opus_demo.vcxproj
--- opus-0.9.14+20120615/src/opus_demo.vcxproj 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/src/opus_demo.vcxproj 2012-10-18 15:43:35.000000000 +1030
SUMMARY: More msvc project goop that's not for us.
diff -Nru opus-0.9.14+20120615/src/opus_demo.vcxproj.filters opus-1.0.1/src/opus_demo.vcxproj.filters
--- opus-0.9.14+20120615/src/opus_demo.vcxproj.filters 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/src/opus_demo.vcxproj.filters 2012-10-18 15:43:35.000000000 +1030
diff -Nru opus-0.9.14+20120615/src/opus_encoder.c opus-1.0.1/src/opus_encoder.c
--- opus-0.9.14+20120615/src/opus_encoder.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/src/opus_encoder.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Implementation for the new (encoder side) ctls.
And bugfix from commit 31e8a845923ace3cb818dd12839188cf3f29af80:
Don't try to create fullband silk frames when forced to low rate.
When libopus is forced to sufficiently low rates it will start
outputting 'PLC' (one byte) frames. The code that did this
did not sanitize the mode well enough and would create corrupted
TOC values in some cases.
@@ -366,10 +366,13 @@
}
static void stereo_fade(const opus_val16 *in, opus_val16 *out, opus_val16 g1, opus_val16 g2,
- int overlap, int frame_size, int channels, const opus_val16 *window, opus_int32 Fs)
+ int overlap48, int frame_size, int channels, const opus_val16 *window, opus_int32 Fs)
{
int i;
- int inc = 48000/Fs;
+ int overlap;
+ int inc;
+ inc = 48000/Fs;
+ overlap=overlap48/inc;
g1 = Q15ONE-g1;
g2 = Q15ONE-g2;
for (i=0;i<overlap;i++)
@@ -501,16 +504,22 @@
if (max_data_bytes<3 || st->bitrate_bps < 3*frame_rate*8
|| (frame_rate<50 && (max_data_bytes*frame_rate<300 || st->bitrate_bps < 2400)))
{
+ /*If the space is too low to do something useful, emit 'PLC' frames.*/
int tocmode = st->mode;
+ int bw = st->bandwidth == 0 ? OPUS_BANDWIDTH_NARROWBAND : st->bandwidth;
if (tocmode==0)
tocmode = MODE_SILK_ONLY;
if (frame_rate>100)
tocmode = MODE_CELT_ONLY;
if (frame_rate < 50)
tocmode = MODE_SILK_ONLY;
- data[0] = gen_toc(tocmode, frame_rate,
- st->bandwidth == 0 ? OPUS_BANDWIDTH_NARROWBAND : st->bandwidth,
- st->stream_channels);
+ if(tocmode==MODE_SILK_ONLY&&bw>OPUS_BANDWIDTH_WIDEBAND)
+ bw=OPUS_BANDWIDTH_WIDEBAND;
+ else if (tocmode==MODE_CELT_ONLY&&bw==OPUS_BANDWIDTH_MEDIUMBAND)
+ bw=OPUS_BANDWIDTH_NARROWBAND;
+ else if (bw<=OPUS_BANDWIDTH_SUPERWIDEBAND)
+ bw=OPUS_BANDWIDTH_SUPERWIDEBAND;
+ data[0] = gen_toc(tocmode, frame_rate, bw, st->stream_channels);
RESTORE_STACK;
return 1;
}
@@ -1522,12 +1531,35 @@
*value += st->delay_compensation;
}
break;
+ case OPUS_GET_SAMPLE_RATE_REQUEST:
+ {
+ opus_int32 *value = va_arg(ap, opus_int32*);
+ if (value==NULL)
+ {
+ ret = OPUS_BAD_ARG;
+ break;
+ }
+ *value = st->Fs;
+ }
+ break;
case OPUS_GET_FINAL_RANGE_REQUEST:
{
opus_uint32 *value = va_arg(ap, opus_uint32*);
*value = st->rangeFinal;
}
break;
+ case OPUS_SET_LSB_DEPTH_REQUEST:
+ {
+ opus_int32 value = va_arg(ap, opus_int32);
+ ret = celt_encoder_ctl(celt_enc, OPUS_SET_LSB_DEPTH(value));
+ }
+ break;
+ case OPUS_GET_LSB_DEPTH_REQUEST:
+ {
+ opus_int32 *value = va_arg(ap, opus_int32*);
+ celt_encoder_ctl(celt_enc, OPUS_GET_LSB_DEPTH(value));
+ }
+ break;
case OPUS_RESET_STATE:
{
void *silk_enc;
diff -Nru opus-0.9.14+20120615/src/opus_multistream.c opus-1.0.1/src/opus_multistream.c
--- opus-0.9.14+20120615/src/opus_multistream.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/src/opus_multistream.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: several bugfixes:
Remove large multistream stack buffers is the bulk of the changes here
(commit a40689e6efccb13065a0e2db22c06208482dea6f)
Additional multistream tests and reject channels<1 in multistream API.
(commit 582eba6f4f703929e646f6dc6e864d9b12f4f4af)
Opus_multistream API hardening.
(commit d060dd7cbd6405c8a31510ca17adb1e051934f49)
Multistream support for the new ctls.
@@ -163,6 +162,10 @@
int i;
char *ptr;
+ if ((channels>255) || (channels<1) || (coupled_streams>streams) ||
+ (coupled_streams+streams>255) || (streams<1) || (coupled_streams<0))
+ return OPUS_BAD_ARG;
+
st->layout.nb_channels = channels;
st->layout.nb_streams = streams;
st->layout.nb_coupled_streams = coupled_streams;
@@ -217,23 +220,31 @@
return st;
}
+typedef void (*opus_copy_channel_in_func)(
+ opus_val16 *dst,
+ int dst_stride,
+ const void *src,
+ int src_stride,
+ int src_channel,
+ int frame_size
+);
+
/* Max size in case the encoder decides to return three frames */
#define MS_FRAME_TMP (3*1275+7)
-#ifdef FIXED_POINT
-int opus_multistream_encode(
-#else
-int opus_multistream_encode_float(
-#endif
+static int opus_multistream_encode_native
+(
OpusMSEncoder *st,
- const opus_val16 *pcm,
+ opus_copy_channel_in_func copy_channel_in,
+ const void *pcm,
int frame_size,
unsigned char *data,
opus_int32 max_data_bytes
)
{
+ opus_int32 Fs;
int coupled_size;
int mono_size;
- int s, i;
+ int s;
char *ptr;
int tot_size;
VARDECL(opus_val16, buf);
@@ -241,8 +252,18 @@
OpusRepacketizer rp;
ALLOC_STACK;
- ALLOC(buf, 2*frame_size, opus_val16);
ptr = (char*)st + align(sizeof(OpusMSEncoder));
+ opus_encoder_ctl((OpusEncoder*)ptr, OPUS_GET_SAMPLE_RATE(&Fs));
+ /* Validate frame_size before using it to allocate stack space.
+ This mirrors the checks in opus_encode[_float](). */
+ if (400*frame_size != Fs && 200*frame_size != Fs &&
+ 100*frame_size != Fs && 50*frame_size != Fs &&
+ 25*frame_size != Fs && 50*frame_size != 3*Fs)
+ {
+ RESTORE_STACK;
+ return OPUS_BAD_ARG;
+ }
+ ALLOC(buf, 2*frame_size, opus_val16);
coupled_size = opus_encoder_get_size(2);
mono_size = opus_encoder_get_size(1);
@@ -266,16 +287,15 @@
int left, right;
left = get_left_channel(&st->layout, s, -1);
right = get_right_channel(&st->layout, s, -1);
- for (i=0;i<frame_size;i++)
- {
- buf[2*i] = pcm[st->layout.nb_channels*i+left];
- buf[2*i+1] = pcm[st->layout.nb_channels*i+right];
- }
+ (*copy_channel_in)(buf, 2,
+ pcm, st->layout.nb_channels, left, frame_size);
+ (*copy_channel_in)(buf+1, 2,
+ pcm, st->layout.nb_channels, right, frame_size);
ptr += align(coupled_size);
} else {
int chan = get_mono_channel(&st->layout, s, -1);
- for (i=0;i<frame_size;i++)
- buf[i] = pcm[st->layout.nb_channels*i+chan];
+ (*copy_channel_in)(buf, 1,
+ pcm, st->layout.nb_channels, chan, frame_size);
ptr += align(mono_size);
}
/* number of bytes left (+Toc) */
@@ -302,7 +322,60 @@
}
+#if !defined(DISABLE_FLOAT_API)
+static void opus_copy_channel_in_float(
+ opus_val16 *dst,
+ int dst_stride,
+ const void *src,
+ int src_stride,
+ int src_channel,
+ int frame_size
+)
+{
+ const float *float_src;
+ int i;
+ float_src = (const float *)src;
+ for (i=0;i<frame_size;i++)
+#if defined(FIXED_POINT)
+ dst[i*dst_stride] = FLOAT2INT16(float_src[i*src_stride+src_channel]);
+#else
+ dst[i*dst_stride] = float_src[i*src_stride+src_channel];
+#endif
+}
+#endif
+
+static void opus_copy_channel_in_short(
+ opus_val16 *dst,
+ int dst_stride,
+ const void *src,
+ int src_stride,
+ int src_channel,
+ int frame_size
+)
+{
+ const opus_int16 *short_src;
+ int i;
+ short_src = (const opus_int16 *)src;
+ for (i=0;i<frame_size;i++)
+#if defined(FIXED_POINT)
+ dst[i*dst_stride] = short_src[i*src_stride+src_channel];
+#else
+ dst[i*dst_stride] = (1/32768.f)*short_src[i*src_stride+src_channel];
+#endif
+}
+
#ifdef FIXED_POINT
+int opus_multistream_encode(
+ OpusMSEncoder *st,
+ const opus_val16 *pcm,
+ int frame_size,
+ unsigned char *data,
+ opus_int32 max_data_bytes
+)
+{
+ return opus_multistream_encode_native(st, opus_copy_channel_in_short,
+ pcm, frame_size, data, max_data_bytes);
+}
#ifndef DISABLE_FLOAT_API
int opus_multistream_encode_float(
@@ -313,22 +386,26 @@
opus_int32 max_data_bytes
)
{
- int i, ret;
- VARDECL(opus_int16, in);
- ALLOC_STACK;
-
- ALLOC(in, frame_size*st->layout.nb_channels, opus_int16);
-
- for (i=0;i<frame_size*st->layout.nb_channels;i++)
- in[i] = FLOAT2INT16(pcm[i]);
- ret = opus_multistream_encode(st, in, frame_size, data, max_data_bytes);
- RESTORE_STACK;
- return ret;
+ return opus_multistream_encode_native(st, opus_copy_channel_in_float,
+ pcm, frame_size, data, max_data_bytes);
}
#endif
#else
+int opus_multistream_encode_float
+(
+ OpusMSEncoder *st,
+ const opus_val16 *pcm,
+ int frame_size,
+ unsigned char *data,
+ opus_int32 max_data_bytes
+)
+{
+ return opus_multistream_encode_native(st, opus_copy_channel_in_float,
+ pcm, frame_size, data, max_data_bytes);
+}
+
int opus_multistream_encode(
OpusMSEncoder *st,
const opus_int16 *pcm,
@@ -337,19 +414,9 @@
opus_int32 max_data_bytes
)
{
- int i, ret;
- VARDECL(float, in);
- ALLOC_STACK;
-
- ALLOC(in, frame_size*st->layout.nb_channels, float);
-
- for (i=0;i<frame_size*st->layout.nb_channels;i++)
- in[i] = (1./32768)*pcm[i];
- ret = opus_multistream_encode_float(st, in, frame_size, data, max_data_bytes);
- RESTORE_STACK;
- return ret;
+ return opus_multistream_encode_native(st, opus_copy_channel_in_short,
+ pcm, frame_size, data, max_data_bytes);
}
-
#endif
int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...)
@@ -403,6 +470,7 @@
}
}
break;
+ case OPUS_GET_LSB_DEPTH_REQUEST:
case OPUS_GET_VBR_REQUEST:
case OPUS_GET_APPLICATION_REQUEST:
case OPUS_GET_BANDWIDTH_REQUEST:
@@ -413,6 +481,7 @@
case OPUS_GET_VBR_CONSTRAINT_REQUEST:
case OPUS_GET_SIGNAL_REQUEST:
case OPUS_GET_LOOKAHEAD_REQUEST:
+ case OPUS_GET_SAMPLE_RATE_REQUEST:
case OPUS_GET_INBAND_FEC_REQUEST:
{
OpusEncoder *enc;
@@ -442,6 +511,7 @@
}
}
break;
+ case OPUS_SET_LSB_DEPTH_REQUEST:
case OPUS_SET_COMPLEXITY_REQUEST:
case OPUS_SET_VBR_REQUEST:
case OPUS_SET_VBR_CONSTRAINT_REQUEST:
@@ -534,6 +604,10 @@
int i, ret;
char *ptr;
+ if ((channels>255) || (channels<1) || (coupled_streams>streams) ||
+ (coupled_streams+streams>255) || (streams<1) || (coupled_streams<0))
+ return OPUS_BAD_ARG;
+
st->layout.nb_channels = channels;
st->layout.nb_streams = streams;
st->layout.nb_coupled_streams = coupled_streams;
@@ -593,23 +667,37 @@
}
+typedef void (*opus_copy_channel_out_func)(
+ void *dst,
+ int dst_stride,
+ int dst_channel,
+ const opus_val16 *src,
+ int src_stride,
+ int frame_size
+);
+
static int opus_multistream_decode_native(
OpusMSDecoder *st,
const unsigned char *data,
opus_int32 len,
- opus_val16 *pcm,
+ void *pcm,
+ opus_copy_channel_out_func copy_channel_out,
int frame_size,
int decode_fec
)
{
+ opus_int32 Fs;
int coupled_size;
int mono_size;
- int s, i, c;
+ int s, c;
char *ptr;
int do_plc=0;
VARDECL(opus_val16, buf);
ALLOC_STACK;
+ /* Limit frame_size to avoid excessive stack allocations. */
+ opus_multistream_decoder_ctl(st, OPUS_GET_SAMPLE_RATE(&Fs));
+ frame_size = IMIN(frame_size, Fs/25*3);
ALLOC(buf, 2*frame_size, opus_val16);
ptr = (char*)st + align(sizeof(OpusMSDecoder));
coupled_size = opus_decoder_get_size(2);
@@ -661,16 +749,16 @@
/* Copy "left" audio to the channel(s) where it belongs */
while ( (chan = get_left_channel(&st->layout, s, prev)) != -1)
{
- for (i=0;i<frame_size;i++)
- pcm[st->layout.nb_channels*i+chan] = buf[2*i];
+ (*copy_channel_out)(pcm, st->layout.nb_channels, chan,
+ buf, 2, frame_size);
prev = chan;
}
prev = -1;
/* Copy "right" audio to the channel(s) where it belongs */
while ( (chan = get_right_channel(&st->layout, s, prev)) != -1)
{
- for (i=0;i<frame_size;i++)
- pcm[st->layout.nb_channels*i+chan] = buf[2*i+1];
+ (*copy_channel_out)(pcm, st->layout.nb_channels, chan,
+ buf+1, 2, frame_size);
prev = chan;
}
} else {
@@ -679,8 +767,8 @@
/* Copy audio to the channel(s) where it belongs */
while ( (chan = get_mono_channel(&st->layout, s, prev)) != -1)
{
- for (i=0;i<frame_size;i++)
- pcm[st->layout.nb_channels*i+chan] = buf[i];
+ (*copy_channel_out)(pcm, st->layout.nb_channels, chan,
+ buf, 1, frame_size);
prev = chan;
}
}
@@ -690,14 +778,74 @@
{
if (st->layout.mapping[c] == 255)
{
- for (i=0;i<frame_size;i++)
- pcm[st->layout.nb_channels*i+c] = 0;
+ (*copy_channel_out)(pcm, st->layout.nb_channels, c,
+ NULL, 0, frame_size);
}
}
RESTORE_STACK;
return frame_size;
}
+#if !defined(DISABLE_FLOAT_API)
+static void opus_copy_channel_out_float(
+ void *dst,
+ int dst_stride,
+ int dst_channel,
+ const opus_val16 *src,
+ int src_stride,
+ int frame_size
+)
+{
+ float *float_dst;
+ int i;
+ float_dst = (float*)dst;
+ if (src != NULL)
+ {
+ for (i=0;i<frame_size;i++)
+#if defined(FIXED_POINT)
+ float_dst[i*dst_stride+dst_channel] = (1/32768.f)*src[i*src_stride];
+#else
+ float_dst[i*dst_stride+dst_channel] = src[i*src_stride];
+#endif
+ }
+ else
+ {
+ for (i=0;i<frame_size;i++)
+ float_dst[i*dst_stride+dst_channel] = 0;
+ }
+}
+#endif
+
+static void opus_copy_channel_out_short(
+ void *dst,
+ int dst_stride,
+ int dst_channel,
+ const opus_val16 *src,
+ int src_stride,
+ int frame_size
+)
+{
+ opus_int16 *short_dst;
+ int i;
+ short_dst = (opus_int16*)dst;
+ if (src != NULL)
+ {
+ for (i=0;i<frame_size;i++)
+#if defined(FIXED_POINT)
+ short_dst[i*dst_stride+dst_channel] = src[i*src_stride];
+#else
+ short_dst[i*dst_stride+dst_channel] = FLOAT2INT16(src[i*src_stride]);
+#endif
+ }
+ else
+ {
+ for (i=0;i<frame_size;i++)
+ short_dst[i*dst_stride+dst_channel] = 0;
+ }
+}
+
+
+
#ifdef FIXED_POINT
int opus_multistream_decode(
OpusMSDecoder *st,
@@ -708,27 +856,16 @@
int decode_fec
)
{
- return opus_multistream_decode_native(st, data, len, pcm, frame_size, decode_fec);
+ return opus_multistream_decode_native(st, data, len,
+ pcm, opus_copy_channel_out_short, frame_size, decode_fec);
}
#ifndef DISABLE_FLOAT_API
int opus_multistream_decode_float(OpusMSDecoder *st, const unsigned char *data,
opus_int32 len, float *pcm, int frame_size, int decode_fec)
{
- VARDECL(opus_int16, out);
- int ret, i;
- ALLOC_STACK;
-
- ALLOC(out, frame_size*st->layout.nb_channels, opus_int16);
-
- ret = opus_multistream_decode_native(st, data, len, out, frame_size, decode_fec);
- if (ret > 0)
- {
- for (i=0;i<ret*st->layout.nb_channels;i++)
- pcm[i] = (1./32768.)*(out[i]);
- }
- RESTORE_STACK;
- return ret;
+ return opus_multistream_decode_native(st, data, len,
+ pcm, opus_copy_channel_out_float, frame_size, decode_fec);
}
#endif
@@ -737,20 +874,8 @@
int opus_multistream_decode(OpusMSDecoder *st, const unsigned char *data,
opus_int32 len, opus_int16 *pcm, int frame_size, int decode_fec)
{
- VARDECL(float, out);
- int ret, i;
- ALLOC_STACK;
-
- ALLOC(out, frame_size*st->layout.nb_channels, float);
-
- ret = opus_multistream_decode_native(st, data, len, out, frame_size, decode_fec);
- if (ret > 0)
- {
- for (i=0;i<ret*st->layout.nb_channels;i++)
- pcm[i] = FLOAT2INT16(out[i]);
- }
- RESTORE_STACK;
- return ret;
+ return opus_multistream_decode_native(st, data, len,
+ pcm, opus_copy_channel_out_short, frame_size, decode_fec);
}
int opus_multistream_decode_float(
@@ -762,7 +887,8 @@
int decode_fec
)
{
- return opus_multistream_decode_native(st, data, len, pcm, frame_size, decode_fec);
+ return opus_multistream_decode_native(st, data, len,
+ pcm, opus_copy_channel_out_float, frame_size, decode_fec);
}
#endif
@@ -781,6 +907,7 @@
switch (request)
{
case OPUS_GET_BANDWIDTH_REQUEST:
+ case OPUS_GET_SAMPLE_RATE_REQUEST:
{
OpusDecoder *dec;
/* For int32* GET params, just query the first stream */
@@ -845,7 +972,27 @@
}
*value = (OpusDecoder*)ptr;
}
- break;
+ break;
+ case OPUS_SET_GAIN_REQUEST:
+ {
+ int s;
+ /* This works for int32 params */
+ opus_int32 value = va_arg(ap, opus_int32);
+ for (s=0;s<st->layout.nb_streams;s++)
+ {
+ OpusDecoder *dec;
+
+ dec = (OpusDecoder*)ptr;
+ if (s < st->layout.nb_coupled_streams)
+ ptr += align(coupled_size);
+ else
+ ptr += align(mono_size);
+ ret = opus_decoder_ctl(dec, request, value);
+ if (ret != OPUS_OK)
+ break;
+ }
+ }
+ break;
default:
ret = OPUS_UNIMPLEMENTED;
break;
diff -Nru opus-0.9.14+20120615/src/opus_private.h opus-1.0.1/src/opus_private.h
--- opus-0.9.14+20120615/src/opus_private.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/src/opus_private.h 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Fix a warning about 'unary minus operator applied to unsigned type,
result still unsigned'
@@ -77,7 +77,7 @@
/* Make sure everything's aligned to sizeof(void *) bytes */
static inline int align(int i)
{
- return (i+sizeof(void *)-1)&-sizeof(void *);
+ return (i+sizeof(void *)-1)&-((int)sizeof(void *));
}
opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, unsigned char *data, opus_int32 maxlen, int self_delimited);
diff -Nru opus-0.9.14+20120615/src/opus.vcxproj opus-1.0.1/src/opus.vcxproj
--- opus-0.9.14+20120615/src/opus.vcxproj 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/src/opus.vcxproj 2012-10-18 15:43:35.000000000 +1030
SUMMARY: More msvc project goop that's not for us.
diff -Nru opus-0.9.14+20120615/src/opus.vcxproj.filters opus-1.0.1/src/opus.vcxproj.filters
--- opus-0.9.14+20120615/src/opus.vcxproj.filters 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/src/opus.vcxproj.filters 2012-10-18 15:43:35.000000000 +1030
diff -Nru opus-0.9.14+20120615/tests/test_opus_api.c opus-1.0.1/tests/test_opus_api.c
--- opus-0.9.14+20120615/tests/test_opus_api.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/tests/test_opus_api.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: API test suite additions for the new ctls and multistream API bugfixes.
Passes all tests on the experimental buildds for all arches.
diff -Nru opus-0.9.14+20120615/tests/test_opus_api.vcxproj opus-1.0.1/tests/test_opus_api.vcxproj
--- opus-0.9.14+20120615/tests/test_opus_api.vcxproj 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/tests/test_opus_api.vcxproj 2012-10-18 15:43:35.000000000 +1030
SUMMARY: More msvc project goop that's not for us.
diff -Nru opus-0.9.14+20120615/tests/test_opus_api.vcxproj.filters opus-1.0.1/tests/test_opus_api.vcxproj.filters
--- opus-0.9.14+20120615/tests/test_opus_api.vcxproj.filters 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/tests/test_opus_api.vcxproj.filters 2012-10-18 15:43:35.000000000 +1030
diff -Nru opus-0.9.14+20120615/tests/test_opus_decode.c opus-1.0.1/tests/test_opus_decode.c
--- opus-0.9.14+20120615/tests/test_opus_decode.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/tests/test_opus_decode.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: decoder test suite tweaks.
Avoid a (harmless) memory leak.
Match up the exit behavior when the no-fuzz enviroment variable is set.
Passes all tests on the experimental buildds for all arches.
diff -Nru opus-0.9.14+20120615/tests/test_opus_decode.vcxproj opus-1.0.1/tests/test_opus_decode.vcxproj
--- opus-0.9.14+20120615/tests/test_opus_decode.vcxproj 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/tests/test_opus_decode.vcxproj 2012-10-18 15:43:35.000000000 +1030
SUMMARY: More msvc project goop that's not for us.
diff -Nru opus-0.9.14+20120615/tests/test_opus_decode.vcxproj.filters opus-1.0.1/tests/test_opus_decode.vcxproj.filters
--- opus-0.9.14+20120615/tests/test_opus_decode.vcxproj.filters 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/tests/test_opus_decode.vcxproj.filters 2012-10-18 15:43:35.000000000 +1030
diff -Nru opus-0.9.14+20120615/tests/test_opus_encode.c opus-1.0.1/tests/test_opus_encode.c
--- opus-0.9.14+20120615/tests/test_opus_encode.c 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/tests/test_opus_encode.c 2012-10-18 15:43:35.000000000 +1030
SUMMARY: encoder test suite tweaks.
Additional multistream tests and reject channels<1 in multistream API.
Fixes for mingw and msvc.
Passes all tests on the experimental buildds for all arches.
diff -Nru opus-0.9.14+20120615/tests/test_opus_encode.vcxproj opus-1.0.1/tests/test_opus_encode.vcxproj
--- opus-0.9.14+20120615/tests/test_opus_encode.vcxproj 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/tests/test_opus_encode.vcxproj 2012-10-18 15:43:35.000000000 +1030
SUMMARY: Yet more msvc project goop ...
we should probably exclude all this from the packages in future too
diff -Nru opus-0.9.14+20120615/tests/test_opus_encode.vcxproj.filters opus-1.0.1/tests/test_opus_encode.vcxproj.filters
--- opus-0.9.14+20120615/tests/test_opus_encode.vcxproj.filters 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/tests/test_opus_encode.vcxproj.filters 2012-10-18 15:43:35.000000000 +1030
diff -Nru opus-0.9.14+20120615/version.mk opus-1.0.1/version.mk
--- opus-0.9.14+20120615/version.mk 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/version.mk 2012-10-18 15:43:35.000000000 +1030
@@ -0,0 +1,2 @@
+# static version string; update manually every release.
+OPUS_VERSION = "1.0.1"
diff -Nru opus-0.9.14+20120615/win32/config.h opus-1.0.1/win32/config.h
--- opus-0.9.14+20120615/win32/config.h 2012-06-15 11:54:34.000000000 +0930
+++ opus-1.0.1/win32/config.h 2012-10-18 15:43:35.000000000 +1030
SUMMARY: config.h for windows users not using autotools. not for us.
diff -Nru opus-0.9.14+20120615/win32/genversion.bat opus-1.0.1/win32/genversion.bat
--- opus-0.9.14+20120615/win32/genversion.bat 1970-01-01 09:30:00.000000000 +0930
+++ opus-1.0.1/win32/genversion.bat 2012-10-18 15:43:35.000000000 +1030
SUMMARY: windows build stuff, not for us.
--- End Message ---