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/ 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ö <>
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 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ö <>
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
Signed-off-by: Martin Storsjö <>
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 <>
Signed-off-by: Luca Barbato <>
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 <>, but with heavy changes/rewrites.

Signed-off-by: Diego Biurrun <>
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 <>
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 <>
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 <>
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 <>, but with
heavy changes/rewrites.

Signed-off-by: Diego Biurrun <>
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 <>
Reviewed-by: Michael Niedermayer <>
Signed-off-by: James Almer <>
Signed-off-by: Sean McGovern <>
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
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <>
(cherry picked from commit 4a9af07a49295e014b059c1ab624c40345af5892)
Signed-off-by: Diego Biurrun <>
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ö <>
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ö <>
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ö <>
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 <>
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 <>
Reviewed-by: wm4 <>
Reviewed-by: Steven Liu <>
Reviewed-by: Mark Thompson <>
Signed-off-by: Anton Khirnov <>
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 <>
Signed-off-by: Anton Khirnov <>
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ö <>
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ö <>
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ö <>
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ö <>
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,

This partially reverts 896a5bff64264f4d01ed98eacc97a67260c1e17e.

Signed-off-by: Martin Storsjö <>
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ö <>
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
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 <>
Signed-off-by: Luca Barbato <>
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 <>
Signed-off-by: Luca Barbato <>
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ö <>
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ö <>
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ö <>
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
Signed-off-by: Sean McGovern <>
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 <>
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 <>
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ö <>
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.

4 years agohwcontext: Add frame context mapping for nontrivial contexts
Mark Thompson [Sat, 4 Mar 2017 23:57:39 +0000 (23:57 +0000)]
hwcontext: Add frame context mapping for nontrivial contexts

Some frames contexts are not usable without additional format-specific
state in hwctx.  This change adds new functions frames_derive_from and
frames_derive_to to initialise this state appropriately when deriving
a frames context which will require it to be set.

4 years agohwcontext_qsv: Support derivation from child devices
Mark Thompson [Sat, 4 Mar 2017 23:57:43 +0000 (23:57 +0000)]
hwcontext_qsv: Support derivation from child devices

4 years agoavconv: Support setting the hardware device to use when filtering
Mark Thompson [Sat, 4 Mar 2017 23:57:38 +0000 (23:57 +0000)]
avconv: Support setting the hardware device to use when filtering

This only supports one device globally, but more can be used by
passing them with input streams in hw_frames_ctx or by deriving new
devices inside a filter graph with hwmap.

4 years agoavconv_hw: Add implicit device creation with default parameters
Mark Thompson [Sun, 30 Apr 2017 13:11:51 +0000 (14:11 +0100)]
avconv_hw: Add implicit device creation with default parameters

If -hwaccel foo is supplied without any other device options, and the
foo hwaccel is meant to have a device, try to make such a device with
default parameters for the hwaccel to use.

4 years agovp9_raw_reorder_bsf: Remove a redundant allocation
Mark Thompson [Wed, 26 Apr 2017 20:39:54 +0000 (21:39 +0100)]
vp9_raw_reorder_bsf: Remove a redundant allocation

This was left over from an earlier version which created the new
packet inside the current frame structure.  Now it just leaks an
unused packet, so remove the allocation entirely.

4 years agompeg4audio: Make avpriv_copy_pce_data() inline
Anton Khirnov [Thu, 16 Mar 2017 16:34:12 +0000 (17:34 +0100)]
mpeg4audio: Make avpriv_copy_pce_data() inline

The function currently accepts a PutBitContext and a GetBitContext,
which hardcodes their sizes into the lavc ABI. Since the function is
quite small and only called in a few places, the simplest solution is
making it inline, thus avoiding a runtime dependency completely.

Signed-off-by: Diego Biurrun <>
4 years agoarm: hevc_idct: Tune the add_res_8x8 and add_res_32x32 functions
Martin Storsjö [Thu, 27 Apr 2017 21:36:40 +0000 (00:36 +0300)]
arm: hevc_idct: Tune the add_res_8x8 and add_res_32x32 functions

Before:              Cortex     A7      A8      A9     A53
hevc_add_res_8x8_8_neon:     116.0    58.7    80.2    90.7
hevc_add_res_32x32_8_neon:  1230.0   737.5  1187.5   974.4
hevc_add_res_8x8_8_neon:      97.7    57.0    73.7    80.0
hevc_add_res_32x32_8_neon:  1216.0   698.7  1127.5   827.1

Signed-off-by: Martin Storsjö <>
4 years agohevc: Add NEON add_residual for bitdepth 8
Seppo Tomperi [Thu, 27 Apr 2017 19:05:29 +0000 (21:05 +0200)]
hevc: Add NEON add_residual for bitdepth 8

Optimized by Alexandra Hájková.

Signed-off-by: Martin Storsjö <>
4 years agomlp_parser: Drop in-parser downmix functionality
Vittorio Giovara [Wed, 26 Apr 2017 15:08:17 +0000 (11:08 -0400)]
mlp_parser: Drop in-parser downmix functionality

request_channel_layout is a decoder option and it makes no sense
to have it in a parser.

This feature was needed in the past when the decoder was allowed
to reuse the avctx from the demuxer. Nowadays the decoder receives
only the parameters from it, already containing the real channel
layout (and the correct request_channel_layout option).

After initialization the decoder overwrites the channel layout
with the downmixed one that is actually output, so there is no need
to preserve this functionality in the parser.

