ffmpeg.git
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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)

4 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)

4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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.

4 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

4 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

4 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.

4 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>
4 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>
4 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

4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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

4 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>
4 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>
4 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>
4 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>
4 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>
4 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

4 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.

4 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.

4 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.

4 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

4 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.

4 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.

4 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.

4 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.

4 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>
4 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>
4 years agolibvpxdec: fix 'ISO C90 forbids mixed declarations and code' warning
James Zern [Tue, 12 Jan 2016 06:38:01 +0000 (22:38 -0800)]
libvpxdec: fix 'ISO C90 forbids mixed declarations and code' warning

since:
cbcc88c libvpx: Support setting color range for vp9.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Zern <jzern@google.com>
4 years agoconfigure: showspectrum now uses fft, add showspectrumpic
Paul B Mahol [Tue, 12 Jan 2016 21:36:34 +0000 (22:36 +0100)]
configure: showspectrum now uses fft, add showspectrumpic

Signed-off-by: Paul B Mahol <onemda@gmail.com>
4 years agoavfilter/avf_showspectrum: reduce number of operations
Paul B Mahol [Sun, 10 Jan 2016 17:30:16 +0000 (18:30 +0100)]
avfilter/avf_showspectrum: reduce number of operations

Signed-off-by: Paul B Mahol <onemda@gmail.com>
4 years agoavfilter/avf_showspectrum: add posibility to display phase
Paul B Mahol [Sun, 10 Jan 2016 13:20:59 +0000 (14:20 +0100)]
avfilter/avf_showspectrum: add posibility to display phase

Signed-off-by: Paul B Mahol <onemda@gmail.com>
4 years agolavf/mpjpegdec: Do not call av_log() while probing.
Carl Eugen Hoyos [Tue, 12 Jan 2016 19:35:03 +0000 (20:35 +0100)]
lavf/mpjpegdec: Do not call av_log() while probing.

4 years agoavformat/asfenc: Check pts
Michael Niedermayer [Tue, 12 Jan 2016 17:49:20 +0000 (18:49 +0100)]
avformat/asfenc: Check pts

Fixes integer overflow
Fixes: 0063df8be3aaa30dd6d76f59c8f818c8/signal_sigsegv_7b7b59_3634_bf418b6822bbfa68734411d96b667be3.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/asfenc: Flush packet before duration becomes unrepresentable
Michael Niedermayer [Tue, 12 Jan 2016 17:26:34 +0000 (18:26 +0100)]
avformat/asfenc: Flush packet before duration becomes unrepresentable

Fixes: 0063df8be3aaa30dd6d76f59c8f818c8/signal_sigsegv_7b7b59_3634_bf418b6822bbfa68734411d96b667be3.mov
Fixes assertion failure

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/truemotion2: Cleanup in case of tm2_read_stream() failure
Michael Niedermayer [Tue, 12 Jan 2016 14:56:29 +0000 (15:56 +0100)]
avcodec/truemotion2: Cleanup in case of tm2_read_stream() failure

Fixes memleaks
Fixes: 245dae71bc28fe8f3f454300277e575a/signal_sigabrt_7ffff6ae7cb7_5062_f7d9dfa385454806586076f9db48c0bf.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolavc/mjpeg2jpeg: Check for jpeg file header.
Carl Eugen Hoyos [Tue, 12 Jan 2016 15:13:27 +0000 (16:13 +0100)]
lavc/mjpeg2jpeg: Check for jpeg file header.

4 years agolavf/matroskadec: Use av_realloc() in get_qt_codec()
Mats Peterson [Mon, 11 Jan 2016 06:43:29 +0000 (07:43 +0100)]
lavf/matroskadec: Use av_realloc() in get_qt_codec()

Use av_realloc() rather than av_malloc() when normalizing noncompliant
private data in get_qt_codec().

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoCorrect two build/built typos
Timothy Gu [Tue, 12 Jan 2016 04:51:03 +0000 (20:51 -0800)]
Correct two build/built typos

Found-by: Leo Izen <leo.izen@gmail.com> as thebombzen on IRC
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
4 years agoavcodec/mpeg4video: Check time_incr
Michael Niedermayer [Tue, 12 Jan 2016 02:03:01 +0000 (03:03 +0100)]
avcodec/mpeg4video: Check time_incr

Fixes assertion failure
Fixes out of memory access

Fixes: test_casex.ivf

Found-by: Tyson Smith <twsmith@mozilla.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agortmpdh: Initialize gcrypt before using it
Ricardo Constantino [Tue, 29 Dec 2015 21:40:14 +0000 (21:40 +0000)]
rtmpdh: Initialize gcrypt before using it

Either disabling or init'ing secure memory is required after the use
of gcry_check_version. From a look at the functions rtmpdh uses, I
noticed none require the use of secure memory, so we disable it [1][2].

This resolves some errors returned by rtmpdh code with uninitialized
gcrypt, especifically:
Fatal: failed to create the RNG lock: Invalid argument
FATAL: failed to acquire the FSM lock in libgrypt: Invalid argument

Version "1.5.4" was arbitrarily chosen. An older version probably works
as well, but I couldn't compile older versions to test on my machine.

[1]
https://gnupg.org/documentation/manuals/gcrypt/Initializing-the-library.html
[2]
https://www.gnupg.org/documentation/manuals/gcrypt/Controlling-the-library.html

Signed-off-by: Ricardo Constantino <wiiaboo@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agodiracdec: fix idwt_stride calculation in bytes
Andreas Cadhalpun [Mon, 11 Jan 2016 22:19:40 +0000 (23:19 +0100)]
diracdec: fix idwt_stride calculation in bytes

