100 Commits
Author SHA1 Message Date
James Almer 5ea4939a1d obu: don't print warnings for Metadata OBUs of types "Unregistered user private" 2024-12-27 13:48:54 -03:00
James Almer 864d90d9e4 picture: propagate the new sequence event flag in the next picture if the current one is from a lower layer
This further ensures the caller sees the DAV1D_EVENT_FLAG_NEW_SEQUENCE flag in
the first output frame after a new sequence header is parsed even if the first
coded frame is not meant to be output.
2024-02-02 18:45:55 -03:00
James Almer 2373fda303 tools/dav1d: use the new version macros
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-12 12:22:54 -03: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
James Almer fd1a583645 log: replace validate_input() with assert()
Missed in 31de9d5093.
2023-06-08 23:25:38 -03:00
James Almer 4ce4a50d31 tools/dav1d: check for mismatching API version and not build version
There's no reason to be so strict by ensuring the tool only works with a
library built from the exact same git snapshot, when the only thing that
matters is API availability and ABI compatibility.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-06 14:36:35 +00: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
James Almer fbdd3ed03b obu: check trailing bits for Metadata OBUs
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-01 08:29:05 -03:00
James Almer 33555aa20d obu: check for GetBits.error in check_trailing_bits()
Simplifies checks for the caller.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-31 19:30:44 -03:00
James Almer f4b119bce5 obu: check for padding bits in Sequence Header and Frame Header OBUs
Don't just check that we don't overrun at a byte aligned offset. Also make sure
that the parsing was correct and no valid bits are left in the OBU.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-31 18:43:50 -03:00
James Almer 18dee9c72d picture: add a memory pool for pic_ctx_context 2023-05-25 17:14:54 -03:00
James Almer 74de96d89d obu: validate some timing values
It is a requirement of bitstream conformance that all of these are greater than 0.
2023-05-24 20:08:39 -03: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
James Almer 5c584cb332 Remove per plane picture references
Callers using custom picture allocators may ignore the data pointers in the
output pictures, resulting in planes for the wrong frames being displayed.

This reverts commits 98b0c96d21 and 92d8b81542, and fixes #426.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-14 12:22:41 +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 Almer e3fb0ad31f CI: group a few jobs 2023-04-11 12:19:04 -03: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 1ed24f0683 picture: fix attaching props to delayed output pictures
If a Metadata OBU appeared right before a Frame Header OBU with
show_existing_picture = 1, it was not being attached to it but to the next
assembled picture, which was in the following TU.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-21 09:18:47 -03:00
James Almer 98b0c96d21 Don't copy non modified planes when applying film grain
Create new references instead.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-25 22:33:46 +00:00
James Almer 92d8b81542 picture: add per plane reference counting
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-25 22:33:46 +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
James Almer 6f80bad2bd picture: support creating and freeing refs without tile data 2022-12-14 11:21:33 -03:00
James Almer 9cf6c84c69 tools: remove the null last entry in inloop_filters_tbl
Fixes segfaults if you run the CLI with an invalid argument for --inloopfilters
2022-12-09 10:54:03 -03:00
James Almer cd5e415270 data: don't overwrite the Dav1dDataProps size value
Fixes a regression since commit 3d3c51a07c.
2022-08-19 13:58:13 -03:00
James Almer bfc1178f91 obu: don't output invisible but showable key frames more than once
From section 6.8.2 in the AV1 spec:

"It is a requirement of bitstream conformance that when show_existing_frame is
used to show a previous frame with RefFrameType[ frame_to_show_map_idx ] equal
to KEY_FRAME, that the frame is output via the show_existing_frame mechanism at
most once."
2022-04-08 19:28:29 +00:00
James Almer 1ec07ecba7 obu: check that the frame referenced by existing_frame_idx is showable
From section 6.8.2 in the AV1 spec:

"It is a requirement of bitstream conformance that when show_existing_frame
is used to show a previous frame, that the value of showable_frame for the
previous frame was equal to 1."
2022-04-08 19:28:29 +00:00
James Almer cabb94df3f obu: check refresh_frame_flags is not equal to allFrames on Intra Only frames
From section 6.8.2 in the AV1 spec:

