evc.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * EVC definitions and enums
  3. * Copyright (c) 2022 Dawid Kozinski <d.kozinski@samsung.com>
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #ifndef AVCODEC_EVC_H
  22. #define AVCODEC_EVC_H
  23. // The length field that indicates the length in bytes of the following NAL unit is configured to be of 4 bytes
  24. #define EVC_NALU_LENGTH_PREFIX_SIZE (4) /* byte */
  25. #define EVC_NALU_HEADER_SIZE (2) /* byte */
  26. /**
  27. * @see ISO_IEC_23094-1_2020, 7.4.2.2 NAL unit header semantic
  28. * Table 4 - NAL unit type codes and NAL unit type classes
  29. */
  30. enum EVCNALUnitType {
  31. EVC_NOIDR_NUT = 0, /* Coded slice of a non-IDR picture */
  32. EVC_IDR_NUT = 1, /* Coded slice of an IDR picture */
  33. EVC_RSV_VCL_NUT02 = 2,
  34. EVC_RSV_VCL_NUT03 = 3,
  35. EVC_RSV_VCL_NUT04 = 4,
  36. EVC_RSV_VCL_NUT05 = 5,
  37. EVC_RSV_VCL_NUT06 = 6,
  38. EVC_RSV_VCL_NUT07 = 7,
  39. EVC_RSV_VCL_NUT08 = 8,
  40. EVC_RSV_VCL_NUT09 = 9,
  41. EVC_RSV_VCL_NUT10 = 10,
  42. EVC_RSV_VCL_NUT11 = 11,
  43. EVC_RSV_VCL_NUT12 = 12,
  44. EVC_RSV_VCL_NUT13 = 13,
  45. EVC_RSV_VCL_NUT14 = 14,
  46. EVC_RSV_VCL_NUT15 = 15,
  47. EVC_RSV_VCL_NUT16 = 16,
  48. EVC_RSV_VCL_NUT17 = 17,
  49. EVC_RSV_VCL_NUT18 = 18,
  50. EVC_RSV_VCL_NUT19 = 19,
  51. EVC_RSV_VCL_NUT20 = 20,
  52. EVC_RSV_VCL_NUT21 = 21,
  53. EVC_RSV_VCL_NUT22 = 22,
  54. EVC_RSV_VCL_NUT23 = 23,
  55. EVC_SPS_NUT = 24, /* Sequence parameter set */
  56. EVC_PPS_NUT = 25, /* Picture parameter set */
  57. EVC_APS_NUT = 26, /* Adaptation parameter set */
  58. EVC_FD_NUT = 27, /* Filler data */
  59. EVC_SEI_NUT = 28, /* Supplemental enhancement information */
  60. EVC_RSV_NONVCL29 = 29,
  61. EVC_RSV_NONVCL30 = 30,
  62. EVC_RSV_NONVCL31 = 31,
  63. EVC_RSV_NONVCL32 = 32,
  64. EVC_RSV_NONVCL33 = 33,
  65. EVC_RSV_NONVCL34 = 34,
  66. EVC_RSV_NONVCL35 = 35,
  67. EVC_RSV_NONVCL36 = 36,
  68. EVC_RSV_NONVCL37 = 37,
  69. EVC_RSV_NONVCL38 = 38,
  70. EVC_RSV_NONVCL39 = 39,
  71. EVC_RSV_NONVCL40 = 40,
  72. EVC_RSV_NONVCL41 = 41,
  73. EVC_RSV_NONVCL42 = 42,
  74. EVC_RSV_NONVCL43 = 43,
  75. EVC_RSV_NONVCL44 = 44,
  76. EVC_RSV_NONVCL45 = 45,
  77. EVC_RSV_NONVCL46 = 46,
  78. EVC_RSV_NONVCL47 = 47,
  79. EVC_RSV_NONVCL48 = 48,
  80. EVC_RSV_NONVCL49 = 49,
  81. EVC_RSV_NONVCL50 = 50,
  82. EVC_RSV_NONVCL51 = 51,
  83. EVC_RSV_NONVCL52 = 52,
  84. EVC_RSV_NONVCL53 = 53,
  85. EVC_RSV_NONVCL54 = 54,
  86. EVC_RSV_NONVCL55 = 55,
  87. EVC_UNSPEC_NUT56 = 56,
  88. EVC_UNSPEC_NUT57 = 57,
  89. EVC_UNSPEC_NUT58 = 58,
  90. EVC_UNSPEC_NUT59 = 59,
  91. EVC_UNSPEC_NUT60 = 60,
  92. EVC_UNSPEC_NUT61 = 61,
  93. EVC_UNSPEC_NUT62 = 62
  94. };
  95. // slice type
  96. // @see ISO_IEC_23094-1_2020 7.4.5 Slice header semantics
  97. //
  98. enum EVCSliceType {
  99. EVC_SLICE_TYPE_B = 0,
  100. EVC_SLICE_TYPE_P = 1,
  101. EVC_SLICE_TYPE_I = 2
  102. };
  103. enum {
  104. // 7.4.3.1: sps_seq_parameter_set_id is in [0, 15].
  105. EVC_MAX_SPS_COUNT = 16,
  106. // 7.4.3.2: pps_pic_parameter_set_id is in [0, 63].
  107. EVC_MAX_PPS_COUNT = 64,
  108. // 7.4.3.3: adaptional_parameter_set_id is in [0, 31].
  109. EVC_MAX_APS_COUNT = 32,
  110. // 7.4.5: slice header slice_pic_parameter_set_id in [0, 63]
  111. EVC_MAX_SH_COUNT = 64,
  112. // E.3.2: cpb_cnt_minus1[i] is in [0, 31].
  113. EVC_MAX_CPB_CNT = 32,
  114. // A.4.1: in table A.1 the highest level allows a MaxLumaPs of 35 651 584.
  115. EVC_MAX_LUMA_PS = 35651584,
  116. EVC_MAX_NUM_REF_PICS = 21,
  117. EVC_MAX_NUM_RPLS = 64,
  118. // A.4.1: pic_width_in_luma_samples and pic_height_in_luma_samples are
  119. // constrained to be not greater than sqrt(MaxLumaPs * 8). Hence height/
  120. // width are bounded above by sqrt(8 * 35651584) = 16888.2 samples.
  121. EVC_MAX_WIDTH = 16888,
  122. EVC_MAX_HEIGHT = 16888,
  123. // A.4.1: table A.1 allows at most 22 tile rows for any level.
  124. EVC_MAX_TILE_ROWS = 22,
  125. // A.4.1: table A.1 allows at most 20 tile columns for any level.
  126. EVC_MAX_TILE_COLUMNS = 20,
  127. // A.4.1: table A.1 allows at most 600 slice segments for any level.
  128. EVC_MAX_SLICE_SEGMENTS = 600,
  129. };
  130. #endif // AVCODEC_EVC_H