Commit Graph

34690 Commits

Author SHA1 Message Date
Michael Niedermayer 19e456d48c avcodec/wmaenc: Check ff_wma_init() for failure
Fixes null pointer dereference
Fixes: c4faf8280ba366bf00a79d425f2910a8/signal_sigsegv_1f96477_5177_1448ba7e4125faceb966f44ceb69abfa.qcp
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-21 02:39:09 +01:00
Michael Niedermayer a53fbda9dc avcodec/mpeg12enc: Move high resolution thread check to before initializing threads
Cleaner solution is welcome!

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-21 00:56:11 +01:00
Clément Bœsch a362015641 lavc,lavfi: use avutil/thread.h instead of redundant conditional includes
This was somehow forgotten in a8bb81a05c.
2016-01-20 21:36:54 +01:00
Michael Niedermayer 2cb8edea7c avcodec/aacenc: Check all coefficients for finiteness
This is needed as near infinite values on the input side result in only some
output to be non finite.
Also it may still be insufficient if subsequent computations overflow

Fixes null pointer dereference
Fixes: ae66c0f6c12ac1cd5c2c237031240f57/signal_sigsegv_2618c99_9516_6007026f2185a26d7afea895fbed6e38.ogg

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Reviewed-by: Claudio Freire <klaussfreire@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-20 21:21:31 +01:00
James Almer 4c4ebeb587 avcodec/wavpackenc: use put_sbits
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-01-20 16:41:19 -03:00
Rostislav Pehlivanov 6a505e955b aacenc: remove FAAC-like coder
Has been marked for removal for over a month and has not been improved
or touched at all since it was implemented.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-01-20 16:56:53 +00:00
Rostislav Pehlivanov a72b1ea826 aacenc: mark LTP mode as experimental
Too many crashes observed. Can't be helped until the autocorrelation
function is massively checked for sanity.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-01-20 16:49:55 +00:00
Arttu Ylä-Outinen 7d1e985528 libkvazaar: Set frame rate as a rational number
Updates libkvazaar to pass the exact frame rate to Kvazaar by setting
the numerator and denominator separately instead of a single floating
point number. The exact frame rate is needed for writing timing info to
the bitstream.

Requires Kvazaar version 0.8.1.

Signed-off-by: Arttu Ylä-Outinen <arttu.yla-outinen@tut.fi>
2016-01-20 17:29:13 +02:00
Michael Niedermayer 158f0545d8 avcodec/ass_split: Fix null pointer dereference in ff_ass_style_get()
Fixes: 55d71971da50365d542ed14b65565fe1/signal_sigsegv_4765a4_8499_f146af090a94f591d6254515c7700ef5.mkv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-20 16:21:41 +01:00
Michael Niedermayer 22f64c2324 avcodec/ccaption_dec: Fix mixed declarations and code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-19 13:48:21 +01:00
Carl Eugen Hoyos 9cf8c3e62c ape: Show more information for loglevel verbose.
Requested by Andy E, fixes bug 687.
2016-01-19 11:02:14 +01:00
Hendrik Leppkes ed9cff9edf Merge commit 'd1cd20e4e33f8139e150034b3c457302312d81bd'
* commit 'd1cd20e4e33f8139e150034b3c457302312d81bd':
  qsvenc: split encoding frames and reading from the async FIFO

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-19 08:44:50 +01:00
Hendrik Leppkes b5513441e4 Merge commit 'a6259a6ecbad18d58085e4ab23f56151e98d7b53'
* commit 'a6259a6ecbad18d58085e4ab23f56151e98d7b53':
  qsvenc: properly handle the warning from MFXVideoCORE_SyncOperation

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-19 08:43:03 +01:00
Michael Niedermayer 03d83ba34b avcodec/gif: Fix lzw buffer size
Fixes out of array access
Fixes: aaa479088e6fb40b04837b3119f47b04/asan_heap-oob_e38c68_8576_9d653078b2470700e2834636f12ff557.tga

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-18 19:56:37 +01:00
Michael Niedermayer 3ef5de0f19 avcodec/put_bits: Assert buf_ptr in flush_put_bits()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-18 19:56:37 +01:00
Ronald S. Bultje 0f88b3f82f videodsp: fix 1-byte overread in top/bottom READ_NUM_BYTES iterations.
This can overread (either before start or beyond end) of the buffer in
Nx1 (i.e. height=1) images.

