ffmpeg.git
2 years agoparser: Add missing #include for printing ISO C99 conversion specifiers
Diego Biurrun [Sat, 24 Dec 2016 10:36:53 +0000 (11:36 +0100)]
parser: Add missing #include for printing ISO C99 conversion specifiers

2 years agomatroskadec: fix SRT subtitle duration
John Stebbins [Thu, 22 Dec 2016 17:23:30 +0000 (09:23 -0800)]
matroskadec: fix SRT subtitle duration

The codec id for SRT was changed and conditionals were not updated.

2 years agohttp: Check for negative chunk sizes
Martin Storsjö [Thu, 15 Dec 2016 08:24:20 +0000 (10:24 +0200)]
http: Check for negative chunk sizes

A negative chunk size is illegal and would end up used as
length for memcpy, where it would lead to memory accesses
out of bounds.

Found-by: Paul Cher <paulcher@icloud.com>
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2 years agoUse correct printf conversion specifiers for POSIX integer types
Diego Biurrun [Wed, 21 Dec 2016 10:25:34 +0000 (11:25 +0100)]
Use correct printf conversion specifiers for POSIX integer types

2 years agobuild: Generate pkg-config files from Make and not from configure
Diego Biurrun [Tue, 20 Dec 2016 13:27:19 +0000 (14:27 +0100)]
build: Generate pkg-config files from Make and not from configure

This moves work from the configure to the Make stage where it can
be parallelized and ensures that pkgconfig files are updated when
library versions change.

Bug-Id: 449

2 years agobuild: Store library version numbers in .version files
Diego Biurrun [Sat, 17 Dec 2016 19:01:07 +0000 (20:01 +0100)]
build: Store library version numbers in .version files

This moves work from the configure to the Make stage where it can
be parallelized and ensures that shared libraries are built with
the right version number in the filename.

2 years agobuild: Move build-system-related helper files to a separate subdirectory
Diego Biurrun [Tue, 26 Mar 2013 00:11:11 +0000 (01:11 +0100)]
build: Move build-system-related helper files to a separate subdirectory

This unclutters the top-level directory and groups related files together.

2 years agoratecontrol: Drop xvid-rc-related struct members unused after a6901b9c6
Diego Biurrun [Mon, 19 Dec 2016 11:20:14 +0000 (12:20 +0100)]
ratecontrol: Drop xvid-rc-related struct members unused after a6901b9c6

2 years agonvenc: Update check for lookahead
Ruta Gadkari [Mon, 19 Dec 2016 11:14:04 +0000 (16:44 +0530)]
nvenc: Update check for lookahead

By default it is -1.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2 years agoaarch64: vp9itxfm: Use the offset parameter to movrel
Martin Storsjö [Mon, 19 Dec 2016 08:38:33 +0000 (10:38 +0200)]
aarch64: vp9itxfm: Use the offset parameter to movrel

This fixes build failures for iOS, broken since cad42fadcd2c.

Signed-off-by: Martin Storsjö <martin@martin.st>
2 years agotta: Convert to the new bitstream reader
Alexandra Hájková [Thu, 14 Apr 2016 08:54:11 +0000 (10:54 +0200)]
tta: Convert to the new bitstream reader

2 years agomlp: Convert to the new bitstream reader
Alexandra Hájková [Sun, 10 Apr 2016 18:47:11 +0000 (20:47 +0200)]
mlp: Convert to the new bitstream reader

2 years agounary: Convert to the new bitstream reader
Alexandra Hájková [Wed, 8 Jun 2016 09:31:33 +0000 (11:31 +0200)]
unary: Convert to the new bitstream reader

2 years agoh264dec: make sure to only end a field if it has been started
Anton Khirnov [Sun, 18 Dec 2016 10:29:25 +0000 (11:29 +0100)]
h264dec: make sure to only end a field if it has been started

Calling ff_h264_field_end() when the per-field state is not properly
initialized leads to all kinds of undefined behaviour.

CC: libav-stable@libav.org
Bug-Id: 977 978 992

2 years agompeg12dec: move setting first_field to mpeg_field_start()
Anton Khirnov [Sat, 17 Dec 2016 16:04:55 +0000 (17:04 +0100)]
mpeg12dec: move setting first_field to mpeg_field_start()

