4 years agod3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARY
Martin Storsjö [Tue, 4 Jul 2017 17:03:00 +0000 (20:03 +0300)]
d3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARY

If using the winstore compat library, a fallback LoadLibrary
function does exist, that only calls LoadPackagedLibrary though
(which doesn't work for dynamically loading d3d11 DLLs).

Therefore explicitly check the targeted API family instead.

Make this check a reusable HAVE_* component which other parts
of the libraries can check when necessary as well.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agolavf: Remove codec_tag from dashenc and smoothstreamingenc
Martin Storsjö [Fri, 30 Jun 2017 09:49:49 +0000 (12:49 +0300)]
lavf: Remove codec_tag from dashenc and smoothstreamingenc

Currently, the tags enforced and set on the segmenter muxer level
mismatch what the mp4/ismv muxer uses (since 713efb2c0d013).

Skip the codec_tag altogether here, to let the user (try to) set
whichever codec/tag is preferred; the individual chained muxer will
reject invalid codecs anyway.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agohevc: Add support for alternative transfer characterics SEI
Vittorio Giovara [Fri, 9 Jun 2017 21:27:22 +0000 (17:27 -0400)]
hevc: Add support for alternative transfer characterics SEI

The use of this SEI is for backward compatibility in HLG HDR systems:
older devices that cannot interpret the "arib-std-b67" transfer will
get the compatible transfer (usually bt709 or bt2020) from the VUI,
while newer devices that can interpret HDR will read the SEI and use
its value instead.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
4 years agodvbsubdec: Free subrect memory on allocation error
Vittorio Giovara [Tue, 13 Jun 2017 15:35:16 +0000 (11:35 -0400)]
dvbsubdec: Free subrect memory on allocation error

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
4 years agodvbsubdec: Fixed segfault when decoding subtitles
Lorenz Brun [Fri, 21 Oct 2016 20:51:37 +0000 (22:51 +0200)]
dvbsubdec: Fixed segfault when decoding subtitles

This fixes a segfault (originally found in Movian, but traced to libav)
when decoding subtitles because only an array of rects is allocated,
but not the actual structs it contains. The issue was probably
introduced in commit 2383323 where the loop to allocate the rects in
the array was thrown away.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
4 years agohwframe: Allow hwaccel frame allocators to align surface sizes
Anton Khirnov [Thu, 22 Jun 2017 18:05:12 +0000 (20:05 +0200)]
hwframe: Allow hwaccel frame allocators to align surface sizes

Hardware accelerated decoding generally uses AVHWFramesContext for pool
allocation of hardware surfaces. These are setup to allocate surfaces
aligned to hardware and hwaccel API requirements. Due to the
architecture, av_hwframe_get_buffer() will return AVFrames with
the dimensions set to the aligned sizes.

This causes some decoders (like hevc) return these aligned size as
final frame size, instead of cropping them to the video's actual
dimensions. To make sure this doesn't happen, crop the frame to the
size the decoder expects when ff_get_buffer() is called.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agodxva: verbose-log decoder GUID list
wm4 [Thu, 22 Jun 2017 12:52:59 +0000 (14:52 +0200)]
dxva: verbose-log decoder GUID list

Helpful for debugging.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agohwcontext_d3d11va: add option to enable debug mode
wm4 [Thu, 22 Jun 2017 12:52:57 +0000 (14:52 +0200)]
hwcontext_d3d11va: add option to enable debug mode

Basically copied from VLC (LGPL):


Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agodxva: support DXGI_FORMAT_420_OPAQUE decoding
wm4 [Thu, 22 Jun 2017 12:52:56 +0000 (14:52 +0200)]
dxva: support DXGI_FORMAT_420_OPAQUE decoding

Some devices (some phones, apparently) will support only this opaque
format. Of course this won't work with CLI, because copying data
directly is not supported.

Automatic frame allocation (setting AVCodecContext.hw_device_ctx) does
not support this mode, even if it's the only supported mode. But since
opaque surfaces are generally less useful, that's probably ok.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agohwcontext_d3d11va: allocate staging texture lazily
wm4 [Thu, 22 Jun 2017 12:52:55 +0000 (14:52 +0200)]
hwcontext_d3d11va: allocate staging texture lazily

Makes dealing with formats that can not be used for staging textures
easier (DXGI_FORMAT_420_OPAQUE). It also saves memory if the staging
texture is never needed, so this is a good thing.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agohwcontext_d3d11va: fix crash on frames_init failure
wm4 [Thu, 22 Jun 2017 12:52:54 +0000 (14:52 +0200)]
hwcontext_d3d11va: fix crash on frames_init failure

It appears in this case, frames_ininit is called twice (once by
av_hwframe_ctx_init(), and again by unreffing the frames ctx ref).

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agodxva: fix some warnings
wm4 [Thu, 22 Jun 2017 12:52:53 +0000 (14:52 +0200)]
dxva: fix some warnings

Some existed since forever, some are new.

The cast in get_surface() is silly, but unless we change the av_log
function signature, or all callers of ff_dxva2_get_surface_index(), it's
needed to remove the const warning.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agodxva: add declarative profile checks
wm4 [Thu, 22 Jun 2017 12:52:52 +0000 (14:52 +0200)]
dxva: add declarative profile checks

Make supported codec profiles part of each dxva_modes entry. Every DXVA2
mode is representative for a codec with a subset of supported profiles,
so reflecting that in dxva_modes seems appropriate.

In practice, this will more strictly check MPEG2 profiles, will stop
relying on the surface format checks for selecting the correct HEVC
profile, and remove the verbose messages for mismatching H264/HEVC
profiles. Instead of the latter, it will now print the more nebulous "No
decoder device for codec found" verbose message.

Main10 HEVC entry before the normal one to make this work better.

Originally inspired by VLC's code.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agoconfigure: Reset X86ASM_DEP(FLAGS) when probing for the assembler program
Diego Biurrun [Sat, 24 Jun 2017 15:51:02 +0000 (17:51 +0200)]
configure: Reset X86ASM_DEP(FLAGS) when probing for the assembler program

These variables might be set from a previous probe run, but one or the
other program that is probed for may not grok the flags, resulting in
errors during assembling when the values of those variables are passed
to the assembler.

4 years agonvenc: Minimize the surface allocation
Ben Chang [Sat, 24 Jun 2017 12:17:14 +0000 (12:17 +0000)]
nvenc: Minimize the surface allocation

The previous default sets the allocated surfaces to 32 unless it is
user-overridden or the lookahead parameter is set.

Change the surfaces calculation for default, B-frames and lookahead scenario.

4 years agonvenc: Use a fifo to manage the free surface pool
Ben Chang [Sat, 24 Jun 2017 12:14:22 +0000 (12:14 +0000)]
nvenc: Use a fifo to manage the free surface pool

Previously, if a session allocates x surfaces, only x-1 surfaces are
used (due to combination of output delay and lock toggle logic).

4 years agonvenc: Add an explicit auto alias
Ben Chang [Sat, 24 Jun 2017 12:10:10 +0000 (12:10 +0000)]
nvenc: Add an explicit auto alias

4 years agobuild: Add an option for passing linker flags to the shared library build
Janne Grunau [Tue, 20 Jun 2017 17:25:43 +0000 (19:25 +0200)]
build: Add an option for passing linker flags to the shared library build

Also employ this mechanism to pass $libdir to the runtime library search
path if rpath is enabled. This fixes underlinking of some test binaries
on some systems.

4 years agoconfigure: Automatically add -isysroot for darwin if --sysroot is specified
Martin Storsjö [Wed, 21 Jun 2017 13:54:22 +0000 (16:54 +0300)]
configure: Automatically add -isysroot for darwin if --sysroot is specified

Check the existing flags in the cc/cflags/cppflags/ldflags for
occurrances of -isysroot; if none is found but --sysroot was specified,
set -isysroot to the same value as --sysroot.

This simplifies configuring cross-builds for iOS, if the global
environment variable SDKROOT isn't set.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoaf_bs2b: Add missing casts to complex pointer assignments
Diego Biurrun [Mon, 12 Jun 2017 20:12:17 +0000 (22:12 +0200)]
af_bs2b: Add missing casts to complex pointer assignments

Fixes several warnings of the type:
libavfilter/af_bs2b.c:171:22: warning: assignment from incompatible pointer type

4 years agotls_gnutls: Readd support for nonblocking operation
Martin Storsjö [Mon, 19 Jun 2017 12:49:25 +0000 (15:49 +0300)]
tls_gnutls: Readd support for nonblocking operation

The rtmp protocol uses nonblocking reads, to poll for incoming
messages from the server while publishing a stream.

Prior to 94599a6de3822b13c94096d764868128f388ba28 and
d13b124eaf452b267480074b2e6946538ed03a6e, the tls protocol
handled the nonblocking flag, mostly as a side effect from not
using custom IO callbacks for reading from the socket. When custom
IO callbacks were taken into use in
d15eec4d6bdfa3bd4c4b5b7dd2dbd699ba253d02, the handling of a nonblocking
socket wasn't necessary for the default blocking mode any longer.

The code was simplified, since it was overlooked that other code
within libavformat actually used the tls protocol in nonblocking mode.

This fixes publishing over rtmps, with the gnutls backend.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agotls_openssl: Readd support for nonblocking operation
Martin Storsjö [Mon, 19 Jun 2017 12:45:08 +0000 (15:45 +0300)]
tls_openssl: Readd support for nonblocking operation

The rtmp protocol uses nonblocking reads, to poll for incoming
messages from the server while publishing a stream.

Prior to 94599a6de3822b13c94096d764868128f388ba28 and
d13b124eaf452b267480074b2e6946538ed03a6e, the tls protocol
handled the nonblocking flag, mostly as a side effect from not
using custom IO callbacks for reading from the socket. When custom
IO callbacks were taken into use in
d15eec4d6bdfa3bd4c4b5b7dd2dbd699ba253d02, the handling of a nonblocking
socket wasn't necessary for the default blocking mode any longer.

The code was simplified, since it was overlooked that other code
within libavformat actually used the tls protocol in nonblocking mode.

This fixes publishing over rtmps, with the openssl backend.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agomovenc: allow alternative hvc1 h.265 codec tag
John Stebbins [Thu, 15 Jun 2017 18:47:16 +0000 (11:47 -0700)]
movenc: allow alternative hvc1 h.265 codec tag

If AVCodecParameters.codec_tag is 'hvc1' use it instead of 'hev1' for
h.265 streams. QuickTime (and other Apple software) requires 'hvc1'.

4 years agomovenc: write correct format hvcc when tag is hvc1
John Stebbins [Thu, 15 Jun 2017 18:41:15 +0000 (11:41 -0700)]
movenc: write correct format hvcc when tag is hvc1

4 years agomovenc: move tags definitions to where they are used
John Stebbins [Mon, 19 Jun 2017 14:53:45 +0000 (07:53 -0700)]
movenc: move tags definitions to where they are used

4 years agomovenc: simplify codec_tag lookup
John Stebbins [Mon, 19 Jun 2017 14:46:48 +0000 (07:46 -0700)]
movenc: simplify codec_tag lookup

mux.c init_muxer() already sets codec_tag correctly in the cases
simplified here.

This also adds the capability to support alternative tags for the
same codec_id.

4 years agomovenc: use correct tag list for AVOutputFormat.codec_tag
John Stebbins [Thu, 15 Jun 2017 18:20:48 +0000 (11:20 -0700)]
movenc: use correct tag list for AVOutputFormat.codec_tag

ff_mp4_obj_type contains the wrong type of tags for
AVOutputFormat.codec_tag. AVOutputFormat.codec_tag is used to
validate AVCodecParameters.codec_tag so needs to be the same
type of tag.

Creates new tag lists for mp4 and ismv.  New tag lists support
same list of codecs found in ff_mp4_obj_type. psp uses the same
tag list as mp4 since these both use mp4_get_codec_tag to look up tags.

4 years agoaarch64: vp9: Fix assembling with Xcode 6.2 and older
Memphiz [Sun, 18 Jun 2017 10:30:16 +0000 (12:30 +0200)]
aarch64: vp9: Fix assembling with Xcode 6.2 and older

Properly use the b.eq/b.ge forms instead of the nonstandard forms
(which both gas and newer clang accept though), and expand the
register list that used a range (which the Xcode 6.2 clang, based
on clang 3.5 svn, didn't support).

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agodoc: Drop the legacy symlink to README
Luca Barbato [Tue, 13 Jun 2017 23:40:40 +0000 (01:40 +0200)]
doc: Drop the legacy symlink to README

Windows does not like symlinks and README.md is pretty common nowadays.

4 years agod3d11va: Link directly to dxgi.dll and d3d11.dll functions if LoadLibrary is unavailable
Martin Storsjö [Fri, 9 Jun 2017 09:05:00 +0000 (12:05 +0300)]
d3d11va: Link directly to dxgi.dll and d3d11.dll functions if LoadLibrary is unavailable

When targeting the UWP API subset, the LoadLibrary function is not
available (and the fallback, LoadPackagedLibrary, can't be used to
load system DLLs). In these cases, link directly to the functions
in the DLLs instead of trying to load them dynamically at runtime.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoavconv_hw: Free device on initialisation failure
Mark Thompson [Fri, 16 Jun 2017 22:18:55 +0000 (23:18 +0100)]
avconv_hw: Free device on initialisation failure

4 years agovf_hwmap: Properly free a locally derived device
Mark Thompson [Fri, 16 Jun 2017 22:11:51 +0000 (23:11 +0100)]
vf_hwmap: Properly free a locally derived device

4 years agovf_hwmap: Add missing error code
Mark Thompson [Fri, 16 Jun 2017 22:08:47 +0000 (23:08 +0100)]
vf_hwmap: Add missing error code

4 years agoconfigure: Fix handling of _select dependencies
Diego Biurrun [Wed, 24 May 2017 15:59:59 +0000 (17:59 +0200)]
configure: Fix handling of _select dependencies

The handling of _select dependencies had two issues:

1) extralibs from _select dependencies of a component were not added to
   the list of extralibs for that component.
2) extralibs from dependencies were only added to the extralibs of a
   component if the component was enabled. This led to incorrect results
   if that component was enabled by another component later in the dependency
   resolution process. Instead, always generate the full list of component
   extralibs for use later in the dependency resolution process.

