Commit Graph

4751 Commits

Author SHA1 Message Date
Martin Storsjö
7b7760ad6e aarch64: Fix negative movrel offsets for windows
On windows, the offset for the relocation doesn't get stored in
the relocation itself, but as an unsigned immediate in the opcode.
Therefore, negative offsets has to be handled via a separate sub
instruction, just as on MachO.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-08-22 13:41:08 +03:00
Paul B Mahol
1146133df8 avutil/eval: add linear interpolation helper 2017-08-19 12:42:24 +02:00
Ivan Kalvachev
30ae07d7ef Add macros to x86util.asm .
Improved version of VBROADCASTSS that works like the avx2 instruction.
Emulation of vpbroadcastd.
Horizontal sum HSUMPS that places the result in all elements.
Emulation of blendvps and pblendvb.

Signed-off-by: Ivan Kalvachev <ikalvachev@gmail.com>
2017-08-18 17:18:32 +01:00
Vittorio Giovara
1460408703 Add single precision planar RGB pixel formats
Add a pixel format flag to identify this family.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-08-15 15:26:20 +02:00
Vittorio Giovara
f357104866 pixfmt: Support chroma-derived and ictcp color matrices
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-08-10 15:54:06 +02:00
Vittorio Giovara
538e508751 pixfmt: Support chroma-derived and ictcp color matrices
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-08-10 15:36:04 +02:00
Martin Storsjö
9042402ec7 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>

Merged from Libav commit 4d330da006.
2017-08-10 11:58:25 +02:00
wm4
463b81de2b imgutils: add function to clear an image to black
Black isn't always just memset(ptr, 0, size). Limited YUV in particular
requires relatively non-obvious values, and filling a frame with
repeating 0 bytes is disallowed in some contexts. With component sizes
larger than 8 or packed YUV, this can become relatively complicated. So
having a generic function for this seems helpful.

In order to handle the complex cases in a generic way without destroying
performance, this code attempts to compute a black pixel, and then uses
that value to clear the image data quickly by using a function like
memset.

Common cases like yuv410p10 or rgba can't be handled with a simple
memset, so there is some code to fill memory with 2/4/8 byte patterns.
For the remaining cases, a generic slow fallback is used.

Signed-off-by: Anton Khirnov <anton@khirnov.net>

Merged from Libav commit 45df7adc1d.
2017-08-08 13:37:37 +02:00
wm4
caa12027ba lavc, lavu: move frame cropping to a convenience function
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Merged from Libav commit 47399ccdfd.
2017-08-08 13:35:09 +02:00
Paul B Mahol
ab6d89d7ee libavutil: add GRAY9 pixel format 2017-08-07 13:06:51 +02:00
Yogender Gupta
3407d8118c hwcontext_cuda : Support YUV444P16 format
Signed-off-by: Philip Langdale <philipl@overt.org>
2017-08-03 15:25:35 -07:00
Tobias Rapp
60008c0fe9 fate: update pixfmt_best test to check for endianness
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2017-07-27 08:53:37 +02:00
wm4
45df7adc1d imgutils: add function to clear an image to black
Black isn't always just memset(ptr, 0, size). Limited YUV in particular
requires relatively non-obvious values, and filling a frame with
repeating 0 bytes is disallowed in some contexts. With component sizes
larger than 8 or packed YUV, this can become relatively complicated. So
having a generic function for this seems helpful.

In order to handle the complex cases in a generic way without destroying
performance, this code attempts to compute a black pixel, and then uses
that value to clear the image data quickly by using a function like
memset.

Common cases like yuv410p10 or rgba can't be handled with a simple
memset, so there is some code to fill memory with 2/4/8 byte patterns.
For the remaining cases, a generic slow fallback is used.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-07-26 23:21:26 +02:00
wm4
47399ccdfd lavc, lavu: move frame cropping to a convenience function
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-07-26 23:20:40 +02:00
James Almer
4cebf0fc45 avutil/frame: add ICC Profile to av_frame_side_data_name
Reviwed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-07-26 11:31:17 -03:00
Kaustubh Raste
a776cb2074 libavcodec/mips: Optimize avc idct 4x4 for msa
Removed memset call and improved performance.

Signed-off-by: Kaustubh Raste <kaustubh.raste@imgtec.com>
Reviewed-by: Manojkumar Bhosale <Manojkumar.Bhosale@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-07-25 22:04:34 +02:00
Rostislav Pehlivanov
24de4fddca lavu/frame: add new side data type for ICC profiles
Many image formats support embedding of ICC profiles directly in
their bitstreams. Add a new side data type to allow exposing them to
API users.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-07-25 20:11:06 +01:00
Mark Thompson
f2c11b9337 pixdesc: Reindent after previous commit 2017-07-22 21:51:41 +01:00
Mark Thompson
f48efb14f9 pixdesc: Explicitly handle invalid arguments to av_find_best_pix_fmt_of_2() 2017-07-22 21:51:26 +01:00
Kaustubh Raste
ef1b4bdf44 libavutil/mips: Updated msa generic macros
Reduced msa load-store code.
Removed inline asm of GP load-store for 64 bit.
Updated variable names in GP load-store macros for naming consistency.
Corrected macro descriptions.

Signed-off-by: Kaustubh Raste <kaustubh.raste@imgtec.com>
Reviewed-by: Manojkumar Bhosale <Manojkumar.Bhosale@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-07-21 17:37:05 +02:00
Muhammad Faiz
a3d3cfa65c avutil: merge slice threading implementation from avcodec and avfilter
Rework it to improve performance. Now mutex is not shared by workers,
instead each worker has its own mutex and condition variable. This
reduces lock contention between workers. Also use atomic variable for
counter.

The interface also allows execute to run special function on main
thread, requested by Ronald.

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-07-19 15:50:07 +07:00
Mark Thompson
3192821237 pixdesc: Add a test for av_find_best_pix_fmt_of_2() 2017-07-18 22:56:30 +01:00
Mark Thompson
8a442d7a8a pixdesc: Improve scoring for opaque/unknown pixel formats
Hardware pixel formats do not tell you anything about their actual
contents, but should still score higher than formats with completely
unknown properties, which in turn should score higher than invalid
formats.

Do not return an AVERROR code as a score.

