1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00
Commit Graph

45119 Commits

Author SHA1 Message Date
Andreas Rheinhardt
553619eacb avcodec/zmbvenc: Mark encoder as init-threadsafe
Initializing zlib in the way we do here is threadsafe, see
https://www.zlib.net/zlib_faq.html#faq21

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-07 09:26:26 +02:00
Andreas Rheinhardt
141f3053ba avcodec/zmbvenc: Fix memleak upon init error
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-07 09:25:28 +02:00
Andreas Rheinhardt
e51fad097b avcodec/zmbv: Mark decoder as init-threadsafe
Initializing zlib in the way we do here is threadsafe, see
https://www.zlib.net/zlib_faq.html#faq21

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-07 09:25:10 +02:00
Andreas Rheinhardt
9d752ab634 avcodec/zmbv: Don't free uninitialized z_stream
It is not documented to be safe to call inflateEnd() on a z_stream
that has not been successfully initialized via inflateInit(); so
record whether it has been successfully initialized.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-07 09:24:56 +02:00
Andreas Rheinhardt
14a6025384 avcodec/ttmlenc: Don't confuse capabilities and caps_internal
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-07 09:23:37 +02:00
Andreas Rheinhardt
7539a01bb0 avcodec/videotoolboxenc: Avoid copying data, allow user-supplied buffers
Here the packet size is known before allocating the packet because
the encoder provides said information (and works with internal buffers
itself), so one use this information to avoid the implicit use of another
intermediate buffer for the packet data; and by switching to
ff_get_encode_buffer() one can also allow user-supplied buffers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Rick Kern <kernrj@gmail.com>
2021-05-06 00:29:36 -04:00
Andreas Rheinhardt
e10d75610c avcodec/dvenc: Make encoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-06 06:13:54 +02:00
Andreas Rheinhardt
bc5e68ea88 avcodec/dvdec: Make decoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-06 06:13:54 +02:00
Andreas Rheinhardt
6d484671ec avcodec/dv: Don't initialize RL VLC for encoder
Said RL VLC is only used by the decoder, ergo don't initialize it for
the encoder and move the whole code and the RL VLC table itself to
dvdec.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-06 06:13:54 +02:00
Andreas Rheinhardt
fbb9e0dbc8 avcodec/dv: Don't pretend VLC allocation can't fail
It can and therefore we switch from a heap allocated VLC table to
a VLC initialized via the mechanism for static VLCs, but without
an actual static VLC.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-06 06:13:54 +02:00
Andreas Rheinhardt
869b204cbc avcodec/wmalosslessdec: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-06 06:13:54 +02:00
Andreas Rheinhardt
f48e4639ae avcodec/wmavoice: Mark decoder as init-threadsafe
It is init-threadsafe since b9c1ab8907
and except on MIPS even before that due to its use of ff_thread_once()
for static initialization.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-06 06:13:54 +02:00
Andreas Rheinhardt
f6ee90b6dc avcodec/qcelpdec: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-06 06:13:54 +02:00
Zhao Zhili
71ad83667d lavc/videotoolboxenc: set DataRateLimits for hevc
From the comment it's not available on old version. It works now
by testing on macOS 11.2.1. There is no document about since when.
So trying to set the configuration and ignore the error for hevc.

