]> git.sesse.net Git - ffmpeg/log
ffmpeg
8 years agodoc/ffmpeg: Clarify that the sdp_file option requires an rtp output.
Simon Thelen [Mon, 2 Nov 2015 14:57:50 +0000 (15:57 +0100)]
doc/ffmpeg: Clarify that the sdp_file option requires an rtp output.

Signed-off-by: Simon Thelen <ffmpeg-dev@c-14.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoffmpeg: Don't try and write sdp info if none of the outputs had an rtp format.
Simon Thelen [Mon, 2 Nov 2015 15:36:16 +0000 (16:36 +0100)]
ffmpeg: Don't try and write sdp info if none of the outputs had an rtp format.

Fixes a segfault when trying to write nonexistent rtp information.

Signed-off-by: Simon Thelen <ffmpeg-dev@c-14.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavformat/cache: Avoid int-overflow in cache compare function
Bryan Huh [Mon, 9 Nov 2015 00:35:01 +0000 (16:35 -0800)]
avformat/cache: Avoid int-overflow in cache compare function

cache protocol indexes its cache using AVTreeNodes which require a cmp
function for inserting and searching new cache-entries. This cmp
function expects a 32-bit int return value (negative, zero, or positive)
but the cache cmp function returns an int64_t which can overflow the
int, giving negative numbers for when it should be positive, vice versa.
This manifests itself only for very large files (e.g. 4GB+)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/nvenc: update nvenc default parameters
Agatha Hu [Mon, 9 Nov 2015 12:05:02 +0000 (13:05 +0100)]
avcodec/nvenc: update nvenc default parameters

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
8 years agoavutil/x86/intmath: Correct intrinsic headers for older compilers.
Matt Oliver [Mon, 9 Nov 2015 10:40:33 +0000 (21:40 +1100)]
avutil/x86/intmath: Correct intrinsic headers for older compilers.

Signed-off-by: Matt Oliver <protogonoi@gmail.com>
8 years agoavformat/rsd: add XMA support
Paul B Mahol [Mon, 9 Nov 2015 09:31:24 +0000 (10:31 +0100)]
avformat/rsd: add XMA support

Signed-off-by: Paul B Mahol <onemda@gmail.com>
8 years agoswresample/resample: improve bessel function accuracy and speed
Ganesh Ajjanagadde [Mon, 2 Nov 2015 19:28:39 +0000 (14:28 -0500)]
swresample/resample: improve bessel function accuracy and speed

This improves accuracy for the bessel function at large arguments, and this in turn
should improve the quality of the Kaiser window. It also improves the
performance of the bessel function and hence build_filter by ~ 20%.
Details are given below.

Algorithm: taken from the Boost project, who have done a detailed
investigation of the accuracy of their method, as compared with e.g the
GNU Scientific Library (GSL):
http://www.boost.org/doc/libs/1_52_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/bessel/mbessel.html.
Boost source code (also cited and licensed in the code):
https://searchcode.com/codesearch/view/14918379/.

Accuracy: sample values may be obtained as follows. i0 denotes the old bessel code,
i0_boost the approach here, and i0_real an arbitrary precision result (truncated) from Wolfram Alpha:
type "bessel i0(6.0)" to reproduce. These are evaluation points that occur for
the default kaiser_beta = 9.

Some illustrations:
bessel(8.0)
i0      (8.000000) = 427.564115721804739678191254
i0_boost(8.000000) = 427.564115721804796521610115
i0_real (8.000000) = 427.564115721804785177396791

bessel(6.0)
i0      (6.000000) = 67.234406976477956163762428
i0_boost(6.000000) = 67.234406976477970374617144
i0_real (6.000000) = 67.234406976477975326188025

Reason for accuracy: Main accuracy benefits come at larger bessel arguments, where the
Taylor-Maclaurin method is not that good: 23+ iterations
(at large arguments, since the series is about 0) can cause
significant floating point error accumulation.

Benchmarks: Obtained on x86-64, Haswell, GNU/Linux via a loop calling
build_filter 1000 times:
test: fate-swr-resample-dblp-44100-2626

new:
995894468 decicycles in build_filter(loop 1000),     256 runs,      0 skips
1029719302 decicycles in build_filter(loop 1000),     512 runs,      0 skips
984101131 decicycles in build_filter(loop 1000),    1024 runs,      0 skips

old:
1250020763 decicycles in build_filter(loop 1000),     256 runs,      0 skips
1246353282 decicycles in build_filter(loop 1000),     512 runs,      0 skips
1220017565 decicycles in build_filter(loop 1000),    1024 runs,      0 skips

A further ~ 5% may be squeezed by enabling -ftree-vectorize. However,
this is a separate issue from this patch.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
8 years agoswresample: allow double precision beta value for the Kaiser window
Ganesh Ajjanagadde [Sat, 7 Nov 2015 15:16:27 +0000 (10:16 -0500)]
swresample: allow double precision beta value for the Kaiser window

Kaiser windows inherently don't require beta to be an integer. This was
an arbitrary restriction. Moreover, soxr does not require it, and in
fact often estimates beta to a non-integral value.

