NVIDIA DRIVE OS Linux API Reference

5.1.3.0 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nvmedia_surface.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. All
3  * information contained herein is proprietary and confidential to NVIDIA
4  * Corporation. Any use, reproduction, or disclosure without the written
5  * permission of NVIDIA Corporation is prohibited.
6  */
7 
16 #ifndef NVMEDIA_SURFACE_H
17 #define NVMEDIA_SURFACE_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include "nvmedia_core.h"
24 
46 #define NVMEDIA_SURFACE_VERSION_MAJOR (1u)
47 
48 #define NVMEDIA_SURFACE_VERSION_MINOR (11u)
49 
50 
53 typedef enum {
71 
74 #define NVM_SURF_ATTR_SURF_TYPE_YUV (0x00000001u)
75 
76 #define NVM_SURF_ATTR_SURF_TYPE_RGBA (0x00000002u)
77 
78 #define NVM_SURF_ATTR_SURF_TYPE_RAW (0x00000003u)
79 
82 #define NVM_SURF_ATTR_LAYOUT_BL (0x00000001u)
83 
84 #define NVM_SURF_ATTR_LAYOUT_PL (0x00000002u)
85 
88 #define NVM_SURF_ATTR_DATA_TYPE_UINT (0x00000001u)
89 
90 #define NVM_SURF_ATTR_DATA_TYPE_INT (0x00000002u)
91 
92 #define NVM_SURF_ATTR_DATA_TYPE_FLOAT (0x00000003u)
93 
94 #define NVM_SURF_ATTR_DATA_TYPE_FLOATISP (0x00000004u)
95 
98 #define NVM_SURF_ATTR_MEMORY_PLANAR (0x00000001u)
99 
100 #define NVM_SURF_ATTR_MEMORY_SEMI_PLANAR (0x00000002u)
101 
102 #define NVM_SURF_ATTR_MEMORY_PACKED (0x00000003u)
103 
108 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_420 (0x00000001u)
109 
110 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_422 (0x00000002u)
111 
112 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_444 (0x00000003u)
113 
114 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_422R (0x00000004u)
115 
116 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_NONE (0x00000000u)
117 
122 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_8 (0x00000001u)
123 
124 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_10 (0x00000002u)
125 
126 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_12 (0x00000003u)
127 
128 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_14 (0x00000004u)
129 
130 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_16 (0x00000005u)
131 
132 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_32 (0x00000006u)
133 
135 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_LAYOUT_16_8_8 (0x00000007u)
136 
137 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_LAYOUT_10_8_8 (0x00000008u)
138 
139 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_LAYOUT_2_10_10_10 (0x00000009u)
140 
141 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_20 (0x0000000Au)
142 
145 #define NVM_SURF_ATTR_COMPONENT_ORDER_LUMA (0x00000001u)
146 
147 #define NVM_SURF_ATTR_COMPONENT_ORDER_YUV (0x00000002u)
148 
149 #define NVM_SURF_ATTR_COMPONENT_ORDER_YVU (0x00000003u)
150 
151 #define NVM_SURF_ATTR_COMPONENT_ORDER_YUYV (0x00000004u)
152 
153 #define NVM_SURF_ATTR_COMPONENT_ORDER_YVYU (0x00000005u)
154 
155 #define NVM_SURF_ATTR_COMPONENT_ORDER_VYUY (0x00000006u)
156 
157 #define NVM_SURF_ATTR_COMPONENT_ORDER_UYVY (0x00000007u)
158 
159 #define NVM_SURF_ATTR_COMPONENT_ORDER_XUYV (0x00000008u)
160 
161 #define NVM_SURF_ATTR_COMPONENT_ORDER_XYUV (0x00000009u)
162 
163 #define NVM_SURF_ATTR_COMPONENT_ORDER_VUYX (0x0000000Au)
164 
167 #define NVM_SURF_ATTR_COMPONENT_ORDER_ALPHA (0x00000011u)
168 
169 #define NVM_SURF_ATTR_COMPONENT_ORDER_RGBA (0x00000012u)
170 
171 #define NVM_SURF_ATTR_COMPONENT_ORDER_ARGB (0x00000013u)
172 
173 #define NVM_SURF_ATTR_COMPONENT_ORDER_BGRA (0x00000014u)
174 
175 #define NVM_SURF_ATTR_COMPONENT_ORDER_RG (0x00000015u)
176 
179 #define NVM_SURF_ATTR_COMPONENT_ORDER_RGGB (0x00000021u)
180 
181 #define NVM_SURF_ATTR_COMPONENT_ORDER_BGGR (0x00000022u)
182 
183 #define NVM_SURF_ATTR_COMPONENT_ORDER_GRBG (0x00000023u)
184 
185 #define NVM_SURF_ATTR_COMPONENT_ORDER_GBRG (0x00000024u)
186 
188 #define NVM_SURF_ATTR_COMPONENT_ORDER_RCCB (0x00000025u)
189 
190 #define NVM_SURF_ATTR_COMPONENT_ORDER_BCCR (0x00000026u)
191 
192 #define NVM_SURF_ATTR_COMPONENT_ORDER_CRBC (0x00000027u)
193 
194 #define NVM_SURF_ATTR_COMPONENT_ORDER_CBRC (0x00000028u)
195 
197 #define NVM_SURF_ATTR_COMPONENT_ORDER_RCCC (0x00000029u)
198 
199 #define NVM_SURF_ATTR_COMPONENT_ORDER_CCCR (0x0000002Au)
200 
201 #define NVM_SURF_ATTR_COMPONENT_ORDER_CRCC (0x0000002Bu)
202 
203 #define NVM_SURF_ATTR_COMPONENT_ORDER_CCRC (0x0000002Cu)
204 
206 #define NVM_SURF_ATTR_COMPONENT_ORDER_CCCC (0x0000002Du)
207 
211 typedef struct {
215  unsigned int value;
217 
221 #define NVM_SURF_FMT_DEFINE_ATTR(x) \
222  NvMediaSurfFormatAttr x[] = { \
223  { \
224  .type = NVM_SURF_ATTR_SURF_TYPE, \
225  .value = 0, \
226  }, \
227  { \
228  .type = NVM_SURF_ATTR_LAYOUT, \
229  .value = 0, \
230  }, \
231  { \
232  .type = NVM_SURF_ATTR_DATA_TYPE, \
233  .value = 0, \
234  }, \
235  { \
236  .type = NVM_SURF_ATTR_MEMORY, \
237  .value = 0, \
238  }, \
239  { \
240  .type = NVM_SURF_ATTR_SUB_SAMPLING_TYPE, \
241  .value = 0, \
242  }, \
243  { \
244  .type = NVM_SURF_ATTR_BITS_PER_COMPONENT, \
245  .value = 0, \
246  }, \
247  { \
248  .type = NVM_SURF_ATTR_COMPONENT_ORDER, \
249  .value = 0, \
250  }, \
251  }; \
252 
253 
259 #define NVM_SURF_FMT_SET_ATTR_YUV(attr, order, samplingtype, memory, datatype, bpc, layout) \
260 { \
261  attr[0].type = NVM_SURF_ATTR_SURF_TYPE; \
262  attr[0].value = NVM_SURF_ATTR_SURF_TYPE_YUV; \
263  \
264  attr[1].type = NVM_SURF_ATTR_LAYOUT; \
265  attr[1].value = NVM_SURF_ATTR_LAYOUT_##layout; \
266  \
267  attr[2].type = NVM_SURF_ATTR_DATA_TYPE; \
268  attr[2].value = NVM_SURF_ATTR_DATA_TYPE_##datatype; \
269  \
270  attr[3].type = NVM_SURF_ATTR_MEMORY; \
271  attr[3].value = NVM_SURF_ATTR_MEMORY_##memory; \
272  \
273  attr[4].type = NVM_SURF_ATTR_SUB_SAMPLING_TYPE; \
274  attr[4].value = NVM_SURF_ATTR_SUB_SAMPLING_TYPE_##samplingtype; \
275  \
276  attr[5].type = NVM_SURF_ATTR_BITS_PER_COMPONENT; \
277  attr[5].value = NVM_SURF_ATTR_BITS_PER_COMPONENT_##bpc; \
278  \
279  attr[6].type = NVM_SURF_ATTR_COMPONENT_ORDER; \
280  attr[6].value = NVM_SURF_ATTR_COMPONENT_ORDER_##order; \
281 }
282 
287 #define NVM_SURF_FMT_SET_ATTR_RGBA(attr, order, datatype, bpc, layout) \
288 { \
289  attr[0].type = NVM_SURF_ATTR_SURF_TYPE; \
290  attr[0].value = NVM_SURF_ATTR_SURF_TYPE_RGBA; \
291  \
292  attr[1].type = NVM_SURF_ATTR_LAYOUT; \
293  attr[1].value = NVM_SURF_ATTR_LAYOUT_##layout; \
294  \
295  attr[2].type = NVM_SURF_ATTR_DATA_TYPE; \
296  attr[2].value = NVM_SURF_ATTR_DATA_TYPE_##datatype; \
297  \
298  attr[3].type = NVM_SURF_ATTR_MEMORY; \
299  attr[3].value = NVM_SURF_ATTR_MEMORY_PACKED; \
300  \
301  attr[4].type = NVM_SURF_ATTR_SUB_SAMPLING_TYPE; \
302  attr[4].value = 0; \
303  \
304  attr[5].type = NVM_SURF_ATTR_BITS_PER_COMPONENT; \
305  attr[5].value = NVM_SURF_ATTR_BITS_PER_COMPONENT_##bpc; \
306  \
307  attr[6].type = NVM_SURF_ATTR_COMPONENT_ORDER; \
308  attr[6].value = NVM_SURF_ATTR_COMPONENT_ORDER_##order; \
309 }
310 
315 #define NVM_SURF_FMT_SET_ATTR_RAW(attr, order, datatype, bpc, layout) \
316 { \
317  attr[0].type = NVM_SURF_ATTR_SURF_TYPE; \
318  attr[0].value = NVM_SURF_ATTR_SURF_TYPE_RAW; \
319  \
320  attr[1].type = NVM_SURF_ATTR_LAYOUT; \
321  attr[1].value = NVM_SURF_ATTR_LAYOUT_##layout; \
322  \
323  attr[2].type = NVM_SURF_ATTR_DATA_TYPE; \
324  attr[2].value = NVM_SURF_ATTR_DATA_TYPE_##datatype; \
325  \
326  attr[3].type = NVM_SURF_ATTR_MEMORY; \
327  attr[3].value = NVM_SURF_ATTR_MEMORY_PACKED; \
328  \
329  attr[4].type = NVM_SURF_ATTR_SUB_SAMPLING_TYPE; \
330  attr[4].value = 0; \
331  \
332  attr[5].type = NVM_SURF_ATTR_BITS_PER_COMPONENT; \
333  attr[5].value = NVM_SURF_ATTR_BITS_PER_COMPONENT_##bpc; \
334  \
335  attr[6].type = NVM_SURF_ATTR_COMPONENT_ORDER; \
336  attr[6].value = NVM_SURF_ATTR_COMPONENT_ORDER_##order; \
337 }
338 
342 typedef enum {
367 
371 #define NVM_SURF_ATTR_CPU_ACCESS_UNCACHED (0x00000001u)
372 
373 #define NVM_SURF_ATTR_CPU_ACCESS_CACHED (0x00000002u)
374 
375 #define NVM_SURF_ATTR_CPU_ACCESS_UNMAPPED (0x00000003u)
376 
380 #define NVM_SURF_ATTR_ALLOC_ISOCHRONOUS (0x00000001u)
381 
382 #define NVM_SURF_ATTR_ALLOC_SECURED (0x00000002u)
383 
387 #define NVM_SURF_ATTR_SCAN_PROGRESSIVE (0x00000001u)
388 
389 #define NVM_SURF_ATTR_SCAN_INTERLACED (0x00000002u)
390 
396 #define NVM_SURF_ATTR_COLOR_STD_SRGB (0x00000001u)
397 
400 #define NVM_SURF_ATTR_COLOR_STD_REC601_SR (0x00000002u)
401 
404 #define NVM_SURF_ATTR_COLOR_STD_REC601_ER (0x00000003u)
405 
408 #define NVM_SURF_ATTR_COLOR_STD_REC709_SR (0x00000004u)
409 
412 #define NVM_SURF_ATTR_COLOR_STD_REC709_ER (0x00000005u)
413 
418 #define NVM_SURF_ATTR_COLOR_STD_REC2020_RGB (0x00000006u)
419 
424 #define NVM_SURF_ATTR_COLOR_STD_REC2020_SR (0x00000007u)
425 
430 #define NVM_SURF_ATTR_COLOR_STD_REC2020_ER (0x00000008u)
431 
436 #define NVM_SURF_ATTR_COLOR_STD_YcCbcCrc_SR (0x00000009u)
437 
442 #define NVM_SURF_ATTR_COLOR_STD_YcCbcCrc_ER (0x0000000Au)
443 
450 #define NVM_SURF_ATTR_COLOR_STD_SENSOR_RGBA (0x0000000Bu)
451 
455 #define NVM_SURF_ATTR_COLOR_STD_REC2020PQ_ER (0x0000000Cu)
456 
460 typedef struct {
464  unsigned int value;
466 
470 #define NvMediaSurfaceType uint32_t
471 
472 
482 #define NvMediaSurfaceType_Video_420 (1000u)
483 #define NvMediaSurfaceType_Video_420_10bit (1001u)
484 #define NvMediaSurfaceType_Video_420_12bit (1002u)
485 
488 #define NvMediaSurfaceType_Video_422 (1003u)
489 #define NvMediaSurfaceType_Video_422_10bit (1004u)
490 #define NvMediaSurfaceType_Video_422_12bit (1005u)
491 
494 #define NvMediaSurfaceType_Video_444 (1006u)
495 #define NvMediaSurfaceType_Video_444_10bit (1007u)
496 #define NvMediaSurfaceType_Video_444_12bit (1008u)
497 
498 #define NvMediaSurfaceType_VideoCapture_422 (1009u)
499 
500 #define NvMediaSurfaceType_VideoCapture_YUYV_422 (1010u)
501 
502 #define NvMediaSurfaceType_R8G8B8A8 (1011u)
503 
506 #define NvMediaSurfaceType_R8G8B8A8_BottomOrigin (1012u)
507 
508 #define NvMediaSurfaceType_Image_Monochrome (1013u)
509 
510 #define NvMediaSurfaceType_Image_YUV_420 (1014u)
511 
512 #define NvMediaSurfaceType_Image_YUV_422 (1015u)
513 
514 #define NvMediaSurfaceType_Image_YUV_444 (1016u)
515 
516 #define NvMediaSurfaceType_Image_YUYV_422 (1017u)
517 
518 #define NvMediaSurfaceType_Image_RGBA (1018u)
519 
520 #define NvMediaSurfaceType_Image_RAW (1019u)
521 
522 #define NvMediaSurfaceType_Image_V16Y16U16X16 (1020u)
523 
524 #define NvMediaSurfaceType_Image_Y16 (1021u)
525 
526 #define NvMediaSurfaceType_Image_X2U10Y10V10 (1022u)
527 
528 #define NvMediaSurfaceType_Image_Y10U8V8_420 (1023u)
529 
530 #define NvMediaSurfaceType_Image_Y10 (1024u)
531 
532 #define NvMediaSurfaceType_A8 (1025u)
533 
534 #define NvMediaSurfaceType_Unsupported (99999u)
535 
537 #define NvMediaSurfaceType_YV12 NvMediaSurfaceType_Video_420
538 
539 #define NvMediaSurfaceType_YV16 NvMediaSurfaceType_Video_422
540 
541 #define NvMediaSurfaceType_YV24 NvMediaSurfaceType_Video_444
542 
543 #define NvMediaSurfaceType_YV16x2 NvMediaSurfaceType_VideoCapture_422
544 
553  NvMediaSurfFormatAttr *attrs,
554  unsigned int numAttrs
555 );
556 
573  NvMediaSurfaceType type,
574  NvMediaSurfFormatAttr *attrs,
575  unsigned int numAttrs
576 );
577 
589  NvMediaVersion *version
590 );
591 
592 /*
593  * \defgroup history_nvmedia_surface History
594  * Provides change history for the NvMedia Surface API.
595  *
596  * \section history_nvmedia_surface Version History
597  *
598  * <b> Version 1.0 </b> March 1, 2017
599  * - Initial release
600  *
601  *
602  * <b> Version 1.1 </b> April 24, 2017
603  * - Added NVM_SURF_ATTR_COMPONENT_ORDER_XYUV and
604  * NVM_SURF_ATTR_COMPONENT_ORDER_RG component order flags
605  *
606  * <b> Version 1.2 </b> May 18, 2017
607  * - Added NVM_SURF_ATTR_COLOR_STD_TYPE and
608  * NVM_SURF_ATTR_COLOR_STD flags
609  *
610  * <b> Version 1.3 </b> June 08, 2017
611  * - Removed NvMediaSurfaceType_Image_NonColor_S16_XY and
612  * NvMediaSurfaceType_Image_NonColor_S16_X surface types
613  *
614  * <b> Version 1.4 </b> June 12, 2017
615  * - Added NVM_SURF_ATTR_COMPONENT_ORDER_VUYX flag
616  *
617  * <b> Version 1.5 </b> October 09, 2017
618  * - Added NVM_SURF_ATTR_COLOR_STD_SENSOR_RGBA and
619  * NVM_SURF_ATTR_COLOR_STD_REC2020PQ_ER flags
620  *
621  * <b> Version 1.6 </b> October 31, 2017
622  * - Added NVM_SURF_ATTR_DATA_TYPE_FLOATISP type
623  *
624  * <b> Version 1.7 </b> November 07, 2017
625  * - Added NVM_SURF_ATTR_BITS_PER_COMPONENT_20
626  *
627  * <b> Version 1.8 </b> June 04, 2018
628  * - Added NVM_SURF_ATTR_COMPONENT_ORDER_CCCC component order
629  *
630  * <b> Version 1.9 </b> July 10, 2018
631  * - Added NvMediaSurfaceGetVersion API
632  *
633  * <b> Version 1.10 </b> December 11, 2018
634  * - Fixed MISRA-C rule 10.4, 20.7 and 21.1 violations
635  * resulting from this header.
636  *
637  * <b> Version 1.11 </b> December 03, 2019
638  * - Updated the comments to deprecate old NvMediaSurfaceType_ macros
639  */
642 #ifdef __cplusplus
643 }; /* extern "C" */
644 #endif
645 
646 #endif /* NVMEDIA_SURFACE_H */
#define NvMediaSurfaceType
Defines the set of NvMedia surface types.
NvMediaStatus NvMediaSurfaceGetVersion(NvMediaVersion *version)
Returns the version information for the NvMediaSurface component.
! Surface type flags.
! Maximum number of surface format attributes.
! Surface scan type (default: Progressive)
NvMediaSurfFormatAttrType type
Surface Format Attribute Type.
! Surface width
Holds NvMedia Version information.
Definition: nvmedia_core.h:252
NVIDIA Media Interface: Core
! Peer VM ID in case of shared buffers
NvMediaStatus
The set of all possible error codes.
Definition: nvmedia_core.h:199
! Embedded lines bottom
unsigned int value
Surface Format Attribute Value.
! Maximum number of surface allocation attributes
! Surface layout type flags.
! Surface height (excluding embedded data lines)
unsigned int value
Surface Allocation Attribute Value.
! Allocation type, isochronous or secured (default: none)
Holds NvMedia Surface allocation attributes.
! CPU access to surface flags (default: uncached)
NvMediaSurfAllocAttrType type
Surface Allocation Attribute Type.
! Color Standard type (default: YCbCr Rec.601 (Extended Range) for YUV surface types, sRGB for RGB surface types)
! Bits per component flags.
NvMediaSurfaceType NvMediaSurfaceFormatGetType(NvMediaSurfFormatAttr *attrs, unsigned int numAttrs)
Gets the NvMedia surface format type for the input surface format attributes.
Holds NvMedia Surface format attributes.
! Surface sub sampling type flags.
NvMediaSurfAllocAttrType
Defines NvMedia Surface Allocation attribute types.
! Embedded lines top
! Pixel order flags.
! Surface memory type flags.
NvMediaSurfFormatAttrType
Defines NvMedia Surface format attribute types.
! Surface data type flags.
NvMediaStatus NvMediaSurfaceFormatGetAttrs(NvMediaSurfaceType type, NvMediaSurfFormatAttr *attrs, unsigned int numAttrs)
Gets NvMedia surface format attributes for the input surface type.