Commit graph

227 commits

Author SHA1 Message Date
Jean-Marc Valin
1975eeadd2 Big squashed commit of Garf's MSVC reorg:
commit 77880655f652c54415e4b5f03b5984b951f5267b
Author: Timothy B. Terriberry <tterribe@xiph.org>
Date:   Wed Jun 26 12:23:53 2013 +0200

    Fix version.mk parsing in genversion.bat.

    This was broken by the changes in 0482c82f to make it work with spaces.

    CMD interprets the quotes to mean the argument to FOR is a string,
    not a file name. Instead, we expand the path to a short file name.

    Signed-off-by: Gian-Carlo Pascutto <gcp@sjeng.org>

commit 8e97847ecac3a04956747b117fefef14939cbcbe
Merge: 0482c82 3c0aa8f
Author: Gian-Carlo Pascutto <gcp@sjeng.org>
Date:   Wed Jun 26 12:19:41 2013 +0200

    Merge branch 'master' into msvc_reorg

commit 0482c82fea6dd397a7d2ab50dc6cda4965278fc2
Author: Gian-Carlo Pascutto <gcp@sjeng.org>
Date:   Tue May 21 17:59:30 2013 +0200

    Make genversion.bat work in paths with spaces.

commit 3648ec55b7511119735280fc49bc57c7a3b55d6a
Author: Gian-Carlo Pascutto <gcp@sjeng.org>
Date:   Tue May 21 17:42:14 2013 +0200

    Rework output & intermediate dirs for parallel build support.

commit c367a0fcfcbf5551fb65d61365d9b832d7af2b38
Merge: bafb1dd b518b56
Author: Gian-Carlo Pascutto <gcp@sjeng.org>
Date:   Tue May 21 14:17:11 2013 +0200

    Merge branch 'master' into msvc_reorg

    Conflicts:
    	win32/VS2010/celt.vcxproj
    	win32/VS2010/opus.vcxproj
    	win32/VS2010/silk_common.vcxproj
    	win32/VS2010/silk_float.vcxproj

commit bafb1dda3fcf6785decdfb42a1f934c7fab0c567
Author: Gian-Carlo Pascutto <gcp@sjeng.org>
Date:   Mon Mar 11 21:25:28 2013 +0100

    Fix two more files to not have the Platform Toolset explicitly set.

commit c69c870201fec7461862fe79731a37866a1810f1
Author: Gian-Carlo Pascutto <gcp@sjeng.org>
Date:   Mon Mar 11 21:08:00 2013 +0100

    Add missing SILK MSVC project files.

commit a0d41fb7f97558c8f812d500b9027c77907c37c0
Author: Gian-Carlo Pascutto <gcp@sjeng.org>
Date:   Fri Mar 8 15:00:51 2013 +0100

    Use the default toolset in the MSVC project files.

commit 34aac5b2637ed38c5620f0d876e08db232849933
Author: Gian-Carlo Pascutto <gcp@sjeng.org>
Date:   Fri Mar 8 14:54:41 2013 +0100

    Move the MSVC project files outside the source tree.

    Bring the project structure more in line with the one in libogg.
2013-06-27 03:12:38 -04:00
Timothy B. Terriberry
e3ad4ea1cd Move misplaced RESTORE_STACK.
Introduced in c152d602.

Thanks to Pedro Becerra for the report.
2013-05-23 19:33:34 -07:00
Timothy B. Terriberry
7e783b141b Move misplaced RESTORE_STACK.
Introduced in c152d602.

Thanks to Pedro Becerra for the report.
2013-05-23 15:54:55 -07:00
Timothy B. Terriberry
e095c3eb7f Move ARM asm into its own directories. 2013-05-21 12:53:33 -07:00
Timothy B. Terriberry
b518b56fe1 Clean up register constraints.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0068b/CIHBJEHG.html
 says that "Rd cannot be the same as Rm."
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0068b/CIHBJEHG.html
 says that "RdLo, RdHi, and Rm must all be different registers."
This means that some of the early clobbers I removed really should
 have been there (to prevent aliasing Rd, RdLo, or RdHi with Rm).
It also means that we should reverse some of the operands in the
 FFT's complex multiplies.
This should only affect the ARMv4 optimizations.

Thanks to Nils Wallménius for the report.

While we're here, audit the commutative pair flags again, since I
 screwed up at least one of them, and eliminate some dead code.