Thus, this patch allows greater flexibility for swresample clients.
Micro version is updated.

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
8 years agosoftfloat: handle INT_MIN correctly in av_int2sf
Andreas Cadhalpun [Sun, 8 Nov 2015 16:19:10 +0000 (17:19 +0100)]
softfloat: handle INT_MIN correctly in av_int2sf

Otherwise v=INT_MIN doesn't get normalized and thus triggers av_assert2
in other functions.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
8 years agosoftfloat: assert when the argument of av_sqrt_sf is negative
Andreas Cadhalpun [Sun, 8 Nov 2015 14:15:24 +0000 (15:15 +0100)]
softfloat: assert when the argument of av_sqrt_sf is negative

The correct result can't be expressed in SoftFloat.
Currently it returns a random value from an out of bounds read.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
8 years agoavfilter: add anoisesrc
Kyle Swanson [Sun, 8 Nov 2015 11:39:37 +0000 (12:39 +0100)]
avfilter: add anoisesrc

Signed-off-by: Kyle Swanson <k@ylo.ph>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
8 years agoavutil/softfloat: Include negative numbers in cmp/gt tests
Michael Niedermayer [Sun, 8 Nov 2015 14:04:05 +0000 (15:04 +0100)]
avutil/softfloat: Include negative numbers in cmp/gt tests

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavutil/softfloat: Fix av_gt_sf() with large exponents try #2
Michael Niedermayer [Sun, 8 Nov 2015 14:03:28 +0000 (15:03 +0100)]
avutil/softfloat: Fix av_gt_sf() with large exponents try #2

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavutil/softfloat: Add test for av_gt_sf()
Michael Niedermayer [Sun, 8 Nov 2015 14:02:05 +0000 (15:02 +0100)]
avutil/softfloat: Add test for av_gt_sf()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavutil/softfloat: Extend the av_cmp_sf() test to cover a wider range of exponents
Michael Niedermayer [Sun, 8 Nov 2015 13:45:19 +0000 (14:45 +0100)]
avutil/softfloat: Extend the av_cmp_sf() test to cover a wider range of exponents

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavutil/softfloat: Fix overflows in shifts in av_cmp_sf() and av_gt_sf()
Michael Niedermayer [Sun, 8 Nov 2015 13:13:42 +0000 (14:13 +0100)]
avutil/softfloat: Fix overflows in shifts in av_cmp_sf() and av_gt_sf()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavutil/softfloat: Add test for av_cmp_sf()
Michael Niedermayer [Sun, 8 Nov 2015 13:39:46 +0000 (14:39 +0100)]
avutil/softfloat: Add test for av_cmp_sf()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavutil/softfloat: Add tests for exponent underflows
Michael Niedermayer [Sun, 8 Nov 2015 13:07:22 +0000 (14:07 +0100)]
avutil/softfloat: Add tests for exponent underflows

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavutil/softfloat: Fix exponent underflow in av_div_sf()
Michael Niedermayer [Sun, 8 Nov 2015 12:59:21 +0000 (13:59 +0100)]
avutil/softfloat: Fix exponent underflow in av_div_sf()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavutil/softfloat: Fix exponent underflow in av_mul_sf()
Michael Niedermayer [Sun, 8 Nov 2015 12:57:19 +0000 (13:57 +0100)]
avutil/softfloat: Fix exponent underflow in av_mul_sf()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavutil/softfloat: Fix typo in av_mul_sf() doxy
Michael Niedermayer [Sun, 8 Nov 2015 12:54:15 +0000 (13:54 +0100)]
avutil/softfloat: Fix typo in av_mul_sf() doxy

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoRevert "avutil/softfloat: Check for MIN_EXP in av_sqrt_sf()"
Michael Niedermayer [Sun, 8 Nov 2015 12:44:27 +0000 (13:44 +0100)]
Revert "avutil/softfloat: Check for MIN_EXP in av_sqrt_sf()"

This case should not be possible if the input has a exponent within
the valid range

This reverts commit 0269fb11e3de17375f86d9120599af8c87cdfa0a.

8 years agoavutil/softfloat: Check for MIN_EXP in av_sqrt_sf()
Michael Niedermayer [Sun, 8 Nov 2015 12:25:54 +0000 (13:25 +0100)]
avutil/softfloat: Check for MIN_EXP in av_sqrt_sf()

Otherwise the exponent could eventually underflow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavutil/softfloat: Correctly set the exponent for 0.0 in av_sqrt_sf()
Michael Niedermayer [Sun, 8 Nov 2015 12:25:21 +0000 (13:25 +0100)]
avutil/softfloat: Correctly set the exponent for 0.0 in av_sqrt_sf()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/aacsbr: Use FLOAT_0
Michael Niedermayer [Sun, 8 Nov 2015 10:05:48 +0000 (11:05 +0100)]
avcodec/aacsbr: Use FLOAT_0

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavutil/softfloat: FLOAT_0 should use MIN_EXP
Michael Niedermayer [Sun, 8 Nov 2015 02:04:33 +0000 (03:04 +0100)]
avutil/softfloat: FLOAT_0 should use MIN_EXP

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoAdd pixblockdsp checkasm tests
Timothy Gu [Sun, 1 Nov 2015 11:31:22 +0000 (03:31 -0800)]
Add pixblockdsp checkasm tests