The transformation to bytes must happen after alignment to get the same
resulting pointers as before.

This fixes segmentation faults in the assembler code.

The regression was introduced in commit 9553689.

Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
4 years agolavc/cbrt_tablegen: speed up tablegen
Ganesh Ajjanagadde [Mon, 11 Jan 2016 22:09:44 +0000 (17:09 -0500)]
lavc/cbrt_tablegen: speed up tablegen

This exploits an approach based on the sieve of Eratosthenes, a popular
method for generating prime numbers.

Tables are identical to previous ones.

Tested with FATE with/without --enable-hardcoded-tables.

Sample benchmark (Haswell, GNU/Linux+gcc):
prev:
7860100 decicycles in cbrt_tableinit,       1 runs,      0 skips
7777490 decicycles in cbrt_tableinit,       2 runs,      0 skips
[...]
7582339 decicycles in cbrt_tableinit,     256 runs,      0 skips
7563556 decicycles in cbrt_tableinit,     512 runs,      0 skips

new:
2099480 decicycles in cbrt_tableinit,       1 runs,      0 skips
2044470 decicycles in cbrt_tableinit,       2 runs,      0 skips
[...]
1796544 decicycles in cbrt_tableinit,     256 runs,      0 skips
1791631 decicycles in cbrt_tableinit,     512 runs,      0 skips

Both small and large run count given as this is called once so small run
count may give a better picture, small numbers are fairly consistent,
and there is a consistent downward trend from small to large runs,
at which point it stabilizes to a new value.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
4 years agoffmdec: change type of len to ptrdiff_t
Andreas Cadhalpun [Sat, 2 Jan 2016 15:32:09 +0000 (16:32 +0100)]
ffmdec: change type of len to ptrdiff_t

It is used to store the difference between pointers, so ptrdiff_t is the
correct type.

This prevents potential overflows.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
4 years agoqtpalette: make the color_* variables unsigned again
Andreas Cadhalpun [Sun, 10 Jan 2016 09:53:33 +0000 (10:53 +0100)]
qtpalette: make the color_* variables unsigned again

This fixes segmentation faults due to out of bounds writes, when
color_start is interpreted as negative number.

This regression was introduced in commit 57631f.

Reviewed-by: Mats Peterson <matsp888@yahoo.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
4 years agoavcodec/wavpackenc: Check the number of channels
Michael Niedermayer [Mon, 11 Jan 2016 17:58:08 +0000 (18:58 +0100)]
avcodec/wavpackenc: Check the number of channels

They are stored in a byte, thus more than 255 is not possible

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/wavpackenc: Headers are per channel
Michael Niedermayer [Mon, 11 Jan 2016 17:32:32 +0000 (18:32 +0100)]
avcodec/wavpackenc: Headers are per channel

Fixes: 1b8b83a53bfa751f01b1daa65a4758db/signal_sigabrt_7ffff6ae7cb7_7488_403f71d1a2565b598d01b6cb110fac8f.aiff
Fixes: assertion failure

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/dfa: Fix packet leak on error
Michael Niedermayer [Mon, 11 Jan 2016 16:08:07 +0000 (17:08 +0100)]
avformat/dfa: Fix packet leak on error

Fixes: 07fa81f300736485e585b63e7b1cd155/signal_sigabrt_7ffff6ae7cb7_16_94ee815791a1357826524072db5bc2dc.dfa

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolavf/matroskadec: Normalize noncompliant A_QUICKTIME/V_QUICKTIME private data
Mats Peterson [Sun, 10 Jan 2016 02:59:21 +0000 (03:59 +0100)]
lavf/matroskadec: Normalize noncompliant A_QUICKTIME/V_QUICKTIME private data

This patch adds a new static function get_qt_codec() that takes care of
the initial retrieval of the fourcc and codec ID for A_QUICKTIME and
V_QUICKTIME. It also normalizes noncompliant private data found in some
older files that incorrectly starts with the fourcc by expanding/shifting
the data by 4 bytes, and storing the data size at the start. This is
necessary in order for the rest of the code in the A_QUICKTIME and
V_QUICKTIME blocks (and most likely other code as well) to correctly
parse the private data.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/ac3enc: Remove duplicate #include
Michael Niedermayer [Sun, 10 Jan 2016 21:12:36 +0000 (22:12 +0100)]
avcodec/ac3enc: Remove duplicate #include

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/aacdec_template: Check id_map
Michael Niedermayer [Sun, 10 Jan 2016 18:29:39 +0000 (19:29 +0100)]
avcodec/aacdec_template: Check id_map

Fixes index out of bounds error
Fixes: aac_index_out_of_bounds.wmv

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/dvdec: Fix "left shift of negative value -254"
Michael Niedermayer [Sun, 10 Jan 2016 16:43:56 +0000 (17:43 +0100)]
avcodec/dvdec: Fix "left shift of negative value -254"

Fixes: dvdec_left_shift.avi

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/g2meet: Check for ff_els_decode_bit() failure in epic_decode_run_length()
Michael Niedermayer [Sun, 10 Jan 2016 15:59:42 +0000 (16:59 +0100)]
avcodec/g2meet: Check for ff_els_decode_bit() failure in epic_decode_run_length()

Fixes invalid shift
Fixes: g2m_left_shift_2.wmv

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agofate: fix sub-cc font
Clément Bœsch [Sun, 10 Jan 2016 15:31:30 +0000 (16:31 +0100)]
fate: fix sub-cc font

4 years agolavc/ccaption_dec: improve default style
Clément Bœsch [Sun, 10 Jan 2016 15:19:50 +0000 (16:19 +0100)]
lavc/ccaption_dec: improve default style

Use monospaced font, and a black box outline.