vic40.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. /*
  2. * Copyright © 2016-2018 NVIDIA Corporation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. */
  22. #ifndef VIC40_H
  23. #define VIC40_H
  24. #include <stdint.h>
  25. #define NVB0B6_VIDEO_COMPOSITOR_SET_APPLICATION_ID 0x00000200
  26. #define NVB0B6_VIDEO_COMPOSITOR_EXECUTE 0x00000300
  27. #define NVB0B6_VIDEO_COMPOSITOR_SET_SURFACE0_SLOT0_LUMA_OFFSET 0x00000400
  28. #define NVB0B6_VIDEO_COMPOSITOR_SET_SURFACE0_SLOT0_CHROMA_U_OFFSET 0x00000404
  29. #define NVB0B6_VIDEO_COMPOSITOR_SET_SURFACE0_SLOT0_CHROMA_V_OFFSET 0x00000408
  30. #define NVB0B6_VIDEO_COMPOSITOR_SET_CONTROL_PARAMS 0x00000704
  31. #define NVB0B6_VIDEO_COMPOSITOR_SET_CONFIG_STRUCT_OFFSET 0x00000708
  32. #define NVB0B6_VIDEO_COMPOSITOR_SET_HIST_OFFSET 0x00000714
  33. #define NVB0B6_VIDEO_COMPOSITOR_SET_OUTPUT_SURFACE_LUMA_OFFSET 0x00000720
  34. typedef struct {
  35. uint64_t SlotEnable : 1; /* 0 */
  36. uint64_t DeNoise : 1; /* 1 */
  37. uint64_t AdvancedDenoise : 1; /* 2 */
  38. uint64_t CadenceDetect : 1; /* 3 */
  39. uint64_t MotionMap : 1; /* 4 */
  40. uint64_t MMapCombine : 1; /* 5 */
  41. uint64_t IsEven : 1; /* 6 */
  42. uint64_t ChromaEven : 1; /* 7 */
  43. uint64_t CurrentFieldEnable : 1; /* 8 */
  44. uint64_t PrevFieldEnable : 1; /* 9 */
  45. uint64_t NextFieldEnable : 1; /* 10 */
  46. uint64_t NextNrFieldEnable : 1; /* 11 */
  47. uint64_t CurMotionFieldEnable : 1; /* 12 */
  48. uint64_t PrevMotionFieldEnable : 1; /* 13 */
  49. uint64_t PpMotionFieldEnable : 1; /* 14 */
  50. uint64_t CombMotionFieldEnable : 1; /* 15 */
  51. uint64_t FrameFormat : 4; /* 19..16 */
  52. uint64_t FilterLengthY : 2; /* 21..20 */
  53. uint64_t FilterLengthX : 2; /* 23..22 */
  54. uint64_t Panoramic : 12; /* 35..24 */
  55. uint64_t reserved1 : 22; /* 57..36 */
  56. uint64_t DetailFltClamp : 6; /* 63..58 */
  57. uint64_t FilterNoise : 10; /* 73..64 */
  58. uint64_t FilterDetail : 10; /* 83..74 */
  59. uint64_t ChromaNoise : 10; /* 93..84 */
  60. uint64_t ChromaDetail : 10; /* 103..94 */
  61. uint64_t DeinterlaceMode : 4; /* 107..104 */
  62. uint64_t MotionAccumWeight : 3; /* 110..108 */
  63. uint64_t NoiseIir : 11; /* 121..111 */
  64. uint64_t LightLevel : 4; /* 125..122 */
  65. uint64_t reserved4 : 2; /* 127..126 */
  66. /* 128 */
  67. uint64_t SoftClampLow : 10; /* 9..0 */
  68. uint64_t SoftClampHigh : 10; /* 19..10 */
  69. uint64_t reserved5 : 3; /* 22..20 */
  70. uint64_t reserved6 : 9; /* 31..23 */
  71. uint64_t PlanarAlpha : 10; /* 41..32 */
  72. uint64_t ConstantAlpha : 1; /* 42 */
  73. uint64_t StereoInterleave : 3; /* 45..43 */
  74. uint64_t ClipEnabled : 1; /* 46 */
  75. uint64_t ClearRectMask : 8; /* 54..47 */
  76. uint64_t DegammaMode : 2; /* 56..55 */
  77. uint64_t reserved7 : 1; /* 57 */
  78. uint64_t DecompressEnable : 1; /* 58 */
  79. uint64_t reserved9 : 5; /* 63..59 */
  80. uint64_t DecompressCtbCount : 8; /* 71..64 */
  81. uint64_t DecompressZbcColor : 32; /* 103..72 */
  82. uint64_t reserved12 : 24; /* 127..104 */
  83. /* 256 */
  84. uint64_t SourceRectLeft : 30; /* 29..0 */
  85. uint64_t reserved14 : 2; /* 31..30 */
  86. uint64_t SourceRectRight : 30; /* 61..32 */
  87. uint64_t reserved15 : 2; /* 63..62 */
  88. uint64_t SourceRectTop : 30; /* 93..64 */
  89. uint64_t reserved16 : 2; /* 95..94 */
  90. uint64_t SourceRectBottom : 30; /* 125..96 */
  91. uint64_t reserved17 : 2; /* 127..126 */
  92. /* 384 */
  93. uint64_t DestRectLeft : 14; /* 13..0 */
  94. uint64_t reserved18 : 2; /* 15..14 */
  95. uint64_t DestRectRight : 14; /* 29..16 */
  96. uint64_t reserved19 : 2; /* 31..30 */
  97. uint64_t DestRectTop : 14; /* 45..32 */
  98. uint64_t reserved20 : 2; /* 47..46 */
  99. uint64_t DestRectBottom : 14; /* 61..48 */
  100. uint64_t reserved21 : 2; /* 63..62 */
  101. uint64_t reserved22 : 32; /* 95..64 */
  102. uint64_t reserved23 : 32; /* 127..96 */
  103. } SlotConfig;
  104. typedef struct {
  105. uint64_t SlotPixelFormat : 7; /* 6..0 */
  106. uint64_t SlotChromaLocHoriz : 2; /* 8..7 */
  107. uint64_t SlotChromaLocVert : 2; /* 10..9 */
  108. uint64_t SlotBlkKind : 4; /* 14..11 */
  109. uint64_t SlotBlkHeight : 4; /* 18..15 */
  110. uint64_t SlotCacheWidth : 3; /* 21..19 */
  111. uint64_t reserved0 : 10; /* 31..22 */
  112. uint64_t SlotSurfaceWidth : 14; /* 45..32 */
  113. uint64_t SlotSurfaceHeight : 14; /* 59..46 */
  114. uint64_t reserved1 : 4; /* 63..60 */
  115. uint64_t SlotLumaWidth : 14; /* 77..64 */
  116. uint64_t SlotLumaHeight : 14; /* 91..78 */
  117. uint64_t reserved2 : 4; /* 95..92 */
  118. uint64_t SlotChromaWidth : 14; /* 109..96 */
  119. uint64_t SlotChromaHeight : 14; /* 123..110 */
  120. uint64_t reserved3 : 4; /* 127..124 */
  121. } SlotSurfaceConfig;
  122. typedef struct {
  123. uint64_t luma_coeff0 : 20; /* 19..0 */
  124. uint64_t luma_coeff1 : 20; /* 39..20 */
  125. uint64_t luma_coeff2 : 20; /* 59..40 */
  126. uint64_t luma_r_shift : 4; /* 63..60 */
  127. uint64_t luma_coeff3 : 20; /* 83..64 */
  128. uint64_t LumaKeyLower : 10; /* 93..84 */
  129. uint64_t LumaKeyUpper : 10; /* 103..94 */
  130. uint64_t LumaKeyEnabled : 1; /* 104 */
  131. uint64_t reserved0 : 2; /* 106..105 */
  132. uint64_t reserved1 : 21; /* 127..107 */
  133. } LumaKeyStruct;
  134. typedef struct {
  135. uint64_t matrix_coeff00 : 20; /* 19..0 */
  136. uint64_t matrix_coeff10 : 20; /* 39..20 */
  137. uint64_t matrix_coeff20 : 20; /* 59..40 */
  138. uint64_t matrix_r_shift : 4; /* 63..60 */
  139. uint64_t matrix_coeff01 : 20; /* 83..64 */
  140. uint64_t matrix_coeff11 : 20; /* 103..84 */
  141. uint64_t matrix_coeff21 : 20; /* 123..104 */
  142. uint64_t reserved0 : 3; /* 126..124 */
  143. uint64_t matrix_enable : 1; /* 127 */
  144. /* 128 */
  145. uint64_t matrix_coeff02 : 20; /* 19..0 */
  146. uint64_t matrix_coeff12 : 20; /* 39..20 */
  147. uint64_t matrix_coeff22 : 20; /* 59..40 */
  148. uint64_t reserved1 : 4; /* 63..60 */
  149. uint64_t matrix_coeff03 : 20; /* 83..64 */
  150. uint64_t matrix_coeff13 : 20; /* 103..84 */
  151. uint64_t matrix_coeff23 : 20; /* 123..104 */
  152. uint64_t reserved2 : 4; /* 127..124 */
  153. } MatrixStruct;
  154. typedef struct {
  155. uint64_t ClearRect0Left : 14; /* 13..0 */
  156. uint64_t reserved0 : 2; /* 15..14 */
  157. uint64_t ClearRect0Right : 14; /* 29..16 */
  158. uint64_t reserved1 : 2; /* 31..30 */
  159. uint64_t ClearRect0Top : 14; /* 45..32 */
  160. uint64_t reserved2 : 2; /* 47..46 */
  161. uint64_t ClearRect0Bottom : 14; /* 61..48 */
  162. uint64_t reserved3 : 2; /* 63..62 */
  163. uint64_t ClearRect1Left : 14; /* 77..64 */
  164. uint64_t reserved4 : 2; /* 79..78 */
  165. uint64_t ClearRect1Right : 14; /* 93..80 */
  166. uint64_t reserved5 : 2; /* 95..94 */
  167. uint64_t ClearRect1Top : 14; /* 109..96 */
  168. uint64_t reserved6 : 2; /* 111..110 */
  169. uint64_t ClearRect1Bottom : 14; /* 125..112 */
  170. uint64_t reserved7 : 2; /* 127..126 */
  171. } ClearRectStruct;
  172. typedef struct {
  173. uint64_t AlphaK1 : 10; /* 9..0 */
  174. uint64_t reserved0 : 6; /* 15..10 */
  175. uint64_t AlphaK2 : 10; /* 25..16 */
  176. uint64_t reserved1 : 6; /* 31..26 */
  177. uint64_t SrcFactCMatchSelect : 3; /* 34..32 */
  178. uint64_t reserved2 : 1; /* 35 */
  179. uint64_t DstFactCMatchSelect : 3; /* 38..36 */
  180. uint64_t reserved3 : 1; /* 39 */
  181. uint64_t SrcFactAMatchSelect : 3; /* 42..40 */
  182. uint64_t reserved4 : 1; /* 43 */
  183. uint64_t DstFactAMatchSelect : 3; /* 46..44 */
  184. uint64_t reserved5 : 1; /* 47 */
  185. uint64_t reserved6 : 4; /* 51..48 */
  186. uint64_t reserved7 : 4; /* 55..52 */
  187. uint64_t reserved8 : 4; /* 59..56 */
  188. uint64_t reserved9 : 4; /* 63..60 */
  189. uint64_t reserved10 : 2; /* 65..64 */
  190. uint64_t OverrideR : 10; /* 75..66 */
  191. uint64_t OverrideG : 10; /* 85..76 */
  192. uint64_t OverrideB : 10; /* 95..86 */
  193. uint64_t OverrideA : 10; /* 105..96 */
  194. uint64_t reserved11 : 2; /* 107..106 */
  195. uint64_t UseOverrideR : 1; /* 108 */
  196. uint64_t UseOverrideG : 1; /* 109 */
  197. uint64_t UseOverrideB : 1; /* 110 */
  198. uint64_t UseOverrideA : 1; /* 111 */
  199. uint64_t MaskR : 1; /* 112 */
  200. uint64_t MaskG : 1; /* 113 */
  201. uint64_t MaskB : 1; /* 114 */
  202. uint64_t MaskA : 1; /* 115 */
  203. uint64_t reserved12 : 12; /* 127..116 */
  204. } BlendingSlotStruct;
  205. typedef struct {
  206. uint64_t AlphaFillMode : 3; /* 2..0 */
  207. uint64_t AlphaFillSlot : 3; /* 5..3 */
  208. uint64_t BackgroundAlpha : 10; /* 15..6 */
  209. uint64_t BackgroundR : 10; /* 25..16 */
  210. uint64_t BackgroundG : 10; /* 35..26 */
  211. uint64_t BackgroundB : 10; /* 45..36 */
  212. uint64_t RegammaMode : 2; /* 47..46 */
  213. uint64_t OutputFlipX : 1; /* 48 */
  214. uint64_t OutputFlipY : 1; /* 49 */
  215. uint64_t OutputTranspose : 1; /* 50 */
  216. uint64_t reserved1 : 1; /* 51 */
  217. uint64_t reserved2 : 12; /* 63..52 */
  218. uint64_t TargetRectLeft : 14; /* 77..64 */
  219. uint64_t reserved3 : 2; /* 79..78 */
  220. uint64_t TargetRectRight : 14; /* 93..80 */
  221. uint64_t reserved4 : 2; /* 95..94 */
  222. uint64_t TargetRectTop : 14; /* 109..96 */
  223. uint64_t reserved5 : 2; /* 111..110 */
  224. uint64_t TargetRectBottom : 14; /* 125..112 */
  225. uint64_t reserved6 : 2; /* 127..126 */
  226. } OutputConfig;
  227. typedef struct {
  228. uint64_t OutPixelFormat : 7; /* 6..0 */
  229. uint64_t OutChromaLocHoriz : 2; /* 8..7 */
  230. uint64_t OutChromaLocVert : 2; /* 10..9 */
  231. uint64_t OutBlkKind : 4; /* 14..11 */
  232. uint64_t OutBlkHeight : 4; /* 18..15 */
  233. uint64_t reserved0 : 3; /* 21..19 */
  234. uint64_t reserved1 : 10; /* 31..22 */
  235. uint64_t OutSurfaceWidth : 14; /* 45..32 */
  236. uint64_t OutSurfaceHeight : 14; /* 59..46 */
  237. uint64_t reserved2 : 4; /* 63..60 */
  238. uint64_t OutLumaWidth : 14; /* 77..64 */
  239. uint64_t OutLumaHeight : 14; /* 91..78 */
  240. uint64_t reserved3 : 4; /* 95..92 */
  241. uint64_t OutChromaWidth : 14; /* 109..96 */
  242. uint64_t OutChromaHeight : 14; /* 123..110 */
  243. uint64_t reserved4 : 4; /* 127..124 */
  244. } OutputSurfaceConfig;
  245. typedef struct {
  246. uint64_t DownsampleHoriz : 11; /* 10..0 */
  247. uint64_t reserved0 : 5; /* 15..11 */
  248. uint64_t DownsampleVert : 11; /* 26..16 */
  249. uint64_t reserved1 : 5; /* 31..27 */
  250. uint64_t reserved2 : 32; /* 63..32 */
  251. uint64_t reserved3 : 32; /* 95..64 */
  252. uint64_t reserved4 : 32; /* 127..96 */
  253. } PipeConfig;
  254. typedef struct {
  255. SlotConfig slotConfig;
  256. SlotSurfaceConfig slotSurfaceConfig;
  257. LumaKeyStruct lumaKeyStruct;
  258. MatrixStruct colorMatrixStruct;
  259. MatrixStruct gamutMatrixStruct;
  260. BlendingSlotStruct blendingSlotStruct;
  261. } SlotStruct;
  262. typedef struct {
  263. PipeConfig pipeConfig;
  264. OutputConfig outputConfig;
  265. OutputSurfaceConfig outputSurfaceConfig;
  266. MatrixStruct outColorMatrixStruct;
  267. ClearRectStruct clearRectStruct[4];
  268. SlotStruct slotStruct[8];
  269. } ConfigStruct;
  270. #endif