Fixes a hang in libavfilter where format negotiation gets stuck in a
loop because AV_PIX_FMT_NONE scores more highly than all other
possibilities.
2017-07-18 22:56:30 +01:00
Aleksandr Slobodeniuk
390e028c66 avutil/threadmessage: fix error return in case of av_fifo_alloc failure
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-07-14 02:30:37 +02:00
Martin Storsjö
1912973a2d 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>
2017-07-05 13:55:11 +03:00
Clément Bœsch
2658e66cd1 lavu/cpu: disable MMX warning on non x86 platforms
We have AV_CPU_FLAG_ARMV8 == AV_CPU_FLAG_SSE3 which causes a trigger of
this MMX warning on AArch64.
2017-06-29 18:00:58 +02:00
Hendrik Leppkes
15b00aea41 hwcontext_d3d11va: use correct license header 2017-06-28 00:19:55 +02:00
wm4
289d387330 hwcontext_d3d11va: add option to enable debug mode
Basically copied from VLC (LGPL):

http://git.videolan.org/?p=vlc.git;a=blob;f=modules/video_output/win32/direct3d11.c;h=e9fcb83dcabfe778f26e63d19f218caf06a7c3ae;hb=HEAD#l1482
http://git.videolan.org/?p=vlc.git;a=blob;f=modules/codec/avcodec/d3d11va.c;h=85e7d25caebc059a9770da2ef4bb8fe90816d76d;hb=HEAD#l599

Merges Libav commit cfc9e7c94e.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-06-27 18:05:02 +02:00
wm4
8d7fdba7b8 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.

Merges Libav commit 5030e3856c.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-06-27 18:05:02 +02:00
wm4
6f5ff3269b 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.

Merges Libav commit 98d73e4174.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-06-27 18:05:02 +02:00
wm4
1509d739a0 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).

Merges Libav commit 086321c612.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-06-27 18:05:02 +02:00
Martin Storsjö
3125a4a8a8 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.

Merges Libav commit fd1ffa1f10.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-06-27 18:05:02 +02:00
wm4
70143a3954 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.

Merges Libav commit f9e7a2f95a.
Also adds untested VP9 support.
The check for DXVA2 COBJs is removed. Just update your MinGW to
something newer than a 5 year old release.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-06-27 18:05:02 +02:00
wm4
3303511f33 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.

Merges Libav commit fff90422d1.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-06-27 18:05:02 +02:00
James Almer
4d62ee6746 x86inc: don't use read-only data sections on COFF targets
Yasm:
src/libavfilter/x86/af_volume.asm:24: warning: Standard COFF does not support read-only data sections
src/libavfilter/x86/af_volume.asm:24: warning: Unrecognized qualifier `align'

Nasm:
src/libavfilter/x86/af_volume.asm:24: error: standard COFF does not support section alignment specification
src/libavutil/x86/x86inc.asm:92: ... from macro `SECTION_RODATA' defined here

Tested-by: Clément Bœsch <u@pkh.me>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-06-27 12:48:04 -03:00
wm4
cfc9e7c94e hwcontext_d3d11va: add option to enable debug mode
Basically copied from VLC (LGPL):

http://git.videolan.org/?p=vlc.git;a=blob;f=modules/video_output/win32/direct3d11.c;h=e9fcb83dcabfe778f26e63d19f218caf06a7c3ae;hb=HEAD#l1482
http://git.videolan.org/?p=vlc.git;a=blob;f=modules/codec/avcodec/d3d11va.c;h=85e7d25caebc059a9770da2ef4bb8fe90816d76d;hb=HEAD#l599

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-06-27 00:23:12 +02:00
wm4
5030e3856c 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>
2017-06-27 00:23:12 +02:00
wm4
98d73e4174 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>
2017-06-27 00:23:12 +02:00
wm4
086321c612 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>
2017-06-27 00:23:12 +02:00
Diego Biurrun
fd502f4f5f build: Generalize yasm/nasm-related variable names
None of them are specific to the YASM assembler.

(Cherry-picked from libav commit 39e208f4d4)

Signed-off-by: James Almer <jamrial@gmail.com>
2017-06-21 17:00:29 -03:00
James Almer
e229df9478 x86/aacpsdsp: add ff_ps_hybrid_synthesis_deint_{sse,sse4}
About 2x faster than the c version.
2017-06-18 22:33:27 -03:00
Martin Storsjö
fd1ffa1f10 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>
2017-06-18 23:45:03 +03:00
Mark Thompson
4993a68f0f hwcontext: Mark local table static const 2017-06-15 00:02:06 +01:00
James Almer
e53c9065ca avutil/tests: remove float_dsp test
It's been ported to checkasm.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-06-14 19:20:19 -03:00
Mark Thompson
d59c6a3aeb 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.

(cherry picked from commit c5714b51aa)
2017-06-14 22:27:32 +01:00
Mark Thompson
a97fb14418 hwcontext_qsv: Implement mapping frames to the child device type
(cherry picked from commit e1c5d56b18)
2017-06-14 22:27:07 +01:00
Mark Thompson
f82ace71c0 hwcontext_qsv: Implement mapping frames from the child device type
Factorises out existing surface initialisation code to reuse.

(cherry picked from commit eaa5e07104)
2017-06-14 22:27:07 +01:00
Mark Thompson
ec3dbeae81 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.

(cherry picked from commit 27978155bc)
2017-06-14 22:27:07 +01:00
Mark Thompson
045ff8d30a hwcontext_qsv: Support derivation from child devices
(cherry picked from commit aa51bb3d27)
2017-06-14 22:27:07 +01:00
Mark Thompson
0b1794a43e hwcontext: Make it easier to work with device types
Adds functions to convert to/from strings and a function to iterate
over all supported device types.  Also adds a new invalid type
AV_HWDEVICE_TYPE_NONE, which acts as a sentinel value.

(cherry picked from commit b7487f4f3c)
2017-06-14 22:26:29 +01:00
Mark Thompson
b22172f6f3 hwcontext: Add device derivation
Creates a new device context from another of a different type which
refers to the same underlying hardware.

(cherry picked from commit b266ad56fe)
2017-06-14 22:25:57 +01:00
Mark Thompson
f2e4fb61af hwcontext_vaapi: Try to support the VDPAU wrapper
The driver is somewhat bitrotten (not updated for years) but is still
usable for decoding with this change.  To support it, this adds a new
driver quirk to indicate no support at all for surface attributes.

Based on a patch by wm4 <nfxjfg@googlemail.com>.