8 years agopixblockdsp: x86: Condense diff_pixels_* to a shared macro
Timothy Gu [Sun, 1 Nov 2015 11:12:45 +0000 (03:12 -0800)]
pixblockdsp: x86: Condense diff_pixels_* to a shared macro

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
8 years agoavcodec/takdec: Use memove, avoid undefined memcpy() use
Michael Niedermayer [Sat, 7 Nov 2015 19:05:27 +0000 (20:05 +0100)]
avcodec/takdec: Use memove, avoid undefined memcpy() use

Fixes: e214333cbd94c91228e624ff39329ce6/asan_generic_4a5159_6412_96cda2530e80607210ab41ccae3d456d.tak
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agommaldec: correct package buffering accounting
wm4 [Fri, 6 Nov 2015 12:02:16 +0000 (13:02 +0100)]
mmaldec: correct package buffering accounting

The assert in ffmmal_stop_decoder() could trigger sometimes. The
packets_buffered counter was indeed not correctly maintained, and
packets were not subtracted from it if they were still in the waiting
queue.

For some reason, this happened especially with VC-1.

8 years agommaldec: add vc1 decoding support
wm4 [Fri, 6 Nov 2015 11:59:16 +0000 (12:59 +0100)]
mmaldec: add vc1 decoding support

8 years agolavfi/af_asyncts: remove looping on request_frame().
Nicolas George [Sat, 24 Oct 2015 14:01:22 +0000 (16:01 +0200)]
lavfi/af_asyncts: remove looping on request_frame().

8 years agolavfi/af_amix: mostly fix scheduling.
Nicolas George [Sat, 24 Oct 2015 13:19:11 +0000 (15:19 +0200)]
lavfi/af_amix: mostly fix scheduling.

8 years agolavfi/vf_framepack: fix scheduling.
Nicolas George [Thu, 22 Oct 2015 07:58:25 +0000 (09:58 +0200)]
lavfi/vf_framepack: fix scheduling.

8 years agolavfi/af_join: partially fix scheduling.
Nicolas George [Thu, 22 Oct 2015 07:56:11 +0000 (09:56 +0200)]
lavfi/af_join: partially fix scheduling.

8 years agolavfi/fifo: do not assume request_frame() returns a frame.
Nicolas George [Thu, 22 Oct 2015 07:57:34 +0000 (09:57 +0200)]
lavfi/fifo: do not assume request_frame() returns a frame.

8 years agolavfi/avf_concat: return immediately after requesting a frame on input.
Nicolas George [Fri, 23 Oct 2015 10:36:17 +0000 (12:36 +0200)]
lavfi/avf_concat: return immediately after requesting a frame on input.

8 years agolavfi: remove astreamsync.
Nicolas George [Sat, 24 Oct 2015 14:13:32 +0000 (16:13 +0200)]
lavfi: remove astreamsync.

It was only useful for very specific testing purposes
and appears to be currently partially broken.

8 years agolavu/opt: enhance printing durations.
Nicolas George [Mon, 26 Oct 2015 20:07:33 +0000 (21:07 +0100)]
lavu/opt: enhance printing durations.

Trim unneeded leading components and trailing zeros.
Move the formating code in a separate function.
Use the function also to format the default value, it was currently
printed as plain integer, inconsistent to the way it is parsed.

8 years agolavfi: add realtime filter.
Nicolas George [Sun, 25 Oct 2015 16:31:58 +0000 (17:31 +0100)]
lavfi: add realtime filter.

Similar to the -re option in ffmpeg that only works for input files.
Can be used at any place in the filter graph.

8 years agofate: add mpdecimate test.
Nicolas George [Sun, 25 Oct 2015 19:40:48 +0000 (20:40 +0100)]
fate: add mpdecimate test.

8 years agolavfi: add testsrc2 test source.
Nicolas George [Sun, 25 Oct 2015 15:31:00 +0000 (16:31 +0100)]
lavfi: add testsrc2 test source.

Similar to testsrc, but using drawutils and therefore
supporting a lot of pixel formats instead of just rgb24.
This allows using it as input for other tests without
requiring a format conversion.
It is also slightly faster than testsrc for some reason.

8 years agodoc/resampler: fix some trivial typos
Ganesh Ajjanagadde [Thu, 5 Nov 2015 03:37:10 +0000 (22:37 -0500)]
doc/resampler: fix some trivial typos

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
8 years agoavformat/segafilm: Only add index entries when the stream exists
Michael Niedermayer [Sat, 7 Nov 2015 12:35:10 +0000 (13:35 +0100)]
avformat/segafilm: Only add index entries when the stream exists

Fixes null pointer dereference
Fixes: cb02dfb163ac833c04cace3d7e35b160/signal_sigsegv_e55c49_6326_8f25619fc86a00b303c57b7778baf70a.cpk
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoapng: use correct size for output buffer
Andreas Cadhalpun [Fri, 6 Nov 2015 22:44:01 +0000 (23:44 +0100)]
apng: use correct size for output buffer

