Commit Graph

1479 Commits

Author SHA1 Message Date
Mans Rullgard 54918d0394 libavutil: remove unused av_abort() macro
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-09 20:52:39 +01:00
Mans Rullgard 1c4ab37c38 libavutil: drop offsetof() fallback definition
The only compiler I have that does not define the standard
offsetof() macro is "Bruce's C Compiler", a simple compiler
for producing 8/16-bit 8086 code, usually for use in early
stages of PC booting.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-09 20:52:39 +01:00
Mans Rullgard d913fd1f00 libavutil: drop fallback definitions of INTxx_MIN/MAX
This list is incomplete (we also use UINT16_MAX), so there does
not appear to be any system we care about that needs these.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-09 20:52:39 +01:00
Diego Biurrun 804d7a1aa6 doxygen: Fix function parameter names to match the code 2012-08-09 20:05:55 +02:00
Mans Rullgard d7a4f8f8b9 Move MASK_ABS macro to libavcodec/mathops.h
This macro is only used in two places, both in libavcodec, so this
is a more sensible place for it.

Two small tweaks to the macro are made:

- removing the trailing semicolon
- dropping unnecessary 'volatile' from the x86 asm

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-09 00:58:20 +01:00
Mans Rullgard 070a402b60 x86: move MANGLE() and related macros to libavutil/x86/asm.h
These x86-specific macros do not belong in generic code.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-09 00:58:20 +01:00
Mans Rullgard c318626ce2 x86: rename libavutil/x86_cpu.h to libavutil/x86/asm.h
This puts x86-specific things in the x86/ subdirectory where they
belong.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-09 00:58:20 +01:00
Mans Rullgard ec9d2c15c1 ARM: use Q/R inline asm operand modifiers only if supported
Some compilers do not support the Q/R modifiers used to access
the low/high parts of a 64-bit register pair.  Check for this
and disable all uses of it when not supported.