2013-05-20 23:15:15 -07:00
Timothy B. Terriberry
9880c4cdeb Fix bustage in a16cef62. 2013-05-19 20:52:55 -07:00
Timothy B. Terriberry
a16cef6225 Replace silk_CLZ functions with EC_ILOG().
In most cases these will use __builtin_clz().
In a follow-up, we should audit usage of silk_CLZ32() and convert
 the places where its argument must be non-zero to use EC_ILOG()
 directly to avoid the test for zero (which is necessary on x86).
2013-05-19 19:16:15 -07:00
Timothy B. Terriberry
80ad38370c Convert quotes in license headers to ASCII.
Since the last patch originally had them mangled (presumably by
 mailer, http server, or something else), let's just get rid of
 them.
2013-05-19 19:16:11 -07:00
Timothy B. Terriberry
972a34ec2c Add ARMv4/ARMv5E macros.
Original patch by Aurélien Zanelli <aurelien.zanelli@parrot.com>:
 http://lists.xiph.org/pipermail/opus/2013-May/002078.html

Revised version:
- Add autconf detection (ported from libtheora).
- Rename ARM5E to ARMv5E (an ARM5 is not the same thing as ARMv5!).
- Use actual macros so they can still be selectively overridden.
- Split out ARMv4 parts and add a few more ARMv4 macros.
- Label blocks to make them easy to find in generated assembly.
- Fix MULT16_32_Q15() so we can pass make check.
  The MDCT test passes in values larger than 2**30 for b.
  The new version should be just as fast (or faster, since it's
   easier to merge the shift with following instructions), and
   there's no appreciable impact on accuracy (FFT/MDCT SNR actually
   goes up in most cases).
- Fix register constraints.
  We were using early-clobber flags in a bunch of places that
   didn't need them, and commutative-pair flags in a bunch of
   places that weren't actually commutative.
  This was Jean-Marc's fault (the original code came from Speex).
- Simplify silk_CLZ16().
- Port over iFFT C_MULC asm by Andree Buschmann
   <AndreeBuschmann@t-online.de> from Rockbox.
- Speed up the C_MULC asm by using LDRD, allowing more flexible
   addressing, re-ordering instructions to avoid some stalls,
   allowing more flexible register allocation, and getting things
   out of the inline asm block so the compiler can schedule them
   better.
- Add C_MUL and C_MUL4 asm for the FFT to the encoder based, on the
   new C_MULC.

In total, this patch gives a 22.3% speed-up on test_opus_encoder on
 a 600 MHz Cortex A8 using gcc 4.2.1,
When restricted to ARMv4 optimizations, it gives a 9.6% speed-up
 on the same processor/compiler.
On the conformance test vectors:
 Average mono quality is 97.0583 %
 Average stereo quality is 97.775 %
2013-05-19 19:12:51 -07:00
Jean-Marc Valin
74de3a580c Saturates the last RC to 0.99 when Schur blows up
This is a follow-up on ac76b15. When Schur blows up, we set the last RC to
+/- 0.99 instead of eliminating it.
2013-05-16 23:14:46 -04:00
Ralph Giles
b7d5531ffe Change Visual Studio files to use PACKAGE_VERSION.
This replaces the OPUS_VERSION removed by ron's auto-updater.
2013-05-10 11:27:13 -07:00
Jean-Marc Valin
ac76b1503f Fixes an assertion failure in SILK
We stop the schur recursion before any reflection coefficient
goes outside of ]-1,1[ and we force reporting a residual energy
of at least 1.
Assertion was:
Fatal (internal) error in ../silk/fixed/noise_shape_analysis_FIX.c, line 290: assertion failed: nrg >= 0
triggered by:
opus_demo voip 16000 1 12500 -bandwidth WB -complexity 10 pl04f087.stp-crash out.pcm
2013-05-09 16:17:13 -04:00
Timothy B. Terriberry
c9f857ef60 Fix bustage from c152d602.
silk_setup_resamples() was using x_bufFIX for two purposes, and I
 only allocated enough space for one of them.
This patch also switches to slightly more descriptive variable
 names than nSamples_temp and computes the resampler input/ouput
 sizes in a way that a little more obviously doesn't have issues
 with fractional samples (and replaces a divide with a variable
 divisor by one with a constant divisor).
2013-05-08 14:08:42 -07:00
Timothy B. Terriberry
c152d602aa Use dynamic stack allocation in the SILK encoder.
This makes all remaining large stack allocations use the vararray
 macros.
This continues the work of 6f2d9f50 to allow compiling with
 NONTHREADSAFE_PSEUDOSTACK to move the memory for large buffers
 off the stack for devices where it is very limited.

It also does this for some additional large buffers used by the
 PLC in the decoder.
2013-05-08 10:37:17 -07:00
Timothy B. Terriberry
dc58579c2c Fix several memory errors in the SILK resampler.
1) The memcpy's were using sizeof(opus_int32), but the type of the
    local buffer was opus_int16.
