1
0
Fork 0
Commit Graph

255 Commits

Author SHA1 Message Date
Andreas Rheinhardt 790f793844 avutil/common: Don't auto-include mem.h
There are lots of files that don't need it: The number of object
files that actually need it went down from 2011 to 884 here.

Keep it for external users in order to not cause breakages.

Also improve the other headers a bit while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:43 +01:00
Andreas Rheinhardt c00cd007e8 configure: Remove av_restrict
All versions of MSVC that support C11 (namely >= v19.27)
also support the restrict keyword, therefore av_restrict
is no longer necessary since 75697836b1.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-15 12:51:15 +01:00
sunyuechi 40911bc1a1 lavc/dnxhdenc: add ff_dnxhdenc_init
This is for clarity and use in testing, consistent with other parts of the code.

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-27 20:32:37 +02:00
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
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
James Almer 2f561ba953 avcodec: use the new AVFrame interlace flags in all decoders and encoders
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:14:02 -03:00
Anton Khirnov 8d73f3ce56 lavc: support AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE in all no-delay encoders
Including fake-delay encoders marked with FF_CODEC_CAP_EOF_FLUSH.
2023-01-29 09:22:57 +01:00
Andreas Rheinhardt fd72d8aea3 avcodec/blockdsp: Remove unused AVCodecContext parameter
Possible since be95df12bb.

Reviewed-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-21 20:24:40 +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 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
Andreas Rheinhardt 40e6575aa3 all: Replace if (ARCH_FOO) checks by #if ARCH_FOO
This is more spec-compliant because it does not rely
on dead-code elimination by the compiler. Especially
MSVC has problems with this, as can be seen in
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296373.html
or
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/297022.html

This commit does not eliminate every instance where we rely
on dead code elimination: It only tackles branching to
the initialization of arch-specific dsp code, not e.g. all
uses of CONFIG_ and HAVE_ checks. But maybe it is already
enough to compile FFmpeg with MSVC with whole-programm-optimizations
enabled (if one does not disable too many components).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-15 04:56:37 +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 86c909558c avcodec/internal: Move FF_SIGNBIT and ff_log2_run to mathops.h
It is a more fitting place for them.
Also move the definition of ff_log2_run to mathtables.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 23:25:36 +01:00
Andreas Rheinhardt 5aabb2596f avcodec/codec_internal: Rename AVCodecDefault->FFCodecDefault
This structure is no longer declared in a public header,
so using an FF-prefix is more appropriate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 01:33:10 +01: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
Paul B Mahol 14c9b7b194 avcodec/dnxhdenc: fill unused bytes from put bits buffer with zeros 2022-03-05 23:03:45 +01:00
Paul B Mahol 044c09c0a0 avcodec/dnxhdenc: retry increasing qscale to not overflow max_bits
Increase mb_bits type from uint16_t to uint32_t to fix possible overflows
in bit size calculations.

Update fate test that needs change.
2022-03-05 22:11:38 +01:00
Paul B Mahol 37480b1b85 avcodec/dnxhdenc: fix possible out of bound writes for big w/h
It was caused by integer overflows.
2022-03-04 23:44:01 +01:00
Andreas Rheinhardt 746e7102be avcodec/mpegvideo: Move encoder-only stuff to a new header
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-13 19:49:29 +01:00
Andreas Rheinhardt 17c8533745 avcodec/dnxhddata: Unavpriv dnxhd_get_(hr_|)_frame_size()
It is no longer used in libavformat.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-19 20:32:49 +01:00
Andreas Rheinhardt eec5a45f05 avcodec/dnxhdenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt ed6549887a avcodec/encoders: Remove redundant setting of AV_PKT_FLAG_KEY
It is now set generically for all those encoders whose corresponding
AVCodecDescriptor has the AV_CODEC_PROP_INTRA_ONLY.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-28 01:57:10 +02:00
Andreas Rheinhardt 8b32a6f1aa avcodec/dnxhdenc: Mark encoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:02 +02:00
Andreas Rheinhardt 3c1208be02 avcodec/dnxhdenc: Use av_memdup() instead of av_malloc()+memcpy()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:02 +02:00
Andreas Rheinhardt eb583b3cb9 avcodec/dnxhdenc: Fix segfault when using too many slice threads
The DNXHD encoder's context contains an array of 32 pointers to
DNXHDEncContexts used in case of slice threading; when trying
to use more than 32 threads with slice threading, the encoder's init
function errors out, but the close function takes avctx->thread_count
at face value and tries to free inexistent elements of the array,
leading to potential crashes.

