Commit Graph

111966 Commits

Author SHA1 Message Date
Andreas Rheinhardt 8238bc0b5e avcodec/defs: Add AV_PROFILE_* defines, deprecate FF_PROFILE_* defines
These defines are also used in other contexts than just AVCodecContext
ones, e.g. in libavformat. Furthermore, given that these defines are
public, the AV-prefix is the right one, so deprecate (and not just move)
the FF-macros.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:39:02 +02:00
Andreas Rheinhardt 0c6e5f321b avformat/avformat: Avoid including codec.h, frame.h
AVCodec is only ever used as an incomplete type (i.e. via a pointer
to an AVCodec) in avformat.h and it is not really part of the core
of avformat.h or libavformat; almost none of our internal users
make use of it (and none make use of hwcontext.h, which is implicitly
included). So switch to use struct AVCodec, but continue to include
codec.h for external users for compatibility.

Also, do the same for AVFrame and frame.h, which is implicitly included
by codec.h (via lavu/hwcontext.h).

Also, remove an unnecessary inclusion of <time.h>.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:30:08 +02:00
Andreas Rheinhardt 4e633e51da avformat/matroskadec: Factor parsing content encodings out
Namely, out of matroska_parse_tracks().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt b105ad50c5 avformat/matroskadec: Move WEBVTT code to mkv_parse_subtitle_codec()
and also perform the remainder of the subtitle parsing directly
after mkv_parse_subtitle_codec().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt ee25dcd5fb avformat/matroskdec: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt a20bd65934 avformat/matroskadec: Factor generic parsing of audio tracks out
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt c2b8a694e1 avformat/matroskadec: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt c8903755ae avformat/matroskadec: Factor generic parsing of video tracks out
Out of matroska_parse_tracks(), that is.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt 7b5b6ebdac avformat/matroskadec: Factor parsing subtitle codecs out
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt a64c2e0e0b avformat/matroskadec: Use av_dict_set_int() where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt d989785e47 avformat/matroskadec: Avoid clobbering CodecPrivate size
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt 007c22ce09 avformat/matroskadec: Move reading color space to a better place
Namely to a place after the AVStream has already been created,
so that it can be directly attached to it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt 05ae0ccad9 avformat/matroskadec: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt 15f96bb074 avformat/matroskadec: Factor video parsing out of matroska_parse_tracks()
More exactly, factor codec-specific video parsing out of
matroska_parse_tracks(). This is intended to improve readability.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt 8eaf23a160 avformat/matroskadec: Reindent after the previous commit
Also fix a variable shadowing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt 9d3c4170c5 avformat/matroskadec: Remove redundant checks
If the size of the data of an EbmlBin is > 0, its data is always
present, as ebml_read_binary() always leaves the buffer
in a consistent state (even on error).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt 8ecd1b80d1 avformat/matroskdec: Factor audio parsing out of matroska_parse_tracks()
More exactly, factor codec-specific audio parsing out of
matroska_parse_tracks(). This is intended to improve readability.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt 758b3ba6e1 avformat/matroskadec: Set AVCodecParameters earlier
This is in preparation for future commits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt 7c95dbd94e avformat/matroskadec: Redo handling extradata allocation
Up until now, matroska_parse_tracks() has two main ways
to set AVCodecParameters.extradata: A generic way via CodecPrivate
(possibly with an offset) and by allocating a buffer manually;
the pointer to this buffer is stored in a stack pointer.

In particular, the latter method is problematic, as the buffer
needs to be freed manually in case of error (currently there
are no error conditions between the place where it is set
to AVCodecParameters.extradata).

Most of these buffers are very small (<= 22B), so replace
the pointer to an allocated buffer with a stack buffer
and set the extradata directly for the one place where
the buffer may not be small.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt e8af7d0acd avformat/matroskadec: Use dedicated pointer for access to codecpar
Shortens code and improves readability.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt 8507b9203c avformat/matroskadec: Set several stream parameters earlier
Don't do it in between parsing and setting extradata.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt f32a83c4eb fate/matroska: Add test for remuxing non-rotation displaymatrix
This provides coverage for the case in which the displaymatrix
is ignored.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:27 +02:00
Andreas Rheinhardt 8d3f721e0b avcodec/rv34_parser: Remove unused ParseContext
This parser does not do frame packetization at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:01 +02:00
Andreas Rheinhardt a7443421f2 avcodec/rv34_parser: Merge RV30 and RV40 parsers
They do mostly the same.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:27:52 +02:00
Andreas Rheinhardt 947d51f32a avcodec/x86/hpeldsp_vp3: Merge into hpeldsp
Once upon a time, 413abbe164
added versions of some put_no_rnd_pixels functions for use
in VP3 and Theora (with an explicit check so that they are
only used for VP3 and Theora). When this was moved to hpeldsp
(from dsputil) in 3ced55d51c,
the check was replaced by a check for the bitexact flag
(and a CONFIG_VP3_DECODER compile-time check), so that
these functions were now used for other codecs as well.

