Commit graph

47641 commits

Author SHA1 Message Date
Paul B Mahol
e8e9950f2a avcodec/amrwbdec: update .p.sample_fmts to planar variant 2022-11-28 09:11:38 +01:00
James Almer
1009396953 avcodec/mjpegenc: take into account component count when writing the SOF header size
Fixes ticket #10069

Signed-off-by: James Almer <jamrial@gmail.com>
2022-11-26 09:54:01 -03:00
Andreas Rheinhardt
0c5af908c1 avcodec/pngdec: Mark damaged frames as finished
Fixes the deadlock reported in ticket #10071.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-25 22:46:33 +01:00
Paul B Mahol
5d7f3b2639 avcodec/apac: stop adding samples if we run out of bits on EOF 2022-11-25 18:37:34 +01:00
Lynne
ca8aaf24df
binkaudio: convert to lavu/tx 2022-11-24 15:58:36 +01:00
Andreas Rheinhardt
c8e9cc8d20 avcodec/flashsvenc: Remove unnecessary or unused variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Andreas Rheinhardt
61d28ee0e4 avcodec/flashsvenc: Avoid copying frame
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Andreas Rheinhardt
a8d39e8846 avcodec/flashsvenc: Change check for first frame
AVCodecContext.frame_number is actually only incremented
in case encoding was successfull; if e.g. the ff_alloc_packet()
below fails, it won't be incremented and therefore it is possible
for the previous_frame buffer to be allocated for multiple
first frames, leaking every one except the last.
So check for whether there already is a previous frame instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Andreas Rheinhardt
721305e280 avcodec/flashsvenc: Use const where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Andreas Rheinhardt
44c09e86c7 avcodec/flashsvenc: Remove unused buffer
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Andreas Rheinhardt
6695983111 avcodec/flashsvenc: Fix packet size calculation
The earlier code did not account for the frame header as well
as the block headers; furthermore, in case a large part of
a block is unused (due to padding), the output size may
exceed 3 * width * height (where the dimensions correspond
to the visible pixels) due to the overhead of the zlib header,
so use the padded dimensions to calculate the maximum packet size
(which is also what the actual call to compress2() uses).
Fixes ticket #10053.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Andreas Rheinhardt
715bf3509a avcodec/pnmenc: Check av_image_get_buffer_size()
Fixes the crash in ticket #10050.
Also ensure that we don't overflow before ff_get_encode_buffer().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Paul B Mahol
abb5ff373d avcodec/bonk: check level value to not reach invalid values
Also reset bitstream parsing variables on fatal error.
2022-11-22 20:51:42 +01:00
Zhao Zhili
0ff18a7d6d avcodec: add MediaCodec encoder
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:56:16 +08:00
Zhao Zhili
3a59446967 avcodec/mediacodec: add ANativeWindow support
ANativeWindow can be used without JVM.
2022-11-21 23:55:57 +08:00
Zhao Zhili
040567965e avcodec/mediacodecdec: enable NDK mediacodec
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:53:04 +08:00
Zhao Zhili
4df9cb918e avcodec/mediacodec: add NDK media codec wrapper
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:52:34 +08:00
Zhao Zhili
4f2ea862b3 avcodec/mediacodec_wrapper: separate implementation from interface
This is in preparation for NDK media codec wrapper.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:52:25 +08:00
Zhao Zhili
d4b06c99ab avcodec/mediacodecdec_common: fix useless av_buffer_unref
Since frame->buf[0] is always NULL in this case, av_buffer_unref
has no effect. If it's not NULL, double-free will happen.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:52:18 +08:00
Zhao Zhili
2b97fdb8cc avcodec/mediacodecdec_common: fix misuse av_free/av_freep
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:52:11 +08:00
Zhao Zhili
b1facd11a3 avcodec/mediacodecdec: don't break out if both input and output port return try again
At the beginning of decoding, if we feed mediacodec too fast, the
input port will return try again. It takes some time for mediacodec
to consume bitstream and output frame. So the output port also return
try again. It possible that mediacodec_receive_frame doesn't consume
any AVPacket and no AVFrame is output. Then both avcodec_send_packet()
and avcodec_receive_frame() return EAGAIN, which shouldn't happen.

