1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

98 Commits

Author SHA1 Message Date
Anton Khirnov
1e7d2007c3 all: use designated initializers for AVOption.unit
Makes it robust against adding fields before it, which will be useful in
following commits.

Majority of the patch generated by the following Coccinelle script:

@@
typedef AVOption;
identifier arr_name;
initializer list il;
initializer list[8] il1;
expression tail;
@@
AVOption arr_name[] = { il, { il1,
- tail
+ .unit = tail
}, ...  };

with some manual changes, as the script:
* has trouble with options defined inside macros
* sometimes does not handle options under an #else branch
* sometimes swallows whitespace
2024-02-14 14:53:41 +01:00
Anton Khirnov
08bebeb1be Revert "all: Don't set AVClass.item_name to its default value"
Some callers assume that item_name is always set, so this may be
considered an API break.

This reverts commit 0c6203c97a.
2024-01-20 10:34:48 +01:00
Andreas Rheinhardt
0c6203c97a all: Don't set AVClass.item_name to its default value
Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9;
also avoids relocations.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-22 15:12:33 +01:00
Paul B Mahol
36eb774ad4 avcodec/mlpenc: try different filter parameters in case of out of range output from LPC 2023-10-27 12:45:23 +02:00
Paul B Mahol
567af48fba avcodec/mlpenc: add support for 4.0/4.1 ch layout 2023-10-27 12:45:23 +02:00
Paul B Mahol
deb4c28dcc avcodec/mlpenc: add 3.1 ch layout support for truehd 2023-10-27 12:45:23 +02:00
Paul B Mahol
393d1ee541 avcodec/mlpenc: add 2.1 layout support for truehd 2023-10-20 23:29:45 +02:00
Paul B Mahol
79c568dd4e avcodec/mlpenc: add proper support for output bit shift 2023-10-20 17:07:25 +02:00
Paul B Mahol
3f773d8d02 avcodec/mlpenc: add support for TrueHD substreams
Add 3.0 channel layout support for truehd encoder.
2023-10-20 17:07:24 +02:00
Paul B Mahol
98857ece48 avcodec/mlpenc: use ctx->num_substreams when writing headers 2023-10-20 17:07:23 +02:00
Paul B Mahol
94abb4df32 avcodec/mlpenc: add helper function to derive TrueHD ch map from ch_layout 2023-10-20 17:07:22 +02:00
Paul B Mahol
e7a6bba51a avcodec/mlp*: merge flags used by encoder and decoder 2023-10-18 23:01:40 +02:00
Paul B Mahol
be2bbfe71d avcodec/mlpenc: cleanup filtering 2023-10-18 23:01:39 +02:00
Paul B Mahol
c1053e2e35 avcodec/mlpenc: allow smaller shift for LPC 2023-10-18 23:01:38 +02:00
Paul B Mahol
b206056c82 avcodec/mlpenc: implement advanced stereo rematrix 2023-10-18 23:01:37 +02:00
Paul B Mahol
727ee32da7 avcodec/mlpenc: remove TODO comment, sample rate is always fixed 2023-10-18 23:01:36 +02:00
Paul B Mahol
9adc5d8bfe avcodec/mlpenc: restructure code even more
Implement lsb_bypass for lossless rematrix.
2023-10-18 23:01:35 +02:00
Paul B Mahol
44dc42e4ac avcodec/mlpenc: export lpc_coeff_precision option
Change default precision from 11 to 15, improves compression.
2023-10-10 13:53:11 +02:00
Paul B Mahol
394106a138 avcodec/mlpenc: fix regression in encoding only zeroes
Previously it would use more bits than neccessary.
2023-10-10 10:31:37 +02:00
Paul B Mahol
78fa1cff70 avcodec/mlpenc: export max_interval option 2023-10-09 23:48:00 +02:00
Paul B Mahol
ee9fb28429 avcodec/mlpenc: export codebook_search option too 2023-10-09 23:47:58 +02:00
Paul B Mahol
8786b91607 avcodec/mlpenc: change flag for shorten_by in THD case 2023-10-09 18:42:43 +02:00
Paul B Mahol
27c623b3d5 avcodec/mlpenc: fix stereo decorrelation 2023-10-09 18:42:42 +02:00
Paul B Mahol
84e0e2f43e avcodec/mlpenc: rename some variables related to thd
Remove warning message that is no longer needed.
2023-10-07 11:19:53 +02:00
Paul B Mahol
d7579189f7 avcodec/mlpenc: restructure code and resolve several bugs
Do not use put_sbits() where only unsigned is stored.
Reduce size of data_check_present field.
Reduce size of table of codebook_extremes[].
Avoid anonymously typedeffed structs.
Use encoder private context to store parameters.
Fix wrapping when calculating offsets.
Restructure arrays in encoder private context so to keep
arrays belonging to same subblock into separate structure.
Disable matrix coefficients as they are sometimes
producing wrong results.
2023-10-06 00:05:56 +02:00
Paul B Mahol
4fe0a31cab avcodec/mlpenc: allow changing some LPC parameters 2023-10-02 20:31:30 +02:00
Paul B Mahol
a1b29ab60d avcodec/mlpenc: increase compression ratio even more, fix LPC parameters 2023-10-02 20:31:28 +02:00
Paul B Mahol
0be5da9cfa avcodec/mlpenc: increase compression ratio when input is of lower bit depth 2023-10-02 20:31:27 +02:00
Paul B Mahol
7a444501d5 avcodec/mlpenc: fix quant_step_size for 16bit sample format input 2023-10-01 23:24:17 +02:00
Paul B Mahol
ffc783dea7 avcodec/mlpenc: fix writing end of stream marker 2023-10-01 23:24:16 +02:00
Marton Balint
6b6f7db819 avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number
Frame counters can overflow relatively easily (INT_MAX number of frames is
slightly more than 1 year for 60 fps content), so make sure we use 64 bit
values for them.