Fixes bug #337.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-07 21:13:30 +01:00
Mans Rullgard edd8226795 x86: fix build with nasm 2.08
It appears that something goes wrong in old nasm versions when the
%+ operator is used in the last argument of a macro invocation and
this argument is tested with %ifdef within the macro.  This patch
rearranges the macro arguments such that the %+ operator is never
used in the last argument.
2012-08-07 15:24:34 +01:00
Mans Rullgard 180d43bc67 x86: use nop cpu directives only if supported
nasm does not support 'CPU foonop' directives.  This adds a configure
test for the directive and uses it only if supported.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-07 15:22:20 +01:00
Mans Rullgard 7238265052 x86: fix rNmp macros with nasm
For some reason, nasm requires this.  No harm done to yasm.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-07 15:21:58 +01:00
Mans Rullgard a3df4781f4 x86: add colons after labels
nasm prints a warning if the colon is missing.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-07 15:20:56 +01:00
Mans Rullgard 82494835c4 rational: add av_inv_q() returning the inverse of an AVRational
This allows simplifying a few expressions.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-05 17:46:41 +01:00
Diego Biurrun 239fdf1b4a x86: build: replace mmx2 by mmxext
Refactoring mmx2/mmxext YASM code with cpuflags will force renames.
So switching to a consistent naming scheme beforehand is sensible.
The name "mmxext" is more official and widespread and also the name
of the CPU flag, as reported e.g. by the Linux kernel.
2012-08-03 22:51:05 +02:00
Diego Biurrun ca844b7be9 x86: Use consistent 3dnowext function and macro name suffixes
Currently there is a wild mix of 3dn2/3dnow2/3dnowext.  Switching to
"3dnowext", which is a more common name of the CPU flag, as reported
e.g. by the Linux kernel, unifies this.
2012-08-03 14:00:47 +02:00
Loren Merritt f8d8fe255d x86inc: clip num_args to 7 on x86-32.
This allows us to unconditionally set the cglobal num_args
parameter to a bigger value, thus making writing yasm code
even easier than before.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-07-28 08:29:45 -07:00
Ronald S. Bultje 96c9cc1094 x86inc: sync to latest version from x264. 2012-07-28 08:29:44 -07:00
Justin Ruggles 79687079a9 x86: add support for fmaddps fma4 instruction with abstraction to avx/sse 2012-07-27 11:25:48 -04:00
Ronald S. Bultje 02ac28229a eval: fix printing of NaN in eval fate test.
This fixes "make fate-eval" on MSVC builds. Without this, the test outputs
"-1.#NaN" instead of "nan" on MSVS 2010.
2012-07-26 15:56:32 -07:00
Ronald S. Bultje 30b45d9c38 x86inc: automatically insert vzeroupper for YMM functions. 2012-07-26 13:43:16 -07:00
Jason Garrett-Glaser 85a3c19ed1 dsputil: x86: add SHUFFLE_MASK_W macro
Simplifies pshufb masks that operate on words.
2012-07-22 16:56:58 -04:00
Luca Barbato f3e5e6f05b mem: introduce av_malloc_array and av_mallocz_array
Both function ease allocating large arrays implementing the overflow
check inside it.
2012-07-14 20:07:25 +02:00
Janne Grunau 2d497c141d eval: add gt(), gte(), lt() and lte() fate tests 2012-07-14 13:43:10 +02:00
Max Lazarov caac3ab6ef eval: fix swapping of lt() and lte()
CC: libav-stable@libav.org
2012-07-14 13:33:25 +02:00
Ronald S. Bultje 183b1c2268 configure: Check for the math function rint
Add a fallback implementation if it doesn't exist.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-11 10:40:11 +03:00
Ronald S. Bultje 358d854df8 x86/cpu: implement get/set_eflags using intrinsics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-10 14:33:32 +03:00
Ronald S. Bultje c0ee695bd7 x86/cpu: implement support for cpuid through intrinsics
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-10 14:33:24 +03:00
Ronald S. Bultje 3f150ffba3 x86/cpu: implement support for xgetbv through intrinsics
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-10 14:33:17 +03:00
Ronald S. Bultje f80ddd5bf7 lavu: use intrinsics for emms on systems lacking inline asm support
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-10 14:33:09 +03:00
Martin Storsjö 620b1e7e98 mem: Don't abort on av_malloc(0) in debug mode
This makes the behaviour consistent between debug and release mode.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-10 11:37:03 +03:00
Ronald S. Bultje 07b287020c x86/timer: implement an intrinsic-based version for rdtsc (AV_READ_TIME). 2012-07-07 13:35:07 -07:00
Loren Merritt 4d4752366f x86inc: add SPLATB_LOAD, SPLATB_REG, PSHUFLW macros
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-07-05 17:37:11 +02:00
Loren Merritt 2cd1f5cadc x86inc: modify ALIGN to not generate long nops on i586
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-07-05 17:37:11 +02:00
Samuel Pitoiset 983db9b2b4 xtea: Make the count parameter match the documentation
Previously it was interpreted as number of bytes, while the
documentation stated that it was the number of 8 byte blocks.
This makes it behave similarly to the existing AES code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-05 12:45:18 +03:00
Samuel Pitoiset e4a7fb3da3 blowfish: Make the count parameter match the documentation
Previously it was interpreted as number of bytes, while the
documentation stated that it was the number of 8 byte blocks.
This makes it behave similarly to the existing AES code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-05 12:41:57 +03:00
Luca Barbato f6687bf5f8 xtea: invert branch and loop precedence
Should slightly improve performance depending on the compiler used.
2012-07-05 10:42:00 +02:00
Luca Barbato 669bbedfa8 blowfish: invert branch and loop precedence
Should slightly improve performance depending on the compiler used.
2012-07-05 10:40:13 +02:00
Diego Biurrun 2047e40e6e Clarify Doxygen comment for FF_API_* #defines. 2012-07-04 15:10:10 +02:00
Diego Biurrun 86ab7b0f2f Create version.h headers for libraries that lack them 2012-07-04 15:10:06 +02:00
Samuel Pitoiset 8c14f7a593 Add XTEA encryption support in libavutil
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-04 15:10:57 +03:00
Samuel Pitoiset bc3dbcc8e5 Add Blowfish encryption support in libavutil
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-04 15:10:57 +03:00
Martin Storsjö 143f1e9203 eval: Add the isinf() function and tests for it
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-04 15:10:56 +03:00
Diego Biurrun 1a068bfefd cosmetics: Consistently use C-style comments with multiple inclusion guards 2012-07-03 17:35:12 +02:00
Reinhard Tartler 22662ca560 attributes: add av_noreturn
Also use it in the declaration of the various exit_program
implementations in avtools.