Also remove a leftover unused variable.

4 years agobuild: Adjust dependencies for faan(i)dct components
Diego Biurrun [Mon, 12 Jun 2017 19:33:35 +0000 (21:33 +0200)]
build: Adjust dependencies for faan(i)dct components

4 years agoconfigure: Factorize qsv dependencies
Diego Biurrun [Tue, 6 Jun 2017 15:41:11 +0000 (17:41 +0200)]
configure: Factorize qsv dependencies

4 years agoconfigure: Add missing arch dependencies for arch extensions
Diego Biurrun [Tue, 6 Jun 2017 17:06:10 +0000 (19:06 +0200)]
configure: Add missing arch dependencies for arch extensions

4 years agoconfigure: Add x86 dependency for mmx_internal
Diego Biurrun [Tue, 6 Jun 2017 16:56:24 +0000 (18:56 +0200)]
configure: Add x86 dependency for mmx_internal

This ensures that mmx_internal is only ever enabled on x86.

4 years agobuild: Add missing idctdsp dependency for clearvideo
Diego Biurrun [Wed, 7 Jun 2017 10:48:00 +0000 (12:48 +0200)]
build: Add missing idctdsp dependency for clearvideo

4 years agobuild: Add missing mpeg4audio dependency for RTP muxer
Diego Biurrun [Sun, 11 Jun 2017 21:50:24 +0000 (23:50 +0200)]
build: Add missing mpeg4audio dependency for RTP muxer

