1
0
Fork 0
Commit Graph

251 Commits

Author SHA1 Message Date
Andreas Rheinhardt 1533351990 avcodec/flacenc: Avoid shift where possible
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:53:26 +02:00
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
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
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
Anton Khirnov d0c8ca961d lavc: add a private cap for fake-delay encoders
Some encoders (ffv1, flac, adx) are marked with AV_CODEC_CAP_DELAY onky
in order to be flushed at the end, otherwise they behave as no-delay
encoders.

Add a capability to mark these encoders. Use it for setting pts
generically.
2023-01-29 09:14:13 +01:00
Martijn van Beurden d8f1404c50 libavcodec/flacenc: Implement encoding of 32 bit-per-sample PCM
Add encoding of 32 bit-per-sample PCM to FLAC files to libavcodec.
Coding to this format is at this point considered experimental and
-strict experimental is needed to get ffmpeg to encode such files.
2022-12-26 21:15:36 +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
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 17b1375965 avcodec/flac: Move ff_flac_get_max_frame_size() to flacenc.c
It is its only user.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:55:22 +02:00
Andreas Rheinhardt 59eadb5060 avcodec/internal: Move ff_samples_to_time_base() to encode.h
It is only used by encoders; in fact, AVCodecContext.time_base
is only used by encoders, so it is only useful for encoders.

Also constify the AVCodecContext parameter in it.

Also fixup the other headers a bit while removing now unnecessary
internal.h inclusions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 14:14:57 +02:00
Andreas Rheinhardt 6c4595190e avcodec/flacdsp: Split encoder-only parts into a ctx of its own
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-05 03:28:45 +02:00
Andreas Rheinhardt 3a869cd5cd avcodec/flacdsp: Remove unused function parameter
Forgotten in e609cfd697.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-05 03:28:45 +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 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
Anton Khirnov 5e257c1f7b flac: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:41 -03:00
Andreas Rheinhardt 2b541b8c1d avcodec/golomb: Factor writing golomb codes out
Most users only want to either read or write golomb codes, not both.
By splitting these headers one avoids having unnecesssary
(get|put)_hits.h inclusions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-06 08:28:02 +01:00
Andreas Rheinhardt 1be3d8a0cb avcodec/avcodec: Stop including channel_layout.h in avcodec.h
Also include channel_layout.h directly wherever used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 11:14:31 +02:00
Andreas Rheinhardt 5abb5c0415 avcodec/flacenc: Avoid copying packet data, allow user-supplied buffers
The FLAC encoder calculates the size in advance, so 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.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 15:12:57 +02:00
Andreas Rheinhardt 9fd34c8bb3 avcodec/flacenc: Mark encoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 03:16:56 +02:00
Andreas Rheinhardt 2606c48391 avcodec/flacenc: Remove always-true check
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-28 17:42:37 +02:00
Andreas Rheinhardt 1c7f252783 avcodec: Remove redundant freeing of extradata of encoders
AVCodecContext.extradata is freed generically by libavcodec for
encoders, so it is unnecessary for an encoder to do it on its own.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-28 16:56:40 +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 d85c41b572 avcodec: Remove private options from AVCodecContext
Several options that were too codec-specific were deprecated between
0e6c853221 and
0e9c4fe254.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:02 -03:00
Andreas Rheinhardt 26ca5ebd7b avcodec: Remove sidedata-only-packet cruft
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:42:59 -03:00
Andreas Rheinhardt 56bd071e54 avcodec/flacenc: Fix memleak upon init error
An AVMD5 struct would leak if an error happened after its allocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-04-02 18:55:27 +02:00
Andreas Rheinhardt c81b8e04aa Avoid intermediate bitcount for number of bytes in PutBitContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-30 12:36:32 +02: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
Michael Niedermayer d8ef5a47bb avcodec/flacenc: Replace "return -1" by named constant
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-24 02:33:48 +02:00
Jai Luthra 0c023d181e lavc/lpc: Add min_shift parameter in LPC
The min_shift parameter is needed by the MLP encoder

