rk_hdr_meta_com.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Copyright 2022 Rockchip Electronics Co. LTD
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef __RK_HDR_META_COM_H__
  17. #define __RK_HDR_META_COM_H__
  18. #include "rk_type.h"
  19. typedef enum HdrCodecType_e {
  20. HDR_CODEC_UNSPECIFIED = -1,
  21. HDR_AVS2 = 0,
  22. HDR_HEVC = 1,
  23. HDR_H264 = 2,
  24. HDR_AV1 = 3,
  25. } HdrCodecType;
  26. typedef enum HdrFormat_e {
  27. HDR_NONE = 0,
  28. HDR10 = 1,
  29. HLG = 2,
  30. // RESERVED3 = 3, //reserved for more future static hdr format
  31. // RESERVED4 = 4, //reserved for more future static hdr format
  32. HDRVIVID = 5,
  33. // RESERVED6 = 6, //reserved for hdr vivid
  34. // RESERVED7 = 7, //reserved for hdr vivid
  35. HDR10PLUS = 8,
  36. // RESERVED9 = 9, //reserved for hdr10+
  37. // RESERVED10 = 10,//reserved for hdr10+
  38. DOLBY = 11,
  39. // RESERVED12 = 12, //reserved for other dynamic hdr format
  40. // RESERVED13 = 13, //reserved for other dynamic hdr format
  41. HDR_FORMAT_MAX,
  42. } HdrFormat;
  43. typedef enum HdrPayloadFormat_e {
  44. STATIC = 0,
  45. DYNAMIC = 1,
  46. HDR_PAYLOAD_FORMAT_MAX,
  47. } HdrPayloadFormat;
  48. typedef struct HdrStaticMeta_t {
  49. RK_U32 color_space;
  50. RK_U32 color_primaries;
  51. RK_U32 color_trc;
  52. RK_U32 red_x;
  53. RK_U32 red_y;
  54. RK_U32 green_x;
  55. RK_U32 green_y;
  56. RK_U32 blue_x;
  57. RK_U32 blue_y;
  58. RK_U32 white_point_x;
  59. RK_U32 white_point_y;
  60. RK_U32 min_luminance;
  61. RK_U32 max_luminance;
  62. RK_U32 max_cll;
  63. RK_U32 max_fall;
  64. RK_U32 reserved[4];
  65. } HdrStaticMeta;
  66. /*
  67. * HDR metadata format from codec
  68. *
  69. * +----------+
  70. * | header1 |
  71. * +----------+
  72. * | |
  73. * | payload |
  74. * | |
  75. * +----------+
  76. * | header2 |
  77. * +----------+
  78. * | |
  79. * | payload |
  80. * | |
  81. * +----------+
  82. * | header3 |
  83. * +----------+
  84. * | |
  85. * | payload |
  86. * | |
  87. * +----------+
  88. */
  89. typedef struct RkMetaHdrHeader_t {
  90. /* For transmission */
  91. RK_U16 magic; /* magic word for checking overwrite error */
  92. RK_U16 size; /* total header+payload length including header */
  93. RK_U16 message_total; /* total message count in current transmission */
  94. RK_U16 message_index; /* current message index in the transmission */
  95. /* For payload identification */
  96. RK_U16 version; /* payload structure version */
  97. RK_U16 hdr_format; /* HDR protocol: HDR10, HLG, Dolby, HDRVivid ... */
  98. RK_U16 hdr_payload_type; /* HDR data type: static data, dynamic data ... */
  99. RK_U16 video_format; /* video format: H.264, H.265, AVS2 ... */
  100. /* For extenstion usage */
  101. RK_U32 reserve[4];
  102. /* payload data aligned to 32bits */
  103. RK_U32 payload[];
  104. } RkMetaHdrHeader;
  105. #ifdef __cplusplus
  106. extern "C" {
  107. #endif /* __cplusplus */
  108. void fill_hdr_meta_to_frame(MppFrame frame, MppCodingType in_type);
  109. #ifdef __cplusplus
  110. }
  111. #endif
  112. #endif