ffmpeg.git
3 years agoavcodec/gif: Fix lzw buffer size
Michael Niedermayer [Mon, 18 Jan 2016 18:20:03 +0000 (19:20 +0100)]
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>
3 years agoavcodec/put_bits: Assert buf_ptr in flush_put_bits()
Michael Niedermayer [Mon, 18 Jan 2016 16:13:55 +0000 (17:13 +0100)]
avcodec/put_bits: Assert buf_ptr in flush_put_bits()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter/avf_showfreqs/showspectrum: rename skip_samples to hop_size
Paul B Mahol [Mon, 18 Jan 2016 18:38:14 +0000 (19:38 +0100)]
avfilter/avf_showfreqs/showspectrum: rename skip_samples to hop_size

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agovideodsp: fix 1-byte overread in top/bottom READ_NUM_BYTES iterations.
Ronald S. Bultje [Sat, 16 Jan 2016 19:44:28 +0000 (14:44 -0500)]
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.

3 years agolavc/rawdec: Use AV_PIX_FMT_PAL8 for 1-bit raw QuickTime video
Mats Peterson [Sun, 17 Jan 2016 21:27:52 +0000 (22:27 +0100)]
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>
3 years agodoc/filters: add yet another fftfilt example
Paul B Mahol [Sun, 17 Jan 2016 10:13:33 +0000 (11:13 +0100)]
doc/filters: add yet another fftfilt example

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavcodec/tiff: Check subsample & rps values more completely
Michael Niedermayer [Mon, 18 Jan 2016 02:31:25 +0000 (03:31 +0100)]
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>
3 years agolavf/icodec: Improve autodetection.
Carl Eugen Hoyos [Sun, 17 Jan 2016 23:36:44 +0000 (00:36 +0100)]
lavf/icodec: Improve autodetection.

Avoids misdetection of MPEG (B-)frames.

Reviewed-by: Michael Bradshaw
3 years agoavcodec/v210: guard new avx2 functions from old assemblers
James Darnley [Sun, 17 Jan 2016 20:20:25 +0000 (21:20 +0100)]
avcodec/v210: guard new avx2 functions from old assemblers

3 years agoswscale/swscale: Add some sanity checks for srcSlice* parameters
Michael Niedermayer [Sun, 17 Jan 2016 17:57:01 +0000 (18:57 +0100)]
swscale/swscale: Add some sanity checks for srcSlice* parameters

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/libaacplus: Cleanup in case of init failure
Michael Niedermayer [Sun, 17 Jan 2016 17:01:33 +0000 (18:01 +0100)]
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>
3 years agoconfigure: The XMA decoders depend on wmapro.
Carl Eugen Hoyos [Sun, 17 Jan 2016 17:37:01 +0000 (18:37 +0100)]
configure: The XMA decoders depend on wmapro.

Fixes compilation with --disable-fft.

3 years agoavcodec/diracdec: Fix qfactor/offset tables
Michael Niedermayer [Wed, 13 Jan 2016 22:51:47 +0000 (23:51 +0100)]
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>
3 years agolibavcodec/aacenc_tnc.c: remove unused variable w2
Claudio Freire [Sun, 17 Jan 2016 16:14:24 +0000 (13:14 -0300)]
libavcodec/aacenc_tnc.c: remove unused variable w2

No longer needed since previous commit

3 years agoAAC encoder: TNS fixes on short windows
Claudio Freire [Sun, 17 Jan 2016 02:02:41 +0000 (23:02 -0300)]
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).

3 years agoAAC encoder: use signed coeffs when measuring IS energy
Claudio Freire [Sat, 16 Jan 2016 23:47:00 +0000 (20:47 -0300)]
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.

3 years agoAAC encoder: enforce SF delta in PNS and IS SFs
Claudio Freire [Sat, 16 Jan 2016 23:44:36 +0000 (20:44 -0300)]
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.

3 years agoavcodec/v210: document the requirement for sample_factor
James Darnley [Fri, 15 Jan 2016 18:53:28 +0000 (19:53 +0100)]
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.

3 years agoavcodec/v210: add avx2 version of the 10-bit line encoder
James Darnley [Fri, 15 Jan 2016 18:30:03 +0000 (18:30 +0000)]
avcodec/v210: add avx2 version of the 10-bit line encoder

