1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

89610 Commits

Author SHA1 Message Date
wm4
4ed66517c6 lavc: remove complex debug code around avcodec init locking
This is just a lot of complicated and confusing code that had no purpose
anymore.

Also, the functions return values were checked only sometimes. Locking
shouldn't fail anyway, so remove the return values. Barely any other
pthread lock calls check the return value (including more important code
that is more likely to fail horribly if locking fails).

It could be argued that it might be helpful in some debugging
situations, or when the user built FFmpeg without thread support against
all good advice.

But there are dummy atomics too, so the atomic check won't help with
ensuring correctness absolutely. You gain very little.

Also, for debugging, you can just raise the ASSERT_LEVEL, and then
libavutil/thread.h will redefine the locking functions to explicitly
check the return values.
2017-12-26 02:50:00 +01:00
wm4
86a13bf2ff lavc, lavf: move avformat static mutex from avcodec to avformat
It's completely absurd that libavcodec would care about libavformat
locking, but it was there because the lock manager was in libavcodec.

This is more stright forward. Changes ABI, but we don't require ABI
compatibility currently.
2017-12-26 02:50:00 +01:00
wm4
e24f192a9f ffplay: drop lock manager use
Deprecated and useless.
2017-12-26 02:50:00 +01:00
wm4
a04c2c707d lavc: replace and deprecate the lock manager
Use static mutexes instead of requiring a lock manager. The behavior
should be roughly the same before and after this change for API users
which did not set the lock manager at all (except that a minor memory
leak disappears).
2017-12-26 02:50:00 +01:00
wm4
9b121dfc32 w32pthreads: always use Vista+ API, drop XP support
This removes the XP compatibility code, and switches entirely to SWR
locks, which are available starting at Windows Vista.

This removes CRITICAL_SECTION use, which allows us to add
PTHREAD_MUTEX_INITIALIZER, which will be useful later.

Windows XP is hereby not a supported build target anymore. It was
decided in a project vote that this is OK.
2017-12-26 02:49:48 +01:00
Steven Liu
2aee5a8723 avformat/hlsenc: fix resource leak
fix CID: 1426931 1426929
2017-12-25 23:51:25 +08:00
Paul B Mahol
e712d30173 avfilter/vf_convolve: add threading for complex multiplication
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-25 15:46:04 +01:00
Paul B Mahol
c59e49f9b2 avfilter/vf_convolve: implement slice threading
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-25 11:53:54 +01:00
Paul B Mahol
f9f1b2a927 avfilter/vf_convolve: split input/output operations from fft
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-25 11:05:26 +01:00
Paul B Mahol
86e3eebfb7 avfilter/vf_convolve: use shorter variants for pointers
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-25 10:19:47 +01:00
Paul B Mahol
ec6608f51b avfilter/vf_convolve: clear coefficients only when needed
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-25 10:06:07 +01:00
Karthick Jeyapal
be2da4c522 avformat/hlsenc: Signal http end of chunk(http_shutdown) during hlsenc_io_close()
Currently http end of chunk is signalled implicitly in hlsenc_io_open().
This mean playlists http writes would have to wait upto a segment duration to signal end of chunk causing delays.
This patch will fix that problem and improve performance.
2017-12-25 12:08:06 +08:00
Karthick Jeyapal
6848201f70 avformat/http: Avoid calling http_shutdown() if end of chunk is signalled already 2017-12-25 12:07:43 +08:00
James Almer
90d216cb90 x86inc: set the correct amount of simd regs in x86_64 when avx512 is enabled but not used
Fixes compilation of libavresample/x86/audio_mix.asm

Reviewed-by: Gramner
Signed-off-by: James Almer <jamrial@gmail.com>
2017-12-24 23:02:54 -03:00
James Darnley
40d4b13228 checkasm: support for AVX-512 functions 2017-12-24 22:02:41 +01:00
Henrik Gramner
f7197f68dc x86inc: AVX-512 support
AVX-512 consists of a plethora of different extensions, but in order to keep
things a bit more manageable we group together the following extensions
under a single baseline cpu flag which should cover SKL-X and future CPUs:
 * AVX-512 Foundation (F)
 * AVX-512 Conflict Detection Instructions (CD)
 * AVX-512 Byte and Word Instructions (BW)
 * AVX-512 Doubleword and Quadword Instructions (DQ)
 * AVX-512 Vector Length Extensions (VL)

