Commit Graph

86638 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 5659f74047 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
readable.

Merges Libav commit 831cfe10b4.

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

Merges Libav commit 4dec101acc.
Adds changes to vp9 over the Libav patch.

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

Merges Libav commit bd747b9226.

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
Paul B Mahol feab761b73 avcodec/interplayvideo: properly check if there is enough bytes left
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-27 15:46:08 +02:00
Hein-Pieter van Braam c4cbaec6e3 Interplay MVE: Changelog entry for changes
Signed-off-by: Hein-Pieter van Braam <hp@tmm.cx>
2017-06-27 15:10:37 +02:00
Hein-Pieter van Braam 8f96da060a Interplay MVE: Implement frame format 0x10
This implements the 0x10 frame format for Interplay MVE movies. The
format is a variation on the 0x06 format with some changes. In addition
to the decoding map there's also a skip map. This skip map is used to
determine what 8x8 blocks can change in a particular frame.

This format expects to be able to copy an 8x8 block from before the last
time it was changed. This can be an arbitrary time in the past. In order
to implement this this decoder allocates two additional AVFrames where
actual decoding happens. At the end of a frame decoding changed blocks
are copied to a finished frame based on the skip map.

The skip map's encoding is a little convulted, I'll refer to the code
for details.

Values in the decoding map are the same as in format 0x06.

Signed-off-by: Hein-Pieter van Braam <hp@tmm.cx>
2017-06-27 15:09:12 +02:00
Hein-Pieter van Braam 19f6fd199e Interplay MVE: Implement frame format 0x06
This implements the 0x06 frame format for Interplay MVE movies. The
format is relatively simple. The video data consists of two parts:

16 bits per 8x8 block movement data
a number of 8x8 blocks of pixel data

For each 8x8 block of pixel data the movement data is consulted. There
are 3 possible meanings of the movement data:
* zero     : copy the 8x8 block from the pixel data
* negative : copy the 8x8 block from the previous frame from an offset
             determined by the actual value of the entry -0xC000.
* positive : copy the 8x8 block from the current frame from an offset
             determined by the actual value of the entry -0x4000

Decoding happens in two passes, in the fist pass only new pixeldata is
copied, during the second pass data is copied from the previous and
current frames.

The codec expects that the current frame being decoded to still has the
data from 2 frames ago on it when decoding starts.

Signed-off-by: Hein-Pieter van Braam <hp@tmm.cx>
2017-06-27 15:08:39 +02:00
Hein-Pieter van Braam 8f87bfb4b7 Interplay MVE: Refactor IP packet format
Interplay MVE can contain up to three different frame formats. They
require different streams of information to render a frame. This patch
changes the IP packet format to prepare for the extra frame formats.

Signed-off-by: Hein-Pieter van Braam <hp@tmm.cx>
2017-06-27 15:06:14 +02:00
Hein-Pieter van Braam ba2c385006 Interplay MVE: Implement MVE SEND_BUFFER operation
Interplay MVE movies have a SEND_BUFFER operation. Only after this
command does the current decoding buffer get displayed. This is required
for the other frame formats. They are fixed-size and can't always encode
a full frame worth of pixeldata.

This code prevents half-finished frames from being emitted.

Signed-off-by: Hein-Pieter van Braam <hp@tmm.cx>
2017-06-27 15:03:51 +02:00
Paul B Mahol bbaca6e867 avcodec/proresenc_kostya: add 4444XQ profile
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-27 13:53:51 +02:00
Michael Niedermayer 0f8d3d8a46 avcodec/ffv1enc: compute the max number of slices and limit by that
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-27 13:09:58 +02:00
Andreas Håkon a29c712729 avformat: Fix Pro-MPEG non-square matrix
Reviewed-by:vtarca@mobibase.com
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-27 12:54:06 +02:00
Michael Niedermayer 430d4f2bb5 avcodec/ffv1enc: Allow less than 2 rows of slices for low vertical resolution
Fixes: Ticket5548

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-27 12:54:06 +02:00
Paul B Mahol 4ed7c2bbc3 avcodec/utvideodec: add SIMD for restore_rgb_planes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-27 09:54:10 +02:00
Paul B Mahol 3594788b71 avcodec/utvideodec: decode to GBR(A)P
This is actually internal utvideo format.
Allows to make use of SIMD for median prediction for rgb(a) formats,
thus speeding up decoding.
Simplifies code, eases further developement and maintenance.

