Commit Graph

751 Commits

Author SHA1 Message Date
Derek Buitenhuis bcae59b898 avutil/error: Add HTTP 429 Too Many Requests AVERROR code
This is a common error code from e.g. CDNs or cloud storage, and
it is useful to be able to handle it differently to a generic
4XX code.

Its source is RFC6585.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2024-04-25 14:13:47 +01:00
James Almer 8616cfe089 avutil/opt: add support for children objects in av_opt_serialize
Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-23 23:54:46 -03:00
James Almer 6d760c666d avutil/mastering_display_metadata: add a new allocator function that returns a size
av_mastering_display_metadata_alloc() is not useful in scenarios where you need to
know the runtime size of AVMasteringDisplayMetadata.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-11 11:46:18 -03:00
James Almer adb67bba06 avutil/version: bump minor after recent AVFrame API additions
Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-11 11:43:51 -03:00
Jan Ekström 29561c8e2d avutil/pix{desc,fmt}: add new matrix coefficients from H.273 v3
* SMPTE ST 2128 IPT-C2 defines the coefficients utilized in DoVi
  Profile 5. Profile 5 can thus now be represented in VUI as
  {AVCOL_RANGE_JPEG, AVCOL_PRI_BT2020, AVCOL_TRC_SMPTE2084,
   AVCOL_SPC_IPT_C2, AVCHROMA_LOC_LEFT} (although other chroma
  sample locations are allowed). AVCOL_TRC_SMPTE2084 should in
  this case be interpreted as 'PQ with reshaping'.
* YCgCo-Re and YCgCo-Ro define the bitexact YCgCo-R, where the
  number of bits added to a source RGB bit depth is 2 (i.e., even)
  and 1 (i.e., odd), respectively.
2024-04-03 21:31:35 +03:00
Niklas Haas 4f55e16f2b avutil/dovi_meta: add dolby vision extension blocks
As well as accessors plus a function for allocating this struct with
extension blocks,

Definitions generously taken from quietvoid/dovi_tool, which is
assembled as a collection of various patent fragments, as well as output
by the official Dolby Vision bitstream verifier tool.
2024-04-03 16:16:25 +02:00
quietvoid 78076ede29 avutil/dovi_meta: add AVDOVIDataMapping.nlq_pivots
The NLQ pivots are not documented but should be present in the header
for profile 7 RPU format. It has been verified using Dolby's
verification toolkit.

Signed-off-by: quietvoid <tcChlisop0@gmail.com>
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-04-03 16:16:23 +02:00
Anton Khirnov 2621be3539 lavu/frame: add side data descriptors
They allow exporting extended information about side data types.
2024-03-27 11:33:45 +01:00
Michael Niedermayer 6b213175c9
Bump after 7.0 branch point
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-27 01:04:54 +01:00
Michael Niedermayer 872980ace6
Bump prior release/7.0 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-27 01:04:53 +01:00
Marton Balint 5df901ffa5 avutil/timestamp: introduce av_ts_make_time_string2 for better precision
av_ts_make_time_string() used "%.6g" format, but this format was losing
precision even when the timestamp to be printed was not that large. For example
for 3 hours (10800) seconds, only 1 decimal digit was printed, which made this
format inaccurate when it was used in e.g. the silencedetect filter. Other
detection filters printing timestamps had similar issues. Also time base
parameter of the function was *AVRational instead of AVRational.

Resolve these problems by introducing a new function, av_ts_make_time_string2().

We change the used format to "%.*f", use a precision of 6, except when printing
values near 0, in which case we calculate the precision dynamically to aim for
a similar precision in normal form as with %.6g.  No longer using scientific
representation can make parsing the timestamp easier for the users, we can
safely do this because the theoretical maximum of INT64_MAX*INT32_MAX still
fits into the string buffer in normal form.

We somewhat imitate %g by trimming ending zeroes and the potential decimal
point characters. In order not to trim "inf" as well, we assume that the
decimal point string does not contain the letter "f". Note that depending on
printf %f implementation, we might trim "infinity" to "inf".