"If frame_type is equal to INTRA_ONLY_FRAME, it is a requirement of bitstream
conformance that refresh_frame_flags is not equal to 0xff."

Make this a soft requirement by checking that strict standard complaince is
enabled.
2022-04-08 12:06:38 +00:00
James Almer 9bd8350ace picture: ensure the new seq header and op param info flags are attached to the next visible picture in display order
If the first picture in coding order after a new sequence header is parsed is
not visible, the first picture output by dav1d after the fact (which is coded
after the aforementioned invisible picture) would not trigger the new seq
header event flag as expected, despite being the first containing a reference
to a new sequence header.

Assuming the invisible picture is ever output, the result of this change will
be two pictures signaling a new sequence header was seen despite there being
only one new sequence header.
2022-04-07 14:56:33 -03:00
James Almer 6777dd0a61 lib: add a function to query the decoder frame delay 2022-03-31 09:42:56 -03:00
James Almer ac07a6653a lib: split calculating thread count to its own function 2022-03-31 09:31:32 -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
James Almer 65e2b5f805 lib: always set operating_point_idc and max_spatial_id
This clears stale values from the context in the scenario where you first parse
a svc sequence, and then a sequence header with the reduced still picture
header flag being true immediately after it.
2022-03-07 15:07:40 +00:00
James Almer 07ab20b5a2 lib: add parenthesis for improved readability 2022-03-07 09:59:37 -03:00
James Almer 56fc43ae2b lib: don't buffer an extra frame when there's a single spatial layer 2022-03-06 23:43:21 -03:00
James Almer 4124eded3b lib: clear cached_error on flush 2022-03-04 17:57:28 -03:00
James AlmerandJean-Baptiste Kempf 887fa1d718 reset Dav1dDataProps to defaults when unreferencing data and pictures 2022-02-26 11:13:37 +00:00
James AlmerandJean-Baptiste Kempf 4dd4e919eb obu: make all parsing errors use the same error path 2022-02-26 11:13:37 +00:00
James Almer 3e12be7331 lib: remove some unnecessary brackets
Cosmetic change
2022-02-25 23:32:53 -03:00
James Almer 1f09a9119f lib: fix signaling frames ready to be returned when no frame delay is expected
Prevents dav1d_get_picture() from returning EAGAIN when no frame delay was
requested (threads=1, or threads > 1 and max_frame_delay=1).

Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-04 23:02:17 -03:00
James Almer 0dc1d3539c add a picture flag to signal that a new temporal delimiter unit was seen 2022-02-03 17:21:21 -03: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
James Almer c8f80104bd cli: split long help line
Signed-off-by: James Almer <jamrial@gmail.com>
2022-01-07 20:44:43 -03: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
James AlmerandJean-Baptiste Kempf 27f0b245e0 build: add -Wstrict-prototypes to the compiler arguments 2021-06-20 20:24:48 +00:00
James Almer a823252b6d Update NEWS with a mention to the new event flag API 2021-05-13 10:56:09 -03:00
James Almer a98f5e6056 dav1d: add event flags to the decoding process
And a function to fetch them. Should be useful to signal changes in the
bitstream the user may want to know about.