Update FATE because of pixel format switch.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-26 20:11:58 +02:00
Paul B Mahol e9510dc032 avfilter: remove usage of empty header
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-26 19:43:41 +02:00
Kyle Swanson c11ca6105e avcodec/g722enc: force mono channel layout
Signed-off-by: Kyle Swanson <k@ylo.ph>
2017-06-26 09:46:58 -05:00
Michael Niedermayer 3c70251780 avcodec/jpeg2000dwt: Fix integer overflows in sr_1d97_int()
Fixes: runtime error: signed integer overflow: 1157259380 + 1157259380 cannot be represented in type 'int'
Fixes: 2365/clusterfuzz-testcase-minimized-6020421927305216

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-26 16:06:25 +02:00
Michael Niedermayer ea5366670e avcodec/jpeg2000dwt: Fix integer overflow in dwt_decode97_int()
Fixes: runtime error: signed integer overflow: -163654656 * 256 cannot be represented in type 'int'
Fixes: 2367/clusterfuzz-testcase-minimized-4648678897745920

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-26 16:06:25 +02:00
Michael Niedermayer 4147bb9053 avcodec/ffv1enc: Try to choose slice count so that slice packet sizes are within the supported size
Fixes assertion failure

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-26 16:06:25 +02:00
Michael Niedermayer 449cdfa687 avcodec/ffv1: Increase the maximum number of slices to 1024
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-26 16:06:25 +02:00
Matthieu Bouron db5bf64b21 lavc/x86: clear r2 higher bits in ff_sbr_sum_square
Suggested-by: James Almer <jamrial@gmail.com>
2017-06-26 09:55:23 +02:00
Paul B Mahol 915be7e13a avcodec/proresenc_kostya: enable frame threading
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-26 09:11:03 +02:00
Michael Niedermayer 7d317d4706 avcodec/frame_thread_encoder: Fix AV_OPT_TYPE_STRING handling in priv_data
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-26 01:06:04 +02:00
Paul B Mahol 4bd4fc56ab avcodec/proresenc_kostya: use frame metadata instead of avctx
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-26 00:01:07 +02:00
Paul B Mahol 315f51128a avcodec/prores_kostya: increase bits usage when alpha is used
Also fix undefined left shift of negative variable.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-25 17:36:54 +02:00
Paul B Mahol 22a03c2900 avfilter/vf_blend: add extremity blend mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-25 16:39:10 +02:00
Paul B Mahol 8a14374ab3 avfilter/vf_waveform: allow alpha output for >8 depth planar rgb inputs
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-25 13:14:22 +02:00
Paul B Mahol f269a1e0b8 avfilter/vf_overlay: separate functions with main alpha
~5-15% faster overall with main input without alpha.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-25 12:32:53 +02:00
Michael Niedermayer 89f8bff798 avcodec/hevcdec: Do not check the first ff_init_cabac_decoder() call in hls_decode_entry_wpp() for failure
The result of the call is not used in any testcase but breaks some cases if
its failure is considered.