For field picture, the first_field is set based on its previous value.
Before this commit, first_field is set when reading the picture
coding extension. However, in corrupted files there may be multiple
picture coding extension headers, so the final value of first_field that
is actually used during decoding can be wrong. That can lead to various
undefined behaviour, like predicting from a non-existing field.

Fix this problem, by setting first_field in mpeg_field_start(), which
should be called exactly once per field.

CC: libav-stable@libav.org
Bug-ID: 999

2 years agompeg12dec: avoid signed overflow in bitrate calculation
Anton Khirnov [Sat, 17 Dec 2016 14:07:51 +0000 (15:07 +0100)]
mpeg12dec: avoid signed overflow in bitrate calculation

CC: libav-stable@libav.org
Bug-Id: 981
Found-By: Agostino Sarubbo
2 years agompegvideo_parser: avoid signed overflow in bitrate calculation
Anton Khirnov [Sat, 17 Dec 2016 14:07:51 +0000 (15:07 +0100)]
mpegvideo_parser: avoid signed overflow in bitrate calculation

CC: libav-stable@libav.org
Bug-Id: 981
Found-By: Agostino Sarubbo
2 years agomov: fix a possible invalid read in mov_read_mac_string()
Anton Khirnov [Sat, 17 Dec 2016 13:17:20 +0000 (14:17 +0100)]
mov: fix a possible invalid read in mov_read_mac_string()

When the input string is too large, so the second condition in if ()
fails, the code will erroneously execute the else branch, indexing the
mac_to_unicode table with a negative index.

CC: libav-stable@libav.org
Bug-Id: 1000
Found-By: Kamil Frankowicz
2 years agovaapi_decode: use the correct logging context
Anton Khirnov [Mon, 19 Dec 2016 07:13:28 +0000 (08:13 +0100)]
vaapi_decode: use the correct logging context

2 years agohevcdec: add a VAAPI hwaccel
Anton Khirnov [Sun, 2 Oct 2016 06:51:32 +0000 (08:51 +0200)]
hevcdec: add a VAAPI hwaccel

Partially based on a patch by Timo Rothenpieler <timo@rothenpieler.org>.
Additional scaling list handling fix by Jun Zhao <mypopydev@gmail.com>.

2 years agoChangelog: add some missing entries
Anton Khirnov [Thu, 15 Dec 2016 09:23:26 +0000 (10:23 +0100)]
Changelog: add some missing entries

2 years agopthread_frame: do not run hwaccel decoding asynchronously unless it's safe
Anton Khirnov [Thu, 24 Nov 2016 14:14:22 +0000 (15:14 +0100)]
pthread_frame: do not run hwaccel decoding asynchronously unless it's safe

Certain hardware decoding APIs are not guaranteed to be thread-safe, so
having the user access decoded hardware surfaces while the decoder is
running in another thread can cause failures (this is mainly known to
happen with DXVA2).

For such hwaccels, only allow the decoding thread to run while the user
is inside a lavc decode call (avcodec_send_packet/receive_frame).

2 years agopthread_frame: ensure the threads don't run simultaneously with hwaccel
Anton Khirnov [Sat, 3 Dec 2016 14:21:40 +0000 (15:21 +0100)]
pthread_frame: ensure the threads don't run simultaneously with hwaccel

2 years agohevcdec: do not set decoder-global SPS prematurely
Anton Khirnov [Sun, 18 Dec 2016 21:06:32 +0000 (22:06 +0100)]
hevcdec: do not set decoder-global SPS prematurely

It should only be set after the decoder state has been fully initialized
for using that SPS.
Fixes possible invalid reads on get_format() failure.

CC: libav-stable@libav.org
2 years agov4l2: use codec descriptors for mapping a codec name to id
Anton Khirnov [Wed, 14 Dec 2016 12:22:19 +0000 (13:22 +0100)]
v4l2: use codec descriptors for mapping a codec name to id

This mapping has nothing to do with decoder implementations, so using
decoder names is wrong.

2 years agobuild: Add name parameter to check_lib() helper function
Diego Biurrun [Thu, 8 Dec 2016 09:16:34 +0000 (10:16 +0100)]
build: Add name parameter to check_lib() helper function

This allows enabling or disabling the library-related variables from
within the function instead of doing it manually outside of it.

2 years agoconfigure: Disentangle vfw32 and user32 lib handling
Diego Biurrun [Thu, 15 Dec 2016 17:59:46 +0000 (18:59 +0100)]
configure: Disentangle vfw32 and user32 lib handling

