You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
4.4KB

  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 "libavutil/md5.h"
  24. #include "get_bits.h"
  25. /**
  26. * SEI message types
  27. */
  28. typedef enum {
  29. HEVC_SEI_TYPE_BUFFERING_PERIOD = 0,
  30. HEVC_SEI_TYPE_PICTURE_TIMING = 1,
  31. HEVC_SEI_TYPE_PAN_SCAN_RECT = 2,
  32. HEVC_SEI_TYPE_FILLER_PAYLOAD = 3,
  33. HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35 = 4,
  34. HEVC_SEI_TYPE_USER_DATA_UNREGISTERED = 5,
  35. HEVC_SEI_TYPE_RECOVERY_POINT = 6,
  36. HEVC_SEI_TYPE_SCENE_INFO = 9,
  37. HEVC_SEI_TYPE_FULL_FRAME_SNAPSHOT = 15,
  38. HEVC_SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_START = 16,
  39. HEVC_SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_END = 17,
  40. HEVC_SEI_TYPE_FILM_GRAIN_CHARACTERISTICS = 19,
  41. HEVC_SEI_TYPE_POST_FILTER_HINT = 22,
  42. HEVC_SEI_TYPE_TONE_MAPPING_INFO = 23,
  43. HEVC_SEI_TYPE_FRAME_PACKING = 45,
  44. HEVC_SEI_TYPE_DISPLAY_ORIENTATION = 47,
  45. HEVC_SEI_TYPE_SOP_DESCRIPTION = 128,
  46. HEVC_SEI_TYPE_ACTIVE_PARAMETER_SETS = 129,
  47. HEVC_SEI_TYPE_DECODING_UNIT_INFO = 130,
  48. HEVC_SEI_TYPE_TEMPORAL_LEVEL0_INDEX = 131,
  49. HEVC_SEI_TYPE_DECODED_PICTURE_HASH = 132,
  50. HEVC_SEI_TYPE_SCALABLE_NESTING = 133,
  51. HEVC_SEI_TYPE_REGION_REFRESH_INFO = 134,
  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;
  56. typedef struct HEVCSEIPictureHash {
  57. struct AVMD5 *md5_ctx;
  58. uint8_t md5[3][16];
  59. uint8_t is_md5;
  60. } HEVCSEIPictureHash;
  61. typedef struct HEVCSEIFramePacking {
  62. int present;
  63. int arrangement_type;
  64. int content_interpretation_type;
  65. int quincunx_subsampling;
  66. } HEVCSEIFramePacking;
  67. typedef struct HEVCSEIDisplayOrientation {
  68. int present;
  69. int anticlockwise_rotation;
  70. int hflip, vflip;
  71. } HEVCSEIDisplayOrientation;
  72. typedef struct HEVCSEIPictureTiming {
  73. int picture_struct;
  74. } HEVCSEIPictureTiming;
  75. typedef struct HEVCSEIA53Caption {
  76. int a53_caption_size;
  77. uint8_t *a53_caption;
  78. } HEVCSEIA53Caption;
  79. typedef struct HEVCSEIMasteringDisplay {
  80. int present;
  81. uint16_t display_primaries[3][2];
  82. uint16_t white_point[2];
  83. uint32_t max_luminance;
  84. uint32_t min_luminance;
  85. } HEVCSEIMasteringDisplay;
  86. typedef struct HEVCSEIContentLight {
  87. int present;
  88. uint16_t max_content_light_level;
  89. uint16_t max_pic_average_light_level;
  90. } HEVCSEIContentLight;
  91. typedef struct HEVCSEIAlternativeTransfer {
  92. int present;
  93. int preferred_transfer_characteristics;
  94. } HEVCSEIAlternativeTransfer;
  95. typedef struct HEVCSEI {
  96. HEVCSEIPictureHash picture_hash;
  97. HEVCSEIFramePacking frame_packing;
  98. HEVCSEIDisplayOrientation display_orientation;
  99. HEVCSEIPictureTiming picture_timing;
  100. HEVCSEIA53Caption a53_caption;
  101. HEVCSEIMasteringDisplay mastering_display;
  102. HEVCSEIContentLight content_light;
  103. int active_seq_parameter_set_id;
  104. HEVCSEIAlternativeTransfer alternative_transfer;
  105. } HEVCSEI;
  106. struct HEVCParamSets;
  107. int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s,
  108. const struct HEVCParamSets *ps, int type);
  109. /**
  110. * Reset SEI values that are stored on the Context.
  111. * e.g. Caption data that was extracted during NAL
  112. * parsing.
  113. *
  114. * @param s HEVCContext.
  115. */
  116. void ff_hevc_reset_sei(HEVCSEI *s);
  117. #endif /* AVCODEC_HEVC_SEI_H */