inspired by a clang-scan report.
2012-07-03 17:26:51 +02:00
Reinhard Tartler a1641e9540 attributes: drop pointless define guards
the av_-prefixed attributes must not be defined outside of this file
2012-07-03 17:26:51 +02:00
Ronald S. Bultje ff8f8dfb79 intfloat: Don't use designated initializers in the public headers
intfloat.h is a public header, and is now (since a1245d5ca) included
by mathematics.h, which many external callers include.

This fixes building third party applications that include
mathematics.h in a language that doesn't support designated
initalizers.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-02 14:05:40 +03:00
Martin Storsjö 3893feeccd opt/eval: Include mathematics.h for NAN/INFINITY
These files use NAN/INFINITY but didn't include mathematics.h to get
the fallback definitions if the system lacks the macros.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-01 19:20:11 +03:00
Ronald S. Bultje a1245d5ca1 mathematics: Don't use division by zero in NAN/INFINITY macros
Some compilers, MSVC among them, don't recognize the divisions by
zero as meaning infinity/nan.

These macros should, according to the standard, expand to constant
expressions, but this shouldn't matter for our usage.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-01 19:06:13 +03:00
Mans Rullgard 889c1ec4cc x86: cpu: clean up check for cpuid instruction support
This adds macros for accessing the EFLAGS register and uses
these instead of coding the entire check in inline asm.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-01 12:25:33 +01:00
Mans Rullgard 62634158b7 ARM: generate position independent code to access data symbols
This creates proper position independent code when accessing
data symbols if CONFIG_PIC is set.

