Commit Graph

38600 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Mark Thompson
bde0460406 vaapi_encode: Add VP9 support
(cherry picked from commit 0fd91e4bfc)
2017-06-24 17:41:55 +01:00
Mark Thompson
49419925d3 vp9: Add bsf to fix reordering in raw streams
Takes a raw input stream containing frames with correct timestamps but
possibly out of order and inserts additional show-existing-frame
packets to correct the ordering.

(cherry picked from commit 34e051d168)
(cherry picked from commit b43b95f478)

Also converted from bitstream to get_bits.
2017-06-24 17:41:30 +01:00
Michael Niedermayer
4976a3411f avcodec/mpeg4videodec: Fix GMC with videos of dimension 1
Fixes: runtime error: shift exponent -1 is negative
Fixes: 2338/clusterfuzz-testcase-minimized-5153426541379584

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-24 14:48:13 +02:00
James Almer
349446e36f x86/mdct15: use three operand form for some instructions
Fixes compilation with old yasm
2017-06-24 01:44:49 -03:00
Reino17
078322f33c Add support for LibOpenJPEG v2.2/git
Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
2017-06-23 20:29:23 -07:00
Rostislav Pehlivanov
e1120b1c54 mdct15: add assembly optimizations for the 15-point FFT
c:    1802 decicycles in fft15,16774635 runs,   2581 skips
avx:   865 decicycles in fft15,16776378 runs,    838 skips

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-06-23 23:45:37 +01:00
jerett
9f26d670e4 lavc/videotoolboxenc: fix open videotoolbox bug on iOS8.4
Checks for NULL before using object.

Signed-off-by: Rick Kern <kernrj@gmail.com>
2017-06-23 09:37:34 -04:00
jerett
82a8724df2 lavc/videotoolboxenc: fix loadVTEncSymbols crash when symbol not found
Signed-off-by: Rick Kern <kernrj@gmail.com>
2017-06-23 09:37:34 -04:00
Jun Zhao
ea1d07aed9 lavc/golomb: add value range comment for set_ue_golomb().
set_ue_golomb just support 2^16 - 2 at most, becase this function call
put_bits, and put_bits just support write up to 31 bits, when write 32
bit in put_bits, it's will overwrite the bit buffer, and the default
assert level is 0, the av_assert2(n <= 31 && value < (1U << n)) in
put_bits can not be trigger runtime.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-23 13:03:20 +02:00
Michael Niedermayer
24e95f9d4d avcodec/wavpack: Fix integer overflow
Fixes: runtime error: signed integer overflow: 227511904 + 1964113935 cannot be represented in type 'int'
Fixes: 2331/clusterfuzz-testcase-minimized-6182185830711296

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-23 03:03:04 +02:00
Michael Niedermayer
0c2ef4f6b4 avcodec/takdec: Fix integer overflow
Fixes: runtime error: signed integer overflow: 512 + 2147483146 cannot be represented in type 'int'
Fixes: 2314/clusterfuzz-testcase-minimized-4519333877252096

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-23 03:03:04 +02:00
Michael Niedermayer
27f80ab016 avcodec/tiff: Update pointer only when the result is used
Fixes: runtime error: signed integer overflow: 538976288 * 32 cannot be represented in type 'int'
Fixes: 2310/clusterfuzz-testcase-minimized-4534784887881728

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-23 03:03:04 +02:00
Rostislav Pehlivanov
7e98da9c4f opus_celt: do not use double precision exp2
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-06-22 22:37:53 +01:00
Michael Niedermayer
6f1d2355a7 avcodec/cfhd: Check bpc before setting bpc in context
Fixes: runtime error: shift exponent 32 is too large for 32-bit type 'int'
Fixes: 2306/clusterfuzz-testcase-minimized-5002997392211968

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-22 01:54:40 +02:00
Michael Niedermayer
5a950f4e32 avcodec/cfhd: Fix undefined shift
Fixes: runtime error: left shift of negative value -1
Fixes: 2303/clusterfuzz-testcase-minimized-5529675273076736

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-22 01:54:40 +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
Ronald S. Bultje
e639d09199 mdec: stop preferring the simple IDCT.
This was added in e3e3c82555, probably
as a workaround for the fact that the quant table was not permutated
and the IDCT coefficients are, meaning that you'd only get correct
reconstruction if the IDCT permutation was an identity matrix, which
happens to be the case when you use the simple IDCT. The quant table
permutation bug was fixed in 42dd1434bf,
meaning this workaround is no longer necessary.

In practical terms, before 42dd1434bf,
the PSNR between decodes of the fate-mdec using simple (C) or simplemmx
IDCTs was 35. After 42dd1434bf, it's 90.
2017-06-21 09:01:32 -04:00
Ronald S. Bultje
42dd1434bf mdec: use correctly permutated quant matrix for dequantization. 2017-06-21 08:59:22 -04:00
Memphiz
9e85c5d6a7 aarch64: vp9 16bpp: Fix assembling with Xcode 6.2 and older
Properly use the b.eq form instead of the nonstandard form (which
both gas and newer clang accept though), and expand the register
lists that used a range (which the Xcode 6.2 clang, based on clang
3.5 svn, didn't support).

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-06-21 09:08:14 +03:00
Memphiz
998609ddb8 aarch64: vp9: Fix assembling with Xcode 6.2 and older
Properly use the b.eq/b.ge forms instead of the nonstandard forms
(which both gas and newer clang accept though), and expand the
register list that used a range (which the Xcode 6.2 clang, based
on clang 3.5 svn, didn't support).

This is cherrypicked from libav commit
a970f9de86.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-06-21 09:08:13 +03:00