Fixes regression found by jamrial

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-25 04:25:56 +02:00
Michael Niedermayer 73ea2a028e avcodec/wavpack: Fix integer overflow in wv_unpack_stereo()
Fixes: runtime error: signed integer overflow: 2080374785 + 2080374784 cannot be represented in type 'int'
Fixes: 2351/clusterfuzz-testcase-minimized-5359403240783872

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-25 01:13:17 +02:00
Michael Niedermayer 63e7bfe78e avcodec/hevc_ps: Fix max_dec_buffer check
Fixes: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
Fixes: 2339/clusterfuzz-testcase-minimized-6663164320022528

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-25 01:13:17 +02:00
Paul B Mahol 5c1f4330d4 avfilter/vf_lut2: add support for gray10 and gray12 pixel formats
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-24 22:40:32 +02:00
Paul B Mahol 1054249111 avcodec/adpcm_data: use uint16_t to handle all values
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-24 22:30:44 +02:00
Jun Zhao 32deea87c1 lavc/tests/golomb: Add unit test for set_ue_golomb_long.
Add unit test for set_ue_golomb_long.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-24 22:17:15 +02:00
Jun Zhao e61abe2d73 lavc/golobm: Add set_ue_golomb_long to support up to 2^32 -2.
add set_ue_golomb_long to support up to 2^32-2.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-24 22:17:15 +02:00
Jun Zhao 2b7d9a1f3f lavc/put_bits: Add put_bits64() to support up to 64 bits.
put_bits64() can write up to 64 bits into a bitstream.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-24 22:17:15 +02:00
Michael Niedermayer 2476067680 avcodec/hevcdec: Use error path if init_get_bits8() fails
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-24 22:17:15 +02:00
Michael Niedermayer 933aa91e31 avcodec/hevcdec: check ff_init_cabac_decoder() for failure
Fixes: runtime error: left shift of 1965559808 by 4 places cannot be represented in type 'int'
Fixes: 2333/clusterfuzz-testcase-minimized-5223935677300736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-24 22:17:15 +02:00
Paul B Mahol c1b43e8452 avfilter/vf_overlay: remove rgb option
Its been deprecated for over 3 years.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-24 19:20:46 +02:00
Paul B Mahol f483949188 avfilter/af_headphone: do not free frame that's gonna be reused later
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-24 19:15:57 +02:00
Paul B Mahol c90b88090c avfilter: do not leak AVFrame on failed buffer allocation
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-24 19:15:57 +02:00
Marton Balint db9e87dd8c avformat/file: increase min/max packet size to 256k for written files
Buffering more than one packet can be a huge performance improvement for
encoding files with small packets (e.g. wav) over SMB/CIFS.

Acked-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-06-24 18:51:29 +02:00
Marton Balint eeeb595c7f avformat: make flush_packets a tri-state and set it to -1 (auto) by default
If flushing is not disabled, then mux.c will signal the end of the packets with
an AVIO_DATA_MARKER_FLUSH_POINT, and aviobuf will be able to decide to flush or
not based on the preferred minimum packet size set by the used protocol.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-06-24 18:51:29 +02:00
Marton Balint 09891c5391 avformat/aviobuf: add support for specifying minimum packet size and marking flush points
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-06-24 18:51:29 +02:00
Marton Balint c14fa7a330 avformat/aviobuf: fix flushing write buffers after seeking backward or forward
This patch makes aviobuf work more like traditinal file IO, which is how people
think about it.

For example, in the past, aviobuf only flushed buffers until the current buffer
position, even if more data was written to it previously, and a backward seek
was used to reposition the IO context.

From now, aviobuf will keep track of the written data, so no explicit seek will
be required till the end of the buffer, or till the end of file before flushing.

This fixes at least one regression, fate-vsynth3-flv was broken if
flush_packets option was set to false, an explicit seek was removed in
4e3cc4bdd8.

Also from now on, if a forward seek in the write buffer were to cause a gap
between the already written data and the new file position, a flush will
happen.

The must_flush varable is also removed, which might have caused needless
flushes with multiple seeks whithin the write buffer. Since we know the amount
of data written to it, we will know when to flush.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-06-24 18:51:29 +02:00
Mark Thompson dc81f1a2ce doc: Add VAAPI encoders
(cherry picked from commit 41dda86087)
2017-06-24 17:41:59 +01:00