Fixes mozilla bug 1240080.
2016-01-18 11:12:47 -05:00
Mats Peterson 5da1477fa0 lavc/rawdec: Use AV_PIX_FMT_PAL8 for 1-bit raw QuickTime video
Match the use of AV_PIX_FMT_PAL8 for 1-bit QuickTime Animation in
lavc/qtrle. To reiterate, 1-bit video is not necessary black & white in
QuickTime, merely bi-level. The two colors can be any color. The palette,
either included in the sample description, or the default Macintosh
palette (black & white for 1-bit video) will be set in lavf/qtpalette.
See the QuickTime File Format Specification for details.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-18 15:15:28 +01:00
Michael Niedermayer 89f464e9c2 avcodec/tiff: Check subsample & rps values more completely
Fixes out of array access
Fixes: 83aedfb29af669c4d6e10f1bfad974d2/asan_heap-oob_1ab42fe_4984_9f6ec14462f8d8a00ea24b320572a963.tif

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-18 03:51:00 +01:00
James Darnley f59b727e2f avcodec/v210: guard new avx2 functions from old assemblers 2016-01-17 21:23:58 +01:00
Michael Niedermayer 033b49e02d avcodec/libaacplus: Cleanup in case of init failure
Fixes: memleak
Fixes: 6b343214a0c12d94c1ea0ae9c3102dba/signal_sigsegv_262857d_8792_71ba605ad9ca9068b8218a6ce3628c25.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-17 20:35:36 +01:00
Michael Niedermayer 5fbd97fc75 avcodec/diracdec: Fix qfactor/offset tables
It seems the previous tables where calculated with 32bit integers ignoring
overflows.
Also check for the max qindex, the value is choosen so that the qfactor/offset
fit in int32.

Fixes: 070b7914fd5dfe8f93248bea71363410/asan_static-oob_c8d034_2764_258e20f4a3c79158aecddb61a833d756.drc
Fixes out of array reads

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-17 17:28:20 +01:00
Claudio Freire 69697be922 libavcodec/aacenc_tnc.c: remove unused variable w2
No longer needed since previous commit
2016-01-17 13:14:24 -03:00
Claudio Freire 3d0849cc90 AAC encoder: TNS fixes on short windows
TNS was computing filter coefficients incorrectly for short windows
due to a few coefficient addressing bugs. Fixing them fixes lots of
instability with transients (short windows).
2016-01-17 12:52:54 -03:00
Claudio Freire df3fa48288 AAC encoder: use signed coeffs when measuring IS energy
I/S energy, especially when it comes to phase cancellations,
needs to use signed coefficients as input, yet it was using
abs'd coefficients. That was a slight bug.
2016-01-17 12:52:54 -03:00
Claudio Freire 60a76f8be8 AAC encoder: enforce SF delta in PNS and IS SFs
Make sure to properly enforce maximum scalefactor delta in PNS
and I/S, not as an absolute range but relative to the previous
and first scalefactor, the latter important since PNS uses an
implicit inicial scalefactor derived from the global gain, and
encoded in a different way, which makes a big difference in the
allowed range.
2016-01-17 12:52:54 -03:00
James Darnley 4c430738d9 avcodec/v210: document the requirement for sample_factor
The sample factor must be the same for both 8- and 10-bit functions chosen
otherwise the output will be incorrect.
2016-01-17 16:03:43 +01:00
James Darnley 2cba1825f7 avcodec/v210: add avx2 version of the 10-bit line encoder
Around 25% faster than the ssse3 version.
2016-01-17 16:03:43 +01:00
James Darnley 3836f404a8 avcodec/v210: add avx2 version of the 8-bit line encoder
Around 35% faster than the avx version.

Signed-off-by: Henrik Gramner <henrik@gramner.com>
2016-01-17 16:03:43 +01:00
Eddie Hao a6dc1eb837 remove all uses of the deprecated avpicture_get_size() function
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-17 12:01:35 +01:00
Michael Niedermayer aa6aa2ef09 avcodec/wmaenc: Check input for finiteness
Fixes out of array read
Fixes: 1b79b985cdf860ffa228c00ee5497051/signal_sigsegv_1f99d24_315_f0f1fdb451264b1138e9c24eb7d49181.wv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-16 21:42:12 +01:00
Michael Niedermayer 057549a9cc avcodec/aacenc: Check both channels for finiteness
Fixes null pointer dereference
Fixes: 10412fc52ecc6eab40ed67f82ca7b372/signal_sigsegv_2618c99_2129_f808373959e46afb165593332799ffbc.aif

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-16 18:33:12 +01:00
Michael Niedermayer d7c75a5db0 avcodec/motion_est: Attempt to fix "short data segment overflowed" on IA64
This decreases the MV related encoding table sizes
This should have little effect on real world video encoding performance

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-16 00:56:05 +01:00
Andreas Cadhalpun 564dd3f0f4 mpeg4videodec: silence ubsan warning
s->ac_val[0][0] is of type 'int16_t [16]', but points into a larger buffer.
Here it is used as base pointer to find the correct position in the
larger buffer by adding 's->block_index[n] * 16' and thus as 'int16_t *'.

This fixes clang's ubsan runtime error: index out of bounds for type
'int16_t [16]'

Fixes: test_case.mp4