The buffer needs s->bpp bytes, at maximum currently 10.
Assert that s->bpp is not larger.

This fixes a stack buffer overflow.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
8 years agojvdec: avoid unsigned overflow in comparison
Andreas Cadhalpun [Fri, 6 Nov 2015 20:04:34 +0000 (21:04 +0100)]
jvdec: avoid unsigned overflow in comparison

The return type of strlen is size_t, i.e. unsigned, so if pd->buf_size
is 3, the right side overflows leading to a wrong result of the
comparison and subsequently a heap buffer overflow.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
8 years agohevc: extract SEI caption data
Will Kelleher [Fri, 6 Nov 2015 20:48:46 +0000 (14:48 -0600)]
hevc: extract SEI caption data

Signed-off-by: Will Kelleher <wkelleher@gogoair.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/jpeg2000dec: Clip all tile coordinates
Michael Niedermayer [Sat, 7 Nov 2015 01:16:11 +0000 (02:16 +0100)]
avcodec/jpeg2000dec: Clip all tile coordinates

Fixes out of array access
Fixes: b877a6b788a25c70e8b1d014f8628549/asan_heap-oob_1da2c3f_2324_5a1b329b0b3c4bb6b1d775660ac56717.r3d
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/microdvddec: Check for string end in 'P' case
Michael Niedermayer [Fri, 6 Nov 2015 21:24:23 +0000 (22:24 +0100)]
avcodec/microdvddec: Check for string end in 'P' case

Fixes out of array read
Fixes: a9502b60f4cecc19475382aee255f73c/asan_heap-oob_1e87fba_2548_a8ad47f6dde36644fe9cdc444d4632d0.sub
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agovp9_parser: allow superframes with a single frame.
Ronald S. Bultje [Fri, 6 Nov 2015 16:57:07 +0000 (11:57 -0500)]
vp9_parser: allow superframes with a single frame.

8 years agoavcodec/dirac_parser: Fix undefined memcpy() use
Michael Niedermayer [Fri, 6 Nov 2015 20:58:42 +0000 (21:58 +0100)]
avcodec/dirac_parser: Fix undefined memcpy() use

Fixes: 9d375e415486edd1a0c826f2307d89a4/asan_generic_4a5159_1577_faa333e83dacdd9e4dd322380aeed537.iss
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavdevice/dshow_enummediatypes: check return of av_malloc
Ganesh Ajjanagadde [Mon, 26 Oct 2015 18:49:21 +0000 (14:49 -0400)]
avdevice/dshow_enummediatypes: check return of av_malloc

Untested.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
8 years agoXMA1 and XMA2 stereo decoders
Paul B Mahol [Sun, 1 Nov 2015 12:15:36 +0000 (13:15 +0100)]
XMA1 and XMA2 stereo decoders

Signed-off-by: Paul B Mahol <onemda@gmail.com>
8 years agoswresample/resample: speed up build_filter for Blackman-Nuttall filter
Ganesh Ajjanagadde [Thu, 5 Nov 2015 03:02:13 +0000 (22:02 -0500)]
swresample/resample: speed up build_filter for Blackman-Nuttall filter

This uses the trigonometric double and triple angle formulae to avoid
repeated (expensive) evaluation of libc's cos().

Sample benchmark (x86-64, Haswell, GNU/Linux)
test: fate-swr-resample-dblp-44100-2626
old:
1104466600 decicycles in build_filter(loop 1000),     256 runs,      0 skips
1096765286 decicycles in build_filter(loop 1000),     512 runs,      0 skips
1070479590 decicycles in build_filter(loop 1000),    1024 runs,      0 skips

new:
588861423 decicycles in build_filter(loop 1000),     256 runs,      0 skips
591262754 decicycles in build_filter(loop 1000),     512 runs,      0 skips
577355145 decicycles in build_filter(loop 1000),    1024 runs,      0 skips

This results in small differences with the old expression:
difference (worst case on [0, 2*M_PI]), argmax 0.008:
max diff (relative): 0.000000000000157289807188
blackman_old(0.008): 0.000363951585488813192382
blackman_new(0.008): 0.000363951585488755946507

These are judged to be insignificant for the performance gain. PSNR to
reference file is unchanged up to second decimal point for instance.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
8 years agompegtsenc: Implement writing of Opus trim_start/trim_end control values
Sebastian Dröge [Mon, 2 Nov 2015 07:06:19 +0000 (09:06 +0200)]
mpegtsenc: Implement writing of Opus trim_start/trim_end control values

Signed-off-by: Sebastian Dröge <sebastian@centricular.com>
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agompegtsenc: Add support for muxing Opus in MPEG-TS
Sebastian Dröge [Thu, 5 Nov 2015 22:35:42 +0000 (23:35 +0100)]
mpegtsenc: Add support for muxing Opus in MPEG-TS

Signed-off-by: Sebastian Dröge <sebastian@centricular.com>
Previous version reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavformat/xmv: Discard remainder of packet on error
Michael Niedermayer [Fri, 6 Nov 2015 01:13:36 +0000 (02:13 +0100)]
avformat/xmv: Discard remainder of packet on error