4 years agohwcontext: Mark local table static const
Mark Thompson [Tue, 13 Jun 2017 21:27:31 +0000 (22:27 +0100)]
hwcontext: Mark local table static const

4 years agolibfdk-aacdec: Correct buffer_size parameter
Michael Niedermayer [Thu, 25 May 2017 01:21:50 +0000 (03:21 +0200)]
libfdk-aacdec: Correct buffer_size parameter

The timeDataSize argument to aacDecoder_DecodeFrame() seems undocumented
and until 2016 04 (203e3f28fbebec7011342017fafc2a0bda0ce530) unused.
After that commit libfdk-aacdec interprets it as size in sample units
and memsets that on error.

FFmpeg as well as others (like GStreamer) did interpret it as size in

Fixes: 1442/clusterfuzz-testcase-minimized-4540199973421056 (This requires recent libfdk to reproduce)

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agommal: Add missing .item_name to AVClass declaration
Diego Biurrun [Mon, 12 Jun 2017 09:01:14 +0000 (11:01 +0200)]
mmal: Add missing .item_name to AVClass declaration

4 years agoconfigure: Simplify AltiVec/VSX check with a helper function
Diego Biurrun [Fri, 26 May 2017 17:04:51 +0000 (19:04 +0200)]
configure: Simplify AltiVec/VSX check with a helper function