Around 25% faster than the ssse3 version.

3 years agoavcodec/v210: add avx2 version of the 8-bit line encoder
James Darnley [Wed, 30 Dec 2015 17:20:59 +0000 (17:20 +0000)]
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>
3 years agofate: add 10-bit v210 encoder tests
James Darnley [Fri, 15 Jan 2016 16:29:28 +0000 (16:29 +0000)]
fate: add 10-bit v210 encoder tests

3 years agoswscale/x86/rgb2rgb_template: Fix planar2x() for short width
Michael Niedermayer [Sun, 17 Jan 2016 11:33:50 +0000 (12:33 +0100)]
swscale/x86/rgb2rgb_template: Fix planar2x() for short width

Fixes: 451b3e0cf956c0bd2f27ed753ac24050/asan_heap-oob_2873c01_3231_7ed10a9464d15f0d57277f5917c566a8.AVI

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoremove all uses of the deprecated avpicture_get_size() function
Eddie Hao [Sun, 17 Jan 2016 05:41:54 +0000 (21:41 -0800)]
remove all uses of the deprecated avpicture_get_size() function

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoswscale/swscale_unscaled: Fix odd height inputs for bayer_to_yv12_wrapper()
Michael Niedermayer [Sat, 16 Jan 2016 23:55:44 +0000 (00:55 +0100)]
swscale/swscale_unscaled: Fix odd height inputs for bayer_to_yv12_wrapper()

Fixes: 372d2df1f04b49e25f109f07f90b1505/asan_heap-oob_2835d2e_8501_99e0114d7ba3a6db885d0b4684d200c1.cine
Fixes out of array read

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoswscale/swscale_unscaled: Fix odd height inputs for bayer_to_rgb24_wrapper()
Michael Niedermayer [Sat, 16 Jan 2016 23:55:44 +0000 (00:55 +0100)]
swscale/swscale_unscaled: Fix odd height inputs for bayer_to_rgb24_wrapper()

Fixes: 372d2df1f04b49e25f109f07f90b1505/asan_heap-oob_2835d2e_8501_99e0114d7ba3a6db885d0b4684d200c1.cine
Fixes out of array read

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoffmpeg: fix sws_dict leak on error exit
Michael Niedermayer [Sat, 16 Jan 2016 22:14:51 +0000 (23:14 +0100)]
ffmpeg: fix sws_dict leak on error exit

Fixes: 1b79b985cdf860ffa228c00ee5497051/signal_sigsegv_1f99d24_3549_86d92054a79f6ff900fbaf03f8012b32.aif

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agox86/fixed_dsp: add ff_butterflies_fixed_sse2
James Almer [Sat, 16 Jan 2016 01:04:09 +0000 (22:04 -0300)]
x86/fixed_dsp: add ff_butterflies_fixed_sse2

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/wmaenc: Check input for finiteness
Michael Niedermayer [Sat, 16 Jan 2016 20:40:49 +0000 (21:40 +0100)]
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>
3 years agoavcodec/aacenc: Check both channels for finiteness
Michael Niedermayer [Sat, 16 Jan 2016 17:32:07 +0000 (18:32 +0100)]
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>
3 years agolavf/matroskadec: Get sample size from private data
Mats Peterson [Fri, 15 Jan 2016 22:25:38 +0000 (23:25 +0100)]
lavf/matroskadec: Get sample size from private data

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolavf/mov: Don't limit fourcc 0 -> raw/twos to version 0 sample descriptions
Mats Peterson [Fri, 15 Jan 2016 22:28:06 +0000 (23:28 +0100)]
lavf/mov: Don't limit fourcc 0 -> raw/twos to version 0 sample descriptions

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/motion_est: Attempt to fix "short data segment overflowed" on IA64
Michael Niedermayer [Fri, 15 Jan 2016 22:58:51 +0000 (23:58 +0100)]
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>
3 years agompeg4videodec: silence ubsan warning
Andreas Cadhalpun [Thu, 14 Jan 2016 23:17:10 +0000 (00:17 +0100)]
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>
3 years agolavu/x86/lls: add fma3 optimizations for update_lls
Ganesh Ajjanagadde [Wed, 13 Jan 2016 22:59:26 +0000 (17:59 -0500)]
lavu/x86/lls: add fma3 optimizations for update_lls

