1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-28 12:32:17 +02:00

47611 Commits

Author SHA1 Message Date
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 9a4b318286b548ddab42cd56d0f8ca658ddb5859
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
Michael Niedermayer
3263185225
avcodec/bonk: Check step against overflow
No testcase

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-10 21:14:23 +01:00
Michael Niedermayer
9f00286c4c
avcodec/bonk: Simplify read_uint_max()
The max == 0 case can be removed too but i left it as 50% of the cases use it

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-10 21:14:23 +01:00
Michael Niedermayer
f4df49eb48
avcodec/bonk: Use unsigned in predictor_calc_error() to avoid undefined overflows
Fixes: signed integer overflow: 22 * -2107998208 cannot be represented in type 'int'
Fixes: 51363/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5660734784143360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-10 21:14:22 +01:00
Michael Niedermayer
024c5b4ab4
avcodec/dts2pts_bsf: Check ctx for NULL before ff_cbs_flush()
Fixes: null pointer dereference
Fixes: 52155/clusterfuzz-testcase-minimized-ffmpeg_BSF_DTS2PTS_fuzzer-5760107527143424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-10 21:14:22 +01:00
erankor
6043352bd9 libx265: support ATSC A/53 captions
added a new option 'a53cc' (on by default, as in libx264) for rendering
AV_FRAME_DATA_A53_CC as hevc sei payloads.
the code is a blend of the libx265.c code for writing
AV_FRAME_DATA_SEI_UNREGISTERED with the libx264.c code for writing atsc
a/53 payloads.
2022-11-10 16:28:07 +01:00
Timo Rothenpieler
939273d3b4 avcodec/nvenc: remove unsupported AV1 High Profile 2022-11-10 15:26:43 +01:00
Timo Rothenpieler
e7fbdda64e avcodec/nvenc: fix AV1 darWidth/Height calculation
nvenc uses the darWidth/Height fields for the AV1 render_width/height
instead, so a different calculation is needed.
2022-11-10 14:51:31 +01:00
Andreas Rheinhardt
65f3bc9e7e avcodec/clearvideo: Avoid allocations when decoding tiles
Up until now, the ClearVideo decoder separates parsing tiles
and actually using the parsed information: The information is
instead stored in structures which are constantly allocated
and freed. This commit changes this to use the information
immediately, avoiding said allocations. This e.g. reduced
the amount of allocations for [1] from 2,866,462 to 24,720.
For said sample decoding speed improved by 143%.

[1]: https://samples.ffmpeg.org/V-codecs/UCOD/AccordianDance-300.avi

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-10 00:39:43 +01:00
Andreas Rheinhardt
165682a6d4 avcodec/clearvideo: Use const where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-10 00:39:43 +01:00
Andreas Rheinhardt
c2966ae14c avcodec/clearvideo: Redo updating predicition
This is in preparation for further commits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-10 00:39:43 +01:00
Andreas Rheinhardt
a7a783a5c5 avcodec/clearvideo: Move tile_do_block() upwards
Will avoid a forward-declaration later.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-10 00:39:43 +01:00
Andreas Rheinhardt
4e6ca99c36 avcodec/clearvideo: Remove unnecessary level parameter
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-10 00:39:43 +01:00
Andreas Rheinhardt
4228f8ad49 avcodec/x86/cavsdsp: Remove unused 3DNow-macro
Forgotten in 3221aba87989742ea22b639a7bb4af69f4eaa0e7.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-09 17:39:00 +01:00
Martin Storsjö
202b7a9ae7 avcodec/tests/fft: Fix building with CONFIG_MDCT disabled
Since e6afa61be97674312e36c9b6f8bb5fba009232e7, no components in
libavcodec enable CONFIG_MDCT. This fixes building "make testprogs".

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-11-07 10:34:31 +02:00
Wenbin Chen
dc4d3429e1 libavcodec/qsvenc: Add skip_frame support to qsvenc
Add skip_frame support to qsvenc. Use per-frame metadata
"qsv_skip_frame" to control it. skip_frame option defines the behavior
of qsv_skip_frame.
no_skip: Frame skipping is disabled.
insert_dummy: Encoder inserts into bitstream frame where all macroblocks
are encoded as skipped.
insert_nothing: Similar to insert_dummy, but encoder inserts nothing.
The skipped frames are still used in brc. For example, gop still include
skipped frames, and the frames after skipped frames will be larger in
size.
brc_only: skip_frame metadata indicates the number of missed frames
before the current frame.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2022-11-07 10:57:12 +08:00
nyanmisaka
09775cfea7 libavcodec/qsvenc_hevc: add tier option
Without this change, MSDK/VPL always defaults the HEVC tier to MAIN if the -level is specified.
Also, according to the HEVC specs, only level >= 4 can support High Tier.

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
2022-11-07 10:57:12 +08:00
Andreas Rheinhardt
09eaa76a72 avcodec/wmaprodec: Remove unused variable
Unused since 5f1111e42ea7763d24d74b596285f5daeaa203f7
(replaced by a new "err" variable).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 18:09:01 +01:00
Andreas Rheinhardt
649d7cbda8 avcodec/vc1data: Mark tables as hidden
This e.g. allows compilers to bake the offset implied
by using ff_vc1_b_field_mvpred_scales[3] into the
general offset; for certain arches this is also necessary
in order to avoid building suboptimal code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
a6657493da avcodec/motion_est: Remove unused field
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
fd0e37f126 avcodec/mpegvideo_enc: Move initializing QpelDSPCtx to mpeg4videoenc.c
It is the only encoder supporting quarter samples.
This also allows to remove the qpeldsp dependency from
mpegvideo_enc.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
8fcaa3f2a8 avcodec/h263dec: Move initializing qpel DSP context to mpeg4videodec.c
The MPEG-4 decoder is the only decoder based upon H.263 that
supports quarterpel motion vectors.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
496b3c6987 avcodec/vc1dec: Remove VC-1 decoders->H.263 decoder dependency
The only thing from the H.263 decoder that is reachable
by the VC-1 decoder is ff_h263_decode_init(); but it does
not even use all of it; e.g. h263dsp is unused and so are
the VLCs initialized in ff_h263_decode_init() (they amount
to about 77KB which are now no longer touched).