Thanks for Allan Cady for bringing up this issue.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-25 21:30:51 +01:00
Niklas Haas a9023377b2 avutil/film_grain_params: add av_film_grain_params_select()
Common utility function that can be used by all codecs to select the
right (any valid) film grain parameter set. In particular, this is
useful for AFGS1, which has support for multiple parameters.

However, it also performs parameter validation for H274.
2024-03-23 18:55:15 +01:00
Niklas Haas 35d2960dcd avutil/film_grain_params: add metadata to common struct
This is needed for AV1 film grain as well, when using AFGS1 streams.
Also add extra width/height and subsampling information, which AFGS1
cares about, as part of the same API bump. (And in principle, H274
should also expose this information, since it is needed downstream to
correctly adjust the chroma grain frequency to the subsampling ratio)

Deprecate the equivalent H274-exclusive fields. To avoid breaking ABI,
add the new fields after the union; but with enough of a paper trail to
hopefully re-order them on the next bump.
2024-03-23 18:54:29 +01:00
Andreas Rheinhardt 26398da8f3 avutil/frame: Constify av_frame_side_data_get()
Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-22 23:36:07 +01:00
Jan Ekström d9ade14c5c {avutil/version,APIchanges}: bump, document new AVFrameSideData functions 2024-03-20 19:15:05 +02:00
Marton Balint ed6207274e avutil/channel_layout: add AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-16 19:49:39 +01:00
Anton Khirnov efe4478778 lavu/opt: add array options 2024-03-08 07:36:15 +01:00
James Almer 783d00b203 libs: bump major version for all libraries
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 11:29:43 -03:00
James Almer 7b11fd585f avutil/version_major: postpone some deprecations until the next bump
They are too recent.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 583cf2a869 avutil: remove deprecated FF_API_FRAME_PICTURE_NUMBER
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 67e7f0b05e avutil: remove deprecated FF_API_REORDERED_OPAQUE
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer b8fef7e9c5 avutil: remove deprecated FF_API_PKT_DURATION
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 4c92fc02f8 avutil: remove deprecated FF_API_AV_FOPEN_UTF8
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 65ddc74988 avutil: remove deprecated FF_API_OLD_CHANNEL_LAYOUT
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer a12cd3be98 avutil: remove deprecated FF_API_XVMC
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 4105899245 avutil: remove deprecated FF_API_FIFO_OLD_API
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 43c62b11aa avutil: remove deprecated FF_API_FIFO_PEEK2
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
Andreas Rheinhardt 58e3ef7f54 avutil/timestamp: Constify av_ts_make_time_string()
(Actually, the time base should be passed by value.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:51:10 +01:00
Michael Niedermayer eea9bd88a5
avutil/pixfmt: Add AV_VIDEO_MAX_PLANES
It seems we do not have a named identifier for the maximum planes of pixel formats

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-16 21:34:38 +01:00
Marton Balint 66386bf2a2 avutil/channel_layout: add av_channel_layout_retype()
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-12 21:03:45 +01:00
Marton Balint 4569b86132 avutil/channel_layout: add av_channel_layout_custom_init()
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-12 21:03:45 +01:00
Zhao Zhili 5d255ba95a avutil/hwcontext_videotoolbox: add frame hwctx to specify color range
VideoToolbox use different identifiers for the same pixel format
with different color range, like

kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
kCVPixelFormatType_420YpCbCr8BiPlanarFullRange.

Before the patch, vt_pool_alloc() always use limited range, and it
will fail for pixel format AV_PIX_FMT_BGRA since there is no limited
range kCVPixelFormatType_32BGRA.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-04 17:31:49 +08:00
Wu Jianhua 142f727b9c libavutil: add hwcontext_d3d12va and AV_PIX_FMT_D3D12
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
James Almer d2af93bbef avutil: introduce an Immersive Audio Model and Formats API
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:07:11 -03:00
Martin Storsjö 8d24a28d06 riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu
The names of the cpu flags, when parsed from a string with
av_parse_cpu_caps, are parsed by the libavutil eval functions. These
interpret dashes as subtractions. Therefore, these previous cpu flag
names haven't been possible to set.

Use the official names for these extensions, as the previous ad-hoc
names wasn't parseable.

libavutil/tests/cpu tests that the cpu flags can be set, and prints
the detected flags.

Acked-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-17 23:47:04 +02:00
Marton Balint 5475f665f6 avutil/imgutils: add new function av_image_fill_color()
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-12-13 18:51:32 +01:00
James Almer b82957a66a avutil: bump minor version after recent commits
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-08 10:13:50 -03:00
Niklas Haas 57c16323f2 avutil/pixdesc: add AV_PIX_FMT_FLAG_XYZ
There are already several places in the codebase that match desc->name
against "xyz", and many downstream clients replicate this behavior.
I have no idea why this is not just a flag.

Motivated by my desire to add yet another check for XYZ to the codebase,
and I'd rather not keep copy/pasting a string comparison hack.
2023-10-31 15:46:07 +01:00
Michael Niedermayer 47e784f881
Bump versions after 6.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 16:19:14 +01:00
Michael Niedermayer 9d3a7d30c4
Bump versions prior to 6.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 15:34:05 +01:00
James Almer 52a9764260 avutil: bump minor version after recent commits
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-27 08:52:35 -03:00
Paul B Mahol 8e1ef7c38f avutil: add GBRAP14 format support 2023-09-28 19:36:08 +02:00
Roman Arzumanyan 05f8b2ca0f avutil/hwcontext_cuda: add option to use current device context
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2023-09-28 19:23:51 +02:00
Zhao Zhili ba9cd06c76 avutil/avutil: make AV_TIME_BASE_Q available in C++
ISO C++ forbids compound-literals. It's not available with MSVC.
This is a known issue from 10 years ago, and that's why there is a
av_get_time_base_q().

Since we have no plan to remove AV_TIME_BASE_Q, just make it
available in C++.

There are multiple choices:
1. Use C++11 syntax: AVRational{1, AV_TIME_BASE}

Users may still use C++98 to write new code. So no.

2. Use av_get_time_base_q().

It's for this purpose. But it's not compile time constants as
AV_TIME_BASE_Q in C.

So I choose av_make_q() as Anton's suggestion.

https://libav-devel.libav.narkive.com/ZQCWfTun/patch-0-2-fix-avutil-h-usage-from-c
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-19 00:52:21 +08:00
Andreas Rheinhardt 423b6a7e49 avutil/imgutils: Add wrapper for av_image_copy() to avoid casts
av_image_copy() accepts const uint8_t* const * as source;
lots of user have uint8_t* const * and therefore either
cast (the majority) or copy the array of pointers.

This commit changes this by adding a static inline wrapper
for av_image_copy() that casts between the two types
so that we do not need to add casts everywhere else.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:42:27 +02:00
Andreas Rheinhardt 5094d1f429 avutil/fifo: Constify AVFifo pointees in peek functions
They do not modify the AVFifo state.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:20:49 +02:00
Andreas Rheinhardt fa4bf5793a avutil/audio_fifo: Constify some pointees
Also constify AVAudioFifo* in the peek functions
besides constifying intermediate pointers (void**->void * const *).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:20:13 +02:00
Andreas Rheinhardt 9bf31f6096 avutil/samplefmt: Constify some pointees
This is the samplefmt analog of the imgutils changes
from the preceding commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:17:28 +02:00
Andreas Rheinhardt 41285890e0 avutil/imgutils: Constify some pointees
This is done immediately without waiting for the next major bump
just as in 9546b3a1cb and
4eaaa38d3d.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:14:25 +02:00
Nuo Mi 25ecc94d58
avutil: add thread executor
The executor design pattern was introduced by java
<https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/util/concurrent/Executor.html>
it also adapted by python
<https://docs.python.org/3/library/concurrent.futures.html>
Compared to handcrafted thread pool management, it greatly simplifies the thread code.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-02 02:49:06 +02:00