This improves accuracy (very slightly) and speed for processors having
fma3.

Sample benchmark (fate flac-16-lpc-cholesky, Haswell):
old:
5993610 decicycles in ff_lpc_calc_coefs,      64 runs,      0 skips
5951528 decicycles in ff_lpc_calc_coefs,     128 runs,      0 skips

new:
5252410 decicycles in ff_lpc_calc_coefs,      64 runs,      0 skips
5232869 decicycles in ff_lpc_calc_coefs,     128 runs,      0 skips

Tested with FATE and --disable-fma3, also examined contents of
lavu/lls-test.

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Henrik Gramner <henrik@gramner.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
3 years agoavfilter/af_sidechaincompress & af_agate: use audio fifo from lavu
Paul B Mahol [Fri, 15 Jan 2016 20:34:05 +0000 (21:34 +0100)]
avfilter/af_sidechaincompress & af_agate: use audio fifo from lavu

Fixes regression causing segfault.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavformat/riff: add C210 FourCC (Canopus C210)
Piotr Bandurski [Thu, 14 Jan 2016 16:01:00 +0000 (17:01 +0100)]
avformat/riff: add C210 FourCC (Canopus C210)

3 years agoavformat/riff: add YUYV FourCC (Drastic YUYV)
Piotr Bandurski [Thu, 14 Jan 2016 17:38:08 +0000 (18:38 +0100)]
avformat/riff: add YUYV FourCC (Drastic YUYV)

3 years agoavfilter: add ahistogram multimedia filter
Paul B Mahol [Tue, 29 Dec 2015 20:22:26 +0000 (21:22 +0100)]
avfilter: add ahistogram multimedia filter

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agox86/intmath: add missing early clobber to output operands
James Almer [Fri, 15 Jan 2016 16:32:58 +0000 (13:32 -0300)]
x86/intmath: add missing early clobber to output operands

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/x86/fmtconvert: Add emms to int32_to_float_fmul_array8_sse()
Michael Niedermayer [Fri, 15 Jan 2016 16:08:37 +0000 (17:08 +0100)]
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>
3 years agoavfilter/vaf_spectrumsynth: Fix mixed declaration and statment
Michael Niedermayer [Fri, 15 Jan 2016 15:51:54 +0000 (16:51 +0100)]
avfilter/vaf_spectrumsynth: Fix mixed declaration and statment

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/hls: Even stricter URL checks
Michael Niedermayer [Fri, 15 Jan 2016 14:29:22 +0000 (15:29 +0100)]
avformat/hls: Even stricter URL checks

This fixes a null pointer dereference at least

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/hls: More strict url checks
Michael Niedermayer [Fri, 15 Jan 2016 12:29:38 +0000 (13:29 +0100)]
avformat/hls: More strict url checks

No case is known where these are needed

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/rmdec: add missing av_log argument
James Almer [Fri, 15 Jan 2016 05:26:36 +0000 (02:26 -0300)]
avcodec/rmdec: add missing av_log argument

Also change the format specifier to expect an unsigned int

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agolavf/mov: Confine 0x00000000 to raw/twos fourcc mapping to version 0 sample descriptions
Mats Peterson [Tue, 12 Jan 2016 23:32:20 +0000 (00:32 +0100)]
lavf/mov: Confine 0x00000000 to raw/twos fourcc mapping to version 0 sample descriptions

Confine the 0x00000000 to 'raw '/'twos' fourcc mapping to old version 0
sound sample descriptions, since they are the only valid sample
descriptions for this type of mapping.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/pngenc: Fix mixed up linesizes
Michael Niedermayer [Thu, 14 Jan 2016 23:57:00 +0000 (00:57 +0100)]
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>
3 years agoavcodec/pngenc: Replace memcpy by av_image_copy()
Michael Niedermayer [Thu, 14 Jan 2016 23:35:57 +0000 (00:35 +0100)]
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>
3 years agoasfdec_o: check for too small size in asf_read_unknown
Andreas Cadhalpun [Wed, 6 Jan 2016 18:21:49 +0000 (19:21 +0100)]
asfdec_o: check for too small size in asf_read_unknown

