Commit Graph

4517 Commits

Author SHA1 Message Date
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
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
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
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
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
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 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
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
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
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
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
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