Notice that one could also call ff_idctdsp_init()
directly instead of ff_mpv_idct_init(); one could even
do so in ff_vc1_init_common().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
1d9aac9c4b avcodec/mpegvideo_dec: Don't use MotionEstContext as scratch space
Decoders that might use quarter pixel motion estimation
(namely MPEG-4 as well as the VC-1 family) currently
use MpegEncContext.me.qpel_(put|avg) as scratch space
for pointers to arrays of function pointers.
(MotionEstContext contains such pointers as it supports
quarter pixel motion estimation.) The MotionEstContext
is unused apart from this for the decoding part of
mpegvideo.

Using the context at all is for decoding is actually
unnecessary and easily avoided: All codecs with
quarter pixels set me.qpel_avg to qdsp.avg_qpel_pixels_tab,
so one can just unconditionally use this in ff_mpv_reconstruct_mb().
MPEG-4 sets qpel_put to qdsp.put_qpel_pixels_tab
or to qdsp.put_no_rnd_qpel_pixels_tab based upon
whether the current frame is a b-frame with no_rounding
or not, while the VC-1-based decoders set it to
qdsp.put_qpel_pixels_tab unconditionally. Given
that no_rounding is always zero for VC-1, using
the same check for VC-1 as well as for MPEG-4 would work.
Since ff_mpv_reconstruct_mb() already has exactly
the right check (for hpeldsp), it can simply be reused.

(This change will result in ff_mpv_motion() receiving
a pointer to an array of NULL function pointers instead
of a NULL pointer for codecs without qpeldsp (like MPEG-1/2).
It doesn't matter.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
5739fa8be2 avcodec/vc1_block: Remove redundant write
vc1_decode_skip_blocks() is only called if the current picture
is a P frame. So setting pict_type to AV_PICTURE_TYPE_P
is redundant; removing it makes pict_type read-only in vc1_block.c
(as it should be).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
cbe6ef1031 avcodec/vc1dec: Split VC-1 decoders from msmpeg4
The only msmpeg4 code that is ever executed by the VC-1 based
decoders is ff_msmpeg4_decode_init() and what is directly
reachable from it. This is:
a) A call to av_image_check_size(), then ff_h263_decode_init(),
b) followed by setting [yc]_dc_scale_table and initializing
scantable/permutations.
c) Afterwards, some static tables are initialized.
d) Finally, slice_height is set.

The replacement for ff_msmpeg4_decode_init() performs a)
just like now; it also sets [yc]_dc_scale_table,
but it only initializes inter_scantable and intra_scantable
and not permutated_intra_[hv]_scantable: The latter are only
used inside decode_mb callbacks which are only called
in ff_h263_decode_frame() which is unused for VC-1.*

The static tables initialized in c) are not used at all by
VC-1 (the ones that are used have been factored out in
previous commits); this avoids touching 327KiB of .bss.

slice_height is also not used by the VC-1 decoder (setting
it in ff_msmpeg4_decode_init() is probably redundant after
b34397b4cd780b5692548e7d021ec884c7217dba).

*: It follows from this that the VC-1 decoder is not really
based upon the H.263 decoder either; changing this will
be done in a future commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
d1d30edf42 avcodec/msmpeg4data: Move data shared between msmpeg4 and VC-1 out
This is in preparation for splitting VC-1 from msmpeg4.
(msmpeg4data.c was originally intended to be just this;
9488b966c76a7a52e9a1f7756bda82dbe1070399 changed it).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
44600da535 avcodec/vc1dec: Return early upon error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
835be33ee3 avcodec/vc1dec: Factor (re)initializing code out
This is in preparation for removing the msmpeg4 dependency
from VC-1.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
5a157313b3 avcodec/vc1dec: Don't open and close decoder during init
This is done since 16af29a7a6deff3f6081fca1e36ad96cf8fec77d
(and is actually unnecessary, because the tables initialized
in ff_msmpeg4_decode_init() are only ever used in vc1_block.c
which is only entered after a call to ff_msmpeg4_decode_init())
in a very ugly manner; said manner had the byproduct of
involving lots of unnecessary allocations and even opening
and closing a hwaccel in case one is used.

This commit achieves the aim of 16af29a7a6deff3f6081fca1e36ad96cf8fec77d
by initializing the VLCs used by VC-1 in ff_vc1_init_common().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
83dfc21a21 avcodec/msmpeg4dec: Factor initializing VLCs shared with VC-1 out
It will be useful in the following commits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00