177 Commits
Author SHA1 Message Date
Cameron CawleyandRonald S. Bultje 6d681d5144 Replace platform-specific APIs for getting the program name in getopt fallback 2026-06-10 10:59:12 +00:00
KO Myung-HunandJean-Baptiste Kempf b29c5782e7 Export DAV1D APIs correctly on OS/2 2026-01-22 00:58:15 +01:00
Pranav KantandHenrik Gramner 7d4b789f55 Mark C globals with small code model
We have new option in clang (https://github.com/llvm/llvm-project/pull/124834)
to mark globals to be allocated in non-large sections. We can mark all globals
that are referenced from hardcoded assembly (which implicitly references globals
assuming they are in non-large sections) with this attribute to avoid running
into problems when dav1d is built with -mcmodel=medium with clang.
2025-02-21 15:55:00 +00:00
Maryla Ustarroz f772f3e678 Fix comments on Dav1dMasteringDisplay
The '///<' syntax is used to document a field after the field.
Mistakenly using it before the field results in the documentation
going to the wrong field, see:
https://videolan.videolan.me/dav1d/structDav1dMasteringDisplay.html
2024-11-15 16:55:27 +01:00
Kacper Michajłow f4a0d7cb70 Remove dav1d/ prefix from dav1d.h
This is possible, because we no longer generate version.h at compile
time.

Reverts header change from 7629402bbd to
preserve the same behaviour as before.
2024-09-11 02:43:02 +02:00
Kacper Michajłow 74ccc93687 meson: don't generate version.h
Instead of generating version.h, move the so version there and parse it
in meson.
2024-09-10 23:25:16 +02:00
Kyle SiefringandRonald S. Bultje 4385e7e161 Improve density of group context setting macros
Shared object binary size reduction:
x84_64           : 16112 bytes
ARM64            : 16008 bytes
ARM64(+Os)       : 21592 bytes
ARMv7(+Os+mthumb): 18480 bytes

Size reduction of symbols:
x84_64           : 15712 bytes
ARM64            : 18688 bytes
ARM64(+Os)       : 18404 bytes
ARMv7(+Os+mthumb): 17322 bytes

Compiles were done with clang version 18.1.8 and symbol sizes were
obtained using nm on the shared object.

Provides speed ups on older ARM64 cpus with very little impact on other
cpus.

Speedup:

c7i (skylake)
 Nature1080p      : x0.999
 Chimera          : x0.998

odroid C4
 Nature1080p      : x1.007
 Chimera          : x1.016
 Models1080p      : x1.005
 MountainBike1080p: x1.009
 Balloons1080p    : x1.008

Raspberry Pi 4
 Nature1080p      : x1.005
 Chimera          : x0.999
 Models1080p      : x0.999
 MountainBike1080p: x1.004
 Balloons1080p    : x1.003

Raspberry Pi 2 (Cortex-A7):
 (using size optimized build)
 Nature1080p      : x1.003
 Models1080p      : x0.997
2024-09-06 22:12:56 +00:00
Kacper MichajłowandRonald S. Bultje 7629402bbd meson: fix include directories when building as subproject
This makes `#include <dav1d/dav1d.h>` work correctly as we point to the
parent include directory, same as in the normal installation.

Also fixes conflict of including "version.h" which may already exist in
parent project or another subproject. Be more specific about the
headers. Normally it works, but when building as subproject version.h is
generated in build directory, so it no longer is prioritized when
including from dav1d.h and other header with the same name may be
included.
2024-09-05 11:10:46 +00:00
Cameron Cawley cc6eb3d53d Allow getopt fallback to compile on non-Windows platforms 2024-09-01 22:54:56 +01:00
Martin Storsjö 0d8abee540 Fix the macro parameter name for the CHECK_SIZE macro 2024-08-29 23:29:30 +03:00
Cameron CawleyandRonald S. Bultje 0255c2b227 Ensure that the refmvs_refpair union is packed 2024-08-29 20:17:51 +00:00
Nathan E. Egge a6878be7e0 Alphabetize architecture defines and usage 2024-01-31 06:04:21 -05:00
yuanhecai 2e952f300f Add loongarch support 2024-01-21 15:06:52 +08:00
Henrik GramnerandHenrik Gramner 233a424c38 Use pixel instead of uint16_t for palette buffers
Reduces memory usage by 6 kB per sb128 in 8bpc streams that
uses screen content tools when frame-threading is enabled.
2023-07-06 23:10:22 +02:00
James Almer ccb88afa85 version.h: add macros to extract version components
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-12 12:22:29 -03:00
Henrik GramnerandHenrik Gramner 47e2e672d1 Eliminate validate_input() printf calls in release mode 2023-06-07 13:35:06 +02:00
James Almer 81126bd020 lib: add a function to return the runtime API version
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-06 14:36:35 +00:00
James Almer ca84bc22e3 headers: reduce the size of Dav1dContentLightLevel
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-02 19:02:40 -03:00
James Almer 8f320d5958 headers: reduce the size of Dav1dFrameHeader
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-02 19:02:33 -03:00
James Almer 79c3e30252 headers: reduce the size of Dav1dSequenceHeader
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-01 19:58:39 -03:00
James Almer f195fc1899 headers: make num_units_in_tick, time_scale and num_units_in_decoding_tick unsigned
All of them are 32 bits values that shall be > 0

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-01 19:55:36 -03:00
Henrik GramnerandHenrik Gramner 5aef96407b Fix the printf format attribute on MinGW
The default __printf__ format attribute doesn't match what printf
functions actually support. Using __gnu_printf__ fixes it.
2023-05-31 18:12:20 +02:00
James Almer 5f9e32717d version.h.in: add missing extern C declaration
Completes the work started in cb5a095e41.
2023-05-24 20:06:27 -03:00
Andrey Semashev cb5a095e41 Fix extern "C" declarations
Avoid wrapping external includes in extern "C" blocks. Also wrap all public headers in extern "C" blocks to allow them to be selectively included in C++ projects.

Fixes https://code.videolan.org/videolan/dav1d/-/issues/422.
2023-05-06 21:14:02 +00:00
James Almer feeeccb60f picture: allow storing an array of Dav1dITUTT35 entries
Nothing in the spec prevents a Temporal Unit from having more than one Metadata
OBU of type ITU-T T.35, so export them as an array instead of only exporting
the last one we parse.
This is backwards compatible with the previous implementation, as users unaware
of this change can ignore the n_itut_t35 field and still access the first (or
only) entry in the array as they have been doing until now.
2023-04-18 20:34:25 -03:00
James Almer ed997f5f12 picture: revert recent ITU-T T.35 metadata commits 2023-04-12 19:18:25 +00:00
James AlmerandJean-Baptiste Kempf 76e71ddf42 picture: move Dav1dRef fields out of the public struct
Dav1dRef is an opaque struct to the API user, and they have no business
with these fields at all, so move them to the internal picture struct.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-08 17:45:39 +00:00
James AlmerandJean-Baptiste Kempf 62f8b887d5 picture: allow storing an array of Dav1dITUTT35 entries
Nothing in the spec prevents a Temporal Unit from having more than one Metadata
OBU of type ITU-T T.35, so export them as an array instead of only exporting
the last one we parse.
This is backwards compatible with the previous implementation, as users unaware
of this change can ignore the n_itut_t35 field and still access the first (or
only) entry in the array as they have been doing until now.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-08 17:45:39 +00:00
James Almer ed63a74593 dav1d: add an option to skip decoding some frame types
Should be useful for scenarios like wanting only keyframes to quickly generate
a set of preview images of the whole stream.
2022-12-14 11:21:33 -03:00
Charlie HaydenandRonald S. Bultje 4b9f5b704e Add info to dav1d_send_data docs 2022-11-10 00:58:40 +00:00
Martin Storsjö 8a4932ff03 Implement atomic_compare_exchange_strong in the atomic compat headers
This fixes building with MSVC (and older GCC versions) after
3e7886db54.
2022-10-26 16:14:52 +03:00
Henrik Gramner e4c4af02f3 Specify hidden visibility for global data symbol declarations
'-fvisibility=hidden' only applies to definitions, not declarations,
so the compiler has to be conservative about how references to global
data symbols are performed.

Explicitly specifying the visibility allows for better code generation.
2022-09-30 15:04:20 +00:00
Henrik GramnerandHenrik Gramner 820bf51563 cpu: Inline dav1d_get_cpu_flags() 2022-07-06 14:56:24 +02:00
Henrik GramnerandHenrik Gramner 601bfe21b7 Use a relaxed memory ordering in dav1d_ref_inc()
Increasing a reference counter only requires atomicity, but not
ordering or synchronization.
2022-04-28 16:17:08 +02:00
Matthias Dressel 11aa919a2f lib: Fix typo in documentation 2022-04-23 23:38:20 +02:00
James Almer 6777dd0a61 lib: add a function to query the decoder frame delay 2022-03-31 09:42:56 -03:00
James Almer 493ffb12f7 lib: add a public function to return the props from the last frame that failed to decode 2022-03-08 16:43:22 -03:00
James Almer 3d3c51a07c data: add a public function to release a Dav1dDataProps reference 2022-03-08 15:24:19 -03:00
Ronald S. Bultje 9a691b3131 add --inloopfilters to enable/disable postfilters dynamically
(To be used alongside --filmgrain.)

Addresses part of #310.
2022-01-14 16:27:42 -05:00
James Almer 6da4937abf dav1d.h: mention the defaults for each Dav1dSettings option
Signed-off-by: James Almer <jamrial@gmail.com>
2022-01-11 13:40:14 -03:00
Ronald S. Bultje 068697556f Add interface to output invisible (alt-ref) frames
Addresses part of #310.
2022-01-07 22:04:24 +00:00
Wan-Teh ChangandRonald S. Bultje f9bddfff7b DAV1D_MC_IDENTITY requires DAV1D_PIXEL_LAYOUT_I444
Section 6.4.2 (Color config semantics) of the AV1 spec says:
  If matrix_coefficients is equal to MC_IDENTITY, it is a requirement of
  bitstream conformance that subsampling_x is equal to 0 and
  subsampling_y is equal to 0.
Add Dav1dSettings.strict_std_compliance flag which, when set, allows
aborting decoding when such standard-compliance violations fail, even
though they don't affect decoding. In CLI, this flag can be accessed
using -strict.
2022-01-06 18:36:44 +00:00
Niklas Haas 2a18394511 Expose dav1d_apply_grain as part of the public API
This change is motivated by a desire to be able to toggle between CPU
and GPU film gain synthesis in players such as VLC. Because VLC
initializes the codec before the vout (and, indeed, the active vout
module may change in the middle of decoding), it cannot make the
decision of whether to apply film grain in libdav1d as part of codec
initialization. It needs to be decided on a frame-by-frame basis
depending on whether the currently active vout supports film grain
synthesis or not.

Using the new API, users like VLC can simply set `apply_grain` to 0 and
then manually call `dav1d_apply_grain` whenever the vout does not
support GPU film grain synthesis. As a side note, `dav1d_apply_grain`
could also technically be called from dedicated worker threads,
something that libdav1d does not currently do internally.

The alternative to this solution would have been to allow changing
Dav1dSettings at runtime, but that would be more invasive and a proper
API would also need to take other settings into consideration, some of
which can't be changed as easily as `apply_grain`. This commit
represents a stop-gap solution.

Bump the minor version to allow clients to depend on this API.
2022-01-01 17:23:28 +01:00
Sylvain BERTRANDandRonald S. Bultje f52aee04fb Fix compilation when using the gcc atomic wrappers 2021-10-04 21:58:36 +00:00
Henrik GramnerandHenrik Gramner 9636af88b8 Add automatic thread count selection
Supports Linux, MacOS, and Windows.
2021-09-20 18:44:35 +02:00
Henrik GramnerandHenrik Gramner 51a4272f0c msvc: Remove unnecessary alignment directive for atomics 2021-09-03 18:55:00 +02:00
Henrik GramnerandHenrik Gramner 2d633652f8 msvc: Add compat macros for additional atomic operations 2021-09-03 18:54:59 +02:00
Victorien Le Couviour--TuffetandRonald S. Bultje 753eef833b Merge the 3 threading models into a single one
Merges the 3 threading parameters into a single `--threads=` argument.
Frame threading can still be controlled via the `--framedelay=` argument.
Internally, the threading model is now a global thread/task pool design.

Co-authored-by: Ronald S. Bultje <rsbultje@gmail.com>
2021-09-03 16:06:31 +00:00
Christophe GisquetandHenrik Gramner 3bae53c0b6 refmvs: Pack the refmvs_block struct
Reduces size from 16B to 12B, while maintaining a 4-byte alignment.
2021-08-19 21:29:46 +02:00
James AlmerandJean-Baptiste Kempf 895cda3262 lib: return DAV1D_ERR(ENOENT) if no seqhdr OBU was found
Helps differentiating actual errors in the buffer data or passed-in arguments
with scenarios like empty buffers or containing OBUs other than Sequence
Header.
2021-07-09 16:21:12 +00:00