Fixes infinite loop
Fixes: 9c48ae2680c5f23bca3d20ff0f325fd8/asan_generic_4c254d_1374_993f1e5967dd6f844b8d72f978ce2a6c.pss
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavformat/xmv: factor return check out of if/else
Michael Niedermayer [Fri, 6 Nov 2015 01:11:01 +0000 (02:11 +0100)]
avformat/xmv: factor return check out of if/else

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/mpeg12dec: Do not call show_bits() with invalid bits
Michael Niedermayer [Thu, 5 Nov 2015 23:56:04 +0000 (00:56 +0100)]
avcodec/mpeg12dec: Do not call show_bits() with invalid bits

Fixes assertion failure
Fixes: 63e50545709a6440d3d59f6426d58db9/signal_sigabrt_7ffff6ae7cc9_8189_3272a3010fd98ddf947c662bbde1ac13.ts
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/dnxhddec: Make mb_scan_index a fixed length array
Michael Niedermayer [Thu, 5 Nov 2015 22:04:48 +0000 (23:04 +0100)]
avcodec/dnxhddec: Make mb_scan_index a fixed length array

Fixes null pointer dereference
Fixes: 5c9d1a6f74a12763fc7c9dd7834022b9/signal_sigsegv_11f78d9_1461_ecee3c5e7205457498e79b3ffaf21d0c.mxf
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/faxcompr: Add missing runs check in decode_uncompressed()
Michael Niedermayer [Thu, 5 Nov 2015 20:35:23 +0000 (21:35 +0100)]
avcodec/faxcompr: Add missing runs check in decode_uncompressed()

Fixes out of array access
Fixes: 54e488b9da4abbceaf405d6492515697/asan_heap-oob_32769b0_160_a8755eb08ee8f9579348501945a33955.TIF
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agolibavutil/channel_layout: Check strtol*() for failure
Michael Niedermayer [Thu, 5 Nov 2015 18:24:33 +0000 (19:24 +0100)]
libavutil/channel_layout: Check strtol*() for failure

Fixes assertion failure
Fixes: 4f5814bb15d2dda6fc18ef9791b13816/signal_sigabrt_7ffff6ae7cc9_65_7209d160d168b76f311be6cd64a548eb.wv
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavformat/mpegts: Only start probing data streams within probe_packets
Michael Niedermayer [Thu, 5 Nov 2015 16:04:37 +0000 (17:04 +0100)]
avformat/mpegts: Only start probing data streams within probe_packets

Fixes assertion failure
Fixes: 4321db8ac331f5967ebfbfe80ce5eb78/signal_sigabrt_7ffff6ae7cc9_7213_0d6457b9d6897fa7c78507fa5de53510.ts
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/hevc_ps: Check chroma_format_idc
Michael Niedermayer [Thu, 5 Nov 2015 13:52:33 +0000 (14:52 +0100)]
avcodec/hevc_ps: Check chroma_format_idc

Fixes out of array access
Fixes: 24d05e8b84676799c735c9e27d97895e/asan_heap-oob_1b70f6a_2955_7c3652a7f370f9f3ef40642bc2c99bb2.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/truemotion1: Initialize mb_change_byte only when needed
Michael Niedermayer [Thu, 5 Nov 2015 02:15:24 +0000 (03:15 +0100)]
avcodec/truemotion1: Initialize mb_change_byte only when needed

Fixes out of array read
Fixes: d92114d8c2a019b8a6e50cd2a7301b54/asan_heap-oob_26bf563_60_1d3420277533de9dbf8aba3f93af346f.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/ffv1dec: Print an error if the quant table count is invalid
Michael Niedermayer [Thu, 5 Nov 2015 00:25:50 +0000 (01:25 +0100)]
avcodec/ffv1dec: Print an error if the quant table count is invalid

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/ffv1dec: Free tables on init failure
Michael Niedermayer [Wed, 4 Nov 2015 23:40:09 +0000 (00:40 +0100)]
avcodec/ffv1dec: Free tables on init failure

Fixes memleak
Fixes: 07ec1fc3c1cbf2d3edcd7d9b52ca156c/asan_heap-oob_13624c5_491_ecd4720a03e697ba750b235690656c8f.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/ffv1dec: Check for 0 quant tables
Michael Niedermayer [Wed, 4 Nov 2015 23:36:59 +0000 (00:36 +0100)]
avcodec/ffv1dec: Check for 0 quant tables

Fixes assertion failure
Fixes: 07ec1fc3c1cbf2d3edcd7d9b52ca156c/asan_heap-oob_13624c5_491_ecd4720a03e697ba750b235690656c8f.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoswresample/resample: speed up build_filter by 50%
Ganesh Ajjanagadde [Wed, 4 Nov 2015 01:08:12 +0000 (20:08 -0500)]
swresample/resample: speed up build_filter by 50%

This speeds up build_filter by ~ 50%. This gain should be pretty
consistent across all architectures and platforms.

Essentially, this relies on a observation that the filters have some
even/odd symmetry that may be exploited during the construction of the
polyphase filter bank. In particular, phases (scaled to [0, 1]) in [0.5, 1] are
easily derived from [0, 0.5] and expensive reevaluation of function
points are unnecessary. This requires some rather annoying even/odd
bookkeeping as can be seen from the patch.