Check for and link against user32 instead, which also fixes
the missing dependency of dxva2 on user32 with MSVC.

2 years agoconfigure: fix linking with MSVC when using --disable-optimizations
Steve Lhomme [Thu, 15 Dec 2016 17:00:56 +0000 (18:00 +0100)]
configure: fix linking with MSVC when using --disable-optimizations

Without any optimization flags, MSVC does no dead code elimination (DCE) at
all, even for the most trivial cases. DCE is a prerequisite for building libav
correctly, otherwise there are undefined references to functions for other
architectures and disabled components.

-O1 is the minimal optimization flag for MSVC that does include DCE.

2 years agoconfigure: put d3d11 check in alphabetical order
Steve Lhomme [Thu, 15 Dec 2016 17:00:55 +0000 (18:00 +0100)]
configure: put d3d11 check in alphabetical order

2 years agortmppkt: Check for packet size mismatches
Michael Niedermayer [Mon, 5 Dec 2016 10:14:51 +0000 (11:14 +0100)]
rtmppkt: Check for packet size mismatches

When receiving fragmented packets, the first packet declares the size,
and the later ones normally are small follow-on packets that don't repeat
the size and the other header fields. But technically, the later fragments
also can have a full header, declaring a different size than the previous
packet.

If the follow-on packet declares a larger size than the initial one, we
could end up writing outside of the allocation.

This fixes out of bounds writes.

Found-by: Paul Cher <paulcher@icloud.com>
Reviewed-by: Paul Cher <paulcher@icloud.com>
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2 years agolibavformat: Fix a faulty api deprecation guard in prepare_input_packet
Martin Storsjö [Thu, 15 Dec 2016 07:45:49 +0000 (09:45 +0200)]
libavformat: Fix a faulty api deprecation guard in prepare_input_packet

This seems to have been added by mistake in 11de006b, by not
noticing the negation for the existing condition. This block does
not contain any code that accesses the codec field in AVStream.

This function is meant to serve as a complement to compute_pkt_fields2,
which is guarded by FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX.

Signed-off-by: Martin Storsjö <martin@martin.st>
2 years agoarm64: replace 'bic' with immediate with 'and' with inverted immediate
Janne Grunau [Thu, 8 Dec 2016 19:40:34 +0000 (20:40 +0100)]
arm64: replace 'bic' with immediate with 'and' with inverted immediate

The former is not an official pseudo instruction although gas and llvm's
internal assembler support it. Fixes a build error with xcode 6.2
reported by Memphiz on github.

2 years agoppc: Merge types_altivec.h into util_altivec.h
Diego Biurrun [Tue, 13 Dec 2016 12:50:10 +0000 (13:50 +0100)]
ppc: Merge types_altivec.h into util_altivec.h

There is no point in keeping the two separate.

2 years agoppc: Centralize compiler-specific altivec.h #include handling in one place
Diego Biurrun [Mon, 12 Dec 2016 15:00:04 +0000 (16:00 +0100)]
ppc: Centralize compiler-specific altivec.h #include handling in one place

Also move #includes into canonical order where appropriate.

2 years agoppc: hevcdsp: Use shorthands for vector types
Diego Biurrun [Tue, 13 Dec 2016 12:45:11 +0000 (13:45 +0100)]
ppc: hevcdsp: Use shorthands for vector types

This is more consistent and fixes compilation with clang.

2 years agodecode.h: Add missing headers to fix standalone compilation
Diego Biurrun [Wed, 14 Dec 2016 13:05:16 +0000 (14:05 +0100)]
decode.h: Add missing headers to fix standalone compilation

2 years agopthread_frame: use better memory orders for frame progress
Wan-Teh Chang [Fri, 9 Dec 2016 17:54:47 +0000 (09:54 -0800)]
pthread_frame: use better memory orders for frame progress

This improves commit 59c70227405c214b29971e6272f3a3ff6fcce3d0.

In ff_thread_report_progress(), the fast code path can load
progress[field] with the relaxed memory order, and the slow code path
can store progress[field] with the release memory order. These changes
are mainly intended to avoid confusion when one inspects the source code.
They are unlikely to have measurable performance improvement.

ff_thread_report_progress() and ff_thread_await_progress() form a pair.
ff_thread_await_progress() reads progress[field] with the acquire memory
order (in the fast code path). Therefore, one expects to see
ff_thread_report_progress() write progress[field] with the matching
release memory order.