Signed-off-by: Vittorio Giovara <>
4 years agoaac_ac3_parser: Drop in-parser downmix functionality
Vittorio Giovara [Wed, 26 Apr 2017 15:08:17 +0000 (11:08 -0400)]
aac_ac3_parser: Drop in-parser downmix functionality

request_channel_layout is a decoder option and it makes no sense
to have it in a parser.

This feature was needed in the past when the decoder was allowed
to reuse the avctx from the demuxer. Nowadays the decoder receives
only the parameters from it, already containing the real channel
layout (and the correct request_channel_layout option).

After initialization the decoder overwrites the channel layout
with the downmixed one that is actually output, so there is no need
to preserve this functionality in the parser.

Signed-off-by: Vittorio Giovara <>
4 years agoavprobe: use av_spherical_projection_name() to print spherical projection names
James Almer [Tue, 4 Apr 2017 20:24:19 +0000 (17:24 -0300)]
avprobe: use av_spherical_projection_name() to print spherical projection names

Signed-off-by: James Almer <>
4 years agodump: use av_spherical_projection_name() to print spherical projection names
James Almer [Tue, 4 Apr 2017 20:24:18 +0000 (17:24 -0300)]
dump: use av_spherical_projection_name() to print spherical projection names

Signed-off-by: James Almer <>
4 years agospherical: add functions to retrieve and request projection names
James Almer [Thu, 20 Apr 2017 15:40:48 +0000 (11:40 -0400)]
spherical: add functions to retrieve and request projection names

Signed-off-by: James Almer <>
Signed-off-by: Vittorio Giovara <>
4 years agovaapi: Add external control of allow-profile-mismatch
Mark Thompson [Mon, 27 Mar 2017 19:46:11 +0000 (20:46 +0100)]
vaapi: Add external control of allow-profile-mismatch

Uses the just-added ALLOW_PROFILE_MISMATCH flag.

4 years agolavc: Add flag to allow profile mismatch with hardware decoding
Mark Thompson [Mon, 27 Mar 2017 19:45:21 +0000 (20:45 +0100)]
lavc: Add flag to allow profile mismatch with hardware decoding

4 years agovaapi_encode: Use gop_size consistently in RC parameters
Mark Thompson [Sun, 2 Apr 2017 22:05:13 +0000 (23:05 +0100)]
vaapi_encode: Use gop_size consistently in RC parameters

The non-H.26[45] codecs already use this form.  Since we don't
currently generate I frames for codecs which support them separately
to IDR, the p_per_i variable is set to infinity by default so that it
doesn't interfere with any other calculation.  (All the code for I
frames still exists, and it works for H.264 if set manually.)

4 years agoavfoundation: update to use AVCodecParameters
Vittorio Giovara [Wed, 26 Apr 2017 15:31:28 +0000 (11:31 -0400)]
avfoundation: update to use AVCodecParameters

4 years agomlp: Factor out channel layout subset checks
Vittorio Giovara [Tue, 25 Apr 2017 20:26:58 +0000 (16:26 -0400)]
mlp: Factor out channel layout subset checks

4 years agomlp: Drop ff_ prefix from a static function
Vittorio Giovara [Tue, 25 Apr 2017 20:26:57 +0000 (16:26 -0400)]
mlp: Drop ff_ prefix from a static function

4 years agomlp: Rename the channel layout variable
Vittorio Giovara [Tue, 25 Apr 2017 20:26:56 +0000 (16:26 -0400)]
mlp: Rename the channel layout variable

Purely cosmetic change, will make code more readable once the new
channel layout takes over.

4 years agomatroskaenc: don't warn about unknown spherical metadata when there isn't any
James Almer [Fri, 14 Apr 2017 16:06:35 +0000 (13:06 -0300)]
matroskaenc: don't warn about unknown spherical metadata when there isn't any

The same warning is issued when actual unknown spherical metadata is
found further down in the function.

Signed-off-by: James Almer <>
Signed-off-by: Anton Khirnov <>
4 years agomem: uninline av_malloc(z)_array()
Anton Khirnov [Thu, 30 Mar 2017 15:02:39 +0000 (17:02 +0200)]
mem: uninline av_malloc(z)_array()

Inlining public functions hardcodes their implementation into the ABI,
so it should be avoided unless there is a very good reason for it. No
such reason exists in this case.

4 years agohevc: Add support for bitdepth 10 for IDCT DC
Alexandra Hájková [Tue, 25 Apr 2017 17:43:41 +0000 (19:43 +0200)]
hevc: Add support for bitdepth 10 for IDCT DC

Signed-off-by: Martin Storsjö <>
4 years agohevc: Add NEON IDCT DC functions for bitdepth 8
Seppo Tomperi [Tue, 25 Apr 2017 17:41:29 +0000 (19:41 +0200)]
hevc: Add NEON IDCT DC functions for bitdepth 8

Signed-off-by: Alexandra Hájková <>
Signed-off-by: Martin Storsjö <>
4 years agoclearvideo: Convert to the new bitstream reader
Diego Biurrun [Fri, 14 Apr 2017 18:42:47 +0000 (20:42 +0200)]
clearvideo: Convert to the new bitstream reader

4 years agoAdd ClearVideo decoder
Kostya Shishkov [Thu, 2 Mar 2017 10:21:48 +0000 (11:21 +0100)]
Add ClearVideo decoder

Only I-frames are decoded for now.

Signed-off-by: Diego Biurrun <>