(cherry picked from commit e791b915c7)
2017-06-14 22:23:43 +01:00
Diego Biurrun
d76479c502 ppc: Drop support for Apple GCC
Apple GCC has not been a thing anymore on PowerPC since many years.
2017-06-13 12:34:35 +02:00
Henrik Gramner
aad1b6786e x86inc: Add some additional cpuflag relations
Simplifies writing assembly code that depends on available instructions.

LZCNT implies SSE2
BMI1 implies AVX+LZCNT
AVX2 implies BMI2
2017-06-12 11:41:25 +02:00
Diego Biurrun
97cfe1d8bd Convert all AVClass struct declarations to designated initializers. 2017-06-12 11:01:10 +02:00
Anton Mitrofanov
d991b3e8a8 x86inc: Remove argument from WIN64_RESTORE_XMM
The use of rsp was pretty much hardcoded there and probably didn't work
otherwise with stack_size > 0.
2017-06-09 13:43:01 +02:00
Henrik Gramner
cd4ca82459 x86inc: Prefer r14/r15 over r12/r13 on x86-64
Due to a peculiarity in the ModR/M addressing encoding, the r12 and r13
registers sometimes requires an additional byte when used as a base register.

r14 and r15 doesn't have that issue, so prefer using them.
2017-06-09 13:43:00 +02:00
Henrik Gramner
88dcdfad09 x86inc: Make REP_RET identical to RET in SSSE3+ functions
There's no point in emitting a rep prefix before ret on modern CPUs.
2017-06-09 13:43:00 +02:00
Henrik Gramner
406e0ddc0b x86inc: Fix call with memory operands
We overload the `call` instruction with a macro, but it would misbehave when
the macro argument wasn't a valid identifier. Fix it by explicitly checking
if the argument is an identifier.
2017-06-09 13:43:00 +02:00
wm4
f9e7a2f95a 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>
2017-06-08 21:20:18 +02:00
wm4
fff90422d1 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>
2017-06-08 20:55:36 +02:00
Kevin Mark
482566ccc3 libavutil/eval: Add round function to expression parser
We have floor, ceil, and trunc. Let's add round.

Signed-off-by: Kevin Mark <kmark937@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-06 18:31:47 +02:00
Michael Niedermayer
6019d721d4 avutil/softfloat: Fix sign error in and improve documentation of av_int2sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-04 23:41:08 +02:00
James Almer
a876958d0f 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

Before:

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

After:

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>
2017-06-02 21:00:35 -04:00
James Almer
bd1179e36b avutil/pixfmt: remove superfluous define
It's an AVColorSpace value since 82ad9cbd32.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-06-01 01:18:49 -03:00
Elviss Strazdins
2017ffc18f vaapi: Add ABGR map only if VA_FOURCC_ABGR is defined
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-05-29 13:50:03 +02:00
Aaron Levinson
3d040513a1 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
av_buffer_default_free()).

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
IDirectXVideoAccelerationService::CreateSurface().

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>
2017-05-20 09:41:45 +02:00
Clément Bœsch
6a3538bb23 Merge commit 'b83aea73404f6f9314e72fe5d6238deaffa12b2c'
* commit 'b83aea73404f6f9314e72fe5d6238deaffa12b2c':
  des-test: Pass the proper types to av_des_*() functions

See 183c3fa48a

Merged-by: Clément Bœsch <u@pkh.me>
2017-05-19 11:50:28 +02:00
Aaron Levinson
0c1c514643 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
av_buffer_default_free()).

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
IDirectXVideoAccelerationService::CreateSurface().

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>
2017-05-16 21:45:52 +01:00
wm4
f0435bbe17 hwcontext_videotoolbox: fix fate-source
Thanks to James Darnley for figuring out what the hell it wanted.
2017-05-15 18:50:04 +02:00
wm4
532b23f079 videotoolbox: add hwcontext support
This adds tons of code for no other benefit than making VideoToolbox
support conform with the new hwaccel API (using hw_device_ctx and
hw_frames_ctx).

Since VideoToolbox decoding does not actually require the user to
allocate frames, the new code does mostly nothing.

One benefit is that ffmpeg_videotoolbox.c can be dropped once generic
hwaccel support for ffmpeg.c is merged from Libav.

Does not consider VDA or VideoToolbox encoding.

Fun fact: the frame transfer functions are copied from vaapi, as the
mapping makes copying generic boilerplate. Mapping itself is not
exported by the VT code, because I don't know how to test.
2017-05-15 11:30:36 +02:00
James Almer
0fbc7a2169 x86/float_dsp: remove usage of integer instructions 2017-05-12 23:34:49 -03:00
James Almer
a47bd5d77e Merge commit '52627248e49e58eb4b78e4fcda90a64f4c476ea3'
* commit '52627248e49e58eb4b78e4fcda90a64f4c476ea3':
  frame: add a cropping rectangle to AVFrame

Merged-by: James Almer <jamrial@gmail.com>
2017-05-08 13:08:02 -03:00
Martin Storsjö
59cee42d7d 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>
2017-05-08 14:21:08 +03:00
Michael Niedermayer
277e397eb5 avutil/softfloat: Fix overflow in av_div_sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-06 23:23:39 +02:00
Michael Niedermayer
35f3df0d76 avutil/softfloat: Fix multiple runtime error: left shift of negative value -8
Fixes: 1352/clusterfuzz-testcase-minimized-5757565017260032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-06 00:33:19 +02:00
Clément Bœsch
90fe0800fb Merge commit '00b6a765430e5c5cacf0bd1be8b318d631cd4e14'
* commit '00b6a765430e5c5cacf0bd1be8b318d631cd4e14':
  hmac: Explicitly convert types at function pointer assignment

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-05-05 13:27:03 +02:00
Clément Bœsch
fcc4ed1efa lavu/sha512: update length argument following sha+md5 changes 2017-05-05 13:24:35 +02:00
Clément Bœsch
651ee93461 Merge commit 'e435beb1ea5380a90774dbf51fdc8c941e486551'
* commit 'e435beb1ea5380a90774dbf51fdc8c941e486551':
  crypto: consistently use size_t as type for length parameters

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-05-05 13:04:38 +02:00
Carl Eugen Hoyos
ae68bb779c lavu/timecode: Increase AV_TIMECODE_STR_SIZE.
Fixes the following warning:
libavutil/timecode.c:103:60: warning: '%02d' directive output may be truncated writing between 2 and 10 bytes into a region of size between 0 and 7
2017-05-05 10:09:12 +02:00
James Almer
6fdd35a312 Merge commit '92db5083077a8b0f8e1050507671b456fd155125'
* commit '92db5083077a8b0f8e1050507671b456fd155125':
  build: Generate pkg-config files from Make and not from configure
  build: Store library version numbers in .version files