In the fast code path in ff_thread_report_progress(), the atomic load of
progress[field] doesn't need the acquire memory order because the
calling thread is trying to make the data it just decoded visible to the
other threads, rather than trying to read the data decoded by other
threads.

In ff_thread_get_buffer(), initialize progress[0] and progress[1] using
atomic_init().

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2 years agofate: Add h264 test for frame num gaps
Derek Buitenhuis [Mon, 12 Dec 2016 14:33:28 +0000 (14:33 +0000)]
fate: Add h264 test for frame num gaps

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2 years agoh264_slice: Wait for refs to be available before we use them in error concealment
Derek Buitenhuis [Mon, 12 Dec 2016 14:33:27 +0000 (14:33 +0000)]
h264_slice: Wait for refs to be available before we use them in error concealment

This could happen when there was a frame number gap and frame threading was used.

Debugging-by: Ronald S. Bultje <rsbultje@gmail.com>
Debugging-by: Justin Ruggles <justin.ruggles@gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
CC:libav-stable@libav.org
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2 years agohevc: decouple calling get_format() from exporting the SPS parameters
Anton Khirnov [Sun, 2 Oct 2016 13:39:10 +0000 (15:39 +0200)]
hevc: decouple calling get_format() from exporting the SPS parameters

This makes sure ff_get_format() does not get called unnecessarily from
update_thread_context().

2 years agobinkaudio: switch to the new send/receive API
Anton Khirnov [Thu, 24 Nov 2016 22:05:20 +0000 (23:05 +0100)]
binkaudio: switch to the new send/receive API

It is more natural for this codec and allows to avoid awkward constructs
like "consuming 0 bytes from input". Also, keep a reference to the input
packet to avoid unnecessary copying.

2 years agovp9: split superframes in the filtering stage before actual decoding
Anton Khirnov [Sun, 13 Nov 2016 10:24:16 +0000 (11:24 +0100)]
vp9: split superframes in the filtering stage before actual decoding

Significantly increases the efficiency of frame threading, since
individual frames in a superframe can now be decoded in parallel.

2 years agolavc: add a bitstream filter for splitting VP9 superframes
Anton Khirnov [Sun, 13 Nov 2016 10:00:02 +0000 (11:00 +0100)]
lavc: add a bitstream filter for splitting VP9 superframes

Partially based on code by Ronald S. Bultje <rsbultje@gmail.com>.

2 years agoqsvdec_h2645: switch to the new generic filtering mechanism
Anton Khirnov [Sun, 13 Nov 2016 08:09:06 +0000 (09:09 +0100)]
qsvdec_h2645: switch to the new generic filtering mechanism

Drop the internal manual conversion from the MP4 format to Annex B.

2 years agolavc: add support for filtering packets before decoding
Anton Khirnov [Sat, 12 Nov 2016 16:43:55 +0000 (17:43 +0100)]
lavc: add support for filtering packets before decoding

2 years agodecode: restructure the core decoding code
Anton Khirnov [Wed, 26 Oct 2016 11:59:15 +0000 (13:59 +0200)]
decode: restructure the core decoding code

Currently, the new decoding API is pretty much just a wrapper around the
old deprecated one. This is problematic, since it interferes with making
full use of the flexibility added by the new API. The old API should
also be removed at some future point.

Reorganize the code so that the new send_packet/receive_frame functions
call the actual decoding directly and change the old deprecated
avcodec_decode_* functions into wrappers around the new API.

The new internal API for decoders is now changing as well. Before this
commit, it mirrors the public API, so the decoders need to implement
send_packet() and receive_frame() callbacks. This turns out to require
awkward constructs in both the decoders and the generic code. After this
commit, the decoders only implement the receive_frame() callback and
call a new internal function, ff_decode_get_packet() to obtain input
data, in the same manner to how the bitstream filters now work.

avcodec will now always make a reference to the input packet, which means
that non-refcounted input packets will be copied. Keeping the previous
behaviour, where this copy could sometimes be avoided, would make the
code significantly more complex and fragile for only dubious gains,
since packets are typically small and everyone who cares about
performance should use refcounted packets anyway.

2 years agodecode: be more explicit about storing the last packet properties
Anton Khirnov [Wed, 26 Oct 2016 11:41:12 +0000 (13:41 +0200)]
decode: be more explicit about storing the last packet properties

