1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

77453 Commits

Author SHA1 Message Date
Ganesh Ajjanagadde
e29db08cf7 lavu/libm: add exp10 support
exp10 is a function available in GNU libm. Looks like no other common
libm has it. This adds support for it to FFmpeg.

There are essentially 2 ways of handling the fallback:
1. Using pow(10, x)
2. Using exp2(M_LOG2_10 * x).

First one represents a Pareto improvement, with no speed or accuracy
regression anywhere, but speed improvement limited to GNU libm.

Second one represents a slight accuracy loss (relative error ~ 1e-13)
for non GNU libm. Speedup of > 2x is obtained on non GNU libm platforms,
~30% on GNU libm. These are "average case numbers", another benefit is
the lack of triggering of the well-known terrible worst case paths
through pow.

Based on reviews, second one chosen. Comment added accordingly.

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-23 09:22:59 -08:00
Ganesh Ajjanagadde
520a5d33f0 lavfi/af_aemphasis: remove unnecessary complex number usage
complex is not available on all platforms. Furthermore, it is trivial to
rewrite complex number expressions to real arithmetic, and in fact
sometimes advantageous for performance reasons: by wrapping as a complex,
one forces a particular Cartesian representation that is not necessarily optimal for the purpose.

Configure dependencies also removed, and aemphasis is now available across
all platforms.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-23 09:22:59 -08:00
wm4
a0ec4aebab avformat/subtitles: treat negative duration like unknown duration
Fixes a specific srt sample, which has an event with negative duration.
libavcodec will convert an event with negative duration to an ASS event
which will be displayed forever, which is not wanted here.

Treat negative duration always as unknown duration instead, and show it
until the next subtitle event.
2015-12-23 15:08:58 +01:00
Paul B Mahol
57787f5ef8 avcodec/s302menc: comment out allowed channel layouts
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-23 12:46:23 +01:00
Hendrik Leppkes
b942845bee avcodec/libschroedingerenc: add missing AVClass to private context
Fixes ticket #5104.
2015-12-23 10:22:00 +01:00
Andreas Cadhalpun
b648b246f0 diracdec: add missing check for pixel_range_index
This fixes an out-of-bounds read introduced in commit 0379603.

Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-12-22 20:23:36 +01:00
Andreas Cadhalpun
7172175da6 mlvdec: validate bits_per_coded_sample
A negative bits_per_coded_sample doesn't make sense.
If it is too large, the size calculation for av_get_packet overflows,
resulting in allocation of a too small buffer.

Also make sure width and height are sane.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-12-22 19:39:43 +01:00
Michael Niedermayer
5dbd114b83 avformat/movenc-test: Make format static
Makes greping for non static consts easier

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-22 17:17:56 +01:00
Michael Niedermayer
d3b6a9abac avformat/mov: Update handbrake_version threshold for full mp3 parsing
Fixes: Endangered\ Species\ 1x01\ Collecting\ Merl.mp4

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-22 16:21:47 +01:00
Nicolas George
1655788712 lavfi: make request_frame() non-recursive.
Instead of calling the input filter request_frame() method,
ff_request_frame() now marks the link and returns immediately.
buffersink is changed to activate the marked filters until
a frame is obtained.
2015-12-22 16:04:30 +01:00
Nicolas George
108b4de552 lavfi: replace link.closed by link.status.
The status field can carry any error code instead of just EOF.
Also only update it through a wrapper function and provide a timestamp.
Update the few filters that used it directly.
2015-12-22 16:04:30 +01:00
Nicolas George
39a09e995d lavfi: deprecate avfilter_link_set_closed().
Applications are not supposed to mess with links,
they should close the sinks.
Furthermore, this function does not distinguish what end
of the link caused the close and does not have a timestamp.
2015-12-22 16:04:22 +01:00
Nicolas George
b8b7d5ac6c lavfi: add link.current_pts field. 2015-12-22 15:55:00 +01:00
Nicolas George
d03eab34dd lavfi: rename link.current_pts to current_pts_us.
This field is used for fast comparison between link ages,
it is in AV_TIME_BASE units, in other words microseconds,
µs =~ us.
Renaming it allows a second field in link time base units.
2015-12-22 15:55:00 +01:00
Nicolas George
63f7bee752 lavfi/vf_mpdecimate: remove request_frame().
It is no longer needed since looping is not necessary.
2015-12-22 15:55:00 +01:00
Michael Niedermayer
05af8608c2 avcodec/ass: check for av_mallocz() failure
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-22 14:41:27 +01:00
erankor
18cd7891cb MAINTAINERS: add Eran Kornblau for aes_ctr and movenccenc
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-22 13:57:55 +01:00
Timo Rothenpieler
d7c2b75681 vaapi: Add VP9 hwaccell support
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2015-12-22 12:54:23 +01:00
Carl Eugen Hoyos
b18230ee8c lavf/rmdec: Use correct format specifier for int64_t.
Fixes ticket #5100.
2015-12-22 09:29:08 +01:00
Claudio Freire
4720a562c8 AAC encoder: fix possible assertion failure in PNS
Fix possible SF delta violation that would cause an
eventual assertion failure in some corner cases (esp
on very low bitrates) when marking bands for PNS due
to misuse of the sf_delta utilities
2015-12-22 05:26:12 -03:00
Rostislav Pehlivanov
c0f67e1123 aacenc_is: rename variable
'erf' is far from the best name for a variable and is not very
descriptive since the actual variable points to the comparitively best
IS phase. Therefore rename it to 'best'.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-12-21 17:23:38 +00:00
Ganesh Ajjanagadde
dd68cde28a lavu/libm: add erf hack and make dynaudnorm available everywhere
Source code is from Boost:
http://www.boost.org/doc/libs/1_46_1/boost/math/special_functions/erf.hpp
with appropriate modifications for FFmpeg.