Signed-off-by: Jai Luthra <me@jailuthra.in>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-28 11:18:16 +02:00
Clément Bœsch 9b35242370 Merge commit 'b7f98659f21dce438c33b512e25fd64b8d07c347'
* commit 'b7f98659f21dce438c33b512e25fd64b8d07c347':
  Remove unnecessary get_bits.h #includes

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:16:01 +02:00
Diego Biurrun b7f98659f2 Remove unnecessary get_bits.h #includes 2016-06-07 13:09:57 +02:00
Michael Niedermayer 5781bfae0c flacenc: Load default prediction_order parameters if none is selected
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-02-08 15:00:29 -05:00
Derek Buitenhuis 1ba1fede9d flacenc: Restore defaults and range for {min, max}_prediction_order
This was broken in 243df1351d.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-01 00:57:43 +01:00
Michael Niedermayer 3c8e95ab5d avcodec/flacenc: Fix prediction_order parameter
Fixes regression

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-31 20:05:41 +01:00
Derek Buitenhuis e9eb8b3ba2 flacenc: Restore defaults and range for {min,max}_prediction_order
This was broken in 243df1351d.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-01-31 18:25:29 +00:00
Derek Buitenhuis c86ecdf3f7 Merge commit '243df1351d2d928caa084a5704ed783f0b83f072'
* commit '243df1351d2d928caa084a5704ed783f0b83f072':
  lavc: Move {min,max}_prediction_order to codec private options

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-01-31 13:29:04 +00:00
Paul B Mahol 3e7d684912 avcodec/flacenc: fix calculation of bits required in case of custom sample rate
Sample rate of 11025 takes 16 bits but previous code would pick only 8.
Fixes assertion failure.

Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-01-24 21:54:13 +01:00
Vittorio Giovara 243df1351d lavc: Move {min,max}_prediction_order to codec private options
These options are only used by alac and flac.
They are very codec-specific options, so deprecate the global variants.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-01-21 15:33:19 -05:00
Paul B Mahol 367ffa0c15 avcodec/flacenc: use designated initializers for AVClass
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-20 17:47:21 +01:00
Clément Bœsch fb99ef0bd3 avcodec: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:37:05 +01:00
Derek Buitenhuis 5ebaf1e1cb Merge commit '79d89cf2f4b62eeb653fd8139041c87e75f7ca65'
* commit '79d89cf2f4b62eeb653fd8139041c87e75f7ca65':
  flacenc: Clamp user-supplied min/max prediction orders

  Conflicts:
      libavcodec/flacenc.c

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-22 17:10:42 +00:00
Vittorio Giovara 79d89cf2f4 flacenc: Clamp user-supplied min/max prediction orders
This mimics what the code does internally for default order values.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-11-16 16:56:42 +01:00
Ronald S. Bultje 93866c2aa2 intmath: remove av_ctz.
It's a non-installed header and only used in one place (flacenc).
Since ff_ctz is static inline, it's fine to use that instead.
2015-10-11 18:03:10 -04:00
Vittorio Giovara 6064f697a3 lavc: Enable side data only packets by default
Deprecate the now unused option, but temporarily retain the capability
to disable the now default behaviour.

Mention this change in the AVPacket documentation.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-09-12 13:38:31 +02:00
Hendrik Leppkes 580c4fc98a Merge commit '6064f697a321174232a3fad351afb21150c3e9e5'
* commit '6064f697a321174232a3fad351afb21150c3e9e5':
  lavc: Enable side data only packets by default

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-12 15:12:05 +02:00
Michael Niedermayer 444e9874a7 Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'
* commit 'def97856de6021965db86c25a732d78689bd6bb0':
  lavc: AV-prefix all codec capabilities

Conflicts:
	cmdutils.c
	ffmpeg.c
	ffplay.c
	libavcodec/8svx.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/adpcm.c
	libavcodec/alac.c
	libavcodec/atrac3plusdec.c
	libavcodec/bink.c
	libavcodec/dnxhddec.c
	libavcodec/dvdec.c
	libavcodec/dvenc.c
	libavcodec/ffv1dec.c
	libavcodec/ffv1enc.c
	libavcodec/fic.c
	libavcodec/flacdec.c
	libavcodec/flacenc.c
	libavcodec/flvdec.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/gifdec.c
	libavcodec/h261dec.c
	libavcodec/hevc.c
	libavcodec/iff.c
	libavcodec/imc.c
	libavcodec/libopenjpegdec.c
	libavcodec/libvo-aacenc.c
	libavcodec/libvorbisenc.c
	libavcodec/libvpxdec.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mpegaudiodec_float.c
	libavcodec/msmpeg4dec.c
	libavcodec/mxpegdec.c
	libavcodec/nvenc_h264.c
	libavcodec/nvenc_hevc.c
	libavcodec/pngdec.c
	libavcodec/qpeg.c
	libavcodec/ra288.c
	libavcodec/rv10.c
	libavcodec/s302m.c
	libavcodec/sp5xdec.c
	libavcodec/takdec.c
	libavcodec/tiff.c
	libavcodec/tta.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/vp6.c
	libavcodec/vp9.c
	libavcodec/wavpack.c
	libavcodec/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:50:18 +02:00