The current code stores a pointer to the packet passed to the decoder,
which is then used during get_buffer() for timestamps and side data
passthrough. However, since this is a pointer to user data which we do
not own, storing it is potentially dangerous. It is also ill defined for
the new decoding API with split input/output.

Fix this problem by making an explicit internally owned copy of the
packet properties.

2 years agolavc: add a null bitstream filter
Anton Khirnov [Tue, 24 May 2016 13:09:29 +0000 (15:09 +0200)]
lavc: add a null bitstream filter

It is useful for testing/debugging and will also be used as the default
filter in the following commit adding pre-decode filtering to avoid
having a separate non-filtered codepath.

2 years agolavc: handle MP3 in get_audio_frame_duration()
Anton Khirnov [Fri, 2 Dec 2016 12:21:02 +0000 (13:21 +0100)]
lavc: handle MP3 in get_audio_frame_duration()

2 years agodxva2: Keep code shared between dxva2 and d3d11va under the correct #if
Diego Biurrun [Mon, 12 Dec 2016 11:38:06 +0000 (12:38 +0100)]
dxva2: Keep code shared between dxva2 and d3d11va under the correct #if

This partially reverts commit ac648bb835edd3f67bda2267d0e72e5e582eb5a1.

2 years agohevc: ppc: Add HEVC 4x4 IDCT for PowerPC
Alexandra Hajkova [Sun, 11 Dec 2016 11:10:19 +0000 (12:10 +0100)]
hevc: ppc: Add HEVC 4x4 IDCT for PowerPC

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2 years agoconfigure: Add missing dxva2 dependency for dxva2_lib
Diego Biurrun [Sun, 11 Dec 2016 16:01:33 +0000 (17:01 +0100)]
configure: Add missing dxva2 dependency for dxva2_lib

2 years agoconfigure: Handle dxva2 optional components in the standard way
Diego Biurrun [Tue, 22 Nov 2016 07:21:48 +0000 (08:21 +0100)]
configure: Handle dxva2 optional components in the standard way

2 years agoDrop libxvid rate control support for mpegvideo encoding
Diego Biurrun [Sat, 3 Dec 2016 12:16:13 +0000 (13:16 +0100)]
Drop libxvid rate control support for mpegvideo encoding

The feature has outlived is usefulness and complicates the code.

2 years agodxva2: Simplify some ifdefs
Diego Biurrun [Thu, 8 Dec 2016 08:55:26 +0000 (09:55 +0100)]
dxva2: Simplify some ifdefs

2 years agovaapi_h265: Fix CFR mode with framerate set in AVCodecContext
Mark Thompson [Tue, 29 Nov 2016 22:13:58 +0000 (22:13 +0000)]
vaapi_h265: Fix CFR mode with framerate set in AVCodecContext

Same issue as 17a0f9481cf07af0feb3838ca315b970117e8000.

2 years agolavfi: Add VAAPI deinterlacer
Mark Thompson [Thu, 24 Nov 2016 23:27:11 +0000 (23:27 +0000)]
lavfi: Add VAAPI deinterlacer

2 years agobuild: Add -D_XOPEN_SOURCE=600 to CPPFLAGS on Cygwin
Diego Biurrun [Fri, 9 Dec 2016 14:45:05 +0000 (15:45 +0100)]
build: Add -D_XOPEN_SOURCE=600 to CPPFLAGS on Cygwin

This is required to make certain math defines visible on modern Cygwin.

2 years agoconfigure: Fix _libs vs. _extralibs oversight
Diego Biurrun [Sat, 10 Dec 2016 14:06:34 +0000 (15:06 +0100)]
configure: Fix _libs vs. _extralibs oversight

2 years agobuild: Use _extralibs variable names instead of _libs everywhere
Diego Biurrun [Thu, 8 Dec 2016 14:44:45 +0000 (15:44 +0100)]
build: Use _extralibs variable names instead of _libs everywhere

This makes naming more consistent and simplifies extralibs-related changes.

2 years agobuild: Rename host_libs/HOSTLIBS variables to host_extralibs/HOSTEXTRALIBS
Diego Biurrun [Tue, 6 Dec 2016 17:19:09 +0000 (18:19 +0100)]
build: Rename host_libs/HOSTLIBS variables to host_extralibs/HOSTEXTRALIBS

This is more in line with the other related variable names.