4 years agoppc: Drop support for Apple GCC
Diego Biurrun [Mon, 12 Jun 2017 09:48:57 +0000 (11:48 +0200)]
ppc: Drop support for Apple GCC

Apple GCC has not been a thing anymore on PowerPC since many years.

4 years agoConvert all AVClass struct declarations to designated initializers.
Diego Biurrun [Sat, 10 Jun 2017 14:45:06 +0000 (16:45 +0200)]
Convert all AVClass struct declarations to designated initializers.

4 years agonvenc: Add default value for AVCodecContext::refs
Srinath K R [Thu, 8 Jun 2017 09:13:54 +0000 (14:43 +0530)]
nvenc: Add default value for AVCodecContext::refs

AVCodecContext::refs is used to control the DPB size to be used by the
encoder. The default value for AVCodecContext::refs as set in
libavcodec/options_table.h is 1.

This patch sets AVCodecContext::refs to 0 for h264_nvenc and hevc_nvenc in
order to let the driver take the decision of the correct DPB size to use in
all cases.

Signed-off-by: Srinath K R <skr@nvidia.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agodxva: add support for new dxva2 and d3d11 hwaccel APIs
wm4 [Wed, 7 Jun 2017 15:11:17 +0000 (17:11 +0200)]
dxva: add support for new dxva2 and d3d11 hwaccel APIs

This also adds support to avconv (which is trivial due to the new
hwaccel API being generic enough).

The new decoder setup code in dxva2.c is significantly based on work by
Steve Lhomme <robux4@gmail.com>, but with heavy changes/rewrites.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
4 years agodxva: move d3d11 locking/unlocking to functions
wm4 [Tue, 6 Jun 2017 16:51:10 +0000 (18:51 +0200)]
dxva: move d3d11 locking/unlocking to functions

I want to make it non-mandatory to set a mutex in the D3D11 device
context, and replacing it with user callbacks seems like the best
solution. This is preparation for it. Also makes the code slightly more

Signed-off-by: Diego Biurrun <diego@biurrun.de>
4 years agodxva: preparations for new hwaccel API
wm4 [Tue, 6 Jun 2017 16:51:09 +0000 (18:51 +0200)]
dxva: preparations for new hwaccel API

The actual hwaccel code will need to access an internal context instead
of avctx->hwaccel_context, so add a new DXVA_CONTEXT() macro, that will
dispatch between the "old" external and the new internal context.