This fixes infinite loops due to seeking back.

Reviewed-by: Alexandra Hájková <alexandra.khirnova@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 years agoasfdec_o: break if EOF is reached after asf_read_packet_header
Andreas Cadhalpun [Wed, 6 Jan 2016 17:44:33 +0000 (18:44 +0100)]
asfdec_o: break if EOF is reached after asf_read_packet_header

asf_read_payload can unset eof_reached, so check it also before calling
that function.

This fixes infinite loops.

Reviewed-by: Alexandra Hájková <alexandra.khirnova@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 years agoasfdec_o: make sure packet_size is non-zero before seeking
Andreas Cadhalpun [Wed, 6 Jan 2016 18:03:17 +0000 (19:03 +0100)]
asfdec_o: make sure packet_size is non-zero before seeking

This fixes infinite loops due to seeking back.

Reviewed-by: Alexandra Hájková <alexandra.khirnova@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 years agoasfdec_o: prevent overflow causing seekback
Andreas Cadhalpun [Wed, 6 Jan 2016 13:09:22 +0000 (14:09 +0100)]
asfdec_o: prevent overflow causing seekback

This fixes infinite loops.

Reviewed-by: Alexandra Hájková <alexandra.khirnova@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 years agoasfdec_o: check avio_skip in asf_read_simple_index
Andreas Cadhalpun [Wed, 6 Jan 2016 12:54:59 +0000 (13:54 +0100)]
asfdec_o: check avio_skip in asf_read_simple_index

The loop can be very long, even though the file is very short.

Reviewed-by: Alexandra Hájková <alexandra.khirnova@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 years agoasfdec_o: reject size > INT64_MAX in asf_read_unknown
Andreas Cadhalpun [Tue, 5 Jan 2016 12:20:11 +0000 (13:20 +0100)]
asfdec_o: reject size > INT64_MAX in asf_read_unknown

Both avio_skip and detect_unknown_subobject use int64_t for the size
parameter.

This fixes a segmentation fault due to infinite recursion.

Reviewed-by: Alexandra Hájková <alexandra.khirnova@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 years agoasfdec_o: only set asf_pkt->data_size after sanity checks
Andreas Cadhalpun [Tue, 5 Jan 2016 12:06:51 +0000 (13:06 +0100)]
asfdec_o: only set asf_pkt->data_size after sanity checks

Otherwise invalid values are used unchecked in the next run.
This can cause NULL pointer dereferencing.

Reviewed-by: Alexandra Hájková <alexandra.khirnova@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 years agolavu: prevent overflow in av_clip_intp2_c
Andreas Cadhalpun [Thu, 14 Jan 2016 00:15:22 +0000 (01:15 +0100)]
lavu: prevent overflow in av_clip_intp2_c

This fixes ubsan runtime error: signed integer overflow: 8388608 +
2140274688 cannot be represented in type 'int'

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 years agolavc/aacenc: use isfinite to simplify isnan/isinf logic
Ganesh Ajjanagadde [Thu, 14 Jan 2016 22:55:56 +0000 (17:55 -0500)]
lavc/aacenc: use isfinite to simplify isnan/isinf logic

Reviewed-by: Claudio Freire <klaussfreire@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
3 years agoavformat/rmdec: Fix Packet memleak at close()
Michael Niedermayer [Thu, 14 Jan 2016 22:32:13 +0000 (23:32 +0100)]
avformat/rmdec: Fix Packet memleak at close()

Fixes: asan_heap-oob_445b39_1741_d00eb645ab48eb2203b4a04a5b997103.ivr

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/rmdec: Check size in ivr_read_packet() before use
Michael Niedermayer [Thu, 14 Jan 2016 22:20:58 +0000 (23:20 +0100)]
avformat/rmdec: Check size in ivr_read_packet() before use

Fixes out of array access
Fixes: asan_heap-oob_445b39_1741_d00eb645ab48eb2203b4a04a5b997103.ivr

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoswscale/vscale: Use matching sliceY/chrSliceY for luma/chroma
Michael Niedermayer [Thu, 14 Jan 2016 21:10:08 +0000 (22:10 +0100)]
swscale/vscale: Use matching sliceY/chrSliceY for luma/chroma