2 years agoconfigure: Simplify some library checks via check_lib()
Diego Biurrun [Thu, 8 Dec 2016 09:33:58 +0000 (10:33 +0100)]
configure: Simplify some library checks via check_lib()

2 years agobuild: Fix dependencies for alsa/jack/sndio support
Diego Biurrun [Thu, 8 Dec 2016 10:49:34 +0000 (11:49 +0100)]
build: Fix dependencies for alsa/jack/sndio support

These components should depend on the availability of the respective
libraries, not just on the availability of the respective headers.

2 years agoconfigure: Drop redundant and partly bogus vaapi/vdpau header checks
Diego Biurrun [Thu, 8 Dec 2016 10:52:32 +0000 (11:52 +0100)]
configure: Drop redundant and partly bogus vaapi/vdpau header checks

These are taken care of more correctly by the library checks.

2 years agovdpau: Do not #include vdpau_x11.h from the main vdpau header
Diego Biurrun [Thu, 8 Dec 2016 18:58:12 +0000 (19:58 +0100)]
vdpau: Do not #include vdpau_x11.h from the main vdpau header

That header should only be included in the special bits that use X11 code.

2 years agodxva2: Adjust multiple inclusion guard names to follow convention
Diego Biurrun [Wed, 7 Dec 2016 19:36:41 +0000 (20:36 +0100)]
dxva2: Adjust multiple inclusion guard names to follow convention

2 years agovf_hwupload_cuda: Add min/max limits for device option
Ruta Gadkari [Thu, 8 Dec 2016 09:34:46 +0000 (15:04 +0530)]
vf_hwupload_cuda: Add min/max limits for device option

2 years agoAPIChanges: Mention where release 12 was cut
Vittorio Giovara [Mon, 5 Dec 2016 22:45:06 +0000 (17:45 -0500)]
APIChanges: Mention where release 12 was cut

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2 years agoavio: Keep track of the amount of data written
Luca Barbato [Tue, 6 Dec 2016 01:56:24 +0000 (02:56 +0100)]
avio: Keep track of the amount of data written

Make avio_size() work with any write AVIOContext.

2 years agolibopusdec: fix out-of-bounds read
Andreas Cadhalpun [Thu, 24 Nov 2016 00:06:35 +0000 (01:06 +0100)]
libopusdec: fix out-of-bounds read

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2 years agolibschroedingerdec: fix leaking of framewithpts
Andreas Cadhalpun [Fri, 2 Dec 2016 21:52:44 +0000 (22:52 +0100)]
libschroedingerdec: fix leaking of framewithpts

Also preserve the return value from ff_get_buffer().

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2 years agolibschroedingerdec: don't produce empty frames
Andreas Cadhalpun [Sun, 13 Nov 2016 22:24:45 +0000 (23:24 +0100)]
libschroedingerdec: don't produce empty frames

They are not valid and can cause problems/crashes for API users.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2 years agoomx: Fix allocation check
Timothy Gu [Mon, 5 Dec 2016 17:29:12 +0000 (09:29 -0800)]
omx: Fix allocation check

Also use av_mallocz_array().

Bug-Id: CID 1396839
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2 years agoqsvdec: Fix memory leak on error
Timothy Gu [Mon, 5 Dec 2016 18:21:11 +0000 (10:21 -0800)]
qsvdec: Fix memory leak on error

Bug-Id: CID 1396851
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2 years agocompat/atomics: add typecasts in atomic_compare_exchange_strong()
Wan-Teh Chang [Sat, 3 Dec 2016 00:56:16 +0000 (16:56 -0800)]
compat/atomics: add typecasts in atomic_compare_exchange_strong()

The Solaris and Windows emulations of atomic_compare_exchange_strong()
need typecasts to avoid compiler warnings, because the functions they
call expect a void* pointer but an intptr_t integer is passed.

Note that the emulations of atomic_compare_exchange_strong() (except
the gcc version) only work for atomic_intptr_t because of the type of
the second argument (|expected|). See
http://en.cppreference.com/w/c/atomic:

_Bool atomic_compare_exchange_strong( volatile A* obj,
                                      C* expected, C desired );

The types of the first argument and second argument are different
(|A| and |C|, respectively). |C| is the non-atomic type corresponding
to |A|. In the emulations of atomic_compare_exchange_strong(), |C| is
intptr_t. This implies |A| can only be sig_intptr_t.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
2 years agoavutil: fix data race in av_get_cpu_flags()
Wan-Teh Chang [Thu, 8 Dec 2016 00:16:02 +0000 (16:16 -0800)]
avutil: fix data race in av_get_cpu_flags()

