forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

meta.rs50 lines, 2.4 KiBHistoryRawDownload
1//! The metadata a decoded picture carries: the HDR static metadata of the
2//! coded video sequence, the VUI colour description of the SPS it was decoded
3//! under, and the decoded picture hash of the picture itself.
4//!
5//! The SEI messages are read by `ec_h265_syntax::sei`. Mastering display and
6//! content light level persist: a message applies from the access unit it arrives
7//! in, through the rest of the coded video sequence, and a new IRAP picture with
8//! NoRaslOutputFlag starts from nothing. The picture hash belongs to the picture
9//! whose suffix SEI carries it.
10
11use ec_h265_syntax::ColourDescription;
12use ec_h265_syntax::sei::{ContentLightLevel, MasteringDisplay, PictureHash};
13
14/// Metadata attached to one decoded picture.
15#[derive(Debug, Clone, Default, PartialEq)]
16pub struct PictureMeta {
17 /// `mastering_display_colour_volume` in force for this picture.
18 pub mastering_display: Option<MasteringDisplay>,
19 /// `content_light_level_info` in force for this picture.
20 pub content_light: Option<ContentLightLevel>,
21 /// `preferred_transfer_characteristics` of the alternative transfer
22 /// characteristics SEI in force for this picture.
23 pub alternative_transfer: Option<u8>,
24 /// The VUI `colour_primaries`, `transfer_characteristics` and
25 /// `matrix_coeffs` of the SPS, when the VUI states them.
26 pub colour_description: Option<ColourDescription>,
27 /// The VUI `video_full_range_flag` of the SPS, when the VUI carries one.
28 pub video_full_range_flag: Option<bool>,
29 /// The `decoded_picture_hash` suffix SEI of this picture, if it came.
30 pub picture_hash: Option<PictureHash>,
31 /// Every slice of the picture is an I slice: the samples need no
32 /// inter prediction, so they are exact with respect to the reference decoder.
33 pub intra_only: bool,
34}
35
36impl PictureMeta {
37 /// Take the SEI-carried fields that `other` sets, keeping the rest. Used to
38 /// fold the messages of one access unit into the coded-video-sequence state.
39 pub(crate) fn absorb_sei(&mut self, other: &PictureMeta) {
40 if other.mastering_display.is_some() {
41 self.mastering_display = other.mastering_display;
42 }
43 if other.content_light.is_some() {
44 self.content_light = other.content_light;
45 }
46 if other.alternative_transfer.is_some() {
47 self.alternative_transfer = other.alternative_transfer;
48 }
49 }
50}