On x86-64 AVX-512 provides 16 additional vector registers, prefer using
those over existing ones since it allows us to avoid using `vzeroupper`
unless more than 16 vector registers are required. They also happen to
be volatile on Windows which means that we don't need to save and restore
existing xmm register contents unless more than 22 vector registers are
required.

Big thanks to Intel for their support.
2017-12-24 22:02:41 +01:00
James Darnley
8f86e66238 avcodec: add stride alignment needed for AVX-512 2017-12-24 22:02:41 +01:00
James Darnley
e2218ed8ce avutil: add alignment needed for AVX-512 2017-12-24 22:02:41 +01:00
James Darnley
4783a01c11 avutil: detect when AVX-512 is available 2017-12-24 22:02:41 +01:00
James Darnley
8b81eabe57 avutil: add AVX-512 flags 2017-12-24 22:02:41 +01:00
James Darnley
b7a3d1f249 configure: test whether x86 assembler supports AVX-512 2017-12-24 22:02:41 +01:00
Aman Gupta
207e98b4e5 avformat/hls: fix SEGV in previous commit
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-24 12:31:27 -08:00
Aman Gupta
b33cf73507 avformat/hls: fix memory leak with non-http segments
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-24 11:59:32 -08:00
Aman Gupta
3d95868d1b avformat/hls: fix CID 1426930
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-24 11:58:30 -08:00
Paul B Mahol
5533cbfc84 avfilter/vf_convolve: fix various issues
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-24 18:24:48 +01:00
Paul B Mahol
175122fcd5 avfilter/vf_convolve: fix convolution of borders
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-24 10:15:26 +01:00
Aman Gupta
9e5e3236f4 avformat/internal: fix compile error with some versions of g++
Fixes #6926

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-23 12:36:22 -08:00
Paul B Mahol
b5958ff82e avfilter/vf_convolve: unbreak non-power of 2 width&height filtering
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-23 17:44:52 +01:00
Paul B Mahol
b943bc343d avfilter/vf_fftfilt: support >8 bit depth formats
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-23 11:36:37 +01:00
Paul B Mahol
f6608f4725 avfilter/vf_aspect: change outlink sample aspect ratio instead of inlink
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-23 10:48:14 +01:00
Paul B Mahol
4754d70a23 avfilter/video: pick sar from link
It should not be needed for each filter that sets sample aspect ratio
to set it explicitly also for each and every frame, instead that is
automatically done in get_buffer call.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-23 10:48:14 +01:00
Vishwanath Dixit
d02289c386 avformat/hlsenc:addition of #EXT-X-MEDIA tag and AUDIO attribute
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-12-23 13:42:00 +08:00
Aman Gupta
4c78bbd313 avformat/internal: log underlying error with ff_rename failure
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: wm4 <nfxjfg@googlemail.com>
2017-12-22 18:00:47 -08:00
Aman Gupta
5f4a32a6e3 avformat/hls: hide misleading warning when http reconnect is required
AVERROR_EOF is an internal error which means the http socket is no longer
valid for new requests. It informs the caller that a new connection must
be established, and as such does not need to be surfaced to the user as
a warning.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-22 16:41:41 -08:00
Aman Gupta
54d0ef1738 avformat/http: return EOF from ff_http_do_new_request if previous response said Connection:close
This fixes a deadlock when using the hls demuxer's new http_persistent feature
to stream a youtube live stream over HTTPS. The youtube servers are http/1.1
compliant, but return a "Connecton: close". Before this commit, the demuxer
would attempt to send a new request on the partially shutdown connection and
cause a deadlock in the tls protocol.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-22 16:39:37 -08:00
Aman Gupta
1f0eaa02aa avformat/hls: add http_multiple option
This improves network throughput of the hls demuxer by avoiding
the latency introduced by downloading segments one at a time.