I vaguely recall from signal processing theory more general symmetries allowing even greater
optimization of the construction. At a high level, "even functions"
correspond to 2, and one can imagine variations. Nevertheless, for the sake
of some generality and because of existing filters, this is all that is
being exploited.

Currently, this patch relies on phase_count being even or (trivially) 1,
though this is not an inherent limitation to the approach. This
assumption is safe as phase_count is 1 << phase_bits, and is hence a
power of two. There is no way for user API to set it to a nontrivial odd
number. This assumption has been placed as an assert in the code.

To repeat, this assumes even symmetry of the filters, which is the most common
way to get generalized linear phase anyway and is true of all currently
supported filters.

As a side note, accuracy should be identical or perhaps slightly better
due to this "forcing" filter symmetries leading to a better phase
characteristic. As before, I can't test this claim easily, though it may
be of interest.

Patch tested with FATE.

Sample benchmark (x86-64, Haswell, GNU/Linux):

test: swr-resample-dblp-44100-2626

new:
527376779 decicycles in build_filter(loop 1000),     256 runs,      0 skips
524361765 decicycles in build_filter(loop 1000),     512 runs,      0 skips
516552574 decicycles in build_filter(loop 1000),    1024 runs,      0 skips

old:
974178658 decicycles in build_filter(loop 1000),     256 runs,      0 skips
972794408 decicycles in build_filter(loop 1000),     512 runs,      0 skips
954350046 decicycles in build_filter(loop 1000),    1024 runs,      0 skips

Note that lower level optimizations are entirely possible, I focussed on
getting the high level semantics correct. In any case, this should
provide a good foundation.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
8 years agoavcodec/mjpegdec: Reinitialize IDCT on BPP changes
Michael Niedermayer [Wed, 4 Nov 2015 20:27:04 +0000 (21:27 +0100)]
avcodec/mjpegdec: Reinitialize IDCT on BPP changes

Fixes misaligned access
Fixes: dc9262a469f6f315f74c087a7b3a7f35/signal_sigsegv_2e95bcd_9_9c0f9f4a9ba82aa9b3ab2b91ce4d5277.jpg
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/mjpegdec: Check index in ljpeg_decode_yuv_scan() before using it
Michael Niedermayer [Wed, 4 Nov 2015 17:08:52 +0000 (18:08 +0100)]
avcodec/mjpegdec: Check index in ljpeg_decode_yuv_scan() before using it

Fixes: 04715144ba237443010554be0d05343f/asan_heap-oob_1eafc76_1737_c685b48041a563461839e4e7ab97abb8.jpg
Fixes out of array access

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/aacsbr_template: replace qsort with AV_QSORT
Ganesh Ajjanagadde [Wed, 28 Oct 2015 01:11:45 +0000 (21:11 -0400)]
avcodec/aacsbr_template: replace qsort with AV_QSORT

When sbr->reset is set in encode_frame, a bunch of qsort calls might get made.
Thus, there is the potential of calling qsort whenever the spectral
contents change.

AV_QSORT is substantially faster due to the inlining of the comparison callback.
Thus, the increase in performance should be worth the increase in binary size.

Tested with FATE.

Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
8 years agoavcodec/rawenc: Cast argument for av_image_copy_to_buffer() to const
Michael Niedermayer [Wed, 4 Nov 2015 03:41:22 +0000 (04:41 +0100)]
avcodec/rawenc: Cast argument for av_image_copy_to_buffer() to const

Fixes: libavcodec/rawenc.c:64:40: warning: passing argument 3 of av_image_copy_to_buffer from incompatible pointer type [enabled by default]
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/libzvbi-teletextdec: Remove unused variable ret
Michael Niedermayer [Wed, 4 Nov 2015 03:38:58 +0000 (04:38 +0100)]
avcodec/libzvbi-teletextdec: Remove unused variable ret

Fixes: libavcodec/libzvbi-teletextdec.c:232:9: warning: unused variable ret [-Wunused-variable]
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavcodec/vdpau: Remove CONFIG_H263_VDPAU_HWACCEL
Michael Niedermayer [Wed, 4 Nov 2015 03:29:22 +0000 (04:29 +0100)]
avcodec/vdpau: Remove CONFIG_H263_VDPAU_HWACCEL

Fixes: libavcodec/vdpau.c:320:5: warning: "CONFIG_H263_VDPAU_HWACCEL" is not defined [-Wundef]
It was removed in d15adeacf3e61cd8d2169c090bf06f6d8fc62f8b

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavformat/cache: Use int64_t to avoid int overflow in cache_read
Bryan Huh [Mon, 2 Nov 2015 18:20:39 +0000 (10:20 -0800)]
avformat/cache: Use int64_t to avoid int overflow in cache_read

Fixes an issue where an int64_t ffurl_seek return-value was being stored
in an int (32-bit) "r" variable, leading to integer overflow when seeking
into a large file (>2GB), and ultimately a "Failed to perform internal
seek" error mesage.