This bug can be produced with decoding benchmark on Pixel 3.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:52:02 +08:00
Zhao Zhili
093c437321 avcodec/mediacodec: fix incorrect crop info
The crop info is optional, but used unconditionally.

Co-authored-by: Aman Karmani <ffmpeg@tmm1.net>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:51:53 +08:00
Michael Niedermayer
0871cb9499
avcodec/vqcdec: Check for end of input in decode_vectors()
Fixes: Timeout
Fixes: 52695/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQC_fuzzer-4882310386548736

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>
2022-11-20 21:23:57 +01:00
Michael Niedermayer
6634b6ae5f
avcodec/apac: reset buffer on error
Fixes: repeatly parsing the same data after each 1 byte packet
Fixes: Timeout
Fixes: 51943/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APAC_fuzzer-5779018251370496

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-20 21:23:35 +01:00
Christopher Degawa
96748ac54f avcodec/libsvtav1: only set max_buf_sz if both bitrate and rc_buf_sz is set
maximum_buffer_size_ms should only be set if both are specified or if
the user sets it through -svtav1-params buf-sz=val

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
2022-11-20 16:20:14 -03:00
Hirokazu Honda
7f3e38bda8 avcodec/vp8: Fix wrong vpx_rac_is_end() check
The check of vpx_rac_is_end check(s) are added originally from
1afd246960. It causes a regression
of some vp8 stream. b6b9ac5698 fixes
the regression by a sort of band-aid way. This fixes the wrongness
of the original commit. vpx_rac_is_end() should be called against
the bool decoder for the vp8 headr context, not one for each
coefficient. Reference is vp8_dixie_tokens_process_row() in token.c
in spec 20.16.

Fixes: Ticket 8069
Fixes: regression of 1afd246960.
Fixes: b6b9ac5698

Co-authored-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2022-11-19 10:04:01 -05:00
Zhao Zhili
36a8d1e729 avcodec/libx265: fix build error
x265_sei is available since X265_BUILD 88. Bump required version
to 89 to fix the regression from commit 1f58503013, and remove a
conditional compilation.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-18 23:18:21 +08:00
Christopher Degawa
1c6fd7d756 avcodec/libsvtav1: replace vbv_bufsize with maximum_buffer_size_ms
svt-av1 v1.2.0 has deprecated vbv_bufsize in favor of using
- maximum_buffer_size_ms (--buf-sz)
- starting_buffer_level_ms (--buf-initial-sz)
- optimal_buffer_level_ms (--buf-optimal-sz)

and vbv_bufsize has not been in use since svt-av1 v0.8.6

Signed-off-by: Christopher Degawa <christopher.degawa@intel.com>
2022-11-17 20:27:33 -03:00
Christopher Degawa
031f1561cd avcodec/libsvtav1: remove compressed_ten_bit_format and simplify alloc_buffer
compressed_ten_bit_format has been deprecated upstream and has no effect
and can be removed. Plus, technically it was never used in the first place
since it would require the app (ffmpeg) to set it and do additional
processing of the input frames.

Also simplify alloc_buffer by removing calculations relating to the
non-existant processing.

Signed-off-by: Christopher Degawa <christopher.degawa@intel.com>
2022-11-17 20:27:33 -03:00
Paul B Mahol
e9a67ababa avcodec/rpzaenc: count in packet size also fixed header 2022-11-17 13:54:52 +01:00
Mark Reid
15df8261be avcodec/tiff: add read support for compressed rgb floating point formats
floating point uses a slightly different predictor technique describe here
http://chriscox.org/TIFFTN3d1.pdf

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-11-16 08:41:14 +01:00
Aidan MacDonald
a4405cc0cc avcodec/dvdsub_parser: Fix length check for short packets
The DVD subtitle parser handles two types of packets: "normal"
packets with a 16-bit length, and HD-DVD packets that set the
16-bit length to 0 and encode a 32-bit length in the next four
bytes. This implies that HD-DVD packets are at least six bytes
long, but the code didn't actually verify this.

