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

36 Commits

Author SHA1 Message Date
Jan Ekström
fba9d9609f avcodec/libsvtav1: use larger of bit rate and max rate for buffer size
Generally if maxrate is set, the calculation should be maxrate over
bufsize. This additionally enables CRF + maxrate & bufsize usage.

In order to keep negative values from enabling zero to be treated
as larger and causing a division by zero, check that one of the
variables is larger than zero.
2023-03-14 00:14:52 +02:00
James Almer
fe196fd29a avcodec/libsvtav1: don't force a default value for deprecated options
Stick to the library's default value instead.

Should address AOMediaCodec/SVT-AV1 issue #2011.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-02 21:29:40 -03:00
Christopher Degawa
96748ac54f avcodec/libsvtav1: only set max_buf_sz if both bitrate and rc_buf_sz is set
maximum_buffer_size_ms should only be set if both are specified or if
the user sets it through -svtav1-params buf-sz=val

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
2022-11-20 16:20:14 -03:00
Christopher Degawa
1c6fd7d756 avcodec/libsvtav1: replace vbv_bufsize with maximum_buffer_size_ms
svt-av1 v1.2.0 has deprecated vbv_bufsize in favor of using
- maximum_buffer_size_ms (--buf-sz)
- starting_buffer_level_ms (--buf-initial-sz)
- optimal_buffer_level_ms (--buf-optimal-sz)

and vbv_bufsize has not been in use since svt-av1 v0.8.6

Signed-off-by: Christopher Degawa <christopher.degawa@intel.com>
2022-11-17 20:27:33 -03:00
Christopher Degawa
031f1561cd avcodec/libsvtav1: remove compressed_ten_bit_format and simplify alloc_buffer
compressed_ten_bit_format has been deprecated upstream and has no effect
and can be removed. Plus, technically it was never used in the first place
since it would require the app (ffmpeg) to set it and do additional
processing of the input frames.

Also simplify alloc_buffer by removing calculations relating to the
non-existant processing.

Signed-off-by: Christopher Degawa <christopher.degawa@intel.com>
2022-11-17 20:27:33 -03: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
James Almer
fb70e0611b avcodec/libsvtav1: properly initialize the flush EbBufferHeaderType struct
Should fix ticket #9834

Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-23 13:03:55 -03:00
Andreas Rheinhardt
6aad1204cc avcodec: Add FF_CODEC_CAP_NOT_INIT_THREADSAFE
This is in preparation of switching the default init-thread-safety
to a codec being init-thread-safe.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-18 19:58:56 +02:00
Jan Ekström
fe100bc556 avcodec/libsvtav1: signal CPB properties through side data
This way values such as maxrate/bufsize can be utilized further
down the chain.

First, syncs up the max_rate and buffer_size from SVT-AV1 back to
avctx, and then in case at least one of the utilized values is
nonzero, adds the CPB properties side data.
2022-05-09 23:08:42 +03:00
Jan Ekström
70887d44ff avcodec/libsvtav1: update avctx bit rate according to RC mode
This way we can filter out the default value for this member, which
is nonzero. Bases on the current affairs that bit rate based rate
control is nonzero in SVT-AV1.
2022-05-09 23:08:42 +03:00
Jan Ekström
ded0334d21 avcodec/libsvtav1: add support for setting chroma sample location
Support for configuring this was added with version 1.0.0.
2022-04-26 09:17:47 +03:00
Christopher Degawa
6fd1533057 avcodec/libsvtav1: pass pict_type to library
match the behavior of SvtAv1EncApp to ensure pic_type is always set
before passing it to the library.

The other options for pic_type aren't currently used inside the library,
so they aren't introduced in this patch.

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-04-25 20:35:31 -03:00
James Almer
e3c4442b24 avcodec/libsvtav1: give svtav1-params priority over avctx values
If the svt equivalent option to an avctx AVOption is passed by the user
then it should have priority. The exception are fields like dimensions, bitdepth
and pixel format, which must match what lavc will feed the encoder after init.