The problem is particularly noticable over high-latency network
connections: for instance, if RTT is 250ms, there will a 250ms idle
period between when one segment response is read and the next one
starts.

The obvious solution to this is to use HTTP pipelining, where a
second request can be sent (on the persistent http/1.1 connection)
before the first response is fully read. Unfortunately the way the
http protocol is implemented in avformat makes implementing pipleining
very complex.

Instead, this commit simulates pipelining using two separate persistent
http connections. This has the advantage of working independently of
the http_persistent option, and can be used with http/1.0 servers as
well. The pair of connections is swapped every time a new segment starts
downloading, and a request for the next segment is sent on the secondary
connection right away. This means the second response will be ready and
waiting by the time the current response is fully read.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2017-12-22 14:42:50 -08:00
Aman Gupta
03765aa6fa avformat/hls: allow open_input to be re-used
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2017-12-22 14:42:50 -08:00
Aman Gupta
b7d6c0cd48 avformat/hls: add http_persistent option
This teaches the HLS demuxer to use the HTTP protocols
multiple_requests=1 option, to take advantage of "Connection:
Keep-Alive" when downloading playlists and segments from the HLS server.

With the new option, you can avoid TCP connection and TLS negotiation
overhead, which is particularly beneficial when streaming via a
high-latency internet connection.

Similar to the http_persistent option recently implemented in hlsenc.c

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2017-12-22 14:42:50 -08:00
Aman Gupta
9395e44b8d avformat/http: add "Opening" info logging to ff_http_do_new_request
This mimics logging that was added in 53e0d5d724 for security
purposes.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-12-22 14:42:50 -08:00
Aman Gupta
28358e466d avformat/http: return EINVAL from ff_http_do_new_request() if re-used with different hostname
This will prevent improper use of ff_http_do_new_request() if the user
tries to send a request for a different host to a previously connected
persistent http/1.1 connection.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Karthick J <kjeyapal@akamai.com>
2017-12-22 14:42:35 -08:00
Paul B Mahol
d2a2bc9a9f avfilter/vf_lut: add support for gray formats
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-22 10:57:12 +01:00
Karthick J
e3b2c8502b avformat/dashenc: avformat/dashenc: Fix the EXT-X-TARGETDURATION as per the hls specification 2017-12-22 07:44:51 +08:00
Karthick J
93a0e47876 avformat/hlsenc: set EXT-X-TARGETDURATION use lrint(EXTINF) 2017-12-22 07:43:54 +08:00
Marton Balint
e403e4bdbe avfilter/vf_framerate: fix scene score with negative linesize
Also, do not overread input if linesize > width, or linesize is not divisible
by 8, and use the proper rounded width/height for MAFD calculation.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-12-21 23:03:10 +01:00
Marton Balint
c6a65ed670 avfilter/vf_framerate: do not calculate scene change score multiple times for the same frame
This speeds up the filter, and also fixes scene change detection score which is
reduced based on the difference of the current MAFD to the preivous MAFD.
Obviously if we compare two frames twice, the difference will be 0...

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-12-21 23:03:10 +01:00
Marton Balint
e1113a83cc avfilter/vf_framerate: fix scene change detection score
- normalize score to [0..100] instead of [0..85]
- change the default score to 8.2 to roughly keep existing behaviour
- take into account bit depth
- do not truncate to integer

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-12-21 23:03:10 +01:00
Marton Balint
be15304ee6 avfilter/vf_framerate: factorize get_scene_score
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-12-21 23:03:10 +01:00
Marton Balint
090b740680 avfilter/vf_framerate: factorize blend_frames
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-12-21 23:03:10 +01:00
Marton Balint
1eb926dc02 avfilter/vf_framerate: add threaded blending operations
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-12-21 23:03:10 +01:00
Marton Balint
d6a8e46f97 fate: add 12 bit framerate filter tests
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-12-21 23:03:10 +01:00