The faulty length check results in an out of bounds read for
zero-length "normal" packets that occur in the input, which are
only 2 bytes long, but get misinterpreted as an HD-DVD packet.
When this happens the parser reads packet_len from beyond the
end of the input buffer. The subtitle stream is not correctly
decoded after this point due to the garbage packet_len.

Fixing this is pretty simple: fix the length check so packets
less than 6 bytes long will not be mistakenly parsed as HD-DVD
packets.

Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-11-16 08:41:14 +01:00
Martijn van Beurden
bf6c500cff
libavcodec/flacenc: Enable sample rates > 655350 Hz
Also, make use of the full sample rate code table

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-15 22:59:11 +01:00
Timo Rothenpieler
eb1e359a14 avcodec/nvenc: use provided constant for max extradata size 2022-11-15 01:32:56 +01:00
Timo Rothenpieler
c7a60124e3 avcodec/nvenc: add forgotten X2RGB10 formats to 10-bit-list 2022-11-14 23:10:20 +01:00
Michael Niedermayer
104b516a13
avcodec/bonk: step cannot become 0 without overflowing which is undefined
also the original reference code does not contain a 0 check

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-14 21:52:51 +01:00
Michael Niedermayer
5df8c300a9
avcodec/bonk: actual_run seems not able to become negative
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-14 21:52:51 +01:00
Michael Niedermayer
00b489b168
avcodec/bonk: Remove special 32bit case from read_uint_max()
This case seems not to match the reference decoder and it also
seems not reachable

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-14 21:52:51 +01:00
Paul B Mahol
2d25f33a7e avcodec/smcenc: unbreak skip blocks for inter coding
When using frames with different linesize.
2022-11-13 00:52:19 +01:00
Paul B Mahol
163f1949ed avcodec/smcenc: more y<height checks to fix invalid reads 2022-11-13 00:19:57 +01:00
Paul B Mahol
31e1b614f6 avcodec/rpzaenc: stop assuming prev and current frame linesize match 2022-11-13 00:19:57 +01:00
rcombs
5d7de322d4 lavc: bump micro version
Needed after adding an AVOption in 9a4b318286
2022-11-12 13:40:45 -06:00
rcombs
9a4b318286 lavc/libaribb24: add default_profile option
This allows decoding of streams that don't have a profile tagged
(e.g. ones that were remuxed improperly).
2022-11-12 13:38:05 -06:00
Paul B Mahol
92f9b28ed8 avcodec/rpzaenc: stop accessing out of bounds frame 2022-11-12 16:15:57 +01:00
Paul B Mahol
13c1310975 avcodec/smcenc: stop accessing out of bounds frame 2022-11-12 15:23:11 +01:00
Peter Ross
b653352bd8 avcodec/siren: indent 2022-11-12 11:23:04 +11:00
Andreas Rheinhardt
e2d397a9ef avcodec/mpeg4data: Move ff_mpeg4_resync_prefix to its only user
This array is only ever useful to a decoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-11 12:24:23 +01:00
Andreas Rheinhardt
f56ca21dd4 avcodec/h261dec: Don't update block_index unnecessarily
block_index is write-only for the H.261 decoder, so
don't update it by calling ff_update_block_index().
Instead use a function of our own to set/update dest.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-11 12:24:23 +01:00
Andreas Rheinhardt
e559f8428f avcodec: Remove unnecessary fft, dct inclusions
Also remove some internal.h inclusions which have been
unnecessarily added recently.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-11 12:22:47 +01:00
Michael Niedermayer
8e59e72041
avcodec/bonk: steplet cannot become negative
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-10 21:14:23 +01:00