Also, the new API requires a new D3D11 pixfmt, so all places which check
for the pixfmt need to be adjusted. Introduce a ff_dxva2_is_d3d11()
function, which does the check.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
4 years agolavc: set avctx->hwaccel before init
wm4 [Tue, 6 Jun 2017 16:51:08 +0000 (18:51 +0200)]
lavc: set avctx->hwaccel before init

So a hwaccel can access avctx->hwaccel in init for whatever reason. This
is for the new d3d hwaccel API. We could create separate entrypoints for
each of the 3 hwaccel types (dxva2, d3d11va, new d3d11va), but this
seems nicer.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
4 years agolavu: add new D3D11 pixfmt and hwcontext
wm4 [Tue, 6 Jun 2017 16:51:07 +0000 (18:51 +0200)]
lavu: add new D3D11 pixfmt and hwcontext

To be used with the new d3d11 hwaccel decode API.

With the new hwaccel API, we don't want surfaces to depend on the
decoder (other than the required dimension and format). The old D3D11VA
pixfmt uses ID3D11VideoDecoderOutputView pointers, which include the
decoder configuration, and thus is incompatible with the new hwaccel
API. This patch introduces AV_PIX_FMT_D3D11, which uses ID3D11Texture2D
and an index. It's simpler and compatible with the new hwaccel API.

The introduced hwcontext supports only the new pixfmt.

Frame upload code untested.

Significantly based on work by Steve Lhomme <robux4@gmail.com>, but with
heavy changes/rewrites.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
4 years agoconfigure: Bail out if both GnuTLS and OpenSSL are enabled
Diego Biurrun [Fri, 26 May 2017 11:05:12 +0000 (13:05 +0200)]
configure: Bail out if both GnuTLS and OpenSSL are enabled

Both libraries provide similar functionality and cannot be used together.
When both are enabled one is used and the other ignored arbitrarily. Error
out instead and have the user choose which library to use.

4 years agoconfigure: Move x86 assembler sanity check into assembler probe function
Diego Biurrun [Mon, 22 May 2017 12:48:15 +0000 (14:48 +0200)]
configure: Move x86 assembler sanity check into assembler probe function

This allows for more graceful fallback from NASM to Yasm if the available
NASM version is too old.

4 years agobuild: Add missing zlib dependencies for several protocols
Diego Biurrun [Tue, 14 Mar 2017 15:44:24 +0000 (16:44 +0100)]
build: Add missing zlib dependencies for several protocols

4 years agocmdutils: Mark conditionally used variable as av_unused
Diego Biurrun [Mon, 22 May 2017 14:27:51 +0000 (16:27 +0200)]
cmdutils: Mark conditionally used variable as av_unused

avtools/cmdutils.c:1234:28: warning: unused variable ‘pix_fmt’ [-Wunused-variable]

4 years agobuild: Skip generating .version files when reconfiguring
Diego Biurrun [Wed, 15 Mar 2017 16:36:16 +0000 (17:36 +0100)]
build: Skip generating .version files when reconfiguring

The .version files are only relevant during an actual build.

4 years agoavutil/md5: fix misaligned reads
James Almer [Fri, 3 Mar 2017 03:25:54 +0000 (00:25 -0300)]
avutil/md5: fix misaligned reads

This makes ubsan happy and also considerably increases performance on
big endian systems.

Tested on an IBM POWER7 3.55 GHz


2.24user 0.14system 0:02.39elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
2.26user 0.11system 0:02.38elapsed 99%CPU (0avgtext+0avgdata 2688maxresident)k
2.23user 0.15system 0:02.38elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
2.25user 0.12system 0:02.38elapsed 100%CPU (0avgtext+0avgdata 2624maxresident)k
2.20user 0.15system 0:02.36elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k


1.86user 0.13system 0:02.00elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
1.89user 0.11system 0:02.01elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
1.85user 0.14system 0:02.00elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
1.84user 0.15system 0:01.99elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
1.89user 0.13system 0:02.02elapsed 99%CPU (0avgtext+0avgdata 2688maxresident)k

Tested-by: Nicolas George <george@nsup.org>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Sean McGovern <gseanmcg@gmail.com>
4 years agotls: Hide backend implementation details from users
Diego Biurrun [Tue, 23 May 2017 08:15:28 +0000 (10:15 +0200)]
tls: Hide backend implementation details from users

TLS is currently implemented over either OpenSSL or GnuTLS, with more
backends likely to appear in the future. Currently, those backend libraries
are part of the protocol names used during e.g. the configure stage of a
build. Hide those details behind a generically-named declaration for the
TLS protocol to avoid leaking those details into the configuration stage.

4 years agosmacker: Improve error handling
Diego Biurrun [Tue, 30 May 2017 16:12:48 +0000 (18:12 +0200)]
smacker: Improve error handling

Return sensible error values and forward error codes.