No case known where that makes a difference

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolavc/ccaption_dec: clear all unused rows during rollup
Aman Gupta [Wed, 13 Jan 2016 01:27:06 +0000 (17:27 -0800)]
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.

3 years agolavc/ccaption_dec: clean up whitespace
Aman Gupta [Thu, 14 Jan 2016 21:55:07 +0000 (13:55 -0800)]
lavc/ccaption_dec: clean up whitespace

3 years agofate: add test for realtime ccaption decoder
Aman Gupta [Wed, 13 Jan 2016 01:22:30 +0000 (17:22 -0800)]
fate: add test for realtime ccaption decoder

3 years agolavc/ccaption_dec: implement real_time option
Aman Gupta [Sat, 9 Jan 2016 03:01:22 +0000 (19:01 -0800)]
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.

3 years agoavfilter/vf_fftfilt: this is video filter so use pixels instead of samples
Paul B Mahol [Thu, 14 Jan 2016 21:20:25 +0000 (22:20 +0100)]
avfilter/vf_fftfilt: this is video filter so use pixels instead of samples

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavfilter/vf_fftfilt: use the name 's' for the pointer to the private context
Paul B Mahol [Thu, 14 Jan 2016 21:19:52 +0000 (22:19 +0100)]
avfilter/vf_fftfilt: use the name 's' for the pointer to the private context

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agolavc/ccaption_dec: flush context on seek
Aman Gupta [Wed, 6 Jan 2016 05:46:27 +0000 (21:46 -0800)]
lavc/ccaption_dec: flush context on seek

3 years agoswscale/vscale: Check that 2 tap filters are bilinear before using bilinear code
Michael Niedermayer [Thu, 14 Jan 2016 20:33:53 +0000 (21:33 +0100)]
swscale/vscale: Check that 2 tap filters are bilinear before using bilinear code

Fixes: out of array reads
Fixes: 07e8b9c5d348ccdf7add0f37de20cf6c/asan_heap-oob_27e8df7_6849_e56653f768070ec8cb52f587048444c2.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoswscale/output: Assert that yalpha and uvalpha are within their expected range
Michael Niedermayer [Thu, 14 Jan 2016 17:36:02 +0000 (18:36 +0100)]
swscale/output: Assert that yalpha and uvalpha are within their expected range

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoswscale/vscale: Add fixme comment to "ugly" code
Michael Niedermayer [Thu, 14 Jan 2016 17:11:22 +0000 (18:11 +0100)]
swscale/vscale: Add fixme comment to "ugly" code

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoswscale/slice: Fix indention
Michael Niedermayer [Thu, 14 Jan 2016 16:18:41 +0000 (17:18 +0100)]
swscale/slice: Fix indention

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoswscale/slice: Fix doc typo
Michael Niedermayer [Thu, 14 Jan 2016 16:13:13 +0000 (17:13 +0100)]
swscale/slice: Fix doc typo

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoswscale: Move Contexts used only in hscale.c into it
Michael Niedermayer [Thu, 14 Jan 2016 15:51:34 +0000 (16:51 +0100)]
swscale: Move Contexts used only in hscale.c into it

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoswscale: Move VScalerContext into vscale.c
Michael Niedermayer [Thu, 14 Jan 2016 15:49:33 +0000 (16:49 +0100)]
swscale: Move VScalerContext into vscale.c

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter: add spectrumsynth filter
Paul B Mahol [Sun, 10 Jan 2016 13:48:12 +0000 (14:48 +0100)]
avfilter: add spectrumsynth filter

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoswscale/utils: Detect and skip unneeded sws_setColorspaceDetails() calls
Michael Niedermayer [Thu, 14 Jan 2016 14:11:48 +0000 (15:11 +0100)]
swscale/utils: Detect and skip unneeded sws_setColorspaceDetails() calls

This avoids running various table inits unnecessarily

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoswscale/yuv2rgb: Increase YUV2RGB table headroom
Michael Niedermayer [Thu, 14 Jan 2016 02:05:11 +0000 (03:05 +0100)]
swscale/yuv2rgb: Increase YUV2RGB table headroom