Starting with two flags, DAV1D_EVENT_FLAG_NEW_SEQUENCE and
DAV1D_EVENT_FLAG_NEW_OP_PARAMS_INFO, which signal the presence of an updated
sequence header in the last returned (or to be returned) picture.
2021-04-16 10:54:48 -03:00
James Almer 57a8294ebf lib: check the integrity of the default picture allocator
Ensure both the allocator and release callbacks are pointing to the default
functions, and that no cookie was provided.
This prevents the user from configuring a mix of custom and default callbacks.
2021-01-06 22:14:51 -03:00
James Almer e86ddd562e obu: remove a few unnecessary calls to memset()
The relevant structs are filled immediately after them.
2020-08-06 16:45:28 -03:00
James Almer a579cb8f53 obu: reduce scope of some variables
Cosmetic change.
2020-08-06 16:40:23 -03:00
James Almer 89ea92ba12 lib: restructure the internal implementation of the decode API
Process input data as soon as it's fed to dav1d_send_data() instead of storing
a single packet and expecting the user to call dav1d_get_picture() in order to
trigger the decoding process before they are allowed to feed more data.
2020-03-21 13:57:23 -03:00
James Almer fe52bffeeb headers: partially revert a recent change to Dav1dLogger doxy
The callback function may be NULL, not Dav1dSettings field.
2020-03-15 09:23:00 -03:00
James AlmerandJean-Baptiste Kempf ecc5078cec headers: add missing doxy to some Dav1dSettings fields 2020-03-07 18:15:23 +01:00
James AlmerandJean-Baptiste Kempf a737423261 headers: split some public fields into separate lines and document them
The description was being added only to the last field of each line by Doxygen.
2020-03-07 18:15:23 +01:00
James Almer a7c024ce07 x86: fix generate_grain_uv checkasm crashes on Windows x64
The uv argument is normally in a gpr, but in checkasm it's forcefully
loaded from stack.
2019-10-09 23:11:49 -03:00
James Almer 79c4aa95cd obu: fix deriving render_width and render_height from reference frames
Both values can be independently coded in the bitstream, and are not
always equal to frame_width and frame_height.
2019-09-06 00:57:39 -03:00
James Almer dff0a08cd3 dav1dplay: abort if no input filename is provided 2019-08-10 15:55:09 -03:00
James Almer 3a77c57b0c meson: move dav1dplay to a new examples section
dav1dplay shouldn't be built by default. And it's an example more than a tool.
2019-08-10 11:26:17 -03:00
James Almer 9a9c0c7e78 Export frame ITU-T T.35 Metadata
Based on a patch by Renato Cassaca.
2019-08-07 19:39:13 -03:00
James Almer 6ef9a03014 dav1d_fuzzer: use Dav1dSettings.frame_size_limit instead of a custom picture allocator
Limit frame size in pixels to about 16MP, while allowing the fuzzer to test
frame widths and heights above 4096.
2019-07-07 22:10:30 -03:00
James Almer 1681028f68 obu: also check frame_size_limit with Frame Header OBUs 2019-07-05 23:50:41 -03:00
James Almer e062328622 meson: simplify a few checks for x86 targets 2019-06-09 13:50:43 -03:00
James Almer 1df181649d x86: include config.asm in x86inc instead of every asm file 2019-06-09 13:50:29 -03:00
James Almer e88c8eedc0 dav1d: reserve some bytes in Dav1dSettings
This way adding new fields in the future will not require breaking ABI
2019-05-21 19:42:54 -03:00
James Almer ed35b5bac0 obu: add missing break to the default case of a switch statement 2019-05-12 17:02:37 -03:00
James Almer d0e29420a6 obu: don't abort on unknown OBUs
The spec states that a decoder should instead ignore them. Otherwise, streams
compliant with an hypothetical future revision of the spec may be rejected when
backwards compatibility is expected.
2019-05-12 17:01:42 -03:00
James Almer f713e25030 Add a DAV1D_ERR define to negate errno values when needed 2019-05-08 19:27:20 -03:00
James Almer 7350c59e78 decode: add a frame tile data buffer size check
This check was already done in dav1d_parse_obus(), so it's added as an assert
here for extra precaution.
2019-03-16 20:17:05 -03:00
James Almer f821d9ad7b decode: don't realloc the tile data buffer when it needs to be enlarged
Its previous contents don't need to be preserved.
2019-03-16 19:47:10 -03:00
James Almer 408d048688 build: use the project version as product version in the windows resource file
And the API version as the file version.
2019-03-12 11:28:36 -03:00
James Almer 4380bc331d windres: fix the version number string
VERSION_EXTRA is only needed in the binary FILEVERSION value, which
consists of four 16 bit integers.
2019-03-01 21:58:35 -03:00
James Almer d7c3420b69 picture: fix default_picture_allocator() return value on failure
The doxy for Dav1dPicAllocator.alloc_picture_callback() states it must be a
negative errno value.
Propagate it as well in picture_alloc_with_edges().
2019-03-01 15:48:53 -03:00
James Almer 19d8fac33e picture: make mastering display and content light metadata accessible when allocating pictures 2019-03-01 15:10:34 -03:00
James Almer 04199ada5e picture: use the input picture metadata buffer references in dav1d_picture_alloc_copy()
The references in the Dav1dContext may not necessarely apply to the picture being copied.
2019-02-19 20:17:13 -03:00
James Almer 6bf2a0c6cd headers: reorder and improve the doxy for some fields 2019-02-17 11:41:48 -03:00
James Almer 222bf2495f obu: free Metadata buffers at the start of a new Sequence
They only apply to the old one.
2019-02-14 21:03:40 -03:00
James Almer fd5a950a7d lib: explicity free the metadata buffers in dav1d_close()
They were meant to be freed by the call to dav1d_flush() at the beginning,
but before the previous commit that wasn't the case when decoding with one
frame thread.
This ensures they are explicity freed here and not depend on other functions
behaving correctly.
2019-02-14 11:11:57 -03:00
James Almer c2e0490c0f lib: also free internal buffers when flushing with one frame thread 2019-02-14 11:11:51 -03:00
James Almer 515f5af5a0 Simplify dav1d_thread_picture_alloc()
It's called from a single function in the entire codebase, so no point
passing so many individual arguments to it when almost all of them are
derived from a single struct.
2019-02-08 15:30:55 -03:00
James Almer e0538f046e CI: disable logging on test jobs 2019-02-07 00:43:42 -03:00
James Almer 2502742a32 build: fix defining CONFIG_LOG when logging is disabled
Removes compilation warnings about CONFIG_LOG not being defined.
2019-02-07 00:43:31 -03:00
James Almer f1b756ef5b lib: disable logging in dav1d_parse_sequence_header()
The function uses a Dav1dContext internally, so the caller can't disable
logging or use a custom logger. Play it safe and disable logging altogether
to avoid spamming stderr.
2019-01-31 19:31:33 -03:00
James Almer 4d0c203946 replace fprintf uses with dav1d_log() 2019-01-28 12:17:05 -03:00
James Almer c98bbeb3cf add a logging callback mechanism 2019-01-28 12:16:54 -03:00
James Almer 337d8f9457 data: factorize setting Dav1dDataProps to default values 2019-01-24 10:48:42 -03:00
James Almer 46435a537a allocate Tile Group cache dynamically 2019-01-15 18:27:37 -03:00
James Almer 18d2d7507e obu: fix separate_uv_delta_q for RGB 2019-01-12 21:08:59 -03:00
James Almer e19c769943 obu: set subsampling to 1 for monochrome 2019-01-12 20:52:19 -03:00
James Almer 60ff3002e7 ref: properly free the data buffer in dav1d_ref_create on failure
It was allocated with dav1d_alloc_aligned(), so a simple free() is
not correct.
2019-01-11 12:43:07 -03:00
James Almer aaba9f8e77 data: add dav1d_data_ref()
Makes both picture and data modules more consistent API wise, and
does a few extra validation checks for the input arguments.
2019-01-07 20:02:41 -03:00
James Almer eb37d5cc53 picture: properly handle Dav1dUserData references in Dav1dPicture 2019-01-07 18:02:30 -03:00
James Almer 32908aae0f annexb: don't use a int64_t intermediary for leb128
There are other checks present already that ensure the coded value remains within
the allowed range.
2018-12-08 17:12:51 -03:00
James Almer f72b1fea02 annexb: ensure that OBU size <= frame size <= TU size 2018-12-07 17:04:16 -03:00
James Almer 7b454ebb79 Add Length delimited bitstream (Annex B) demuxer 2018-12-07 16:45:37 -03:00