Commit Graph

34100 Commits

Author SHA1 Message Date
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
Mans Rullgard 06eb4f0885 configure: do not disable av_always_inline with --enable-small
Currently, --enable-small turns av_always_inline into plain inline,
which is more or less ignored by the compiler.  While the intent of
this is probably to reduce code size by avoiding some inlining, it
has more far-reaching effects.

We use av_always_inline in two situations:

1. The body of a function is smaller than the call overhead.
   Instances of these are abundant in libavutil, the bswap.h
   functions being good examples.

2. The function is a template relying on constant propagation
   through inlined calls for sane code generation.  These are
   often found in motion compensation code.

Both of these types of functions should be inlined even if targeting
small code size.

Although GCC has heuristics for detecting the first of these types,
it is not always reliable, especially when the function uses inline
assembler, which is often the reason for having those functions in
the first place, so making it explicit is generally a good idea.

The size increase from inlining template-type functions is usually
much smaller than it seems due to different branches being mutually
exclusive between the different invocations.  The dead branches can,
however, only be removed after inlining and constant propagation have
been performed, which means the initial cost estimate for inlining
these is much higher than is actually the case, resulting in GCC
often making bad choices if left to its own devices.

Furthermore, the GCC inliner limits how much it allows a function to
grow due to automatic inlining of calls, and this appears to not take
call overhead into account.  When nested inlining is used, the limit
may be hit before the innermost level is reached.  In some cases, this
has prevented inlining of type 1 functions as defined above, resulting
in significant performance loss.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-03 16:10:54 +01:00
Luca Barbato 09a445ce34 flvdec: initial stream switch support
Codec change midstream gets mapped to a separate stream.
2012-07-03 15:35:51 +02:00
Luca Barbato 906f9dce85 avplay: fix write on freed memory for rawvideo
Do not assume avpacket and the decoded frames are independent.

To be absolutely sure and not sprinkle av_free_packet around the code
the call had been placed before getting the frame and on the error path.
2012-07-03 15:35:51 +02:00
Ronald S. Bultje 3389545157 snow: remove a VLA used for edge emulation
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-03 16:31:23 +03:00
Mans Rullgard fb93e61e2b x86: lavfi: fix gradfun/yadif build with mmx/sse disabled
These functions are defined conditionally so any uses need to have
preprocessor guards.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-03 14:14:13 +01:00
Ronald S. Bultje cbd9b2f918 snow: remove the runs[] VLA.
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-03 12:16:46 +03:00
Martin Storsjö 4d8516fdb1 snow: Check mallocs at init
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-03 12:16:39 +03:00
Mans Rullgard 4719ea7e1e flacdec: remove redundant setting of avctx->sample_fmt
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-02 22:13:32 +01:00
Anton Khirnov 5e745cefc0 asfdec: read attached pictures. 2012-07-02 16:16:45 +02:00
Anton Khirnov 728d2afa17 apetag: reindent 2012-07-02 16:16:38 +02:00
Anton Khirnov 02a951b919 apetag: export attached covers as video streams. 2012-07-02 16:16:11 +02:00
Anton Khirnov b72767df8e apetag: fix the amount of data read from binary tags.
Substract the filename size from the data size.
2012-07-02 16:15:45 +02:00
Anton Khirnov f2e175c756 apetag: make sure avio_get_str() doesn't read more than it should. 2012-07-02 16:15:34 +02:00
Anton Khirnov a02b8c695c mov: read itunes cover art. 2012-07-02 16:14:25 +02:00
Mans Rullgard 58e57c3052 snow: remove VLA in mc_block()
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-02 12:24:12 +01: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
Ronald S. Bultje 33bb63cb3e snow: remove a VLA.
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-02 13:04:00 +03:00
Diego Biurrun 4aad316bff doc: Remind devs to check return values, especially for malloc() et al 2012-07-02 10:56:54 +02:00
Kostya Shishkov edf35d8342 MS ATC Screen (aka MSS3) decoder 2012-07-02 07:14:44 +02:00
Mans Rullgard a87b17f328 vf_yadif: move x86 init code to x86/yadif.c
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-02 01:16:37 +01:00
Mans Rullgard 2f0accf103 vf_gradfun: move x86 init code to x86/gradfun.c
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-02 01:16:37 +01:00
Martin Storsjö fc31508e3a roqvideo: Remove a totally unused dspcontext
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-01 23:54:35 +03:00
Mans Rullgard 779f8bc24e smacker: remove some unused code
This removes some code apparently left over from vlc reader
debugging.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-01 20:38:14 +01:00
Mans Rullgard d55e5e6bae dsicin: remove dead assignment
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-01 20:38:14 +01:00
Mans Rullgard 3c928477d2 aacdec: remove dead assignment
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-01 20:38:14 +01:00
Mans Rullgard 800ab1bafa rl2: remove dead assignment
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-01 20:38:14 +01:00
Mans Rullgard 1c2c64edac proresenc: make a variable local to the loop where it is used
This moves the mbs_per_slice declaration inside the only loop
where it is used.  Fixes a dead assignment.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-01 20:38:14 +01:00
Mans Rullgard 4ca6d206d1 alsdec: remove dead assignments
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-01 20:38:14 +01: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
Martin Storsjö 710bd8a33e wma: Lower the maximum number of channels to 2
ff_wma_init is used only by wmadec and wmaenc, and neither of them
can handle more than 2 channels.

