edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiBa5441e8Tahinli3 months ago1014 commits
| 1 | //! SEI messages: mastering display, content light level, decoded picture hash. |
| 2 | //! |
| 3 | //! Three messages, and each one is here because something downstream reads it. |
| 4 | //! The two HDR messages are what a tone map finds when the container lost its |
| 5 | //! metadata (see [`ec_core::color::hevc_sei_light`], which reads exactly these |
| 6 | //! payloads back). The decoded picture hash is the encoder's own oracle: an MD5 |
| 7 | //! of the reconstructed picture, which any conformant decoder must reproduce, so |
| 8 | //! a mismatch is a *bit-exactness* failure report rather than a mystery. |
| 9 | |
| 10 | use crateMd5; |
| 11 | use crate; |
| 12 | use craterbsp_trailing_bits; |
| 13 | use BitWriter; |
| 14 | use ContentLight; |
| 15 | |
| 16 | /// `payloadType` values written here. |
| 17 | const PAYLOAD_MASTERING_DISPLAY: u32 = 137; |
| 18 | const PAYLOAD_CONTENT_LIGHT_LEVEL: u32 = 144; |
| 19 | const PAYLOAD_DECODED_PICTURE_HASH: u32 = 132; |
| 20 | |
| 21 | /// Build one SEI RBSP holding `messages`, each a `(payloadType, payload)` pair. |
| 22 | /// |
| 23 | /// The `ff` byte run for sizes over 254 is written the way the spec spells it, |
| 24 | /// even though nothing here comes close: a hash message is 49 bytes. |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | /// The prefix SEI RBSP describing HDR mastering metadata, or `None` when there |
| 47 | /// is nothing to say. |
| 48 | /// |
| 49 | /// Both messages are written whole or not at all: a `mastering_display_colour_volume` |
| 50 | /// with a zero luminance pair is what the oracle writes when it knows nothing, and a |
| 51 | /// tone map that believes it maps the film to black. |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | /// The suffix SEI RBSP carrying one MD5 per colour plane (D.2.20). |
| 86 | /// |
| 87 | /// `planes` are the *reconstructed* planes in coding order, each as |
| 88 | /// `(samples, stride, width, height)` over the whole coded picture — the |
| 89 | /// conformance window is not applied, because the hash is defined over |
| 90 | /// `pic_width_in_luma_samples`. |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | /// The NAL header a prefix SEI travels under. |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | /// The NAL header a suffix SEI (the picture hash) travels under. |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 |