4 years agosmacker: Check that the data size is a multiple of a sample vector
Michael Niedermayer [Sun, 15 Nov 2015 13:52:08 +0000 (14:52 +0100)]
smacker: Check that the data size is a multiple of a sample vector

Fixes out of array access
Fixes: ce19e41f0ef1e52a23edc488faecdb58/asan_heap-oob_2504e97_4202_ffa0df1baed14022b9bfd4f8ac23d0cb.smk

Bug-Id: CVE-2015-8365
CC: libav-stable@libav.org
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4a9af07a49295e014b059c1ab624c40345af5892)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
4 years agoos_support: Remove the dynamic loading of getaddrinfo from the fallback getaddrinfo
Martin Storsjö [Wed, 31 May 2017 10:08:29 +0000 (13:08 +0300)]
os_support: Remove the dynamic loading of getaddrinfo from the fallback getaddrinfo

If we for some unexplicable reason didn't pick up getaddrinfo
at configure, the default, IPv4-only, fallback should be good enough.

This effectively reverts 6023d84a2b7.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoconfigure: Default to _WIN32_WINNT=0x0502 (XP) as minimum, for legacy mingw
Martin Storsjö [Wed, 31 May 2017 10:07:04 +0000 (13:07 +0300)]
configure: Default to _WIN32_WINNT=0x0502 (XP) as minimum, for legacy mingw

This makes the getaddrinfo functions visible, which aren't normally
by default on legacy mingw.

We already force __MSVCRT_VERSION__ to an XP version.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agohlsenc: Support recovery from an already present playlist
Luca Barbato [Fri, 19 May 2017 18:32:47 +0000 (20:32 +0200)]
hlsenc: Support recovery from an already present playlist

Parse the playlist to recover the start sequence and previously
generated segments and continue muxing from there.

Mainly useful for near-seamless recovery in live scenarios.

4 years agoavconv: Always initialize the opkt struct on streamcopy
Luca Barbato [Mon, 29 May 2017 11:55:28 +0000 (13:55 +0200)]
avconv: Always initialize the opkt struct on streamcopy

4 years agoconfigure: Fix the msvcrt version check for mingw32
Martin Storsjö [Wed, 31 May 2017 09:53:32 +0000 (12:53 +0300)]
configure: Fix the msvcrt version check for mingw32

This was actually broken when committed in 46e3936fb04; the
test never succeeded, and thus, _aligned_malloc wasn't actually
used on legacy mingw.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agovaapi: Add ABGR map only if VA_FOURCC_ABGR is defined
Elviss Strazdins [Wed, 24 May 2017 12:33:08 +0000 (14:33 +0200)]
vaapi: Add ABGR map only if VA_FOURCC_ABGR is defined

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agoconfigure: Do not check for the __builtin_vec_vsx_ld
Luca Barbato [Wed, 10 May 2017 15:18:48 +0000 (17:18 +0200)]
configure: Do not check for the __builtin_vec_vsx_ld

Clang support for Altivec/VSX uses a different approach.

4 years agoavutil/hwcontext_dxva2: Don't improperly free IDirect3DSurface9 objects
Aaron Levinson [Tue, 16 May 2017 21:23:27 +0000 (14:23 -0700)]
avutil/hwcontext_dxva2: Don't improperly free IDirect3DSurface9 objects

Add dxva2_pool_release_dummy() and use it in call to
av_buffer_create() in dxva2_pool_alloc().