This fixes crashes with invalid files.

Based on patch by Piotr Bandurski and Michael Niedermayer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-01 15:51:26 +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 ceabc13f12 dsputilenc_mmx: split assignment of ff_sse16_sse2 to SSE2 section. 2012-06-30 09:24:52 -07:00
Ronald S. Bultje e9156741a7 dnxhdenc: add space between function argument type and comment.
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-30 19:22:07 +03:00
Ronald S. Bultje 66a02159ea x86: fmtconvert: add special asm for float_to_int16_interleave_misc_*
This gets rid of a variable-length array and a for loop in C code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-30 19:10:36 +03: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
Martin Storsjö d3ed1c9571 cmdutils: Pass the actual chosen encoder to filter_codec_opts
This allows passing the right options to encoders when there's more
than one encoder for a certain codec id.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-30 15:44:10 +03:00
Ronald S. Bultje 5a608a239b os_support: Add fallback definitions for stat flags
Mingw headers provide similar defines already (unconditional #defines,
without any #undef or #ifdef around it), while MSVC doesn't have
them.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-30 15:18:50 +03:00
Martin Storsjö cab2eb87f9 os_support: Rename the poll fallback function to ff_poll
The fallback function is a non-static function, we shouldn't be
defining non-static functions outside of the proper ff/av prefix
namespaces.

This is especially important for a function like poll, which
other parties (other libraries, or executables linking these
libraries) also might provide similar but incompatible fallbacks for.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-30 15:18:17 +03:00
Martin Storsjö cdee08e365 network: Check for struct pollfd
We need to include winsock2.h here, to make sure we have the
real pollfd struct definition, if one exists, before defining the
fallback poll function.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-30 15:18:06 +03:00
Martin Storsjö 71078ad333 os_support: Don't compare a negative number against socket descriptors
The fds are unsigned integers in the windows definition of struct
sockfds. Due to this, the comparison if (fds[i].fd > n) was always
false.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-30 15:17:52 +03:00
Ronald S. Bultje 5aff37d28d os_support: Include all the necessary headers for the win32 open function
io.h is required for open and _wopen, and fcntl.h is required for
the O_CREAT flag. On mingw, fcntl.h is included by os_support.h (and
the mingw fcntl.h includes io.h), but include it explicitly here
since this implementation requires it.

Also move the #undef open up. open must not be defined to ff_win32_open
while including the headers that declare the open function. On mingw,
this happened in os_support.h before open was redirected.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-30 15:16:43 +03:00
Mans Rullgard f2fd167835 x86: vc1: fix and enable optimised loop filter
The problem is that the ssse3 psign instruction does the wrong
thing here.  Commit ea60dfe incorrectly removed a macro emulating
this instruction for pre-ssse3 code.  However, the emulation is
incorrect, and the code relies on the behaviour of the macro.
Specifically, the psign sets destination elements to zero where
the corresponding source element is zero, whereas the emulation
only negates destination elements where the source is negative.

Furthermore, the PSIGNW_MMX macro in x86util.asm is totally bogus,
which is why the original VC-1 code had an additional right shift
when using it.  Since the psign instruction cannot be used here,
skip all the macro hell and use the working instruction sequence
directly.

None of this was noticed due a stray return statement in
ff_vc1dsp_init_mmx() which meant that only the mmx version of the
loop filter was ever used (before being removed in ea60dfe).

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-30 00:12:05 +01:00
Ronald S. Bultje 3b1ab197be file: Only include unistd.h if it exists
It is included for the open/read/write/close functions. On
MSVC, where this header does not exist, the same functions
are provided by io.h, which is already included.

On windows, these functions are provided by io.h. Make sure
io.h is included if it exists, regardless of the setmode
function.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-29 15:53:41 +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
Samuel Pitoiset e312fcde6a doc: Indicate that RTMPT is natively implemented in libavformat
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-29 15:38:28 +03:00
Ronald S. Bultje dfb57fc596 rtpdec: Don't explicitly include unistd.h any longer
unistd.h used to be required for gethostname. On windows, gethostname
is provided by winsock2.h. Now network.h includes both unistd.h and
winsock2.h if they exist.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-29 15:38:10 +03:00