To test, try running `ffprobe 'cache:http://<something>'` on a file that
is ~3GB large, whose moov atom is at the end of the file

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoavfilter/showcqt: remove yuv offset
Muhammad Faiz [Tue, 3 Nov 2015 15:01:55 +0000 (22:01 +0700)]
avfilter/showcqt: remove yuv offset

this makes draw_bar faster
slightly different result with old version

check result (with ~3 minutes audio file):
old:
    real    0m49.611s
    user    0m49.260s
    sys     0m0.073s
new:
    real    0m47.606s
    user    0m47.378s
    sys     0m0.068s
PSNR between old and new:
yuv444p PSNR
    y:109.519298 u:107.506485 v:104.746878
    average:106.816074 min:99.167305 max:inf
yuv422p PSNR
    y:109.519298 u:108.025801 v:104.489734
    average:107.279817 min:98.007467 max:inf
yuv420p PSNR
    y:109.519298 u:108.363875 v:105.290200
    average:108.261511 min:97.461812 max:inf

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agoall: use FFDIFFSIGN to resolve possible undefined behavior in comparators
Ganesh Ajjanagadde [Sun, 1 Nov 2015 15:43:56 +0000 (10:43 -0500)]
all: use FFDIFFSIGN to resolve possible undefined behavior in comparators

FFDIFFSIGN was created explicitly for this purpose, since the common
return a - b idiom is unsafe regarding overflow on signed integers. It
optimizes to branchless code on common compilers.

FFDIFFSIGN also has the subjective benefit of being easier to read due
to lack of ternary operators.

Tested with FATE.

Things not covered by this are unsigned integers, for which overflows
are well defined, and also places where overflow is clearly impossible,
e.g an instance where the a - b was being done on 24 bit values.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
8 years agoavutil/common: add FFDIFFSIGN macro
Ganesh Ajjanagadde [Fri, 30 Oct 2015 18:21:15 +0000 (14:21 -0400)]
avutil/common: add FFDIFFSIGN macro

This is of use for defining comparator callbacks. Common approaches like
return x-y are not safe due to the risks of overflow.
Furthermore, the (x > y) - (x < y) trick is optimized to branchless
code.
This also documents this macro accordingly.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
8 years agoavfilter/vf_rotate: correct log message
Ganesh Ajjanagadde [Sat, 31 Oct 2015 04:38:30 +0000 (00:38 -0400)]
avfilter/vf_rotate: correct log message

There seems to be some typos in the log messages that are fixed by this.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
8 years agofate: update fate-source ref file
James Almer [Tue, 3 Nov 2015 18:05:32 +0000 (15:05 -0300)]
fate: update fate-source ref file

Signed-off-by: James Almer <jamrial@gmail.com>
8 years agoavformat: add acm demuxer
Paul B Mahol [Fri, 30 Oct 2015 16:45:33 +0000 (17:45 +0100)]
avformat: add acm demuxer

Signed-off-by: Paul B Mahol <onemda@gmail.com>
8 years agoavcodec: add Interplay ACM decoder
Paul B Mahol [Fri, 30 Oct 2015 17:15:22 +0000 (18:15 +0100)]
avcodec: add Interplay ACM decoder

Signed-off-by: Paul B Mahol <onemda@gmail.com>
8 years agoavutil/file_open: avoid file handle inheritance on Windows
Tobias Rapp [Thu, 29 Oct 2015 08:11:37 +0000 (09:11 +0100)]
avutil/file_open: avoid file handle inheritance on Windows

Avoids inheritance of file handles on Windows systems similar to the
O_CLOEXEC/FD_CLOEXEC flag on Linux.

Fixes file lock issues in Windows applications when a child process
is started with handle inheritance enabled (standard input/output
redirection) while a FFmpeg transcoding is running in the parent
process.

Links relevant to the subject:

https://msdn.microsoft.com/en-us/library/w7sa2b22.aspx

Describes the _wsopen() function and the O_NOINHERIT flag. File handles
opened by _wsopen() are inheritable by default.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx

Describes handle inheritance when creating new processes. Handle
inheritance must be enabled (bInheritHandles = TRUE) e.g. when you want
to pass handles for stdin/stdout via lpStartupInfo.

Signed-off-by: Tobias Rapp <t.rapp@noa-audio.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years agohlsenc: Only write PAT/PMT once per segment
Derek Buitenhuis [Sun, 5 Apr 2015 18:28:38 +0000 (14:28 -0400)]
hlsenc: Only write PAT/PMT once per segment

This saves a lot of muxing overhead, especially on lower bitrate
segments.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
8 years agoavfilter/vf_frei0r: use av_strtod instead of strtod for added flexibility
Ganesh Ajjanagadde [Sun, 1 Nov 2015 03:34:15 +0000 (23:34 -0400)]
avfilter/vf_frei0r: use av_strtod instead of strtod for added flexibility

This converts the usage of strtod to av_strtod in order to unify and
make number parsing more consistent. This also adds support for SI
postfixes.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
8 years agoMerge commit '8161220eee152dad8b2ea9e2755c78c8e127f747'
Hendrik Leppkes [Mon, 2 Nov 2015 10:58:38 +0000 (11:58 +0100)]
Merge commit '8161220eee152dad8b2ea9e2755c78c8e127f747'