This makes SWS more robust
Fixes: 07650a772d98aa63b0fed6370dc89037/asan_heap-oob_27ddeaf_2657_2c81ff264dee5d9712cb3251fb9c3bbb.264
Fixes: out of array read

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoswscale/yuv2rgb: Factor YUVRGB_TABLE_LUMA_HEADROOM out
Michael Niedermayer [Thu, 14 Jan 2016 11:36:41 +0000 (12:36 +0100)]
swscale/yuv2rgb: Factor YUVRGB_TABLE_LUMA_HEADROOM out

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter/af_dynaudnorm: fix possible null pointer dereference
Paul B Mahol [Thu, 14 Jan 2016 13:27:01 +0000 (14:27 +0100)]
avfilter/af_dynaudnorm: fix possible null pointer dereference

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavcodec/aacenc_is: replace pow(x, 0.75) by x/sqrtf(sqrtf(x))
Claudio Freire [Thu, 14 Jan 2016 03:38:22 +0000 (00:38 -0300)]
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>
3 years agolavu/libm: add isfinite fallback
Ganesh Ajjanagadde [Thu, 14 Jan 2016 00:09:25 +0000 (19:09 -0500)]
lavu/libm: add isfinite fallback

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
3 years agodca: fix misaligned access in avpriv_dca_convert_bitstream
Andreas Cadhalpun [Tue, 12 Jan 2016 23:52:58 +0000 (00:52 +0100)]
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>
3 years agoavformat/hls: forbid all protocols except http(s) & file
Maxim Andreev [Wed, 13 Jan 2016 08:51:12 +0000 (11:51 +0300)]
avformat/hls: forbid all protocols except http(s) & file

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/aacenc: Check for +-Inf too
Michael Niedermayer [Wed, 13 Jan 2016 21:33:59 +0000 (22:33 +0100)]
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>
3 years agoavcodec/wavpackenc: print channel count in av_log call
James Almer [Wed, 13 Jan 2016 22:26:40 +0000 (19:26 -0300)]
avcodec/wavpackenc: print channel count in av_log call

Fixes a warning with -Wformat-extra-args

3 years agoavcodec/diracdec: Handle the 0 vlc case at the top of coeff_unpack_golomb()
Michael Niedermayer [Tue, 12 Jan 2016 22:32:58 +0000 (23:32 +0100)]
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>
3 years agoavcodec/diracdec: Factor +2 out of the inner loop
Michael Niedermayer [Tue, 12 Jan 2016 22:32:57 +0000 (23:32 +0100)]
avcodec/diracdec: Factor +2 out of the inner loop

Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/diracdec: Inline svq3_get_ue_golomb() and merge the sign bit decoding into it
Michael Niedermayer [Tue, 12 Jan 2016 22:32:56 +0000 (23:32 +0100)]
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>
3 years agoavcodec/aacenc: mark output as const as its not written to
Michael Niedermayer [Wed, 13 Jan 2016 15:40:22 +0000 (16:40 +0100)]
avcodec/aacenc: mark output as const as its not written to

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/aacenc: Fix NAN check
Michael Niedermayer [Wed, 13 Jan 2016 13:15:11 +0000 (14:15 +0100)]
avcodec/aacenc: Fix NAN check

All MDCT outputs must be checked in case of 128point MDCTs
Fixes: out of array read
Fixes: 04442da73d935b776d2236282588d4f9/signal_sigsegv_2625a69_351_52ca6226eb83547a2d26e322ce84ed84.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agodiracdec: Add slice threading to HQ profile
Kieran Kunhya [Tue, 12 Jan 2016 00:51:49 +0000 (00:51 +0000)]
diracdec: Add slice threading to HQ profile

3 years agoAAC encoder: encode out-of-phase I/S efficiently
Claudio Freire [Sun, 10 Jan 2016 06:04:21 +0000 (03:04 -0300)]
AAC encoder: encode out-of-phase I/S efficiently