Also deprecate the old 32 bit frame_number attribute.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-02-13 00:36:46 +01:00
Andreas Rheinhardt
fdff1b9cbf avcodec/codec_internal: Avoid deprecation warnings for channel_layouts
AVCodec.channel_layouts is deprecated and Clang (unlike GCC)
warns when setting this field in a codec definition.
Fortunately, Clang (unlike GCC) allows to use
FF_DISABLE_DEPRECATION_WARNINGS inside a definition (of an FFCodec),
so that one can create simple macros to set AVCodec.channel_layouts
that also suppress deprecation warnings for Clang.

(Notice that some of the codec definitions were already
inside FF_DISABLE/ENABLE_DEPRECATION_WARNINGS (that were not
guarded by FF_API_OLD_CHANNEL_LAYOUT); these have been removed.
Also notice that setting AVCodec.channel_layouts was not guarded
by FF_API_OLD_CHANNEL_LAYOUT either, so testing disabling it
it without removing all the codeblocks would not have worked.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-28 23:44:28 +02:00
Andreas Rheinhardt
65dbc83eec avcodec/mlpenc: Remove dead channel layout checks
ff_encode_preinit() has already checked that the channel layout
is equivalent to one of the layouts in AVCodec.ch_layouts.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:16:49 +02:00
Andreas Rheinhardt
a12338afe5 avcodec/mlpenc: Simplify channel layout comparisons
These encoders have AVCodec.ch_layouts set, so ff_encode_preinit()
has already checked that the used channel layout is equivalent
to one of these native layouts. Therefore one can simply
compare the channel masks (with the added complication
that one has to use av_channel_layout_subset() to get it,
because the channel layout is not guaranteed to have
AV_CHANNEL_ORDER_NATIVE).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:16:03 +02:00
Andreas Rheinhardt
03fb801cd9 avcodec/mlpenc: Fix channel layouts
The encoder actually creates files with side channels, not back
channels. See thd_layout in mlp_parse.h.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-22 01:14:26 +02:00
Paul B Mahol
6a150fcdb9 avcodec/mlpenc: analyze only if there are samples 2022-09-21 14:32:07 +02:00
Paul B Mahol
b0579cc298 avcodec/mlpenc: improve encoding of stereo TrueHD and add mono support 2022-09-18 15:13:37 +02:00
Paul B Mahol
c12a6fd227 avcodec/mlpenc: rename some variables to better alternatives 2022-09-18 15:13:37 +02:00
Andreas Rheinhardt
48286d4d98 avcodec/codec_internal: Add macro to set AVCodec.long_name
It reduces typing: Before this patch, there were 105 codecs
whose long_name-definition exceeded the 80 char line length
limit. Now there are only nine of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-03 15:42:57 +02:00
Andreas Rheinhardt
a499b4345b avcodec: Make ff_alloc_packet() based encoders accept user buffers
Up until now, these encoders received non-refcounted packets
(whose data was owned by the corresponding AVCodecContext)
from ff_alloc_packet(); these packets were made refcounted lateron
by av_packet_make_refcounted() generically.
This commit makes these encoders accept user-supplied buffers by
replacing av_packet_make_refcounted() with an equivalent function
that is based upon get_encode_buffer().

(I am pretty certain that one can also set the flag for mpegvideo-
based encoders, but I want to double-check this later. What is certain
is that it reallocates the buffer owned by the AVCodecContext
which should maybe be moved to encode.c, so that proresenc_kostya.c
and ttaenc.c can make use of it, too.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:23:43 +02:00
Andreas Rheinhardt
5828e8209f avcodec: Constify frame->data pointers for encoders where possible
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-05 03:21:41 +02:00
Andreas Rheinhardt
21b23ceab3 avcodec: Make init-threadsafety the default
and remove FF_CODEC_CAP_INIT_THREADSAFE
All our native codecs are already init-threadsafe
(only wrappers for external libraries and hwaccels
are typically not marked as init-threadsafe yet),
so it is only natural for this to also be the default state.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-18 20:04:59 +02:00
Paul B Mahol
f67403edb3 avcodec/mlpenc: fix encoding after receiving last frame
This happened when major header needed to be written
after input EOF.
2022-04-13 14:22:39 +02:00
Paul B Mahol
c2351d5a53 avcodec/mlpenc: simplify calling function 2022-04-12 19:30:58 +02:00
Paul B Mahol
dc068a7265 avcodec/mlpenc: use FFMAX() 2022-04-12 19:30:58 +02:00
Paul B Mahol
cbad385f04 avcodec/mlpenc: improve handling of last samples 2022-04-12 19:30:58 +02:00
Andreas Rheinhardt
4243da4ff4 avcodec/codec_internal: Use union for FFCodec decode/encode callbacks
This is possible, because every given FFCodec has to implement
exactly one of these. Doing so decreases sizeof(FFCodec) and
therefore decreases the size of the binary.
Notice that in case of position-independent code the decrease
is in .data.rel.ro, so that this translates to decreased
memory consumption.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-05 20:02:37 +02:00
Andreas Rheinhardt
20f9727018 avcodec/codec_internal: Add FFCodec, hide internal part of AVCodec
Up until now, codec.h contains both public and private parts
of AVCodec. This exposes the internals of AVCodec to users
and leads them into the temptation of actually using them
and forces us to forward-declare structures and types that
users can't use at all.

This commit changes this by adding a new structure FFCodec to
codec_internal.h that extends AVCodec, i.e. contains the public
AVCodec as first member; the private fields of AVCodec are moved
to this structure, leaving codec.h clean.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 01:33:09 +01:00
Andreas Rheinhardt
a688f3c13c avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.h
Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault.
This reduces the amount of files that have to include internal.h
(which comes with quite a lot of indirect inclusions), as e.g.
most encoders don't need it. It is furthemore in preparation
for moving the private part of AVCodec out of the public codec.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 01:33:09 +01:00
Martin Storsjö
a78f136f3f configure: Use a separate config_components.h header for $ALL_COMPONENTS
This avoids unnecessary rebuilds of most source files if only the
list of enabled components has changed, but not the other properties
of the build, set in config.h.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:12:49 +02:00