2) Because the size was wrong, this potentially allowed the source
    and destination regions of the memcpy overlap.
   I _believe_ that nSamplesIn is at least fs_in_khZ, which is at
    least 8.
   Since RESAMPLER_ORDER_FIR_12 is only 8, I don't think that's a
    problem once you fix the type size.
3) The size of the buffer used RESAMPLER_MAX_BATCH_SIZE_IN, but the
    data stored in it was actually _twice_ the input batch size
    (nSamplesIn<<1).

Because this never blew up in testing, I suspect that in practice
 the batch sizes are reasonable enough that none of these things
 was ever a problem, but proving that seems non-obvious.

This patch just converts the whole thing to use CELT's vararrays.
This fixes the buffer size problems (since we allocate a buffer
 with the actual size we use) and gets these large buffers off the
 stack on devices using the pseudo-stack.
It also fixes the memcpy problems by changing the sizeof to
 opus_int16.
It turns out sFIR, which saved state between calls, was being used
 elsewhere as opus_int32, so this converts it to a union to make
 this sharing explicit.
2013-05-08 10:37:10 -07:00
Timothy B. Terriberry
c41a81680c Remove trailing whitespace. 2013-05-07 20:05:56 -07:00
Timothy B. Terriberry
bfe52ceb74 Fix some warnings.
You can't use /* within a comment.
2013-05-07 20:05:53 -07:00
Jean-Marc Valin
3ecd9c20cb Fixes two bandwidth decision issues
1) In cases where the SILK desired bandwidth went down, then quickly up, we
count get stuck in a mode with the LP variation going the wrong way.
2) Bandwidth detection can no longer force SILK to go below wideband to
avoid switches that require redundancy.
2013-02-19 00:42:15 -05:00
Jean-Marc Valin
6044907c82 Fixes a SILK fixed-point encoder issue reported by Cliff Parris <cliff@espico.com> 2013-02-07 15:31:30 -05:00
Jean-Marc Valin
e51a3f33cf Fixes a minor CELT->SILK switching glitch in the decoder
By not reinitializing the stereo state during a switch, the old stereo
memory would create a false impulse (i.e. single sample) in the decoded audio.
This change affects the normative part of the decoder. Fortunately,
the modified decoder is still compliant with the specification because
it still easily passes the testvectors. For example, for the float decoder
at 48 kHz, the opus_compare (arbitrary) "quality score" changes from
from 99.9333% to 99.925%.
2013-02-06 23:48:09 -05:00
Joshua Bowman
f77e86a235 Fix MSVC linker warnings
Specify the correct debug runtime libraries for the test
and demo executables to prevent mismatch warnings with
the default runtime.