Later commit 1dfc3cf89d
split off the "VP3-specific bits into a separate file",
yet these bits were not really VP3-specific bits at all
any more. (The error was repeated in commit
0a39c9ac0bfd7345fe676b4e2707d9cec3cbb553.) This commit
has not been reverted, because this would make future
changes from Libav (from where it originated) harder,
yet Libav is no more, so this commit effectively reverts
1dfc3cf89d.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:24:39 +02:00
Christophe Gisquet da888b790a avcodec/utvideodec: add vlc multi support
Faster decoding, by average 50% faster overall.
2023-09-07 00:23:30 +02:00
Paul B Mahol 8b7391cb5f avcodec/magicyuv: add vlc multi support
Gives nice speed boost, depending on encoded content it goes from
30% to 60% faster.
2023-09-07 00:23:30 +02:00
Paul B Mahol 29b9fca4b3 avcodec: add multi vlc reader
Heavily based and inspired by Christophe's cache branches.

Co-Authored-by: Christophe Gisquet
2023-09-07 00:23:30 +02:00
James Almer 3a5be28857 avcodec/qsvenc: add missing header include
Needed for ff_encode_add_cpb_side_data().
Fixes regression since 0231df505d.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-06 16:08:40 -03:00
James Almer 1652f2492f avcodec/av1dec: don't set aspect ratio when it's not yet known
Makes the output of the native decoder consistent with external decoders like
libdav1d with fate-enhanced-flv-av1.

Reviewed-by: Zhao Zhili <quinkblack@foxmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-06 14:37:15 -03:00
Paul B Mahol 6022e0b04f avcodec/rpzaenc: fix assertions with very small width/height 2023-09-06 16:25:41 +02:00
James Almer 0231df505d avcodec/utils: move ff_add_cpb_side_data() to encoder code
It's only used by encoders, so move it to prevent wrong usage.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-06 10:27:45 -03:00
James Almer 3744ada3b8 avcodec/mpeg12dec: stop propagating AVCPBProperties side data
It's already exported using the relevant AVCodecContext fields.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-06 10:27:45 -03:00
James Almer 8e972b13a9 avformat/demux: propagate the internal decoder's bitrate properties
Muxers may access this information through cpb properties within the stream's
side data.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-06 10:27:44 -03:00
James Almer b6627a57f4 Revert "avcodec/mpeg12dec: Do not alter avctx->rc_buffer_size"
This reverts commit eb88ccb92e.

AVCodecContext fields are the proper place for a decoder to export such values.
This change is in preparation for the following commits.
2023-09-06 10:27:12 -03:00
Paul B Mahol d33c630b2a avcodec/yuv4enc: do not read past end of input in case of odd height 2023-09-06 15:17:12 +02:00
Paul B Mahol bfa43447fa fate: add OSQ test 2023-09-06 11:59:20 +02:00
Stefano Sabatini 362ebf246c lavu/avstring: fix typo in av_strireplace function doxy 2023-09-06 01:12:56 +02:00
Stefano Sabatini a76fb12375 lavc/avcodec.h: fix typos in AVCodecContext.pkt_timebase description 2023-09-06 01:02:38 +02:00
Stefano Sabatini bf600db2a0 lavc/libx264: do not unconditionally set x4->params.analyse.b_fast_pskip
Fix output change regression introduced in 418c954e31.
2023-09-06 01:02:07 +02:00
Paul B Mahol d464a687c9 avcodec/hcadec: support decoding with extradata provided in first packet 2023-09-05 23:24:01 +02:00
Paul B Mahol 39f6d9c5c1 avcodec/adxdec: add support for 6 channels 2023-09-05 23:21:39 +02:00
Steven Liu fdd123de13 Changelog: Add Support hevc,vp9,av1 codec fourcclist in enhanced rtmp protocol
Reviewed-by: Jean-Baptiste Kempf <jb@videolan.org>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-09-05 15:04:38 +08:00
Steven Liu 6c2f49e35f fate/enhanced-flv-vp9: add tests reference data 2023-09-05 15:01:34 +08:00
Steven Liu 637c761be1 avformat/rtmpproto: support enhanced rtmp
add option named rtmp_enhanced_codec,
it would support hvc1,av01,vp09 now,
the fourcc is using Array of strings.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-09-05 09:14:18 +08:00
Steven Liu c946e8d921 avformat/rtmppkt: add ff_amf_write_array for write
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-09-05 09:13:08 +08:00
Steven Liu 62fb730762 tests/fate/flvenc: add av1 in enhanced flv test case
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-09-05 09:12:08 +08:00
Steven Liu 1a86cce51e tests/fate/flvenc: add vp9 in enhanced flv test case
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-09-05 09:10:46 +08:00
Paul B Mahol 8cb2c6a71e avcodec/osq: fix 20bit decoding and remove invalid modes 2023-09-05 00:10:53 +02:00
Michael Niedermayer 0adaa90d89
avcodec/mpeg4videodec: more unsigned in amv computation
Fixes: signed integer overflow: -2147483648 + -1048576 cannot be represented in type 'int'
Fixes: 59365/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-642654923954585

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-04 21:45:51 +02:00