Make the one-time initialization in av_get_cpu_flags() thread-safe. The
static variables |flags|, |cpuflags_mask|, and |checked| in
libavutil/cpu.c are read and written using normal load and store
operations. These are considered as data races. The fix is to use atomic
load and store operations.

Remove the |checked| variable because the invalid value of -1 for
|flags| can be used to indicate the same condition. Rename |flags| to
|cpu_flags| and move it to file scope.

The fix can be verified by running the libavutil/tests/cpu_init.c test
program under ThreadSanitizer:
    ./configure --toolchain=clang-tsan
    make libavutil/tests/cpu_init
    libavutil/tests/cpu_init

There should be no warnings from ThreadSanitizer.

Co-author: Dmitry Vyukov of Google, who suggested the data race fix.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
2 years agolibkvazaar: Add missing header #includes
Diego Biurrun [Tue, 6 Dec 2016 22:25:58 +0000 (23:25 +0100)]
libkvazaar: Add missing header #includes

This fixes compilation after the next version bump.

2 years agoconfigure: Fail if cuda was enabled and is not available
Diego Biurrun [Wed, 7 Dec 2016 18:43:57 +0000 (19:43 +0100)]
configure: Fail if cuda was enabled and is not available

This is the standard behavior for external libraries.

2 years agobuild: Drop stray golomb dependencies
Diego Biurrun [Wed, 7 Dec 2016 11:48:31 +0000 (12:48 +0100)]
build: Drop stray golomb dependencies

2 years agobuild: Add an internal component for hevc_ps code
Diego Biurrun [Sat, 3 Dec 2016 14:26:40 +0000 (15:26 +0100)]
build: Add an internal component for hevc_ps code

This allows expressing dependencies in a more correct way.

2 years agoAdd missing #includes for standalone spherical-information-related headers
Diego Biurrun [Thu, 8 Dec 2016 18:47:58 +0000 (19:47 +0100)]
Add missing #includes for standalone spherical-information-related headers

2 years agofate: Add spherical and stereo3d mov tests
Vittorio Giovara [Wed, 30 Nov 2016 22:53:38 +0000 (17:53 -0500)]
fate: Add spherical and stereo3d mov tests

2 years agoavprobe: Allow specifying multiple stream entries to be shown
Vittorio Giovara [Thu, 1 Dec 2016 17:38:18 +0000 (12:38 -0500)]
avprobe: Allow specifying multiple stream entries to be shown

2 years agomov: Export spherical information
Vittorio Giovara [Wed, 2 Nov 2016 15:29:15 +0000 (11:29 -0400)]
mov: Export spherical information

This implements Spherical Video V1 and V2, as described in the
spatial-media collection by Google.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2 years agolavc: Add spherical packet side data API
Vittorio Giovara [Wed, 2 Nov 2016 15:28:54 +0000 (11:28 -0400)]
lavc: Add spherical packet side data API

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2 years agolavu: Add AVSphericalMapping type and frame side data
Vittorio Giovara [Mon, 7 Nov 2016 18:09:03 +0000 (13:09 -0500)]
lavu: Add AVSphericalMapping type and frame side data

While no decoder currently exports spherical information, this type
represents a frame property that has to be passed through from container
to frames.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2 years agolavu: Add a video section to Doxygen documentation
Vittorio Giovara [Thu, 10 Nov 2016 19:26:18 +0000 (14:26 -0500)]
lavu: Add a video section to Doxygen documentation

Fill it with AVStereo3D and AVDisplayMatrix documentation.
Apply the necessary changes to make verbatim code look good in doxygen.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2 years agobuild: Add missing Makefile entries and ifdefs for QSV hwaccels
Diego Biurrun [Sat, 3 Dec 2016 15:55:21 +0000 (15:55 +0000)]
build: Add missing Makefile entries and ifdefs for QSV hwaccels

2 years agobuild: Ensure that the "all" target appears before all Makefile includes
Diego Biurrun [Wed, 7 Dec 2016 14:27:37 +0000 (15:27 +0100)]
build: Ensure that the "all" target appears before all Makefile includes

Otherwise builds without explicit target result in silent no-ops.