* commit '8161220eee152dad8b2ea9e2755c78c8e127f747':
  h264_parser: Rename close() to h264_close()

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
8 years agoMerge commit '407ac22322e5ce67996ec54ef619cafa4c9ceb78'
Hendrik Leppkes [Mon, 2 Nov 2015 10:58:27 +0000 (11:58 +0100)]
Merge commit '407ac22322e5ce67996ec54ef619cafa4c9ceb78'

* commit '407ac22322e5ce67996ec54ef619cafa4c9ceb78':
  w32pthreads: Map MemoryBarrier to __sync_synchronize on mingw

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
8 years agoMerge commit 'a0562e531723923b632684c7b51a9dd584bf534f'
Hendrik Leppkes [Mon, 2 Nov 2015 10:58:16 +0000 (11:58 +0100)]
Merge commit 'a0562e531723923b632684c7b51a9dd584bf534f'

* commit 'a0562e531723923b632684c7b51a9dd584bf534f':
  configure: Add a SONAME entry for the android target

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
8 years agoMerge commit 'd35d0c723e3c8fc8cde76bf677f67928f5e179a8'
Hendrik Leppkes [Mon, 2 Nov 2015 10:58:01 +0000 (11:58 +0100)]
Merge commit 'd35d0c723e3c8fc8cde76bf677f67928f5e179a8'

* commit 'd35d0c723e3c8fc8cde76bf677f67928f5e179a8':
  vdpau: remove dysfunctional H.263 support

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
8 years agoMerge commit 'f53583ea6e2e3fda4e4aa363f9a62cff4285affb'
Hendrik Leppkes [Mon, 2 Nov 2015 10:55:13 +0000 (11:55 +0100)]
Merge commit 'f53583ea6e2e3fda4e4aa363f9a62cff4285affb'

* commit 'f53583ea6e2e3fda4e4aa363f9a62cff4285affb':
  omadec: Fix position of opening parenthesis

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
8 years agoMerge commit 'b4a82e740743744136e07054525560351e4892ae'
Hendrik Leppkes [Mon, 2 Nov 2015 10:54:34 +0000 (11:54 +0100)]
Merge commit 'b4a82e740743744136e07054525560351e4892ae'

* commit 'b4a82e740743744136e07054525560351e4892ae':
  h264: Print the complete user message

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
8 years agoMerge commit '8487987b87a252963b27b6adfd82887ea5933918'
Hendrik Leppkes [Mon, 2 Nov 2015 10:53:55 +0000 (11:53 +0100)]
Merge commit '8487987b87a252963b27b6adfd82887ea5933918'

* commit '8487987b87a252963b27b6adfd82887ea5933918':
  h264: Print user data SEI under normal debug verbosity

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
8 years agoMerge commit '1720791e36f9cc24c05efea5bb275ab52156ce50'
Hendrik Leppkes [Mon, 2 Nov 2015 10:50:35 +0000 (11:50 +0100)]
Merge commit '1720791e36f9cc24c05efea5bb275ab52156ce50'

* commit '1720791e36f9cc24c05efea5bb275ab52156ce50':
  png: read and write stereo3d frame side data information

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
8 years agoMerge commit '00b62968d079e63bf22028f253ac297292436ebe'
Hendrik Leppkes [Mon, 2 Nov 2015 10:43:50 +0000 (11:43 +0100)]
Merge commit '00b62968d079e63bf22028f253ac297292436ebe'

* commit '00b62968d079e63bf22028f253ac297292436ebe':
  os_support: Don't try to return the service name as a string in getnameinfo

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
8 years agoMerge commit '567ca142952c5be57e52c149c815dfe5d6ac6d41'
Hendrik Leppkes [Mon, 2 Nov 2015 10:42:26 +0000 (11:42 +0100)]
Merge commit '567ca142952c5be57e52c149c815dfe5d6ac6d41'

* commit '567ca142952c5be57e52c149c815dfe5d6ac6d41':
  configure: Add -D_CRT_NONSTDC_NO_WARNINGS when building with msvc

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
8 years agoavformat/segafilm: set video stream duration
Paul B Mahol [Fri, 30 Oct 2015 11:09:48 +0000 (12:09 +0100)]
avformat/segafilm: set video stream duration

Signed-off-by: Paul B Mahol <onemda@gmail.com>
8 years agoavformat/segafilm: set audio stream duration
Paul B Mahol [Fri, 30 Oct 2015 11:07:44 +0000 (12:07 +0100)]
avformat/segafilm: set audio stream duration

Signed-off-by: Paul B Mahol <onemda@gmail.com>
8 years agoavformat/segafilm: implement seeking
Paul B Mahol [Fri, 30 Oct 2015 11:07:13 +0000 (12:07 +0100)]
avformat/segafilm: implement seeking

Signed-off-by: Paul B Mahol <onemda@gmail.com>
8 years agoavformat: unref packet after storing it in internal packet queue
Hendrik Leppkes [Sun, 1 Nov 2015 10:08:42 +0000 (11:08 +0100)]
avformat: unref packet after storing it in internal packet queue

Fixes a memory leak when using genpts