FFmpeg
hevc_sei.c
Go to the documentation of this file.
1 /*
2  * HEVC Supplementary Enhancement Information messages
3  *
4  * Copyright (C) 2012 - 2013 Guillaume Martres
5  * Copyright (C) 2012 - 2013 Gildas Cocherel
6  * Copyright (C) 2013 Vittorio Giovara
7  *
8  * This file is part of FFmpeg.
9  *
10  * FFmpeg is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * FFmpeg is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with FFmpeg; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  */
24 
25 #include "atsc_a53.h"
26 #include "dynamic_hdr10_plus.h"
27 #include "golomb.h"
28 #include "hevc_ps.h"
29 #include "hevc_sei.h"
30 
32 {
33  int cIdx, i;
34  uint8_t hash_type;
35  //uint16_t picture_crc;
36  //uint32_t picture_checksum;
37  hash_type = get_bits(gb, 8);
38 
39  for (cIdx = 0; cIdx < 3/*((s->sps->chroma_format_idc == 0) ? 1 : 3)*/; cIdx++) {
40  if (hash_type == 0) {
41  s->is_md5 = 1;
42  for (i = 0; i < 16; i++)
43  s->md5[cIdx][i] = get_bits(gb, 8);
44  } else if (hash_type == 1) {
45  // picture_crc = get_bits(gb, 16);
46  skip_bits(gb, 16);
47  } else if (hash_type == 2) {
48  // picture_checksum = get_bits_long(gb, 32);
49  skip_bits(gb, 32);
50  }
51  }
52  return 0;
53 }
54 
56 {
57  int i;
58 
59  if (size < 24)
60  return AVERROR_INVALIDDATA;
61 
62  // Mastering primaries
63  for (i = 0; i < 3; i++) {
64  s->display_primaries[i][0] = get_bits(gb, 16);
65  s->display_primaries[i][1] = get_bits(gb, 16);
66  }
67  // White point (x, y)
68  s->white_point[0] = get_bits(gb, 16);
69  s->white_point[1] = get_bits(gb, 16);
70 
71  // Max and min luminance of mastering display
72  s->max_luminance = get_bits_long(gb, 32);
73  s->min_luminance = get_bits_long(gb, 32);
74  size -= 24;
75 
76  // As this SEI message comes before the first frame that references it,
77  // initialize the flag to 2 and decrement on IRAP access unit so it
78  // persists for the coded video sequence (e.g., between two IRAPs)
79  s->present = 2;
80 
81  skip_bits_long(gb, 8 * size);
82  return 0;
83 }
84 
86 {
87  if (size < 4)
88  return AVERROR_INVALIDDATA;
89 
90  // Max and average light levels
91  s->max_content_light_level = get_bits(gb, 16);
92  s->max_pic_average_light_level = get_bits(gb, 16);
93  size -= 4;
94  // As this SEI message comes before the first frame that references it,
95  // initialize the flag to 2 and decrement on IRAP access unit so it
96  // persists for the coded video sequence (e.g., between two IRAPs)
97  s->present = 2;
98 
99  skip_bits_long(gb, 8 * size);
100  return 0;
101 }
102 
104 {
105  get_ue_golomb_long(gb); // frame_packing_arrangement_id
106  s->present = !get_bits1(gb);
107 
108  if (s->present) {
109  s->arrangement_type = get_bits(gb, 7);
110  s->quincunx_subsampling = get_bits1(gb);
111  s->content_interpretation_type = get_bits(gb, 6);
112 
113  // spatial_flipping_flag, frame0_flipped_flag, field_views_flag
114  skip_bits(gb, 3);
115  s->current_frame_is_frame0_flag = get_bits1(gb);
116  // frame0_self_contained_flag, frame1_self_contained_flag
117  skip_bits(gb, 2);
118 
119  if (!s->quincunx_subsampling && s->arrangement_type != 5)
120  skip_bits(gb, 16); // frame[01]_grid_position_[xy]
121  skip_bits(gb, 8); // frame_packing_arrangement_reserved_byte
122  skip_bits1(gb); // frame_packing_arrangement_persistence_flag
123  }
124  skip_bits1(gb); // upsampled_aspect_ratio_flag
125  return 0;
126 }
127 
129 {
130  s->present = !get_bits1(gb);
131 
132  if (s->present) {
133  s->hflip = get_bits1(gb); // hor_flip
134  s->vflip = get_bits1(gb); // ver_flip
135 
136  s->anticlockwise_rotation = get_bits(gb, 16);
137  skip_bits1(gb); // display_orientation_persistence_flag
138  }
139 
140  return 0;
141 }
142 
144  void *logctx, int size)
145 {
146  HEVCSEIPictureTiming *h = &s->picture_timing;
147  HEVCSPS *sps;
148 
149  if (!ps->sps_list[s->active_seq_parameter_set_id])
150  return(AVERROR(ENOMEM));
151  sps = (HEVCSPS*)ps->sps_list[s->active_seq_parameter_set_id]->data;
152 
153  if (sps->vui.frame_field_info_present_flag) {
154  int pic_struct = get_bits(gb, 4);
155  h->picture_struct = AV_PICTURE_STRUCTURE_UNKNOWN;
156  if (pic_struct == 2 || pic_struct == 10 || pic_struct == 12) {
157  av_log(logctx, AV_LOG_DEBUG, "BOTTOM Field\n");
158  h->picture_struct = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;
159  } else if (pic_struct == 1 || pic_struct == 9 || pic_struct == 11) {
160  av_log(logctx, AV_LOG_DEBUG, "TOP Field\n");
161  h->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD;
162  } else if (pic_struct == 7) {
163  av_log(logctx, AV_LOG_DEBUG, "Frame/Field Doubling\n");
164  h->picture_struct = HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING;
165  } else if (pic_struct == 8) {
166  av_log(logctx, AV_LOG_DEBUG, "Frame/Field Tripling\n");
167  h->picture_struct = HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING;
168  }
169  get_bits(gb, 2); // source_scan_type
170  get_bits(gb, 1); // duplicate_flag
171  skip_bits1(gb);
172  size--;
173  }
174  skip_bits_long(gb, 8 * size);
175 
176  return 0;
177 }
178 
180  int size)
181 {
182  int ret;
183 
184  ret = ff_parse_a53_cc(&s->buf_ref, gb->buffer + get_bits_count(gb) / 8, size);
185 
186  if (ret < 0)
187  return ret;
188 
189  skip_bits_long(gb, size * 8);
190 
191  return 0;
192 }
193 
195  int size)
196 {
197  AVBufferRef *buf_ref, **tmp;
198 
199  if (size < 16 || size >= INT_MAX - 1)
200  return AVERROR_INVALIDDATA;
201 
202  tmp = av_realloc_array(s->buf_ref, s->nb_buf_ref + 1, sizeof(*s->buf_ref));
203  if (!tmp)
204  return AVERROR(ENOMEM);
205  s->buf_ref = tmp;
206 
207  buf_ref = av_buffer_alloc(size + 1);
208  if (!buf_ref)
209  return AVERROR(ENOMEM);
210 
211  for (int i = 0; i < size; i++)
212  buf_ref->data[i] = get_bits(gb, 8);
213  buf_ref->data[size] = 0;
214  buf_ref->size = size;
215  s->buf_ref[s->nb_buf_ref++] = buf_ref;
216 
217  return 0;
218 }
219 
221  GetBitContext *gb, int size)
222 {
223  size_t meta_size;
224  int err;
225  AVDynamicHDRPlus *metadata = av_dynamic_hdr_plus_alloc(&meta_size);
226  if (!metadata)
227  return AVERROR(ENOMEM);
228 
230  gb->buffer + get_bits_count(gb) / 8, size);
231  if (err < 0) {
232  av_free(metadata);
233  return err;
234  }
235 
236  av_buffer_unref(&s->info);
237  s->info = av_buffer_create((uint8_t *)metadata, meta_size, NULL, NULL, 0);
238  if (!s->info) {
239  av_free(metadata);
240  return AVERROR(ENOMEM);
241  }
242 
243  skip_bits_long(gb, size * 8);
244 
245  return 0;
246 }
247 
249  void *logctx, int size)
250 {
251  int country_code, provider_code;
252 
253  if (size < 3)
254  return AVERROR_INVALIDDATA;
255  size -= 3;
256 
257  country_code = get_bits(gb, 8);
258  if (country_code == 0xFF) {
259  if (size < 1)
260  return AVERROR_INVALIDDATA;
261 
262  skip_bits(gb, 8);
263  size--;
264  }
265 
266  if (country_code != 0xB5) { // usa_country_code
267  av_log(logctx, AV_LOG_VERBOSE,
268  "Unsupported User Data Registered ITU-T T35 SEI message (country_code = %d)\n",
269  country_code);
270  goto end;
271  }
272 
273  provider_code = get_bits(gb, 16);
274 
275  switch (provider_code) {
276  case 0x3C: { // smpte_provider_code
277  // A/341 Amendment - 2094-40
278  const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
279  const uint8_t smpte2094_40_application_identifier = 0x04;
280  uint16_t provider_oriented_code;
281  uint8_t application_identifier;
282 
283  if (size < 3)
284  return AVERROR_INVALIDDATA;
285  size -= 3;
286 
287  provider_oriented_code = get_bits(gb, 16);
288  application_identifier = get_bits(gb, 8);
289  if (provider_oriented_code == smpte2094_40_provider_oriented_code &&
290  application_identifier == smpte2094_40_application_identifier) {
291  return decode_registered_user_data_dynamic_hdr_plus(&s->dynamic_hdr_plus, gb, size);
292  }
293  break;
294  }
295  case 0x31: { // atsc_provider_code
296  uint32_t user_identifier;
297 
298  if (size < 4)
299  return AVERROR_INVALIDDATA;
300  size -= 4;
301 
302  user_identifier = get_bits_long(gb, 32);
303  switch (user_identifier) {
304  case MKBETAG('G', 'A', '9', '4'):
305  return decode_registered_user_data_closed_caption(&s->a53_caption, gb, size);
306  default:
307  av_log(logctx, AV_LOG_VERBOSE,
308  "Unsupported User Data Registered ITU-T T35 SEI message (atsc user_identifier = 0x%04x)\n",
309  user_identifier);
310  break;
311  }
312  break;
313  }
314  default:
315  av_log(logctx, AV_LOG_VERBOSE,
316  "Unsupported User Data Registered ITU-T T35 SEI message (provider_code = %d)\n",
317  provider_code);
318  break;
319  }
320 
321 end:
322  skip_bits_long(gb, size * 8);
323  return 0;
324 }
325 
327 {
328  int num_sps_ids_minus1;
329  int i;
330  unsigned active_seq_parameter_set_id;
331 
332  get_bits(gb, 4); // active_video_parameter_set_id
333  get_bits(gb, 1); // self_contained_cvs_flag
334  get_bits(gb, 1); // num_sps_ids_minus1
335  num_sps_ids_minus1 = get_ue_golomb_long(gb); // num_sps_ids_minus1
336 
337  if (num_sps_ids_minus1 < 0 || num_sps_ids_minus1 > 15) {
338  av_log(logctx, AV_LOG_ERROR, "num_sps_ids_minus1 %d invalid\n", num_sps_ids_minus1);
339  return AVERROR_INVALIDDATA;
340  }
341 
342  active_seq_parameter_set_id = get_ue_golomb_long(gb);
343  if (active_seq_parameter_set_id >= HEVC_MAX_SPS_COUNT) {
344  av_log(logctx, AV_LOG_ERROR, "active_parameter_set_id %d invalid\n", active_seq_parameter_set_id);
345  return AVERROR_INVALIDDATA;
346  }
347  s->active_seq_parameter_set_id = active_seq_parameter_set_id;
348 
349  for (i = 1; i <= num_sps_ids_minus1; i++)
350  get_ue_golomb_long(gb); // active_seq_parameter_set_id[i]
351 
352  return 0;
353 }
354 
356 {
357  if (size < 1)
358  return AVERROR_INVALIDDATA;
359 
360  s->present = 1;
361  s->preferred_transfer_characteristics = get_bits(gb, 8);
362  size--;
363 
364  skip_bits_long(gb, 8 * size);
365  return 0;
366 }
367 
369 {
370  s->num_clock_ts = get_bits(gb, 2);
371 
372  for (int i = 0; i < s->num_clock_ts; i++) {
373  s->clock_timestamp_flag[i] = get_bits(gb, 1);
374 
375  if (s->clock_timestamp_flag[i]) {
376  s->units_field_based_flag[i] = get_bits(gb, 1);
377  s->counting_type[i] = get_bits(gb, 5);
378  s->full_timestamp_flag[i] = get_bits(gb, 1);
379  s->discontinuity_flag[i] = get_bits(gb, 1);
380  s->cnt_dropped_flag[i] = get_bits(gb, 1);
381 
382  s->n_frames[i] = get_bits(gb, 9);
383 
384  if (s->full_timestamp_flag[i]) {
385  s->seconds_value[i] = av_clip(get_bits(gb, 6), 0, 59);
386  s->minutes_value[i] = av_clip(get_bits(gb, 6), 0, 59);
387  s->hours_value[i] = av_clip(get_bits(gb, 5), 0, 23);
388  } else {
389  s->seconds_flag[i] = get_bits(gb, 1);
390  if (s->seconds_flag[i]) {
391  s->seconds_value[i] = av_clip(get_bits(gb, 6), 0, 59);
392  s->minutes_flag[i] = get_bits(gb, 1);
393  if (s->minutes_flag[i]) {
394  s->minutes_value[i] = av_clip(get_bits(gb, 6), 0, 59);
395  s->hours_flag[i] = get_bits(gb, 1);
396  if (s->hours_flag[i]) {
397  s->hours_value[i] = av_clip(get_bits(gb, 5), 0, 23);
398  }
399  }
400  }
401  }
402 
403  s->time_offset_length[i] = get_bits(gb, 5);
404  if (s->time_offset_length[i] > 0) {
405  s->time_offset_value[i] = get_bits_long(gb, s->time_offset_length[i]);
406  }
407  }
408  }
409 
410  s->present = 1;
411  return 0;
412 }
413 
415  GetBitContext *gb)
416 {
417  h->present = !get_bits1(gb); // film_grain_characteristics_cancel_flag
418 
419  if (h->present) {
420  memset(h, 0, sizeof(*h));
421  h->model_id = get_bits(gb, 2);
422  h->separate_colour_description_present_flag = get_bits1(gb);
423  if (h->separate_colour_description_present_flag) {
424  h->bit_depth_luma = get_bits(gb, 3) + 8;
425  h->bit_depth_chroma = get_bits(gb, 3) + 8;
426  h->full_range = get_bits1(gb);
427  h->color_primaries = get_bits(gb, 8);
428  h->transfer_characteristics = get_bits(gb, 8);
429  h->matrix_coeffs = get_bits(gb, 8);
430  }
431  h->blending_mode_id = get_bits(gb, 2);
432  h->log2_scale_factor = get_bits(gb, 4);
433  for (int c = 0; c < 3; c++)
434  h->comp_model_present_flag[c] = get_bits1(gb);
435  for (int c = 0; c < 3; c++) {
436  if (h->comp_model_present_flag[c]) {
437  h->num_intensity_intervals[c] = get_bits(gb, 8) + 1;
438  h->num_model_values[c] = get_bits(gb, 3) + 1;
439  if (h->num_model_values[c] > 6)
440  return AVERROR_INVALIDDATA;
441  for (int i = 0; i < h->num_intensity_intervals[c]; i++) {
442  h->intensity_interval_lower_bound[c][i] = get_bits(gb, 8);
443  h->intensity_interval_upper_bound[c][i] = get_bits(gb, 8);
444  for (int j = 0; j < h->num_model_values[c]; j++)
445  h->comp_model_value[c][i][j] = get_se_golomb_long(gb);
446  }
447  }
448  }
449  h->persistence_flag = get_bits1(gb);
450 
451  h->present = 1;
452  }
453 
454  return 0;
455 }
456 
457 static int decode_nal_sei_prefix(GetBitContext *gb, void *logctx, HEVCSEI *s,
458  const HEVCParamSets *ps, int type, int size)
459 {
460  switch (type) {
461  case 256: // Mismatched value from HM 8.1
462  return decode_nal_sei_decoded_picture_hash(&s->picture_hash, gb);
464  return decode_nal_sei_frame_packing_arrangement(&s->frame_packing, gb);
466  return decode_nal_sei_display_orientation(&s->display_orientation, gb);
467  case SEI_TYPE_PIC_TIMING:
468  return decode_nal_sei_pic_timing(s, gb, ps, logctx, size);
470  return decode_nal_sei_mastering_display_info(&s->mastering_display, gb, size);
472  return decode_nal_sei_content_light_info(&s->content_light, gb, size);
474  return decode_nal_sei_active_parameter_sets(s, gb, logctx);
478  return decode_nal_sei_user_data_unregistered(&s->unregistered, gb, size);
480  return decode_nal_sei_alternative_transfer(&s->alternative_transfer, gb, size);
481  case SEI_TYPE_TIME_CODE:
482  return decode_nal_sei_timecode(&s->timecode, gb);
484  return decode_film_grain_characteristics(&s->film_grain_characteristics, gb);
485  default:
486  av_log(logctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
487  skip_bits_long(gb, 8 * size);
488  return 0;
489  }
490 }
491 
492 static int decode_nal_sei_suffix(GetBitContext *gb, void *logctx, HEVCSEI *s,
493  int type, int size)
494 {
495  switch (type) {
497  return decode_nal_sei_decoded_picture_hash(&s->picture_hash, gb);
498  default:
499  av_log(logctx, AV_LOG_DEBUG, "Skipped SUFFIX SEI %d\n", type);
500  skip_bits_long(gb, 8 * size);
501  return 0;
502  }
503 }
504 
505 static int decode_nal_sei_message(GetBitContext *gb, void *logctx, HEVCSEI *s,
506  const HEVCParamSets *ps, int nal_unit_type)
507 {
508  int payload_type = 0;
509  int payload_size = 0;
510  int byte = 0xFF;
511  av_log(logctx, AV_LOG_DEBUG, "Decoding SEI\n");
512 
513  while (byte == 0xFF) {
514  if (get_bits_left(gb) < 16 || payload_type > INT_MAX - 255)
515  return AVERROR_INVALIDDATA;
516  byte = get_bits(gb, 8);
517  payload_type += byte;
518  }
519  byte = 0xFF;
520  while (byte == 0xFF) {
521  if (get_bits_left(gb) < 8 + 8LL*payload_size)
522  return AVERROR_INVALIDDATA;
523  byte = get_bits(gb, 8);
524  payload_size += byte;
525  }
526  if (get_bits_left(gb) < 8LL*payload_size)
527  return AVERROR_INVALIDDATA;
528  if (nal_unit_type == HEVC_NAL_SEI_PREFIX) {
529  return decode_nal_sei_prefix(gb, logctx, s, ps, payload_type, payload_size);
530  } else { /* nal_unit_type == NAL_SEI_SUFFIX */
531  return decode_nal_sei_suffix(gb, logctx, s, payload_type, payload_size);
532  }
533 }
534 
536 {
537  return get_bits_left(gb) > 0 && show_bits(gb, 8) != 0x80;
538 }
539 
541  const HEVCParamSets *ps, int type)
542 {
543  int ret;
544 
545  do {
546  ret = decode_nal_sei_message(gb, logctx, s, ps, type);
547  if (ret < 0)
548  return ret;
549  } while (more_rbsp_data(gb));
550  return 1;
551 }
552 
554 {
555  av_buffer_unref(&s->a53_caption.buf_ref);
556 
557  for (int i = 0; i < s->unregistered.nb_buf_ref; i++)
558  av_buffer_unref(&s->unregistered.buf_ref[i]);
559  s->unregistered.nb_buf_ref = 0;
560  av_freep(&s->unregistered.buf_ref);
561  av_buffer_unref(&s->dynamic_hdr_plus.info);
562 }
decode_nal_sei_frame_packing_arrangement
static int decode_nal_sei_frame_packing_arrangement(HEVCSEIFramePacking *s, GetBitContext *gb)
Definition: hevc_sei.c:103
decode_registered_user_data_closed_caption
static int decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetBitContext *gb, int size)
Definition: hevc_sei.c:179
skip_bits_long
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
Definition: get_bits.h:292
av_clip
#define av_clip
Definition: common.h:96
HEVCSEIAlternativeTransfer
Definition: hevc_sei.h:87
decode_nal_sei_user_data_registered_itu_t_t35
static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitContext *gb, void *logctx, int size)
Definition: hevc_sei.c:248
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:850
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
HEVCSEIUnregistered
Definition: hevc_sei.h:64
decode_nal_sei_user_data_unregistered
static int decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitContext *gb, int size)
Definition: hevc_sei.c:194
get_se_golomb_long
static int get_se_golomb_long(GetBitContext *gb)
Definition: golomb.h:296
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:90
SEI_TYPE_FILM_GRAIN_CHARACTERISTICS
@ SEI_TYPE_FILM_GRAIN_CHARACTERISTICS
Definition: sei.h:49
SEI_TYPE_DISPLAY_ORIENTATION
@ SEI_TYPE_DISPLAY_ORIENTATION
Definition: sei.h:77
AV_PICTURE_STRUCTURE_UNKNOWN
@ AV_PICTURE_STRUCTURE_UNKNOWN
Definition: avcodec.h:2769
get_bits_long
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
Definition: get_bits.h:547
get_bits_count
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:220
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:26
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS
@ SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS
Definition: sei.h:106
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:468
HEVCSEITimeCode
Definition: hevc_sei.h:92
golomb.h
exp golomb vlc stuff
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:380
SEI_TYPE_ACTIVE_PARAMETER_SETS
@ SEI_TYPE_ACTIVE_PARAMETER_SETS
Definition: sei.h:87
HEVCSEIA53Caption
Definition: hevc_sei.h:60
GetBitContext
Definition: get_bits.h:62
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
decode_nal_sei_active_parameter_sets
static int decode_nal_sei_active_parameter_sets(HEVCSEI *s, GetBitContext *gb, void *logctx)
Definition: hevc_sei.c:326
decode_nal_sei_pic_timing
static int decode_nal_sei_pic_timing(HEVCSEI *s, GetBitContext *gb, const HEVCParamSets *ps, void *logctx, int size)
Definition: hevc_sei.c:143
SEI_TYPE_TIME_CODE
@ SEI_TYPE_TIME_CODE
Definition: sei.h:95
ff_hevc_decode_nal_sei
int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s, const HEVCParamSets *ps, int type)
Definition: hevc_sei.c:540
decode_registered_user_data_dynamic_hdr_plus
static int decode_registered_user_data_dynamic_hdr_plus(HEVCSEIDynamicHDRPlus *s, GetBitContext *gb, int size)
Definition: hevc_sei.c:220
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
decode_nal_sei_message
static int decode_nal_sei_message(GetBitContext *gb, void *logctx, HEVCSEI *s, const HEVCParamSets *ps, int nal_unit_type)
Definition: hevc_sei.c:505
s
#define s(width, name)
Definition: cbs_vp9.c:257
av_realloc_array
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition: mem.c:224
SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35
@ SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35
Definition: sei.h:34
decode_nal_sei_prefix
static int decode_nal_sei_prefix(GetBitContext *gb, void *logctx, HEVCSEI *s, const HEVCParamSets *ps, int type, int size)
Definition: hevc_sei.c:457
SEI_TYPE_PIC_TIMING
@ SEI_TYPE_PIC_TIMING
Definition: sei.h:31
HEVCSEI
Definition: hevc_sei.h:133
HEVCSEIMasteringDisplay
Definition: hevc_sei.h:69
HEVCSEIPictureHash
Definition: hevc_sei.h:37
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
HEVCSEIFramePacking
Definition: hevc_sei.h:42
decode_nal_sei_mastering_display_info
static int decode_nal_sei_mastering_display_info(HEVCSEIMasteringDisplay *s, GetBitContext *gb, int size)
Definition: hevc_sei.c:55
HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING
@ HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING
Definition: hevc_sei.h:34
HEVC_MAX_SPS_COUNT
@ HEVC_MAX_SPS_COUNT
Definition: hevc.h:112
if
if(ret)
Definition: filter_design.txt:179
AV_PICTURE_STRUCTURE_BOTTOM_FIELD
@ AV_PICTURE_STRUCTURE_BOTTOM_FIELD
Definition: avcodec.h:2771
GetBitContext::buffer
const uint8_t * buffer
Definition: get_bits.h:63
ff_parse_a53_cc
int ff_parse_a53_cc(AVBufferRef **pbuf, const uint8_t *data, int size)
Parse a data array for ATSC A53 Part 4 Closed Captions and store them in an AVBufferRef.
Definition: atsc_a53.c:68
NULL
#define NULL
Definition: coverity.c:32
av_buffer_unref
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Definition: buffer.c:139
AV_PICTURE_STRUCTURE_TOP_FIELD
@ AV_PICTURE_STRUCTURE_TOP_FIELD
Definition: avcodec.h:2770
HEVCSEIDisplayOrientation
Definition: hevc_sei.h:50
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:499
SEI_TYPE_FRAME_PACKING_ARRANGEMENT
@ SEI_TYPE_FRAME_PACKING_ARRANGEMENT
Definition: sei.h:75
dynamic_hdr10_plus.h
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
SEI_TYPE_USER_DATA_UNREGISTERED
@ SEI_TYPE_USER_DATA_UNREGISTERED
Definition: sei.h:35
av_buffer_create
AVBufferRef * av_buffer_create(uint8_t *data, size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
Definition: buffer.c:55
decode_nal_sei_timecode
static int decode_nal_sei_timecode(HEVCSEITimeCode *s, GetBitContext *gb)
Definition: hevc_sei.c:368
byte
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_WB16 unsigned int_TMPL byte
Definition: bytestream.h:99
size
int size
Definition: twinvq_data.h:10344
MKBETAG
#define MKBETAG(a, b, c, d)
Definition: macros.h:56
HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING
@ HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING
Definition: hevc_sei.h:33
decode_film_grain_characteristics
static int decode_film_grain_characteristics(HEVCSEIFilmGrainCharacteristics *h, GetBitContext *gb)
Definition: hevc_sei.c:414
skip_bits1
static void skip_bits1(GetBitContext *s)
Definition: get_bits.h:539
av_buffer_alloc
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
Definition: buffer.c:77
decode_nal_sei_display_orientation
static int decode_nal_sei_display_orientation(HEVCSEIDisplayOrientation *s, GetBitContext *gb)
Definition: hevc_sei.c:128
AVBufferRef::size
size_t size
Size of data in bytes.
Definition: buffer.h:94
more_rbsp_data
static int more_rbsp_data(GetBitContext *gb)
Definition: hevc_sei.c:535
hevc_ps.h
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
HEVCSEIDynamicHDRPlus
Definition: hevc_sei.h:77
decode_nal_sei_suffix
static int decode_nal_sei_suffix(GetBitContext *gb, void *logctx, HEVCSEI *s, int type, int size)
Definition: hevc_sei.c:492
show_bits
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
Definition: get_bits.h:447
SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME
@ SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME
Definition: sei.h:96
decode_nal_sei_alternative_transfer
static int decode_nal_sei_alternative_transfer(HEVCSEIAlternativeTransfer *s, GetBitContext *gb, int size)
Definition: hevc_sei.c:355
AVDynamicHDRPlus
This struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2...
Definition: hdr_dynamic_metadata.h:243
decode_nal_sei_content_light_info
static int decode_nal_sei_content_light_info(HEVCSEIContentLight *s, GetBitContext *gb, int size)
Definition: hevc_sei.c:85
ret
ret
Definition: filter_design.txt:187
ff_hevc_reset_sei
void ff_hevc_reset_sei(HEVCSEI *s)
Reset SEI values that are stored on the Context.
Definition: hevc_sei.c:553
atsc_a53.h
sps
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
Definition: cbs_h264_syntax_template.c:260
SEI_TYPE_DECODED_PICTURE_HASH
@ SEI_TYPE_DECODED_PICTURE_HASH
Definition: sei.h:91
ff_parse_itu_t_t35_to_dynamic_hdr10_plus
int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus *s, const uint8_t *data, int size)
Parse the user data registered ITU-T T.35 to AVbuffer (AVDynamicHDRPlus).
Definition: dynamic_hdr10_plus.c:30
HEVCParamSets::sps_list
AVBufferRef * sps_list[HEVC_MAX_SPS_COUNT]
Definition: hevc_ps.h:329
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
get_ue_golomb_long
static unsigned get_ue_golomb_long(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
Definition: golomb.h:106
HEVCSPS
Definition: hevc_ps.h:153
av_dynamic_hdr_plus_alloc
AVDynamicHDRPlus * av_dynamic_hdr_plus_alloc(size_t *size)
Copyright (c) 2018 Mohammad Izadi <moh.izadi at gmail.com>
Definition: hdr_dynamic_metadata.c:24
decode_nal_sei_decoded_picture_hash
static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s, GetBitContext *gb)
Definition: hevc_sei.c:31
av_free
#define av_free(p)
Definition: tableprint_vlc.h:34
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
HEVCSEIContentLight
Definition: hevc_sei.h:81
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
h
h
Definition: vp9dsp_template.c:2038
SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO
@ SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO
Definition: sei.h:103
HEVCSEIPictureTiming
Definition: hevc_sei.h:56
HEVC_NAL_SEI_PREFIX
@ HEVC_NAL_SEI_PREFIX
Definition: hevc.h:68
HEVCSEIFilmGrainCharacteristics
Definition: hevc_sei.h:112
hevc_sei.h
HEVCParamSets
Definition: hevc_ps.h:327