Signed-off-by: Ralph Giles <giles@mozilla.com>
2012-10-23 13:12:25 -07:00
Philip Jägenstedt
b7b5872c9d Fix minor issues reported by scan-build 2012-10-11 09:21:44 -04:00
Jean-Marc Valin
e9b36c1e38 Fixes comment-in-comment warning 2012-10-10 13:53:59 -04:00
Jean-Marc Valin
b56c278b0e Fixes a fixed-point overflow in the new pitch code 2012-10-10 13:32:16 -04:00
Koen Vos
9cbbcb53ae Improvements to the pitch search
Normalizes the cost function by (x+y) instead of sqrt(x*y)
2012-10-10 09:37:10 -04:00
Philip Jägenstedt
ba28403a04 Typo: FIND_PITCH_BANDWI(D)TH_EXPANSION 2012-09-27 09:16:31 -04:00
Philip Jägenstedt
6d9c16d142 Fix common misspellings
I stumbled upon the typo in README.draft, so took the opportunity to
grep for common misspellings using List_of_common_misspellings.txt for
hunspell.
2012-09-27 09:16:30 -04:00
Jean-Marc Valin
6b45974fbd Reduces rate/max rate to make room for redundancy
This fixes a problem where we could end up starving the redundancy
frame, especially for CBR. The solution is to make sure that some
bits are left available -- assuming we use the same rate for redundancy
as for the rest of the frame.
2012-09-20 22:04:37 -04:00
Diego Elio Pettenò
02c653fa0c silk: move down- and upsamplers constants to the header file.
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>
2012-09-12 15:54:33 -04:00
Diego Elio Pettenò
3f2efcbf3d Move to comment a table that is never used in the code.
Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-09-12 15:54:28 -04:00
Diego Elio Pettenò
5f6be0c1c1 Mark tables static when not used outside of their translation unit.
This is similar to the change for functions, but is only used to
perform DCE.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-09-12 15:54:22 -04:00
Diego Elio Pettenò
d006b781ca Mark functions static if they are only used in their own translation unit.
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>
2012-09-12 15:54:17 -04:00
Timothy B. Terriberry
6f2d9f5068 Use dynamic stack allocations in SILK decoder.
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.
2012-09-08 02:35:38 -04:00
Jean-Marc Valin
79a6f4d2ad Makes two static tables const 2012-08-29 09:43:23 -04:00
Jean-Marc Valin
f6c26e0000 Fixes an overflow in silk_log2lin() that was triggered only in debug mode 2012-08-27 00:18:01 -04:00
Gregory Maxwell
0d57a5dc28 Disable silk_get_TOC in the code, as it's not used or exposed. 2012-08-06 12:29:42 -04:00
Cyril Lashkevich
622046c1f1 Fixed sizeof param in silk_get_TOC. Size for memset was calculated wrong.
Signed-off-by: Gregory Maxwell <greg@xiph.org>
silk_get_TOC is unused, unreachable, and not useful without some
packet pre-processing, but until we remove it it should be correct.
This was also reported by Mozilla.
2012-08-06 12:29:42 -04:00
Gian-Carlo Pascutto
0ec93137dc Small cleanups to MSVC build setup.
Add more MSVC files to .gitignore.
Make all configurations use default floating point model.
2012-07-20 08:49:01 -04:00
Chris Moeller
b768c9b0fd Fixes MSVC projects and adds git version generator tool 2012-07-20 08:48:50 -04:00
Gian-Carlo Pascutto
642084c47c Output/intermediate dir cleanup and fixes in 64-bit mode.
Also make the 64-bit builds use the default output directories.
Fix the type of the default Opus output to be a library.
2012-07-16 16:45:04 -04:00
Gian-Carlo Pascutto
eeb7bd3d9d Make MSVC build work in parallel.
The (non-default) temporary & output dirs configured in the projects could
cause issues when doing compilation on a multiprocessor machine. Cleaned
this up a little to use the defaults, which makes that work again and
doesn't make the output structure any worse. Also removed debug output for
release binaries & a tiny whitespace fix.
2012-07-16 16:45:04 -04:00
Gian-Carlo Pascutto
f57be69f07 Remove non-existent ReadMe.txt references. 2012-07-12 18:00:29 -04:00
Gian-Carlo Pascutto
d2fa2edfd8 Make compiler settings consistent. Actually produce the libary, remove the opus_demo for now. 2012-07-12 17:59:26 -04:00
root
bcbf40b601 modified the Visual Studio 2010 projects and solution file to include a x64 configuration. modified the output folders such that the architecture is included in the path (so you get Release64, Debug32, etc.) so you can have all build types in one tree. 2012-06-01 14:26:01 -04:00
Gregory Maxwell
e052947f18 Use 'frame' instead of 'signal', take out stdlib.h in silk/.
On MacOS, stdlib.h ends up including sys/signal.h, generating
warnings about the local variables called 'signal' shadowing
the global symbol signal(3).

This was originally done in 86476906 but it missed some use
of 'signal' in prototypes in headers where it didn't cause
warnings. Later the prototypes were moved around and the
warnings came back.

This also cleans up some cases in where stdlib.h was used
but shouldn't be required.
2012-05-23 10:28:36 -04:00
Gregory Maxwell
1096fe5cfa Remove unused headers/defines in silk/typedef.h, improving portability to AMIX4.0/GCC1.4. 2012-05-15 09:18:43 -04:00
Gregory Maxwell
efbb5ea401 SILK to print error line with FIXED_DEBUG, assert with FIXED_DEBUG_ASSERT. 2012-05-15 09:18:31 -04:00
Jean-Marc Valin
1a9e8539d3 Fixes two fixed-point overflow issues
One in SILK, one in CELT, none of them causing real harm in practice it seems
2012-05-10 12:36:46 -04:00
Jean-Marc Valin
780fbc91f1 Fixes a (harmless) numerical overflow in noise_shape_analysis_FIX.c
Actual behaviour was correct on most architectures and breaking that
code would have required a particularly smart compiler.
2012-04-24 20:45:04 -04:00
Jean-Marc Valin
3af4aa7849 Uses opus_int32 for fs_API_Hz parameter in silk_decoder_set_fs 2012-04-24 17:19:39 -04:00