Use the ability to invert phase with ms_mask instead of changing
the codebook when possible, to avoid having to switch codebooks
if some bands are INTENSTY_BT and others are INTENSITY_BT2, since
usually a set ms_mask uses less bits that a codebook change. While
it may not always be a win (ie: if it causes an ms_mask bitmap
to be sent when it wouldn't have been otherwise), it's unlikely
since the ms_mask bitmap will almost always be there already for
M/S itself.

3 years agoAAC encoder: fix I/S relative error evaluation
Claudio Freire [Fri, 8 Jan 2016 09:18:24 +0000 (06:18 -0300)]
AAC encoder: fix I/S relative error evaluation

The relative error between two encoding strategies is the simple
difference of rate-distortion values, and not the absolute
difference. An absolute measure would allow worsening of the
quantization error as well as improving.

3 years agoAAC encoder: various fixes in M/S coding
Claudio Freire [Fri, 8 Jan 2016 08:31:32 +0000 (05:31 -0300)]
AAC encoder: various fixes in M/S coding

1. Fix sf_idx and band_type addressing to address only the first
subwindow in the group (others could hold garbage values)

2. Don't step on ms_mask when is_mask is set. I/S selection
already sets the ms_mask properly and shouldn't be overridden.

3. Use mid/sid cb/sf when computing coding error, as should be
since those are the cb/sfs that will eventually be set.

4. Fix distortion computation on multi-subwindow groups (was
subtracting the bits terms multiple times)

5. Clear ms_mask when one side uses PNS and the other doesn't.
When using PNS, ms_mask signals correlated noise, which can be
detected just like regular M/S detection, so we don't skip
noise bands, but when only one side uses PNS setting the flag
can confuse some encoders, so avoid that.

3 years agoAAC encoder: in IS, fix index of sf_idx, band_type
Claudio Freire [Fri, 8 Jan 2016 08:16:18 +0000 (05:16 -0300)]
AAC encoder: in IS, fix index of sf_idx, band_type

Correct addressing of sf_idx and band_type arrays in I/S code.

Both arrays don't guarantee valid values for subwindows at all
times, depending on which coder is being used, which could result
in reading of garbage values. Instead, only the first subwindow
in the window group has to be used, ie: use w*16+g instead of
(w+w2)*16+g

3 years agoAAC encoder: don't apply MS on special bands
Claudio Freire [Fri, 8 Jan 2016 08:04:37 +0000 (05:04 -0300)]
AAC encoder: don't apply MS on special bands

Change the condition for application of the M/S transform to match
that of the decoder. Namely, that no special coding books must be
in use in either channel. While the condition ought to be
equivalent to the current one when the invariant of is_mask is
kept, matching the decoder's condition is safer and easier to
maintain.

3 years agoAAC encoder: avoid assertion failure on PNS
Claudio Freire [Fri, 8 Jan 2016 07:39:02 +0000 (04:39 -0300)]
AAC encoder: avoid assertion failure on PNS

In rare corner cases it could still fail an assert on sf_diff due
to failure to update prev_sf in some code paths. Fix that case.

3 years agoAAC encoder: fix assertion error with prediction
Claudio Freire [Tue, 29 Dec 2015 08:18:40 +0000 (05:18 -0300)]
AAC encoder: fix assertion error with prediction

Fixes an assertion error reported in #2686 that happens when
using prediction (either explicitly or implicitly by setting
the AAC main profile), since prediction code would allow
creating new zeroes or removing existing ones, without
properly checking for SF delta violations.

This patch forbids creating/removing zeroes, perhaps an
overly conservative approach, but a safe one. More permissive
and sophisticated approaches may be attempted in the future.

3 years agolavc/mjpeg2jpeg: Accept more mjpeg streams as input.
Carl Eugen Hoyos [Wed, 13 Jan 2016 08:01:29 +0000 (09:01 +0100)]
lavc/mjpeg2jpeg: Accept more mjpeg streams as input.

Fixes ticket #5151.

3 years agoavutil/common: Protect GET_BYTE in GET_UTF8() by ()
Michael Niedermayer [Wed, 13 Jan 2016 01:33:48 +0000 (02:33 +0100)]
avutil/common: Protect GET_BYTE in GET_UTF8() by ()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/aviobuf: Fix end check in put_str16()
Michael Niedermayer [Wed, 13 Jan 2016 01:31:59 +0000 (02:31 +0100)]
avformat/aviobuf: Fix end check in put_str16()

Fixes out of array read
Fixes: 03c406ec9530e594a074ce2979f8a1f0/asan_heap-oob_7dec26_4664_37c52495b2870a2eaac65f53958e76c1.flac

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>