Found-by: Tyson Smith <twsmith@mozilla.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-01-15 23:48:33 +01:00
Piotr Bandurski 23ac355487 avformat/riff: add YUYV FourCC (Drastic YUYV) 2016-01-15 19:14:51 +01:00
Michael Niedermayer da6f34516b avcodec/x86/fmtconvert: Add emms to int32_to_float_fmul_array8_sse()
this should fix checkasm on x86_64-archlinux-gcc-valgrind

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-15 17:08:37 +01:00
Michael Niedermayer 8f4c3e4b92 avcodec/pngenc: Fix mixed up linesizes
Fixes out of array accesses
Fixes: 0cf176e6d3ab9fe924f39738e513f547/asan_generic_4a54aa_3431_aaa28be1cb32e307a9890cad06f84fba.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-15 03:38:43 +01:00
Michael Niedermayer 7ec9c5ce8a avcodec/pngenc: Replace memcpy by av_image_copy()
Fixes out of array access
Fixes: 0cf176e6d3ab9fe924f39738e513f547/asan_generic_4a54aa_3431_aaa28be1cb32e307a9890cad06f84fba.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-15 03:38:43 +01:00
Ganesh Ajjanagadde 2e4fd16f5b lavc/aacenc: use isfinite to simplify isnan/isinf logic
Reviewed-by: Claudio Freire <klaussfreire@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2016-01-14 18:28:38 -05:00
Aman Gupta 3a0e5cfcee lavc/ccaption_dec: clear all unused rows during rollup
Sometimes rollup captions can move around the screen. This fixes "ghost"
captions from below the current rollup area from continuing to be
captured when a rollup moves higher up on the screen.
2016-01-14 23:13:15 +01:00
Aman Gupta 9027806e3c lavc/ccaption_dec: clean up whitespace 2016-01-14 23:13:09 +01:00
Aman Gupta 5c041e2ccc lavc/ccaption_dec: implement real_time option
This new mode is useful for realtime decoding of closed captions so they
can be display along with mpeg2 frames.

Closed caption streams contain two major types of captions:

- POPON captions, which are buffered off-screen and displayed
  only after EOC (end of caption, aka display buffer)

- PAINTON/ROLLUP captions, which are written to the display as soon as
  they arrive.

In a typical real-time eia608 decoder, commands like EOC (end of
caption; display buffer), EDM (erase display memory) and EBM (erase
buffered memory) perform their expected functions as soon as the
commands are processed. This is implemented in the real_time branches
added in this commit.

Before this commit, and in the !real_time branches after this commit,
the decoder cleverly implements its own version of the decoder which is
specifically geared towards buffered decoding. It does so by actively
ignoring commands like EBM (erase buffered memory), and then re-using
the non-display buffer to hold the previous caption while the new one is
received. This is the opposite of the real-time decoder, which uses the
non-display buffer to hold the new caption while the display buffer is
still showing the current caption.

In addition to ignoring EBM, the buffered decoder also has custom
implementations for EDM and EOC. An EDM (erase display memory) command
flushes the existing contents before clearing the screen, and EOC
similarly always flushes the active buffer (the previous subtitle)
before flipping buffers.
2016-01-14 22:41:41 +01:00
Aman Gupta 260e368717 lavc/ccaption_dec: flush context on seek 2016-01-14 22:08:59 +01:00
Claudio Freire 62dfe1d40d avcodec/aacenc_is: replace pow(x, 0.75) by x/sqrtf(sqrtf(x))
This is quite an accurate approximation; testing shows ~ 2ulp error in
the floating point result. Tested with FATE.

Alternatively, if one wants "full accuracy", one can use powf, or sqrt
instead of sqrtf. With powf, one gets 1 ulp error (theoretically should be 0, as
0.75 is exactly representable) on GNU libm, with sqrt, 0 ulp error.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>

Abstracted into pos_pow34 utility function

Signed-off-by: Claudio Freire <klaussfreire@gmail.com>
2016-01-14 00:38:22 -03:00
Andreas Cadhalpun 44ac13eed4 dca: fix misaligned access in avpriv_dca_convert_bitstream
src and dst are only 8-bit-aligned, so accessing them as uint16_t causes
SIGBUS crashes on architectures like sparc.

This fixes ubsan runtime error: load of misaligned address for type
'const uint16_t', which requires 2 byte alignment

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-01-14 01:23:54 +01:00
Michael Niedermayer 92465a2347 avcodec/aacenc: Check for +-Inf too
Fixes out of array read
Fixes: 04442da73d935b776d2236282588d4f9/signal_sigsegv_2625a69_8790_ae85ffc889070663319b3417ede777b0.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-13 23:49:27 +01:00
James Almer 17e7fdf61a avcodec/wavpackenc: print channel count in av_log call
Fixes a warning with -Wformat-extra-args
2016-01-13 19:26:40 -03:00
Michael Niedermayer 39fb3f18c5 avcodec/diracdec: Handle the 0 vlc case at the top of coeff_unpack_golomb()
decoding changes from 17 to 20 fps

Reviewed-by; Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-13 18:56:49 +01:00
Michael Niedermayer bbd9771625 avcodec/diracdec: Factor +2 out of the inner loop
Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-13 18:55:46 +01:00
Michael Niedermayer da144c2ddd avcodec/diracdec: Inline svq3_get_ue_golomb() and merge the sign bit decoding into it
This avoids closing and opening the bit reader

Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-13 18:54:50 +01:00
Michael Niedermayer 9006567bae avcodec/aacenc: mark output as const as its not written to
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-13 17:09:15 +01:00