Commit Graph

102375 Commits

Author SHA1 Message Date
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
Andreas Rheinhardt
9e9836424b avcodec/aptxenc: 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:28:51 +02:00
Andreas Rheinhardt
ad232c6833 avcodec/adxenc: 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:27:04 +02:00
Andreas Rheinhardt
39bb36d723 avcodec/[e]ac3enc: Allow user-supplied buffers
The size of the output buffer is always known in advance and
the code has no alignment requirement (it uses mostly the PutBits API),
so allowing user-supplied buffers is trivial.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 12:26:34 +02:00
Andreas Rheinhardt
32b20a274a avcodec/adpcmenc: Avoid copying packet data, allow direct rendering
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data; and one can also use
user-supplied buffers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 12:26:14 +02:00
Andreas Rheinhardt
259a762729 avcodec/a64multienc: 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:19:02 +02:00
Andreas Rheinhardt
a0b55e2adb avcodec/a64multienc: Don't modify AVCodecContext.global_quality
According to the doxy, this field is set by the user.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 12:18:55 +02:00
Andreas Rheinhardt
8dbf0cc893 avcodec/a64multienc: Avoid intermediate buffer
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 12:17:28 +02:00
Gyan Doshi
7c451b609c ffprobe: add option to control optional fields display 2021-05-05 15:04:54 +05:30
James Almer
d055af5e7b avcodec/codec_id: remove unnecessary offsets from AVCodecID
They are no longer required.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-04 16:19:59 -03:00
Michael Niedermayer
0ff60249a5 avformat/mvdec: Check sample rate in parse_audio_var()
Fixes: signed integer overflow: -635424002382840000 * 16 cannot be represented in type 'long'
Fixes: 33612/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5704741108711424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-04 17:55:24 +02:00
Michael Niedermayer
08d2df4153 avcodec/faxcompr: Check for end of bitstream in decode_group3_1d_line() and decode_group3_2d_line()
Fixes: infinite loop
Fixes: 33674/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4816457818046464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-04 17:55:24 +02:00
Michael Niedermayer
f0ce023ddb avcodec/utils: treat PAL8 for jpegs similar to other colorspaces
Fixes: out of array access
Fixes: 33713/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5778775641030656
Fixes: 33717/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEGLS_fuzzer-4960397238075392
Fixes: 33718/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMVJPEG_fuzzer-5314270096130048.fuzz
Fixes: 33719/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5352721864589312
Fixes: 33721/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THP_fuzzer-5938892055379968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-04 17:55:24 +02:00
Justin Ruggles
c75dfa0435 movenc: add movie_timescale option instead of hardcoding 1000
There are cases where using 1000 as the MP4 timescale is not
accurate enough, for example when one needs sample-accurate audio
handling.

This adds a new AVOption to the MOV/MP4 muxer to override the
movie timescale, but it still defaults to 1000 to maintain current
default behavior.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2021-05-04 15:32:26 +02:00
James Almer
e27e80edcd tests/image: remove colorspace conversion from jpegls tests
It's not needed after 011006874c.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-03 18:32:01 -03:00
Michael Niedermayer
011006874c avcodec/jpeglsdec: Set alpha plane in PAL8 so image is not 100% transparent
Fixes: tickets/3933/128.jls

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-03 21:34:22 +02:00
Michael Niedermayer
c83f60d7d7 avcodec/mjpegdec: Clear palette to avoid uninitialized entries
Suggested-by: James
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-03 21:34:22 +02:00
Michael Niedermayer
7f6ada4eea avcodec/mjpegdec: Decode to PAL8 independant of the location of LSE
This simply performs a 2nd pass if a LSE is encountered with GRAY8

Fixes: tickets/3933/128.jls

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-03 21:34:22 +02:00
Michael Niedermayer
9fd06a3639 Revert "avcodec/mjpegdec: postpone calling ff_get_buffer() until the SOS marker"
This also temporary disables fate-jpegls which is re-enabled in the next commit

This reverts commit c8197f73e6.
2021-05-03 21:34:22 +02:00
Michael Niedermayer
4b1e1f706b Revert "avcodec/mjpegdec: fix SOF check in EOI"
This reverts commit fb5e2d7112.
2021-05-03 21:34:22 +02:00
James Almer
4d3474432f ffmpeg: stop accessing private AVStream.codec_info_nb_frames
Use AVSTREAM_EVENT_FLAG_NEW_PACKETS instead, which should provide the
same information in this case.
Finishes removing all uses of this field as started by 87f0c8280c.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-02 00:44:19 -03:00
Andreas Rheinhardt
5541cffa17 avcodec/mlpenc: Make encoders init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
0166bb12e7 avcodec/mlpenc: Add const where appropriate
The MLP/TrueHD encoder uses pointers to non-const to access several
static objects that are only initialized at runtime and are therefore
not declared as const. This does not result in compiler warnings, but it
is fragile, as these objects are really not to be modified as they are
not owned by any encoder instance. Therefore this commit adds const to
the pointed to type of the pointers used to access them after their
initialization. One object has even been made const.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
e44e41edce avcodec/cfhdenc: Mark encoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
5408366dc5 avcodec/ffv1dec: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
62559a9e00 avcodec/ffv1enc: Mark encoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
a7f4abbc62 avcodec/snow: Hardcode table to save space
The size of ff_qexp is only 32 bytes, but the code to generate it at
runtime takes 47 bytes (GCC 9.3, x64, -O3 in an av_cold function); so
just hardcode it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
56df06dd83 avcodec/bink: Don't waste space for VLC table
The Bink video decoder uses VLCs; the longest codes of these VLCs have
different lengths, yet they are all so small that each VLC is read in
one go, so that the number of elements in the VLC table actually used by
each table is 1 << nb_bits, where nb_bits is the length of the longest
code. Yet when determining the size of the VLC table nb_bits has been
overestimated as the number of bits of the longest code in all VLCs,
making said table unnecessary big (2048 vs 976 elements).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
bd473d325d avcodec/bink: Make decoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
8903c7f1fe avcodec/kmvc: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
1c7e52f8ff avcodec: Mark ff_ass_subtitle_header based decoders as init-threadsafe
ff_ass_subtitle_header_full() just uses av_asprintf() and is therefore
thread-safe itself.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
a380343c75 avcodec/assdec: Mark decoders as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
b3108b1cbc avcodec/dvbsubdec: Make decoder init-threadsafe
Note: This decoder uses a static variable in save_display_set() (which
is only enabled if DEBUG is defined); yet said function can't be reached
from the decoder's init function at all, so it is no problem for
setting the FF_CODEC_CAP_INIT_THREADSAFE flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
834ef6f4a9 avcodec/dvbsubdec: Add const where appropriate
These pointers sometimes point to static storage (namely to
default_clut), so adding const to the pointed-to type is important to
ensure that one does not accidentally modify something that is not owned
by a single AVCodecContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
2a4cedace4 avcodec/movtextenc, srtenc, webvttenc: Mark encoders as init-threadsafe
They all rely on ff_ass_split(), which does not have any static state.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
55982b9447 avcodec/assenc: Mark encoders as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
30a947b8f8 avcodec/sonic: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt
0878ccdcd2 avcodec/sonic: Mark encoders as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:41 +02:00
Andreas Rheinhardt
7d4f1f4d99 avcodec/dca*: Make decoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:41 +02:00