Signed-off-by: Rick Kern <kernrj@gmail.com>
2021-05-06 00:11:56 -04:00
James Almer
3575a495f6 avcodec/decode: stop trying to initialize palette values in avcodec_default_get_buffer2()
avpriv_set_systematic_pal2() is meant to fill fixed vales for formats that
until recently were tagged as "pseudo pal". This is no longer the case, so
this call is a no-op when used on real PAL formats.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-05 16:39:52 -03:00
Andreas Rheinhardt
b30851c872 avcodec/rl: Improve documentation of ff_rl_init/ff_rl_init_vlc
In particular, document that they initialize different parts of an
RLTable and therefore need not be synchronized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-05 18:00:25 +02:00
Andreas Rheinhardt
03008c2811 avcodec/speedhqenc: Hardcode table to save space
The SpeedHQ encoder currently reverses the entries of two small tables
and stores them in other tables. These other tables have a size of 48
bytes, yet the code for their initialization takes 135 bytes (GCC 9.3,
x64, O3 albeit in an av_cold function). So remove the runtime
initialization and hardcode the tables.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-05 17:55:37 +02:00
Andreas Rheinhardt
b05631f7b9 avcodec/speedhq, speedhqenc: Make codecs init-threadsafe
The SpeedHQ decoder uses and initializes a RLTable's VLC, yet it also
initializes other parts of the RLTable that it does not use. This has
downsides besides being wasteful: Because the SpeedHQ encoder also
initializes these additional fields, there is a potential for data races
(and therefore undefined behaviour). In fact, removing the superfluous
initializations from the decoder automatically makes both the decoder
and the encoder init-threadsafe. This commit does so.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-05 17:52:41 +02:00
Andreas Rheinhardt
4fda451c9f avcodec/zmbvenc: Avoid copying packet data, allow user-supplied buffers
Here the packet size is known before allocating the packet because
the encoder itself works with an internal buffer, so one can use
this information to avoid the implicit use of another intermediate
buffer for the packet data; one can also switch to
ff_get_encode_buffer() and directly use user-supplied buffers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:04 +02:00
Andreas Rheinhardt
a3f02388f1 avcodec/yuv4enc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:04 +02:00
Andreas Rheinhardt
a043dcbe65 avcodec/y41penc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
765366bcba avcodec/xwdenc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
b66ca3b8d4 avcodec/xfaceenc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
14407e84b9 avcodec/v410enc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
7bfa533793 avcodec/v408enc: Deduplicate pix_fmts arrays
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
d914da3bb6 avcodec/v408enc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
27b0a5204d avcodec/v308enc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
1dc8f23787 avcodec/v210enc: Allow user-supplied buffers
Trivial for an encoder that knows the size of the output packet in advance.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
fbfae5eb36 avcodec/s302menc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
7bb7161f86 avcodec/roqaudioenc: Avoid copying data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
c7a0addf93 avcodec/rawenc: Allow user-supplied buffers
Trivial for an encoder that knows the size of the output packet in advance.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
8eef32d394 avcodec/ra144enc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
184a8852f1 avcodec/r210enc: Deduplicate pix_fmts arrays
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
5cb64caadf avcodec/r210enc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
0788069cb1 avcodec/pcm: Allow user-supplied buffers
Trivial for encoders that know the size of the output packet in advance.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
3e6dcf0b1a avcodec/pcm-dvdenc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
ef6232aa38 avcodec/nellymoserenc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
8fb25961b9 avcodec/g726: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
f471caaf90 avcodec/g723_1enc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
63218fc2d0 avcodec/g722enc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
6e2fe9958a avcodec/fitsenc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
ae7a7dc458 avcodec/dpxenc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data; this also makes it easy
to allow user-supplied buffers. Only one thing needed to be changed:
One can no longer use a pointer to uint16_t for the destination buffer
because its alignment is unknown.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 13:55:42 +02:00
Andreas Rheinhardt
1393c7edae avcodec/dnxhdenc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 12:45:49 +02:00
Andreas Rheinhardt
4569c70f14 avcodec/dcaenc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 12:44:22 +02:00
Andreas Rheinhardt
72c521e80a avcodec/dcaenc: Don't write one bit at a time
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 12:44:04 +02:00
Andreas Rheinhardt
350c00f3df avcodec/cngenc: Allow user-supplied buffers
Trivial for an encoder that knows the size of the output packet in
advance.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 12:41:52 +02:00
Andreas Rheinhardt
5b8c18495c avcodec/cljrenc: Don't use too big buffers, don't copy them, set CAP_DR1
Up until now, the cljr encoder used buffers that were too big by a
factor of eight (probably bit/byte confusion). This has been fixed.
And because the needed buffer size can be easily calculated in advance,
one can avoid the implicit use of an intermediate buffer and can even
allow user-supplied buffers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 12:35:55 +02:00
Andreas Rheinhardt
60da5b87ad avcodec/bmpenc: Use memcpy when data has desired endianness
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 12:34:25 +02:00
Andreas Rheinhardt
6c69251b03 avcodec/bmpenc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data; this also makes it easy
to allow user-supplied buffers. Only one thing needed to be changed:
One can no longer use a pointer to uint16_t for the destination buffer
because its alignment is unknown.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 12:31:09 +02:00
Andreas Rheinhardt
1106f20645 avcodec/avuienc: Allow user-supplied buffers
Trivial given that this encoder knows the size of the output buffer
in advance.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 12:29:10 +02:00