References to external symbols should now use the movrelx macro.
Some additional code changes are required since this macro may
need a register to hold the GOT pointer.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-01 11:25:06 +01:00
Ronald S. Bultje 4f2c846d96 attributes: Add a definition of av_always_inline for MSVC
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-30 16:03:45 +03:00
Ronald S. Bultje f985113075 random_seed: Only read /dev/*random if we have unistd.h
unistd.h is used for open/read/close, but if this header does not
exist, there's probably no use in trying to open /dev/*random
at all.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-29 15:52:07 +03:00
Martin Storsjö 46df708b45 libm: Provide fallback definitions for isnan() and isinf()
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-27 14:04:02 +03:00
Mans Rullgard 153335625c libm: provide fallback definition for cbrtf() using powf()
This adds a fallback for cbrtf() using powf(x, 1/3).  Since
powf() with a non-integer exponent requires a non-negative
base, special handling of negative inputs is needed.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-26 15:56:38 +01:00
Ronald S. Bultje 246154a9af log: Include io.h on windows
This is required for isatty, which exists on MSVC and is found by
configure, but is provided by io.h instead of unistd.h.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-25 23:28:36 +03:00
Mans Rullgard 963cdf39b4 x86: cpu: whitespace (mostly) cosmetics
This adds whitespace around operators, aligns line continuation
backslashes, and breaks long lines.  Also fixes an ifdef halfway
through a statement.  The one line of duplication this saved is
not worth the ugliness.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-25 16:24:31 +01:00
Ronald S. Bultje 8123e0901f x86: place some inline asm under #if HAVE_INLINE_ASM
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-25 13:23:12 +01:00
Martin Storsjö 145a8096d5 log: Only include unistd.h if configure found it
MSVC has isatty (in io.h), but not unistd.h. (isatty isn't called
at all for windows, since there's a special case block for that.)

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-24 12:36:22 +03:00
Diego Biurrun 65345a5a30 x86: Add CPU flag for the i686 cmov instruction 2012-06-23 16:21:50 +02:00
Mans Rullgard d3d3a32c9d lavu: add av_usleep() function
This function implements a delay using the first available
of the following functions:

- nanosleep()
- usleep()
- Sleep() (Windows)

The conditional #includes in time.c are simplified by including
unistd.h and windows.h whenever they are available rather than
having these lines triggered by specific functions.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-22 17:15:18 +01:00
Diego Biurrun a5a93fa8f5 cosmetics: do not use full path for local headers 2012-06-22 10:49:40 +02:00
Mans Rullgard d11baad055 lavu/file: include unistd.h only when available
The unistd.h header is only needed for the close() declaration.
If this header is not available, the close() declaration may be
provided by another header, e.g. io.h.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-21 22:54:31 +01:00
Mans Rullgard 539df61193 log: include unistd.h only when needed
The only symbol this file uses from unistd.h is isatty().  By
including the header only when this function is used, the file
can be built on systems without unistd.h (which presumably also
lack isatty).

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-21 22:53:35 +01:00
Mans Rullgard dc7e336cae lavf, lavu: version bumps and APIchanges for av_gettime() move
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-21 11:45:28 +01:00
Mans Rullgard 61183b5ab4 av_gettime: support Win32 without gettimeofday()
Based on patch by Ronald S. Bultje.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-20 17:09:03 +01:00
Mans Rullgard 980f81d961 Use av_gettime() in various places
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-20 17:09:03 +01:00
Mans Rullgard ae0a301668 Move av_gettime() to libavutil
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-20 17:09:03 +01:00
Janne Grunau a2b186a188 mathematics.h: remove a couple of math defines
While these defines are not defined by the C standard they are
standardized as X/Open System Interfaces Extension. We use the
appropiate _XOPEN_SOURCE define to make them available. They
seem to be available on all FATE configs since the constants
are used in files where mathematics.h is not included.
2012-06-20 15:45:21 +02:00
Mans Rullgard 6501dcfb5e Remove unnecessary inclusions of [sys/]time.h
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-20 11:46:46 +01:00
Ronald S. Bultje be1a839ca6 mem: add support for _aligned_malloc() as found on Windows
The check uses check_func_header, since this function is
conditionally available depending on the targeted MSVCRT
version.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-19 10:08:00 +03:00
Justin Ruggles 82b2df9790 float_dsp: add x86-optimized functions for vector_fmac_scalar() 2012-06-18 18:01:14 -04:00
Justin Ruggles cb5042d02c float_dsp: Move vector_fmac_scalar() from libavcodec to libavutil 2012-06-18 18:01:14 -04:00
John Stebbins 3971be0eb5 Add Dolby/DPLII downmix support to libavresample
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-06-18 10:55:00 -04:00
Anton Khirnov b0f0dfc485 Bump lavu minor and add an APIChanges entry for audioconvert functions. 2012-06-10 08:04:01 +02:00
Anton Khirnov 59d58b3390 audioconvert: add a function for extracting the channel with the given index 2012-06-10 08:03:45 +02:00
Anton Khirnov 5df320e167 audioconvert: add a function for getting the name of a single channel. 2012-06-10 08:03:11 +02:00
Anton Khirnov 406b257de9 audioconvert: add a function for getting channel's index in layout 2012-06-10 08:02:18 +02:00
Anton Khirnov 3596de55fc audioconvert: use av_popcount64 in av_get_channel_layout_nb_channels 2012-06-10 08:02:11 +02:00
Justin Ruggles 03e098e7a0 lavu: change versioning script to include all av* prefixed symbols
Needed to properly export avpriv_* symbols.
2012-06-08 15:47:59 -04:00
Justin Ruggles 3b81a18ba3 float_dsp: ppc: add a separate header for Altivec function prototypes
Also include config.h so that HAVE_ALTIVEC will be defined.
Fixes compilation on PPC with Altivec enabled.
2012-06-08 14:52:01 -04:00
Mans Rullgard a839d6abf8 ARM: fix float_dsp breakage from d5a7229
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-08 19:45:37 +01:00
Justin Ruggles d5a7229ba4 Add a float DSP framework to libavutil
Move vector_fmul() from DSPContext to AVFloatDSPContext.
2012-06-08 13:14:38 -04:00
Justin Ruggles 98db4e2a4e PPC: Move types_altivec.h and util_altivec.h from libavcodec to libavutil
This will allow for easier implementation of Altivec functions in libraries
other than libavcodec.
2012-06-08 13:14:38 -04:00
Justin Ruggles 94d2b0d2fd ARM: Move asm.S from libavcodec to libavutil
This will allow for easier implementation of ARM-optimized functions in
libraries other than libavcodec.
2012-06-08 13:14:38 -04:00
Vitor Sessak 4a301706fd x86: Avoid movs on BUTTERFLYPS when in AVX mode
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2012-05-29 15:29:46 +02:00
Anton Khirnov 0426c69310 AVOptions: fix the value printed in out of range error message. 2012-05-28 12:55:41 +02:00
Anton Khirnov 780ff97fef log: make colored output more colorful.
Green for verbose, cyan for debug.
2012-05-26 21:14:17 +02:00
Samuel Pitoiset 154486f9ad opt: Add av_opt_set_bin()
Introduce a new function to set binary data through AVOption,
avoiding having to convert the binary data to a string inbetween.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-26 14:31:44 +03:00
Anton Khirnov d89eca507c Add missing version bumps and APIchanges/Changelog entries. 2012-05-15 06:57:31 +02:00
Justin Ruggles 5cc6d5244d lavr: replace the SSE version of ff_conv_fltp_to_flt_6ch() with SSE4 and AVX
The current SSE version is slower than the MMX version on Athlon64 and Sandy
Bridge, but the SSE4 and AVX versions are faster on Sandy Bridge.
2012-05-09 16:17:59 -04:00
Anton Khirnov 6d7f617700 samplefmt: add a function for filling a buffer with silence. 2012-05-09 17:44:56 +02:00
Anton Khirnov 142e740d1e samplefmt: add a function for copying audio samples. 2012-05-09 17:43:26 +02:00
Mans Rullgard 6766169c41 mips: intreadwrite: fix inline asm for gcc 4.8
Just like gcc 4.6 and later on ARM, gcc 4.8 on MIPS generates
inefficient code when a known-unaligned location is used as a
memory input operand.  This applies the same fix as has been
previously done to the ARM version of the code.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-05-09 13:45:22 +01:00
Mans Rullgard b82b49a5b7 mips: intreadwrite: remove unnecessary inline asm
GCC actually handles unaligned accesses correctly in all cases
except, absurdly, 32-bit loads on mips64.  The remaining asm is
thus not needed, and removing it results in better code.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-05-09 13:45:17 +01:00
Diego Biurrun ce473de921 av_samples_fill_array: Mark unmodified function argument as const.
libavcodec/utils.c:274: warning: passing argument 3 of ‘av_samples_fill_arrays’ discards qualifiers from pointer target type
./libavutil/samplefmt.h:151: note: expected ‘uint8_t *’ but argument is of type ‘const uint8_t *’
2012-05-08 11:35:49 +02:00
Diego Biurrun dbe6ba55a3 build: cosmetics: Add missing end-of-line backslashes to item lists. 2012-05-07 14:17:40 +02:00
Diego Biurrun 9eb83a56aa build: cosmetics: Split HEADERS/OBJS/PROGS lists into one entry per line. 2012-05-07 14:01:32 +02:00
Mans Rullgard c02efacc8f arm: intreadwrite: revert 16-bit load asm to old version for gcc < 4.6
Commit adebad0 "arm: intreadwrite: fix inline asm constraints for gcc
4.6 and later" caused some older gcc versions to miscompile code.
This reverts to the old version of the code for these compilers.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-05-03 21:40:19 +01:00
Mans Rullgard ababec7b95 arm: intreadwrite: disable inline asm for gcc 4.7 and later
Starting with version 4.7, gcc properly supports unaligned
memory accesses on ARM.  Not using the inline asm with these
compilers results in better code.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-05-02 17:26:39 +01:00
Mans Rullgard adebad07e0 arm: intreadwrite: fix inline asm constraints for gcc 4.6 and later
With a dereferenced type-cast pointer as memory operand, gcc 4.6
and later will sometimes copy the data to a temporary location,
the address of which is used as the operand value, if it thinks
the target address might be misaligned.  Using a pointer to a
packed struct type instead does the right thing.

The 16-bit case is special since the ldrh instruction addressing
modes are limited compared to ldr.  The "Uq" constraint produces a
memory reference suitable for an ldrsb instruction, which supports
the same addressing modes as ldrh.  However, the restrictions appear
to apply only when the operand addresses a single byte.  The memory
reference must thus be split into two operands each targeting one
byte.  Finally, the "Uq" constraint is only available in ARM mode.
The Thumb-2 ldrh instruction supports most addressing modes so the
normal "m" constraint can be used there.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-05-02 17:26:38 +01:00