hevc_sei.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. * HEVC Supplementary Enhancement Information messages
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef AVCODEC_HEVC_SEI_H
  21. #define AVCODEC_HEVC_SEI_H
  22. #include <stdint.h>
  23. #include "get_bits.h"
  24. /**
  25. * SEI message types
  26. */
  27. typedef enum {
  28. HEVC_SEI_TYPE_BUFFERING_PERIOD = 0,
  29. HEVC_SEI_TYPE_PICTURE_TIMING = 1,
  30. HEVC_SEI_TYPE_PAN_SCAN_RECT = 2,
  31. HEVC_SEI_TYPE_FILLER_PAYLOAD = 3,
  32. HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35 = 4,
  33. HEVC_SEI_TYPE_USER_DATA_UNREGISTERED = 5,
  34. HEVC_SEI_TYPE_RECOVERY_POINT = 6,
  35. HEVC_SEI_TYPE_SCENE_INFO = 9,
  36. HEVC_SEI_TYPE_FULL_FRAME_SNAPSHOT = 15,
  37. HEVC_SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_START = 16,
  38. HEVC_SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_END = 17,
  39. HEVC_SEI_TYPE_FILM_GRAIN_CHARACTERISTICS = 19,
  40. HEVC_SEI_TYPE_POST_FILTER_HINT = 22,
  41. HEVC_SEI_TYPE_TONE_MAPPING_INFO = 23,
  42. HEVC_SEI_TYPE_FRAME_PACKING = 45,
  43. HEVC_SEI_TYPE_DISPLAY_ORIENTATION = 47,
  44. HEVC_SEI_TYPE_SOP_DESCRIPTION = 128,
  45. HEVC_SEI_TYPE_ACTIVE_PARAMETER_SETS = 129,
  46. HEVC_SEI_TYPE_DECODING_UNIT_INFO = 130,
  47. HEVC_SEI_TYPE_TEMPORAL_LEVEL0_INDEX = 131,
  48. HEVC_SEI_TYPE_DECODED_PICTURE_HASH = 132,
  49. HEVC_SEI_TYPE_SCALABLE_NESTING = 133,
  50. HEVC_SEI_TYPE_REGION_REFRESH_INFO = 134,
  51. HEVC_SEI_TYPE_TIME_CODE = 136,
  52. HEVC_SEI_TYPE_MASTERING_DISPLAY_INFO = 137,
  53. HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO = 144,
  54. HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS = 147,
  55. HEVC_SEI_TYPE_ALPHA_CHANNEL_INFO = 165,
  56. } HEVC_SEI_Type;
  57. typedef enum {
  58. HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
  59. HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING = 8
  60. } HEVC_SEI_PicStructType;
  61. typedef struct HEVCSEIPictureHash {
  62. uint8_t md5[3][16];
  63. uint8_t is_md5;
  64. } HEVCSEIPictureHash;
  65. typedef struct HEVCSEIFramePacking {
  66. int present;
  67. int arrangement_type;
  68. int content_interpretation_type;
  69. int quincunx_subsampling;
  70. int current_frame_is_frame0_flag;
  71. } HEVCSEIFramePacking;
  72. typedef struct HEVCSEIDisplayOrientation {
  73. int present;
  74. int anticlockwise_rotation;
  75. int hflip, vflip;
  76. } HEVCSEIDisplayOrientation;
  77. typedef struct HEVCSEIPictureTiming {
  78. int picture_struct;
  79. } HEVCSEIPictureTiming;
  80. typedef struct HEVCSEIA53Caption {
  81. AVBufferRef *buf_ref;
  82. } HEVCSEIA53Caption;
  83. typedef struct HEVCSEIUnregistered {
  84. AVBufferRef **buf_ref;
  85. int nb_buf_ref;
  86. } HEVCSEIUnregistered;
  87. typedef struct HEVCSEIMasteringDisplay {
  88. int present;
  89. uint16_t display_primaries[3][2];
  90. uint16_t white_point[2];
  91. uint32_t max_luminance;
  92. uint32_t min_luminance;
  93. } HEVCSEIMasteringDisplay;
  94. typedef struct HEVCSEIContentLight {
  95. int present;
  96. uint16_t max_content_light_level;
  97. uint16_t max_pic_average_light_level;
  98. } HEVCSEIContentLight;
  99. typedef struct HEVCSEIAlternativeTransfer {
  100. int present;
  101. int preferred_transfer_characteristics;
  102. } HEVCSEIAlternativeTransfer;
  103. typedef struct HEVCSEITimeCode {
  104. int present;
  105. uint8_t num_clock_ts;
  106. uint8_t clock_timestamp_flag[3];
  107. uint8_t units_field_based_flag[3];
  108. uint8_t counting_type[3];
  109. uint8_t full_timestamp_flag[3];
  110. uint8_t discontinuity_flag[3];
  111. uint8_t cnt_dropped_flag[3];
  112. uint16_t n_frames[3];
  113. uint8_t seconds_value[3];
  114. uint8_t minutes_value[3];
  115. uint8_t hours_value[3];
  116. uint8_t seconds_flag[3];
  117. uint8_t minutes_flag[3];
  118. uint8_t hours_flag[3];
  119. uint8_t time_offset_length[3];
  120. int32_t time_offset_value[3];
  121. } HEVCSEITimeCode;
  122. typedef struct HEVCSEI {
  123. HEVCSEIPictureHash picture_hash;
  124. HEVCSEIFramePacking frame_packing;
  125. HEVCSEIDisplayOrientation display_orientation;
  126. HEVCSEIPictureTiming picture_timing;
  127. HEVCSEIA53Caption a53_caption;
  128. HEVCSEIUnregistered unregistered;
  129. HEVCSEIMasteringDisplay mastering_display;
  130. HEVCSEIContentLight content_light;
  131. int active_seq_parameter_set_id;
  132. HEVCSEIAlternativeTransfer alternative_transfer;
  133. HEVCSEITimeCode timecode;
  134. } HEVCSEI;
  135. struct HEVCParamSets;
  136. int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s,
  137. const struct HEVCParamSets *ps, int type);
  138. /**
  139. * Reset SEI values that are stored on the Context.
  140. * e.g. Caption data that was extracted during NAL
  141. * parsing.
  142. *
  143. * @param s HEVCContext.
  144. */
  145. void ff_hevc_reset_sei(HEVCSEI *s);
  146. #endif /* AVCODEC_HEVC_SEI_H */