These are only being used outside if the translation unit and only in
a few codepaths; by making them static in the header, the compiler can
optimize them quickly.
This avoids GOT-based access to the external symbol on Unix, and can
allow for constant propagation to optimize the code.
Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
This allows the compiler to perform more optimization on them as it
knows how the functions are being called.
Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
This allows the decoder to be compiled with
NONTHREADSAFE_PSEUDOSTACK to move the memory for large buffers off
the stack for devices where it is very limited.
This patch only attempts to do this for the decoder.
The encoder still requires more than 10 kB of stack.
This avoids allocating any buffers on the stack that depend on the
total channel count.
Such buffers could easily exceed the size of the
NONTHREADSAFE_PSEUDOSTACK.
It also checks the frame_size argument in both the encoder and
decoder to avoid allocating large stack buffers for opus_encode()
calls that would fail anyway or opus_decode() calls that would
never use all that space anyway.
On some systems (HPPA+HPUX+GCC) -fstatck-protector was causing failures not
at build or link time but at actual runtime. This is much less reasonable to
detect from autotools. It looks this this really can only safely be a white-
list, and the systems which would be whitelisted often already pick up the
setting from the OS build environment in any case. It isn't important for
OPUS, we were just using it as belt-and-suspenders security and because it
makes some failure types easier to troubleshoot.
I'm not sure how this worked before, the the previous version
string fiddling commit ended up not defining OPUS_VERSION in
the autoconf build, so opus_get_version_string() returned
'unknown'.
Microsoft Visual Studio 2010 warns about 'C4146: unary minus
operator applied to unsigned type, result still unsigned'
because of the '&-sizeof(void*)' in align().
This commit works around the warning by casting the size_t
to int before negation.
Patch by Hauke, who reported the issue on the opus mailing
list. Reviewed by derf.
Previously we defined the release version string in configure.ac,
and overrode that with 'git describe --tags' if possible. This
made it difficult for non-autoconf builds to set their version
string correctly.
Instead we create, and check into version control, a file called
version.mk which defines OPUS_VERSION. The configure script reads
that file and uses it as a fallback if the git revision isn't available.
The expectation is that version.mk will be manually updated for
releases, just as the previous configure.ac version was. However,
since this is a simpler format, it is easier for alternate build
systems to use, reducing the number of places which must be updated.
Also removes the OPUS_MINOR_VERSION, etc. defines from config.h.
In particular we no longer document the default complexity because
we're not guaranteeing to keep the default value constant. In the
future the default may be lowered in order to keep the default
speed constant.
We were installing every readable file in man/man3, but
only unstalling files matching opus_*.3. Some doxygen
versions construct manpage versions of the marked up
header files and directory index, which got left on the
system after 'make uninstall'.
I don't think the 'uninstall' target is widely used, it's
often broken and can easily break other software. However,
we rely on 'make distcheck' which does verify this issue.
Instead, only install the opus_*.3 manpages, which are the
core api documentation.
In addition to general reformatting and cleanup, this fixes a
couple of important mistakes:
- The arguments to OPUS_SET_FORCE_CHANNELS are now 1 and 2, not 0
and 1 (as they were when this was called OPUS_SET_FORCE_MONO).
- The default encoder mode is now constrained VBR, not unconstrained
VBR.
It also documents defaults for all the other parameters.