Tested on interval -6 to 6 (beyond which it saturates), +/-NAN, +/-INFINITY
under -fsanitize=undefined on clang to test for possible undefined behavior.

This function turns out to actually be essentially as accurate and faster than the
libm (GNU/BSD's/Mac OS X), and I can think of 3 reasons why upstream
does not use this:
1. They are not aware of it.
2. They are concerned about licensing - this applies especially to GNU
libm.
3. They do not know and/or appreciate the benefits of rational
approximations over polynomial approximations. Boost uses them to great
effect, see e.g swr/resample for bessel derived from them, which is also
similarly superior to libm variants.

First, performance.
sample benchmark (clang -O3, Haswell, GNU/Linux):

3e8 values evenly spaced from 0 to 6
time (libm):
./test  13.39s user 0.00s system 100% cpu 13.376 total
time (boost based):
./test  9.20s user 0.00s system 100% cpu 9.190 total

Second, accuracy.
1e8 eval pts from 0 to 6
maxdiff (absolute): 2.2204460492503131e-16
occuring at point where libm erf is correctly rounded, this is not.

Illustration of superior rounding of this function:
arg   : 0.83999999999999997
erf   : 0.76514271145499457
boost : 0.76514271145499446
real  : 0.76514271145499446

i.e libm is actually incorrectly rounded. Note that this is clear from:
https://github.com/JuliaLang/openlibm/blob/master/src/s_erf.c (the Sun
implementation used by both BSD and GNU libm's), where only 1 ulp is
guaranteed.

Reasons it is not easy/worthwhile to create a "correctly rounded"
variant of this function (i.e 0.5ulp):
1. Upstream libm's don't do it anyway, so we can't guarantee this unless
we force this implementation on all platforms. This is not easy, as the
linker would complain unless measures are taken.
2. Nothing in FFmpeg cares or can care about such things, due to the
above and FFmpeg's nature.
3. Creating a correctly rounded function will in practice need some use of long
double/fma. long double, although C89/C90, unfortunately has problems on
ppc. This needs fixing of toolchain flags/configure. In any case this
will be slower for miniscule gain.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-21 09:03:11 -08:00
Ganesh Ajjanagadde
fc5e39544b lavf/avformat: add av_warn_unused_result to avformat_write_header
May be useful as a defense, see e.g c62d1780ff.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-21 08:39:57 -08:00
Ganesh Ajjanagadde
879b4a9d3e lavd/pulse_audio_enc: replace lround by lrint
Here it is mostly a cosmetic change, but there might be benefits in that
there are no compat hacks for lround, while there are for lrint.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-21 08:25:30 -08:00
Ganesh Ajjanagadde
ea2f04bffe lavfi/vf_histogram: replace round by lrint
lrint is at least as fast, uses a superior rounding mode, and avoids an
implicit cast.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-21 08:23:21 -08:00
Ganesh Ajjanagadde
ad795f6394 lavfi/af_dynaudnorm: replace round by lrint
lrint is at least as fast, uses a superior rounding mode, and avoids an
implicit cast.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-21 08:22:23 -08:00
Ganesh Ajjanagadde
2a486869d9 lavfi/vf_crop: replace round by lrint
lrint is at least as fast, avoids an implicit cast, and uses a superior
rounding mode.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-21 08:21:20 -08:00
Ganesh Ajjanagadde
b9c2ebeee4 lavc/libvpxenc: replace round by lrint
Mostly cosmetic here.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-21 08:20:26 -08:00
Ganesh Ajjanagadde
ff1442a51d lavfi/vf_drawtext: replace round by llrint
llrint is at least as fast, and avoids an implicit cast.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-21 08:18:12 -08:00
Ganesh Ajjanagadde
7af14b3726 lavfi/vf_colorlevels: replace round by lrint
lrint avoids an implicit cast, and is not slower on non-broken libm's. Thus this
represents a Pareto improvement.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-21 08:17:13 -08:00
Ganesh Ajjanagadde
cc37b31ad3 lavfi/vf_colorchannelmixer: replace round by lrint
lrint is faster here on -ftree-vectorize with GCC. This is likely simply
an artifact of GCC's rather terrible auto-vectorizer, since as per the
instruction set manuals cvtsd2si and cvttsd2si (or their vector equivalents)
have identical cycle timings.

Anyway, regardless of above, lrint is superior to round accuracy wise.

Safety guaranteed as long int has at least 32 bits.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-21 08:15:31 -08:00
Clément Bœsch
d3dbae1c71 lavfi/drawtext: fix shadow[xy] descriptions 2015-12-21 16:42:14 +01:00
Clément Bœsch
1d6308dbc6 lavfi/drawtext: hide first font load warning when fontconfig is present 2015-12-21 16:07:22 +01:00
Clément Bœsch
4cb26c3c35 lavfi/drawtext: fix crash when no text, file or timecode provided 2015-12-21 15:54:20 +01:00
Paul B Mahol
a142308dcd avfilter/af_ladspa: fix av_assert0()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-21 13:27:56 +01:00
Clément Bœsch
b4431c80ef lavf/img2enc: add atomic_writing option
This behaviour change caused a regression on our side recently, we might
want to disable the option by default.
2015-12-21 11:19:51 +01:00
Clément Bœsch
f122ba36cb lavc: add text encoder 2015-12-21 11:14:02 +01:00
Clément Bœsch
244766e407 lavfi/scale: add nb_slices debug option 2015-12-21 10:30:52 +01:00
Paul B Mahol
484cc66f57 avcodec/indeo2: use init_get_bits8
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-20 21:31:55 +01:00
James Almer
d4c47333e1 x86/hevc_sao: add ff_hevc_sao_edge_filter_{8,16}_{10,12}
Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-12-20 17:01:15 -03:00
James Almer
3ff2beff65 x86/hevc_sao: simplify sao_edge_filter 10/12bit
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-12-20 16:45:37 -03:00
James Almer
34b2bd03cf x86/hevc_sao: simplify sao_band_filter 10/12bit
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-12-20 16:42:36 -03:00
Paul B Mahol
9e569abe99 avfilter/avf_showfreqs: make it possible to split channels
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-20 19:52:51 +01:00
Paul B Mahol
367ffa0c15 avcodec/flacenc: use designated initializers for AVClass
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-20 17:47:21 +01:00
Paul B Mahol
db6e337b41 avcodec/s302menc: check if buf_size can actually be put into 16bit size
This disallows creating unplayable audio.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-20 16:05:37 +01:00
Paul B Mahol
577f057355 avcodec/s302menc: set supported channel layouts by codec
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-20 16:05:37 +01:00
Andreas Cadhalpun
f6830cf5ba nuv: sanitize negative fps rate
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-12-20 12:22:45 +01:00
Andreas Cadhalpun
699e68371e rawdec: only exempt BIT0 with need_copy from buffer sanity check
Otherwise the too small buffer is directly used in the frame, causing
segmentation faults, when trying to use the frame.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-12-20 12:15:56 +01:00
Andreas Cadhalpun
9fcfe4a3cd mlvdec: check that index_entries exist
This fixes NULL pointer dereferencing.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-12-20 11:57:54 +01:00
Michael Niedermayer
70f13abb4f avcodec/mpeg4videodec: also for empty partitioned slices
Fixes assertion failure
Fixes: id_acf3e47f864e1ee4c7b86c0653e0ff31e5bde56e.m4v

Found-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-19 23:54:10 +01:00