2 years agobuild: Have old H.264/HEVC nvenc encoders select their new counterparts
Diego Biurrun [Sat, 3 Dec 2016 14:36:32 +0000 (15:36 +0100)]
build: Have old H.264/HEVC nvenc encoders select their new counterparts

This makes sense and takes care of missing build dependencies.

2 years agobuild: Move entries related to building TOOLS to a subdirectory Makefile
Diego Biurrun [Mon, 5 Dec 2016 17:38:53 +0000 (18:38 +0100)]
build: Move entries related to building TOOLS to a subdirectory Makefile

2 years agobuild: Warn that reconfiguration is necessary if version.h files changed
Diego Biurrun [Sun, 4 Dec 2016 21:01:50 +0000 (22:01 +0100)]
build: Warn that reconfiguration is necessary if version.h files changed

The library versions are stored in the config.mak file and are used
to derive shared library names.

2 years agoconfigure: add -fPIE instead of -pie to C flags for ThreadSanitizer
Wan-Teh Chang [Fri, 2 Dec 2016 19:27:17 +0000 (11:27 -0800)]
configure: add -fPIE instead of -pie to C flags for ThreadSanitizer

-pie was added to C flags for ThreadSanitizer in commit
19f251a2882a8d0779b432e63bf282e4d9c443bb. Under clang 3.8.0, the -pie
flag causes a compiler warning and a linker error when running configure
--toolchain=clang-tsan. Here is an excerpt from config.log:

clang ... -fsanitize=thread -pie -std=c11 -fomit-frame-pointer -pthread -c -o /tmp/ffconf.A8SsaoCF.o /tmp/ffconf.JdpujQlD.c
clang: warning: argument unused during compilation: '-pie'
clang -fsanitize=thread -pie -Wl,--as-needed -o /tmp/ffconf.2iYA4bsw /tmp/ffconf.A8SsaoCF.o -lm -lm -lbz2 -lz -pthread
/usr/bin/ld: /tmp/ffconf.A8SsaoCF.o: relocation R_X86_64_PC32 against undefined symbol `atan2f@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)

To be conservative, I changed -pie to -fPIE. But the documentation seems
to imply just -fsanitize=thread is enough:

http://clang.llvm.org/docs/ThreadSanitizer.html
https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2 years agoconfigure: Pass CFLAGS_HEADERS through the right CFLAGS filter
Diego Biurrun [Sun, 4 Dec 2016 10:06:47 +0000 (11:06 +0100)]
configure: Pass CFLAGS_HEADERS through the right CFLAGS filter

The generic parameter names used for CFLAGS in configure must be filtered
for each compiler and replaced by the equivalent flag for that compiler.

2 years agobuild: Separate avisynth and avxsynth support
Diego Biurrun [Mon, 14 Nov 2016 16:22:51 +0000 (17:22 +0100)]
build: Separate avisynth and avxsynth support

This simplifies the code.

2 years agoconfigure: Simplify OMX check
Diego Biurrun [Fri, 2 Dec 2016 11:33:50 +0000 (12:33 +0100)]
configure: Simplify OMX check

2 years agoconfigure: Move COMPONENT_LIST to the bottom of CONFIG_LIST
Diego Biurrun [Mon, 5 Dec 2016 16:09:50 +0000 (17:09 +0100)]
configure: Move COMPONENT_LIST to the bottom of CONFIG_LIST

This ensures that dependencies are resolved correctly. COMPONENT_LIST
can contain parts that depend on previous entries of CONFIG_LIST.

2 years agoconfigure: Simplify and fix avfoundation indev handling
Diego Biurrun [Mon, 28 Nov 2016 07:55:31 +0000 (08:55 +0100)]
configure: Simplify and fix avfoundation indev handling

Handle extralibs in the standard way, add missing pthreads dependency.
Also globally check for -fobj-arc with Objective-C compilers since
that option is useful for other Objective-C code as well.

2 years agobuild: Add EXTRALIBS to TOOLS linker command
Diego Biurrun [Tue, 22 Nov 2016 15:20:31 +0000 (16:20 +0100)]
build: Add EXTRALIBS to TOOLS linker command

EXTRALIBS contains general and platform-specific extra libraries
that should be part of all linker commands.

2 years agoconfigure: Separate package name and version requirements in helper functions
Diego Biurrun [Wed, 16 Nov 2016 17:10:35 +0000 (18:10 +0100)]
configure: Separate package name and version requirements in helper functions

The unadorned package name is needed to derive package-related variable names.