Includes cherry-picked commits 8a34f36593 and
ee164727dd to fix issues.

Changes were also made to retain support for raise_major and build_suffix.

Reviewed-by: ubitux
Merged-by: James Almer <jamrial@gmail.com>
2017-05-04 19:59:30 -03:00
Clément Bœsch
3f17751eeb Merge commit '11a9320de54759340531177c9f2b1e31e6112cc2'
* commit '11a9320de54759340531177c9f2b1e31e6112cc2':
  build: Move build-system-related helper files to a separate subdirectory

"ffbuild" directory name is used instead of "avbuild".

Merged-by: Clément Bœsch <u@pkh.me>
2017-05-03 16:49:12 +02:00
Michael Niedermayer
79aa2ff199 avutil/softfloat: use ldexp(), fixes undefined shift
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-02 22:55:44 +02:00
Mark Thompson
c5714b51aa 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.
2017-04-30 17:33:18 +01:00
Mark Thompson
e1c5d56b18 hwcontext_qsv: Implement mapping frames to the child device type 2017-04-30 17:33:18 +01:00
Mark Thompson
eaa5e07104 hwcontext_qsv: Implement mapping frames from the child device type
Factorises out existing surface initialisation code to reuse.
2017-04-30 17:33:06 +01:00
Mark Thompson
27978155bc 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.
2017-04-30 16:13:56 +01:00
Mark Thompson
aa51bb3d27 hwcontext_qsv: Support derivation from child devices 2017-04-30 16:13:56 +01:00
James Almer
ad52eef997 spherical: add functions to retrieve and request projection names
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-04-27 09:59:54 -04:00
Clément Bœsch
06aafda03f Merge commit '05a603a94e4b3eeefa5e18ae653a848001461e89'
* commit '05a603a94e4b3eeefa5e18ae653a848001461e89':
  ppc: Merge types_altivec.h into util_altivec.h

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-26 16:27:24 +02:00
Anton Khirnov
04b0f0e371 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.
2017-04-26 09:05:28 +02:00
Aaron Levinson
5b281b476b libavutil/thread.h: Fixed g++ build error when ASSERT_LEVEL is greater than 1
Purpose: libavutil/thread.h: Fixed g++ build error when ASSERT_LEVEL
is greater than 1.  This is only relevant when thread.h is included by
C++ files.  In this case, the relevant code is only defined if
HAVE_PTHREADS is defined as 1.  Use configure --assert-level=2 to do
so.

Note: Issue discovered as a result of Coverity build failure.  Cause
of build failure pinpointed by Hendrik Leppkes.

Comments:

-- libavutil/thread.h: Altered ASSERT_PTHREAD_NORET definition such
   that it uses av_make_error_string instead of av_err2str().
   av_err2str() uses a "parenthesized type followed by an initializer
   list", which is apparently not valid C++.  This issue started
   occurring because thread.h is now included by the DeckLink C++
   files.  The alteration does the equivalent of what av_err2str()
   does, but instead declares the character buffer as a local
   variable.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-04-22 23:32:41 +02:00
James Almer
657c072036 Merge commit '2170017a1cd033b6f28e16476921022712a522d8'
* commit '2170017a1cd033b6f28e16476921022712a522d8':
  avutil: fix data race in av_get_cpu_flags()

This commit is a noop, see fed50c4304

Merged-by: James Almer <jamrial@gmail.com>
2017-04-13 18:25:30 -03:00
James Almer
7adfa7cdc6 Merge commit '075acbb6ff5740b2eea1bb7dd3afbc8e66e2ebf8'
* commit '075acbb6ff5740b2eea1bb7dd3afbc8e66e2ebf8':
  lavu: Add a video section to Doxygen documentation

Merged-by: James Almer <jamrial@gmail.com>
2017-04-13 17:31:15 -03:00
Paul B Mahol
030c8be7a2 pixfmt: Add gbrap10 pixel format
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-04-13 14:09:07 +02:00
Diego Biurrun
193b091890 thread: Define ff_mutex_* macros as stub functions when threads are disabled
Silences a bunch of "statement with no effect" warnings with threads disabled.
2017-04-12 10:07:09 +02:00
James Almer
f1d80bc630 x86/float_dsp: add ff_vector_fmul_reverse_avx2
~20% faster than AVX.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-04-11 21:35:35 -03:00
Steven Liu
8378466507 doc/APIChages: Add av_strireplace()
Add av_strireplace() into APIChanges

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-04-11 12:46:28 +08:00
Steven Liu
44cd7502c7 avutil/avstring: improve av_strreplace implement
Use AVBprint to implement av_strreplace
add av_strreplace test case TEST_STRREPLACE

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-04-11 10:54:35 +08:00
Michael Niedermayer
a44b3abb4c avutil/internal: Do not enable CHECKED with DEBUG
This avoids potential undefined behavior in debug mode while still allowing
developers which want to check for potential additional overflows to do so
by manually enabling this.

Reviewed-by: wm4
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-11 01:05:05 +02:00
James Almer
ed9b25a148 x86/float_dsp: add ff_vector_dmac_scalar_{sse2,avx,fma3} 2017-04-10 12:18:55 -03:00
James Almer
128e1fbf13 avutil/float_dsp: add test for vector_dmac_scalar 2017-04-10 12:16:30 -03:00
Paul B Mahol
4dc2dd80dc avutil/float_dsp: add vector_dmac_scalar()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-04-10 12:04:14 +02:00
Clément Bœsch
68c9a39942 Merge commit '706af9227b58657c73e3a4df3689da734f010500'
* commit '706af9227b58657c73e3a4df3689da734f010500':
  lavu: Document the color properties enumeration values origin

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-08 14:50:12 +02:00
Steve Lhomme
b378f5bd64 lavu: add support for Content Light Level side metadata
As found in HEVC.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-04-06 11:26:25 -03:00
James Almer
d1ee6fb729 Merge commit '6a1ea4ec932f4fc9fdc00ec51ee070b298ddb35f'
* commit '6a1ea4ec932f4fc9fdc00ec51ee070b298ddb35f':
  arm: warn/error on movrelx usage problematic with PIC on ELF

