28 current->payload_size =
state->payload_size;
31 for (
i = 0;
i < current->payload_size;
i++)
32 fixed(8, ff_byte, 0xff);
43 HEADER(
"User Data Registered ITU-T T.35");
45 u(8, itu_t_t35_country_code, 0x00, 0xff);
46 if (current->itu_t_t35_country_code != 0xff)
49 u(8, itu_t_t35_country_code_extension_byte, 0x00, 0xff);
54 if (
state->payload_size <
i) {
56 "Invalid SEI user data registered payload.\n");
59 current->data_length =
state->payload_size -
i;
62 allocate(current->data, current->data_length);
63 for (j = 0; j < current->data_length; j++)
64 xu(8, itu_t_t35_payload_byte[], current->data[j], 0x00, 0xff, 1,
i + j);
75 HEADER(
"User Data Unregistered");
78 if (
state->payload_size < 16) {
80 "Invalid SEI user data unregistered payload.\n");
83 current->data_length =
state->payload_size - 16;
86 for (
i = 0;
i < 16;
i++)
87 us(8, uuid_iso_iec_11578[
i], 0x00, 0xff, 1,
i);
89 allocate(current->data, current->data_length);
91 for (
i = 0;
i < current->data_length;
i++)
92 xu(8, user_data_payload_byte[
i], current->data[
i], 0x00, 0xff, 1,
i);
103 HEADER(
"Mastering Display Colour Volume");
105 for (
c = 0;
c < 3;
c++) {
106 ubs(16, display_primaries_x[
c], 1,
c);
107 ubs(16, display_primaries_y[
c], 1,
c);
110 ub(16, white_point_x);
111 ub(16, white_point_y);
113 ub(32, max_display_mastering_luminance);
114 ub(32, min_display_mastering_luminance);
125 HEADER(
"Content Light Level Information");
127 ub(16, max_content_light_level);
128 ub(16, max_pic_average_light_level);
140 HEADER(
"Alternative Transfer Characteristics");
142 ub(8, preferred_transfer_characteristics);
152 static const uint16_t max_ambient_light_value = 50000;
155 HEADER(
"Ambient Viewing Environment");
158 u(16, ambient_light_x, 0, max_ambient_light_value);
159 u(16, ambient_light_y, 0, max_ambient_light_value);
173 .payload_type = current->payload_type,
174 .payload_size = current->payload_size,
175 .extension_present = current->extension_bit_length > 0,
177 int start_position, current_position, bits_written;
188 bits_written = current_position - start_position;
191 bits_written < 8 * current->payload_size) {
198 bits_left = 8 * current->payload_size - bits_written;
208 current->extension_bit_length =
212 if (current->extension_bit_length > 0) {
214 (current->extension_bit_length + 7) / 8);
216 bits_left = current->extension_bit_length;
219 xu(length, reserved_payload_extension_data,
220 current->extension_data[
i],
226 fixed(1, bit_equal_to_one, 1);
228 fixed(1, bit_equal_to_zero, 0);
232 current->payload_size = (
put_bits_count(rw) - start_position) / 8;
237 allocate(current->payload, current->payload_size);
238 data = current->payload;
240 for (
i = 0;
i < current->payload_size;
i++)
241 xu(8, payload_byte[
i],
data[
i], 0, 255, 1,
i);
255 uint32_t payload_type = 0;
256 uint32_t payload_size = 0;
261 fixed(8, ff_byte, 0xff);
264 xu(8, last_payload_type_byte,
tmp, 0, 254, 0);
268 fixed(8, ff_byte, 0xff);
271 xu(8, last_payload_size_byte,
tmp, 0, 254, 0);
278 "Invalid SEI message: payload_size too large "
279 "(%"PRIu32
" bytes).\n", payload_size);
287 message = ¤t->messages[k];
289 message->payload_type = payload_type;
290 message->payload_size = payload_size;
300 for (k = 0; k < current->nb_messages; k++) {
305 message = ¤t->messages[k];
309 trace =
ctx->trace_enable;
310 ctx->trace_enable = 0;
313 for (
i = 0;
i < 2;
i++) {
318 fixed(8, ff_byte, 0xff);
321 xu(8, last_payload_type_byte,
tmp, 0, 254, 0);
325 fixed(8, ff_byte, 0xff);
328 xu(8, last_payload_size_byte,
tmp, 0, 254, 0);
331 ctx->trace_enable = trace;