This addresses libsvt-av1 issue #1858.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-04-07 12:15:39 -03: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
Christopher Degawa
51c0b9e829 avcodec/libsvtav1: pass color description info
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
2022-03-23 16:28:15 +02: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
James Almer
d794b36a77 avcodec/libsvtav1: remove version check macro workaround
The current minimum supported version defines the macro.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-13 15:29:06 -03:00
James Almer
50bc872635 avcodec/libsvtav1: fine tune qp mode settings
As requested in https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/1829

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-13 15:29:06 -03:00
James Almer
4e47ebf38b avcodec/libsvtav1: deprecate some options
svtav1-params should be used for these.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-13 15:29:01 -03:00
James Almer
1dddb930aa avcodec/libsvtav1: update some options and defaults
And bump the minimum required version to 0.9.0

Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-24 20:36:53 -03:00
James Almer
a2b090da79 avcodec/libsvtav1: fix compilation with old SVT-AV1 builds
Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-24 16:34:16 -03:00
James Almer
c33b404885 avcodec/libsvtav1: add a svtav1-params option to pass a list of key=value parameters
Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-24 14:57:00 -03:00
Limin Wang
c5f3143090 avcodec/libsvtav1: properly enforce CQP mode when set in wrapper
SVT-AV1 seems to have switched their default from CQP to CRF in February,
so enforce the controlling option accordingly.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-29 18:01:16 +08:00
Limin Wang
0463f5d6d5 avcodec/libsvtav1: Fix value range for rc mode
Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-25 21:37:01 +08:00
Limin Wang
64e2fb3f9d avcodec/libsvtav1: make coded GOP type configurable
Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-25 21:35:54 +08:00
Limin Wang
04b89e8ae3 avcodec/libsvtav1: Fix duplicate definition of caps_internal
Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-25 21:35:40 +08: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
Anton Khirnov
7d09579190 lavc: rename AV_CODEC_CAP_AUTO_THREADS->AV_CODEC_CAP_OTHER_THREADS
This cap is currently used to mark multithreading-capable codecs that
wrap external libraries with their own multithreading code. The name is
highly confusing for our API users, since libavcodec ALWAYS handles
thread_count=0 (see commit message in previous commit). Therefore rename
the cap and update its documentation to make its meaning clear.

The old name is kept deprecated until next+1 major bump.
2021-03-16 10:38:41 +01:00
Anton Khirnov
8a129077cc lavc: replace internal use of AV_CODEC_CAP_AUTO_THREADS with an internal cap
AV_CODEC_CAP_AUTO_THREADS was originally added in b4d44a45f9 to mark
codecs that spawn threads internally and are able to select an optimal
threads count by themselves (all such codecs are wrappers around
external libraries). It is used by lavc generic code to check whether it
should handle thread_count=0 itself or pass the zero directly to the
codec implementation. Within this meaning, it is clearly supposed to be
an internal cap rather than a public one, since from the viewpoint of a
libavcodec user, lavc ALWAYS handles thread_count=0. Whether it happens
in the generic code or within the codec internals is not a meaningful
difference for the caller.

External aspects of this flag will be dealt with in the following
commit.
2021-03-16 10:34:29 +01:00
Limin Wang
392a2d0790 avcodec/libsvtav1: remove unneeded svt_av1_enc_deinit_handle()
It's for FF_CODEC_CAP_INIT_CLEANUP flag.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-08-14 22:54:01 +08:00
Limin Wang
ed39d28ce7 avcodec/libsvtav1: fix copy and paste error
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-08-12 08:12:59 +08:00
Mark Thompson
11a2d05b3f libsvtav1: Fix the documentation to match the actual options 2020-07-31 22:30:41 +01:00
Mark Thompson
ad7aa1e8e7 libsvtav1: Use _ rather than - in options 2020-07-31 22:30:41 +01:00
Mark Thompson
30a4bdbc1f libsvtav1: Rename without a _
The external library is called libsvtav1, so use this name everywhere.
2020-07-31 22:30:35 +01:00