Merged-by: James Almer <jamrial@gmail.com>
2017-04-04 16:04:29 -03:00
Clément Bœsch
47d8410dac Merge commit 'a1d9de304fe63614e3aa8117fef17491fa80093d'
* commit 'a1d9de304fe63614e3aa8117fef17491fa80093d':
  Fix some mismatches between function parameter and doxygen parameter names.

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-03 20:41:16 +02:00
Michael Niedermayer
22b0daa1b3 Bump versions for master after 3.3
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-02 19:54:12 +02:00
Michael Niedermayer
e1cc7f83df Bump minor for 3.3
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-02 19:49:45 +02:00
Hendrik Leppkes
5c612c5ff8 Merge commit 'e18ba2dfd2d19aedc8afccf011d5fd0833352423'
* commit 'e18ba2dfd2d19aedc8afccf011d5fd0833352423':
  hwcontext_dxva2: make sure the sw frame format is the right one during transfer

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2017-04-01 18:53:40 +02:00
Hendrik Leppkes
0f9ce9c5fc Merge commit '5a1d605ceae448b476a525f7368ec452000d1f26'
* commit '5a1d605ceae448b476a525f7368ec452000d1f26':
  hwcontext_dxva2: split transfer_data() into upload/download functions

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2017-04-01 18:53:36 +02:00
Hendrik Leppkes
fbfa72916c Merge commit '9d7026574bbbe67d004a1c32911da75375692967'
* commit '9d7026574bbbe67d004a1c32911da75375692967':
  hwcontext_dxva2: fix handling of the mapping flags

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2017-04-01 18:53:32 +02:00
Hendrik Leppkes
d91e7aac12 Merge commit '0d3176e32f351d18d6174d8b05796829a75a4c6b'
* commit '0d3176e32f351d18d6174d8b05796829a75a4c6b':
  hwcontext_dxva2: do not assume the destination format during mapping is always the right one

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2017-04-01 18:53:27 +02:00
Steven Liu
99e5d81ef9 avutil/avstring: add av_strreplace API into avstring
refer to: http://creativeandcritical.net/str-replace-c
add av_strreplace API for replace string operations.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-04-01 10:55:04 +08:00
Martin Storsjö
10f4511f14 libavutil: Make LOCAL_ALIGNED(xx be equal to LOCAL_ALIGNED_xx(
Previously, the former form always produced a manually aligned,
padded buffer, while the latter can use DECLARE_ALIGNED, if that
amount of stack alignment is supported.

libavutil/internal.h needs to include mem.h, since it uses
the DECLARE_ALIGNED macro.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-31 22:06:52 +03:00
James Almer
9033e8723c avutil/spherical: add av_spherical_projection_name()
Reviewed-by: Benoit Fouet <benoit.fouet@free.fr>
Reviewed-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-03-31 13:26:56 -03:00
Michael Niedermayer
58b867a7cf Bump minor versions for master after release/3.3 branchpoint
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-31 13:21:06 +02:00
Michael Niedermayer
fc332f3e29 Bump minor versions for staring release/3.3 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-31 13:21:06 +02:00
Clément Bœsch
82ad9cbd32 Merge commit '17dac56b8fdd80c594c39b76de3f27a7949afbde'
* commit '17dac56b8fdd80c594c39b76de3f27a7949afbde':
  lavu: Rename ycgco color space appropriately

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-31 09:46:51 +02:00
Michael Niedermayer
afebf470ca avutil/tests/dict: Check return of av_dict_parse_string()
Fixes: CID1396402

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-30 23:35:18 +02:00
Mark Thompson
e3f9c5826a Merge commit 'e8bbacbf529049c401bfeea70d5e0b5d2c8b6de6'
* commit 'e8bbacbf529049c401bfeea70d5e0b5d2c8b6de6':
  hwcontext_qsv: support frame mapping

Merged-by: Mark Thompson <sw@jkqxz.net>
2017-03-30 21:54:46 +01:00
Mark Thompson
546524056d Merge commit '8ea15afbf2c1ec89b5d4bac1f0b8345e4b906a5d'
* commit '8ea15afbf2c1ec89b5d4bac1f0b8345e4b906a5d':
  hwcontext_qsv: transfer data through the child context when VPP fails

Merged-by: Mark Thompson <sw@jkqxz.net>
2017-03-30 21:18:23 +01:00
Mark Thompson
7cb082ac2f Merge commit 'b91ce4860054430d3712deb0d9487cac2fcb7d68'
* commit 'b91ce4860054430d3712deb0d9487cac2fcb7d68':
  hwcontext_qsv: do not fail when download/upload VPP session creation fails

Merged-by: Mark Thompson <sw@jkqxz.net>
2017-03-30 21:16:58 +01:00
Mark Thompson
59b1942aae Merge commit 'b115a35ea62b8f479b48d99a601f0e157517301e'
* commit 'b115a35ea62b8f479b48d99a601f0e157517301e':
  hwcontext_qsv: add support for the P8 format

Merged-by: Mark Thompson <sw@jkqxz.net>
2017-03-30 21:16:09 +01:00
Hendrik Leppkes
14764b93e2 Merge commit '10065d9324c2e35ce7040b6a2b9ebf6079bcbf42'
* commit '10065d9324c2e35ce7040b6a2b9ebf6079bcbf42':
  hwcontext_dxva2: add support for the P8 format

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2017-03-30 11:37:39 +02:00
Hendrik Leppkes
9ca5d2de5d Merge commit '910973765417f06a4a9ccbd006e4df74c32ecb01'
* commit '910973765417f06a4a9ccbd006e4df74c32ecb01':
  hwcontext_dxva2: frame mapping support

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2017-03-30 11:33:51 +02:00
Clément Bœsch
71c22fb7ae Merge commit '8ad9f9d675eab139aa2208722009eeed981460dd'
* commit '8ad9f9d675eab139aa2208722009eeed981460dd':
  hwcontext_vaapi: Frame mapping support

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-30 10:55:32 +02:00
Clément Bœsch
4cda23f1f1 Merge commit 'd06aa24ba583ad08025da9e1b29afcd8218ff9b0'
* commit 'd06aa24ba583ad08025da9e1b29afcd8218ff9b0':
  hwcontext: Hardware frame mapping

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-30 10:36:37 +02:00
Clément Bœsch
03f5e80bdb Merge commit '67351924fa91dea4339109100a4c0689f006581f'
* commit '67351924fa91dea4339109100a4c0689f006581f':
  Drop unreachable break and return statements

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-30 10:26:29 +02:00
Clément Bœsch
f291a9a1ad Merge commit '99434f4df81b6801b2b535d5b9143305595784f6'
* commit '99434f4df81b6801b2b535d5b9143305595784f6':
  float_dsp: Have implementation match function pointer prototype

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-30 10:23:25 +02:00
Clément Bœsch
549045254c Fix all -Wformat warnings raised by DJGPP 2017-03-29 14:49:29 +02:00
Clément Bœsch
1473afac5d lavu/mem: clamp alignment to 16 for DJGPP
See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80208
2017-03-29 14:49:29 +02:00
Clément Bœsch
bfdcdd6d82 lavu: add av_fourcc_make_string() and av_fourcc2str() 2017-03-29 14:49:29 +02:00
Mark Thompson
1bd986ed4b hwcontext: Move NONE to the be the first member of AVHWDeviceType
Also use that to fix a warning in av_hwdevice_get_type_name().
2017-03-27 21:54:06 +01:00
Clément Bœsch
2a69724fd5 Merge commit '0456e684394dc5a7b98ab9ebb48396d743bf3730'
* commit '0456e684394dc5a7b98ab9ebb48396d743bf3730':
  audio_fifo: Drop write-only variable

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-24 13:17:55 +01:00
Clément Bœsch
0b3decc596 Merge commit '0d9b9bd37f43ee29ad9f709d85c8f3be9db71104'
* commit '0d9b9bd37f43ee29ad9f709d85c8f3be9db71104':
  lavu: Add JEDEC P22 color primaries

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-24 11:21:46 +01:00
Clément Bœsch
a44ab512e6 lavu/pixfmt: fix redundant comment
Mistake introduced in a1f6b1d9d8.
2017-03-24 11:17:51 +01:00
James Almer
c97e986e90 Merge commit '7911186ed616ae81dd8617d6d0e8b08c818db9d8'
* commit '7911186ed616ae81dd8617d6d0e8b08c818db9d8':
  emms: Give apriv_emms_yasm() a more general name

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 18:28:56 -03:00
James Almer
29db87af52 Merge commit '6be7944ee2ec2f045e6eb9a93237e992c8b20ac4'
* commit '6be7944ee2ec2f045e6eb9a93237e992c8b20ac4':
  x86: Add missing colons after assembly labels

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 18:05:27 -03:00
Clément Bœsch
a1f6b1d9d8 Merge commit '310c55f1799deab395319471a75c528d0fa7b30d'
* commit '310c55f1799deab395319471a75c528d0fa7b30d':
  pixfmt: Document alternative names for smpte 431 and 432

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-23 11:22:32 +01:00
Vittorio Giovara
5f90ad99bb spherical: Change types of bounding and pad to uint32_t
These values are defined to be 32bit in the specification,
so it makes more sense to store them as fixed width.

Based on a patch by Micahel Niedermayer <michael@niedermayer.cc>.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-03-23 10:09:18 +01:00
Vittorio Giovara
35cf146a33 lavu: Drop deprecated av_dlog macro
Deprecated in 05/2015.
2017-03-23 10:09:17 +01:00
Vittorio Giovara
619a433eca lavu: Drop deprecated option type
Deprecated in 02/2014.
2017-03-23 10:09:17 +01:00
Vittorio Giovara
dd343fd986 lavu: Drop deprecated VDPAU pixel formats
Deprecated in 07/2013.
2017-03-23 10:09:17 +01:00
Vittorio Giovara
0648dec19d lavc: Drop deprecated stream codec tag
Deprecated in 07/2015.
2017-03-23 10:09:17 +01:00
Diego Biurrun
dcc39ee10e lavc: Remove deprecated XvMC support hacks
Deprecated in 11/2013.
2017-03-23 10:09:14 +01:00
Vittorio Giovara
07a2b15594 Bump major versions of all libraries
This disables everything that was deprecated at least 18 months ago.

Readjust the minimum API version as needed, postponing any
API-incompatible changes until the next bump.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-03-23 09:56:20 +01:00
Clément Bœsch
443e969293 Merge commit '27079a426c9d3db918b158976e44b9b143d78e1c'
* commit '27079a426c9d3db918b158976e44b9b143d78e1c':
  buffer: convert to stdatomic

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-22 17:46:01 +01:00
Clément Bœsch
67d8eabdbb lavu/buffer: drop USE_ATOMICS
USE_ATOMICS is only set if there is no thread implementation enabled, in
which case you can't expect any lock mechanism from FFmpeg.

This is also conflicting with the incoming use of stdatomic.
2017-03-22 17:40:03 +01:00
Martin Storsjö
8e2346154e libavutil: Hook up the rest of the gcc specific attributes to clang as well
Hook up all attributes that don't have a MSVC specific version at the
moment.

See f637046d31 for details.

These don't seem to be critical for building with clang in MSVC mode
though, and thus haven't been hooked up until now.

These seem to build fine with as old clang as 3.3 at least.
(clang 3.3 disguises itself as gcc 4.2 normally, so all of these
have been used for clang before, except for av_cold.)

The clang version numbers themselves are useless for detecting what
attributes are available, since Apple's clang builds use a completely
different versioning (presenting itself as e.g. clang 8.0 instead
of 3.8).

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-22 14:25:45 +02:00
Jun Zhao
9365dfcbf6 hwcontext: fix comments for av_hwdevice_ctx_alloc()
fix the wrong comments for av_hwdevice_ctx_alloc()

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2017-03-22 00:58:42 +00:00
James Almer
d8962ffbd8 avutil/x86util: don't use movss in VBROADCASTSS macro when src and dst args are the same
Reviewed-by: Henrik Gramner <henrik@gramner.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-03-21 19:15:00 -03:00
Martin Storsjö
3aa9c523e9 libavutil: Define the noreturn attribute for clang in MSVC mode as well
This is a follow-up to f637046d31.

Without the noreturn attribute set, avconv_opt.c fails to build after
d2e6dd32a4 with the error "control may reach end of non-void function".
By making sure the noreturn attribute is set properly, this compiles
as intended.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-21 22:57:21 +01:00
Mark Thompson
b7487f4f3c hwcontext: Make it easier to work with device types
Adds functions to convert to/from strings and a function to iterate
over all supported device types.  Also adds a new invalid type
AV_HWDEVICE_TYPE_NONE, which acts as a sentinel value.
2017-03-20 23:15:43 +00:00
Mark Thompson
b266ad56fe hwcontext: Add device derivation
Creates a new device context from another of a different type which
refers to the same underlying hardware.
2017-03-20 23:15:43 +00:00
Clément Bœsch
3898e346b3 Merge commit '07e1f99a1bb41d1a615676140eefc85cf69fa793'
* commit '07e1f99a1bb41d1a615676140eefc85cf69fa793':
  x86util: Document SBUTTERFLY macro

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-20 18:38:07 +01:00
Clément Bœsch
2feef75cb5 Merge commit '09a145b3c837273b1379321e44386a3233156e75'
* commit '09a145b3c837273b1379321e44386a3233156e75':
  hwcontext_vdpau: Remove duplicate definition of GET_CALLBACK

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-20 16:05:51 +01:00
Clément Bœsch
3835283293 Merge commit '4fb311c804098d78e5ce5f527f9a9c37536d3a08'
* commit '4fb311c804098d78e5ce5f527f9a9c37536d3a08':
  Drop memalign hack

Merged, as this may indeed be uneeded since
46e3936fb0.

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-20 08:54:44 +01:00
Clément Bœsch
a5cf6628d6 Merge commit 'f01f7a7846529b7c3ef343f117eaa2c0a1457af0'
* commit 'f01f7a7846529b7c3ef343f117eaa2c0a1457af0':
  hwcontext_dxva2: use the special UC copy for downloading frames

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-20 08:37:40 +01:00
Clément Bœsch
8200b16a9c Merge commit 'd7bc52bf456deba0f32d9fe5c288ec441f1ebef5'
* commit 'd7bc52bf456deba0f32d9fe5c288ec441f1ebef5':
  imgutils: add a function for copying image data from GPU mapped memory

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-20 08:34:10 +01:00
Clément Bœsch
9c2436e1e7 lavu: add AV_PIX_FMT_FLAG_BAYER 2017-03-20 08:02:30 +01:00
Clément Bœsch
ea8efc9594 lavu/mathematics: split closing bracket out of ifdefery 2017-03-18 23:50:05 +01:00
Clément Bœsch
1e1513d01a lavu/mathematics: document so-called "cruft" 2017-03-18 23:50:03 +01:00
Clément Bœsch
53587ca482 Merge commit 'ec021d48445a414325ad59a73f9cde3212b173e4'
* commit 'ec021d48445a414325ad59a73f9cde3212b173e4':
  buffer: fix av_buffer_pool_init2() documentation

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-18 19:22:30 +01:00
Vittorio Giovara
f20bcec4c2 spherical: Change types of bounding and pad to uint32_t
These values are defined to be 32bit in the specification,
so it makes more sense to store them as fixed width.

Based on a patch by Micahel Niedermayer <michael@niedermayer.cc>.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-03-17 13:12:25 -04:00
Carl Eugen Hoyos
1cd58e9154 lavu/spherical: Make AVSphericalMapping pointer parameter const.
Reflects the actual code and silences a gcc warning:
ffprobe.c:1797:42: warning: passing argument 1 of 'av_spherical_tile_bounds' discards 'const' qualifier from pointer target type
2017-03-16 22:18:12 +01:00
Clément Bœsch
5e4a572699 Merge commit '24a362569bff1d4161742fffaca80a4a4428be8a'
* commit '24a362569bff1d4161742fffaca80a4a4428be8a':
  buffer: fix av_buffer_realloc() when the data is offset wrt buffer start

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-16 21:42:45 +01:00
James Almer
30fe4b8d4c Merge commit 'f79d847400d218cfd0b95f10358fe6e65ec3c9c4'
* commit 'f79d847400d218cfd0b95f10358fe6e65ec3c9c4':
  intreadwrite: Use the __unaligned keyword on MSVC for ARM and x86_64

Merged-by: James Almer <jamrial@gmail.com>
2017-03-15 21:20:44 -03:00
James Almer
916dff9cb1 Merge commit '230b1c070baa3b6d4bd590426a365b843d60ff50'
* commit '230b1c070baa3b6d4bd590426a365b843d60ff50':
  intreadwrite: Add intermediate variables in the byteswise AV_W*() macros

Mostly a noop. Merged for cosmetic purposes.
See d83ff76ca0

Merged-by: James Almer <jamrial@gmail.com>
2017-03-15 21:17:37 -03:00
Diego Biurrun
994c4bc107 x86util: Port all macros to cpuflags
Also do some small cosmetic changes: Drop pointless _MMX suffix from ABSD2
macro name, drop pointless check for MMX support, we always assume MMX is
available in our SIMD code, fix spelling.
2017-03-14 17:23:32 +01:00
Martin Storsjö
dda45c087b aarch64: Add parentheses around the offset parameter in movrel
This fixes building with clang for linux with PIC enabled.

This is cherrypicked from libav commit
8847eeaa14.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:50 +02:00
Michael Niedermayer
1d0bad421c avutil/tests/lfg: Remove debugging start/stop timer
Fixes code with qemu ARM

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-08 14:32:00 +01:00
Thomas Turner
a50ccbd240 avutil/tests/lfg.c: added proper normality test
The Chen-Shapiro(CS) test was used to test normality for
Lagged Fibonacci PRNG.

Normality Hypothesis Test:

The null hypothesis formally tests if the population
the sample represents is normally-distributed. For
CS, when the normality hypothesis is True, the
distribution of QH will have a mean close to 1.

Information on CS can be found here:

http://www.stata-journal.com/sjpdf.html?articlenum=st0264
http://www.originlab.com/doc/Origin-Help/NormalityTest-Algorithm

Signed-off-by: Thomas Turner <thomastdt@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-08 14:32:00 +01:00
James Almer
dbc932e745 Revert "lavu/atomic: add support for the new memory model aware gcc built-ins"
This reverts commit faa9d29829.

This change became superfluous when support for C11 atomics was introduced.
Reverting it will make the removal of this implementation in an upcoming
merge conflict free.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-03-08 00:48:37 -03:00
Vittorio Giovara
1b7ffddb3a spherical: Add tiled equirectangular type and projection-specific properties
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-03-07 11:19:37 -05:00
Vittorio Giovara
6bce6aa17d spherical: Add tiled equirectangular type and projection-specific properties
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-03-07 11:07:02 -05:00
James Almer
a43389547c avutil/md5: stop discarding the const qualifier for the src pointer
The code modifying the buffer on big endian systems was removed.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-03-03 13:37:11 -03:00
James Almer
e2b7ae4b19 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

Before:

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

After:

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>
2017-03-03 13:36:49 -03:00
Michael Niedermayer
55196e5d10 Revert "avutil/frame: Disallow zero sized frame side data"
Found a case where we use size==0, the other related commits
remain needed, and should be sufficient to fix the original issue

This reverts commit 7e4f32f4e4.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-03 01:03:29 +01:00
Mark Thompson
2b8151c806 hwcontext_vaapi: Don't abort on failing to allocate from a fixed-size pool
Cherry-picked from Libav d30719e62d.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2017-03-02 11:20:47 +01:00
wm4
554bc4eea8 avcodec, avutil, avformat: remove AVOption requirement for some fields
Allow all struct fields to be accessed directly, as long as they're
public.

Before this change, many fields were "public", but could be accessed via
AVOption only. This meant they were effectively not public, but were
present for documentation purposes, which was incredibly confusing at
best.
2017-03-02 10:32:12 +01:00
James Almer
19d57ca62e libavutil: add av_mod_uintp2
Signed-off-by: James Almer <jamrial@gmail.com>
2017-03-01 11:23:19 -05:00
Ganesh Ajjanagadde
7bfda7d157 intmath: add faster clz support 2017-03-01 11:23:19 -05:00
Diego Biurrun
39e208f4d4 build: Generalize yasm/nasm-related variable names
None of them are specific to the YASM assembler.
2017-03-01 10:18:15 +01:00
Micah Galizia
489c09ad4b add locale month names to av_small_strptime
Signed-off-by: Micah Galizia <micahgalizia@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-26 17:16:22 +01:00
Michael Niedermayer
7e4f32f4e4 avutil/frame: Disallow zero sized frame side data
There should be no case that needs this and its a potential for
creating corner cases

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-25 22:02:23 +01:00
Michael Niedermayer
5804201cba avutil/frame: Reimplement av_frame_new_side_data() without size=0 special case
The size 0 special case causes side data to be created which is
different and a special case if for any reasons size = 0 is passed

Fixes: multiple runtime error: null pointer passed as argument 1, which is declared to never be null
Fixes: 653/clusterfuzz-testcase-5773837415219200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-25 22:02:23 +01:00
Michael Niedermayer
4614bf2caf Factorize CHECK/SUINT code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-21 00:40:20 +01:00
Michael Niedermayer
e8d4eacc07 Factor CHECKED out of DEBUG so it can be set seperatly
Suggested-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 15:39:36 +01:00
James Darnley
5336887867 avcodec/h264: sse2, avx h luma mbaff deblock/loop filter
x86-64 only

Yorkfield:
- sse2: ~2.17x (434 vs. 200 cycles)

Nehalem:
- sse2: ~2.94x (409 vs. 139 cycles)

Skylake:
- sse2: ~3.10x (370 vs. 119 cycles)
- avx:  ~3.29x (370 vs. 112 cycles)
2017-02-18 20:26:52 +01:00
James Darnley
7627df15d4 x86util: import MOVHL macro
Originally committed to x264 in 1637239a by Henrik Gramner who has
agreed to re-license it as LGPL.  Original commit message follows.

    x86: Avoid some bypass delays and false dependencies

    A bypass delay of 1-3 clock cycles may occur on some CPUs when transitioning
    between int and float domains, so try to avoid that if possible.
2017-02-18 20:26:51 +01:00
James Darnley
9d815b7424 avcodec/x86: deduplicate PASS8ROWS macro 2017-02-18 20:26:49 +01:00
Martin Storsjö
8847eeaa14 aarch64: Add parentheses around the offset parameter in movrel
This fixes building with clang for linux with PIC enabled.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-02-16 09:56:11 +02:00
Mark Thompson
e791b915c7 hwcontext_vaapi: Try to support the VDPAU wrapper
The driver is somewhat bitrotten (not updated for years) but is still
usable for decoding with this change.  To support it, this adds a new
driver quirk to indicate no support at all for surface attributes.

Based on a patch by wm4 <nfxjfg@googlemail.com>.
2017-02-13 21:44:47 +00:00
wm4
50708f4aa4 hwcontext_dxva2: support D3D9Ex
D3D9Ex uses different driver paths. This helps with "headless"
configurations when no user logs in. Plain D3D9 device creation will
fail if no user is logged in, while it works with D3D9Ex.

Signed-off-by: Anton Khirnov <anton@khirnov.net>

Merges Libav commit c2f97f0508.
2017-02-13 08:01:20 +01:00
wm4
e3af49b14b AVFrame: add an opaque_ref field
This is an extended version of the AVFrame.opaque field, which can be
used to attach arbitrary user information to an AVFrame.

The usefulness of the opaque field is rather limited, because it can
store only up to 32 bits of information (or 64 bit on 64 bit systems).
It's not possible to set this field to a memory allocation, because
there is no way to deallocate it correctly.

The opaque_ref field circumvents this by letting the user set an
AVBuffer, which makes the user data refcounted.

Signed-off-by: Anton Khirnov <anton@khirnov.net>

Merges Libav commit 04f3bd3496.
2017-02-13 08:01:20 +01:00
Anton Khirnov
4de220d2e3 frame: allow align=0 (meaning automatic) for av_frame_get_buffer()
This will avoid every caller from hardcoding some specific alignment,
which may break in the future with new instruction sets.
2017-02-11 11:37:45 +01:00
Anton Khirnov
e6bff23f1e cpu: add a function for querying maximum required data alignment 2017-02-11 11:37:45 +01:00
wm4
c2f97f0508 hwcontext_dxva2: support D3D9Ex
D3D9Ex uses different driver paths. This helps with "headless"
configurations when no user logs in. Plain D3D9 device creation will
fail if no user is logged in, while it works with D3D9Ex.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-02-11 11:37:45 +01:00
wm4
04f3bd3496 AVFrame: add an opaque_ref field
This is an extended version of the AVFrame.opaque field, which can be
used to attach arbitrary user information to an AVFrame.

The usefulness of the opaque field is rather limited, because it can
store only up to 32 bits of information (or 64 bit on 64 bit systems).
It's not possible to set this field to a memory allocation, because
there is no way to deallocate it correctly.

The opaque_ref field circumvents this by letting the user set an
AVBuffer, which makes the user data refcounted.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-02-11 11:37:45 +01:00