Prior to this change, av_buffer_create() was called with NULL for the
third argument, which indicates that av_buffer_default_free() should
be used to free the buffer's data.  Eventually, it gets to
buffer_pool_free() and calls buf->free() on a surface object (which is

This can result in a crash when the debug version of the C-runtime is
used on Windows.  While it doesn't appear to result in a crash when
the release version of the C-runtime is used on Windows, it likely
results in memory corruption, since av_free() is being called on
memory that was allocated using

Signed-off-by: Aaron Levinson <alevinsn@aracnet.com>
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
4 years agodecode: fix the code reducing cropping to preserve alignment
Anton Khirnov [Fri, 19 May 2017 09:47:21 +0000 (11:47 +0200)]
decode: fix the code reducing cropping to preserve alignment

Currently it does not work at all.

Bug-Id: 1058

4 years agohevcdec: move the MD5 context out of HEVCSEIPictureHash back into HEVCContext
Anton Khirnov [Fri, 12 May 2017 14:36:41 +0000 (16:36 +0200)]
hevcdec: move the MD5 context out of HEVCSEIPictureHash back into HEVCContext

HEVCSEIPictureHash should store only the information extracted from the
bitstream and exported to the higher layer (the decoder or the parser).
The MD5 context is allocated, used and freed by this higher layer, so it
makes more sense for it to also be stored there.

4 years agoextract_extradata_bsf: make sure all needed parameter set NALUs were found
James Almer [Fri, 14 Apr 2017 13:53:52 +0000 (10:53 -0300)]
extract_extradata_bsf: make sure all needed parameter set NALUs were found

This mimics the behavior of the now unused h264/hevc parser's split()
function and fixes decoding some files when extract_extradata bsf is

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
4 years agovp9_superframe_bsf: cache input packets directly
Anton Khirnov [Wed, 26 Apr 2017 07:42:32 +0000 (09:42 +0200)]
vp9_superframe_bsf: cache input packets directly

Avoids unnecessary allocs+copies and makes the code slightly simpler.

4 years agovp9_superframe_bsf: convert to the new bitstream reader
Anton Khirnov [Wed, 26 Apr 2017 07:25:05 +0000 (09:25 +0200)]
vp9_superframe_bsf: convert to the new bitstream reader

4 years agohevc: Add names for reserved NAL unit types
Mark Thompson [Sun, 14 May 2017 14:47:36 +0000 (15:47 +0100)]
hevc: Add names for reserved NAL unit types

While not yet used, these NAL units do already have some defined
semantics and are referred to elsewhere.

4 years agoh264_sei: Add namespace prefix to all SEI values
Mark Thompson [Mon, 15 May 2017 21:42:14 +0000 (22:42 +0100)]
h264_sei: Add namespace prefix to all SEI values

This avoids confusion with equivalent H.265 SEI values when both are
being used at the same time.

4 years agoavconv: Flush output BSFs when stream copy reaches EOF
Mark Thompson [Thu, 4 May 2017 22:01:23 +0000 (23:01 +0100)]
avconv: Flush output BSFs when stream copy reaches EOF

Same as f64d1100a54d12c78ce436181bb64229c56da6b3, for stream copy
rather than encode.

4 years agodoc: Document hwupload, hwdownload and hwmap filters
Mark Thompson [Sun, 30 Apr 2017 21:11:54 +0000 (22:11 +0100)]
doc: Document hwupload, hwdownload and hwmap filters

4 years agomovenc-test: Add tests for negative cts offsets
Martin Storsjö [Thu, 7 Apr 2016 13:16:27 +0000 (16:16 +0300)]
movenc-test: Add tests for negative cts offsets

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agomovenc: Don't write any edit list if the start offset is zero
Martin Storsjö [Thu, 7 Apr 2016 12:47:31 +0000 (15:47 +0300)]
movenc: Don't write any edit list if the start offset is zero

In these cases, the CTTS flag is set, but no edit list is necessary.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agomovenc: Add an option for enabling negative CTS offsets
Martin Storsjö [Thu, 7 Apr 2016 12:45:37 +0000 (15:45 +0300)]
movenc: Add an option for enabling negative CTS offsets

This reduces the need for an edit list; streams that start with
e.g. dts=-1, pts=0 can be encoded as dts=0, pts=0 (which is valid
in mov/mp4) by shifting the dts values of all packets forward.
This avoids the need for edit lists for such streams (while they
still are needed for audio streams with encoder delay).

This eases conformance with the DASH-IF interoperability guidelines.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agocheckasm: aarch64: Specify alignment for the register_init const array
Martin Storsjö [Thu, 4 May 2017 18:45:34 +0000 (20:45 +0200)]
checkasm: aarch64: Specify alignment for the register_init const array

Loads from this strictly doesn't require alignment, but specify it
just for consistency with the arm version.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoarm: Avoid using .dn register aliases
Martin Storsjö [Tue, 9 May 2017 07:25:44 +0000 (10:25 +0300)]
arm: Avoid using .dn register aliases

clang now (in the upcoming 5.0 version) is capable of building our
arm assembly without relying on gas-preprocessor, although clang/LLVM
doesn't support .dn register aliases.

The VC1 MC assembly was only built and used if the chosen assembler
supported the .dn directives though. This was supported as long as
gas-preprocessor was used.

This means that VC1 decoding got a speed regression on clang 5.0,
unless the user manually chose using gas-preprocessor again.

By avoiding using the .dn register aliases, we can build the VC1 MC
assembly with the latest clang version.

Support for the .dn/.qn directives in clang/LLVM isn't actively planned,
see https://bugs.llvm.org/show_bug.cgi?id=18199.

This partially reverts 896a5bff64264f4d01ed98eacc97a67260c1e17e.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agompjpeg: Use proper CR/LF in multipart headers
Martin Storsjö [Wed, 10 May 2017 20:57:20 +0000 (23:57 +0300)]
mpjpeg: Use proper CR/LF in multipart headers

This is more correct.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoh264_refs: validate the SPS pointer in ff_h264_execute_ref_pic_marking()
Sean McGovern [Sun, 7 May 2017 21:11:59 +0000 (17:11 -0400)]
h264_refs: validate the SPS pointer in ff_h264_execute_ref_pic_marking()

Bug-Id: 1036
CC: libav-stable@libav.org
4 years agohevcdec: move SEI message parsing into a separate header
James Almer [Sun, 7 May 2017 13:51:59 +0000 (10:51 -0300)]
hevcdec: move SEI message parsing into a separate header

It doesn't depend on hevcdec anymore.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agohevcdec: remove HEVCContext usage from hevc_sei
James Almer [Sun, 7 May 2017 13:51:58 +0000 (10:51 -0300)]
hevcdec: remove HEVCContext usage from hevc_sei

Based on the H264 SEI implementation.

This will be mainly useful once support for SEI messages that can be
used by the hevc parser are implemented, like Picture Timing.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agoarm: Check for the .arch directive in configure
Martin Storsjö [Wed, 3 May 2017 08:18:51 +0000 (11:18 +0300)]
arm: Check for the .arch directive in configure

When targeting windows, the .arch directive isn't available.

So far, when building for windows, we've always used gas-preprocessor,
both when using msvc's armasm and when using clang. Lately, clang/llvm
has implemented the last missing piece (altmacro support) for building
our assembly without gas-preprocessor. This means that we now build
for arm/windows with clang without any extra compatibility layer.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agohevc: Add NEON 32x32 IDCT
Alexandra Hájková [Thu, 4 May 2017 08:52:52 +0000 (10:52 +0200)]
hevc: Add NEON 32x32 IDCT

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agohevc: 16x16 NEON idct: Use the right element size for loads/stores
Alexandra Hájková [Thu, 4 May 2017 08:49:16 +0000 (10:49 +0200)]
hevc: 16x16 NEON idct: Use the right element size for loads/stores

This doesn't change the actual behaviour of the code but improves

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoaacsbr: Turnoff in the event of over read.
Alex Converse [Mon, 20 Mar 2017 19:44:42 +0000 (12:44 -0700)]
aacsbr: Turnoff in the event of over read.

Aliased compressed AAC bytes are almost certainly not meaningful SBR
data. In the wild this causes harsh artifacts switching HE-AAC streams
that don't have SBR headers aligned with segment boundaries.

Turning off SBR falls back to a default set of upsampling parameters
that can function as a sort of error concealment. This is consistent
with how the decoder handles other sorts of errors.

Bug-Id: 1047
CC: libav-stable@libav.org
Signed-off-by: Sean McGovern <gseanmcg@gmail.com>
4 years agoaac: Split function to parse ADTS header data into public and private part
Diego Biurrun [Wed, 26 Apr 2017 16:57:54 +0000 (18:57 +0200)]
aac: Split function to parse ADTS header data into public and private part

This makes the currently semi-public avpriv_aac_parse_header() function
private to libavcodec and adds a proper public API function to return
the parts of the ADTS header required in libavformat.

4 years agobitstream: Move VLC reading functions into the vlc.h header
Luca Barbato [Sat, 29 Apr 2017 00:34:12 +0000 (00:34 +0000)]
bitstream: Move VLC reading functions into the vlc.h header

This makes the bitstream.h header leaner.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
4 years agovlc: Add header #include when the types are used
Luca Barbato [Sat, 29 Apr 2017 00:34:11 +0000 (00:34 +0000)]
vlc: Add header #include when the types are used

Do not rely on indirectly including it from bitstream.h.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
4 years agohevc: Add NEON add_residual for bitdepth 10
Alexandra Hájková [Mon, 1 May 2017 18:16:02 +0000 (20:16 +0200)]
hevc: Add NEON add_residual for bitdepth 10

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agovf_hwmap: Add reverse mapping for hardware frames
Mark Thompson [Sat, 4 Mar 2017 23:57:42 +0000 (23:57 +0000)]
vf_hwmap: Add reverse mapping for hardware frames

This is something of a hack.  It allocates a new hwframe context for
the target format, then maps it back to the source link and overwrites
the input link hw_frames_ctx so that the previous filter will receive
the frames we want from ff_get_video_buffer().  It may fail if
the previous filter imposes any additional constraints on the frames
it wants to use as output.

4 years agovf_hwmap: Add device derivation
Mark Thompson [Sat, 4 Mar 2017 23:57:41 +0000 (23:57 +0000)]
vf_hwmap: Add device derivation

Also refactor a little and improve error messages to make failure
cases easier to understand.

4 years agohwcontext: Improve allocation in derived contexts
Mark Thompson [Sat, 4 Mar 2017 23:57:40 +0000 (23:57 +0000)]
hwcontext: Improve allocation in derived contexts

Use the flags argument of av_hwframe_ctx_create_derived() to pass the
mapping flags which will be used on allocation.  Also, set the format
and hardware context on the allocated frame automatically - the user
should not be required to do this themselves.

4 years agohwcontext_qsv: Implement mapping frames to the child device type
Mark Thompson [Sat, 4 Mar 2017 23:57:45 +0000 (23:57 +0000)]
hwcontext_qsv: Implement mapping frames to the child device type

4 years agohwcontext_qsv: Implement mapping frames from the child device type
Mark Thompson [Sat, 4 Mar 2017 23:57:44 +0000 (23:57 +0000)]
hwcontext_qsv: Implement mapping frames from the child device type

Factorises out existing surface initialisation code to reuse.