Fix this by modifying the check used to decide whether the slice
contexts should be freed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:02 +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 a247ac640d avcodec: Constify AVCodecs
Given that the AVCodec.next pointer has now been removed, most of the
AVCodecs are not modified at all any more and can therefore be made
const (as this patch does); the only exceptions are the very few codecs
for external libraries that have a init_static_data callback.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:15 -03:00
Andreas Rheinhardt 11bc790893 avcodec: Remove deprecated AVCodecContext.coded_frame
Deprecated in 40cf1bbacc.
(The currently disabled filter vf_mcdeint and vf_uspp were users of
this field; they have not been changed, so that whoever wants to fix
them can see the state of these filters when they were disabled.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:12 -03:00
Andreas Rheinhardt 10d059bb24 avcodec/dnxhd: Make ff_dxnhd_get_cid_table return a pointer, not index
All callers only use the index into ff_dnxhd_cid_table to get a pointer
to the desired entry.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-26 13:56:59 +01:00
Anton Khirnov c8c2dfbc37 lavu: move LOCAL_ALIGNED from internal.h to mem_internal.h
That is a more appropriate place for it.
2021-01-01 14:11:01 +01:00
Limin Wang 479c89aa2e avcodec/dnxhdenc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-06-13 06:59:19 +08:00
James Almer 6e1903938b avcodec/internal: move packet related functions to their own header
Signed-off-by: James Almer <jamrial@gmail.com>
2020-06-02 19:02:12 -03:00
James Almer 13b1bbff0b avcodec: deprecate Lossless and Intra Only encoder capabilites
Both are codec properties and not encoder capabilities. The relevant
AVCodecDescriptor.props flags exist for this purpose.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-21 12:32:15 -03:00
Andreas Rheinhardt cc2a9509ce libavcodec, libpostproc: Remove outcommented START/STOP_TIMER
as well as includes of libavutil/timer.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-03-14 18:24:04 +01:00
Andreas Rheinhardt b7f156e8cb avcodec/dnxhdenc: Fix undefined left shifts of negative numbers
Affected 61 FATE-tests: 60 vsynth tests and lavf-mxf_opatom.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-28 17:24:32 +02:00
Limin Wang 3def984a98 avcodec/dnxhdenc: return error if av_malloc failed
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-25 17:56:44 -03:00
Jason Stevens 69f1853a28 libavcodec/dnxhd: change ff_dnxhd_get_hr_frame_size to avpriv_
refactor ff_dnxhd_get_hr_frame_size to avpriv_dnxhd_get_hr_frame_size,
to allow cross library usage in libavformat/mxfenc this change makes
this function no longer be always inlined.

Signed-off-by: Jason Stevens <jay@wizardofthenet.com>
2018-09-10 23:15:42 +02:00
Paul B Mahol a77c2df5cc avcodec/dnxhdenc: interlaced is not supported in DNxHR
Fixes #7263.
2018-09-06 13:47:48 +02:00
Paul B Mahol aeb73c73e1 avcodec/dnxhdenc: stop leaking memory when initalization fails
Fixes #6593.
2018-08-31 17:45:35 +02:00
Paul B Mahol 0d35413e5d avcodec/dnxhdenc: do not free nonexistent slice threads data when frame threading is used
Forgotten in 28e9ba951d.
Fixes #7241.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-06-01 10:54:39 +02:00
James Almer bfab430856 Merge commit '94eed68ace9f2416af8457fcbf142b175928c06b'
* commit '94eed68ace9f2416af8457fcbf142b175928c06b':
  lavc: Drop deprecated options moved to private contexts

Merged-by: James Almer <jamrial@gmail.com>
2017-10-23 17:08:32 -03:00
Frédéric Devernay eec67f2522 avcodec/dnxhdenc: fix DNxHR 444 encoding crashes
Fixes #6649.
2017-09-26 10:00:51 +02:00
Paul B Mahol 28e9ba951d avcodec/dnxhdenc: call slice thread code only if slice threading is enabled 2017-08-17 11:42:16 +02:00
Paul B Mahol 9835ee60da avcodec/dnxhdenc: enable frame threading
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-07-27 15:23:45 +02:00
Michael Niedermayer 900fe8ee5d avcodec/dnxhdenc: Assert that frame size is not assigned an error code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-15 00:16:20 +02:00
Paul B Mahol f6b5a5c7d0 avcodec/dnxhdenc: fix recent regression
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-04-15 09:23:43 +02:00