NVIDIA DRIVE OS Linux API Reference

5.1.0.2 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-2018, 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 1
47 
48 #define NVMEDIA_SURFACE_VERSION_MINOR 9
49 
50 
53 typedef enum {
71 
74 #define NVM_SURF_ATTR_SURF_TYPE_YUV 0x00000001
75 
76 #define NVM_SURF_ATTR_SURF_TYPE_RGBA 0x00000002
77 
78 #define NVM_SURF_ATTR_SURF_TYPE_RAW 0x00000003
79 
82 #define NVM_SURF_ATTR_LAYOUT_BL 0x00000001
83 
84 #define NVM_SURF_ATTR_LAYOUT_PL 0x00000002
85 
88 #define NVM_SURF_ATTR_DATA_TYPE_UINT 0x00000001
89 
90 #define NVM_SURF_ATTR_DATA_TYPE_INT 0x00000002
91 
92 #define NVM_SURF_ATTR_DATA_TYPE_FLOAT 0x00000003
93 
94 #define NVM_SURF_ATTR_DATA_TYPE_FLOATISP 0x00000004
95 
98 #define NVM_SURF_ATTR_MEMORY_PLANAR 0x00000001
99 
100 #define NVM_SURF_ATTR_MEMORY_SEMI_PLANAR 0x00000002
101 
102 #define NVM_SURF_ATTR_MEMORY_PACKED 0x00000003
103 
108 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_420 0x00000001
109 
110 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_422 0x00000002
111 
112 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_444 0x00000003
113 
114 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_422R 0x00000004
115 
116 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_NONE 0x00000000
117 
122 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_8 0x00000001
123 
124 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_10 0x00000002
125 
126 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_12 0x00000003
127 
128 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_14 0x00000004
129 
130 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_16 0x00000005
131 
132 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_32 0x00000006
133 
135 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_LAYOUT_16_8_8 0x00000007
136 
137 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_LAYOUT_10_8_8 0x00000008
138 
139 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_LAYOUT_2_10_10_10 0x00000009
140 
141 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_20 0x0000000A
142 
145 #define NVM_SURF_ATTR_COMPONENT_ORDER_LUMA 0x00000001
146 
147 #define NVM_SURF_ATTR_COMPONENT_ORDER_YUV 0x00000002
148 
149 #define NVM_SURF_ATTR_COMPONENT_ORDER_YVU 0x00000003
150 
151 #define NVM_SURF_ATTR_COMPONENT_ORDER_YUYV 0x00000004
152 
153 #define NVM_SURF_ATTR_COMPONENT_ORDER_YVYU 0x00000005
154 
155 #define NVM_SURF_ATTR_COMPONENT_ORDER_VYUY 0x00000006
156 
157 #define NVM_SURF_ATTR_COMPONENT_ORDER_UYVY 0x00000007
158 
159 #define NVM_SURF_ATTR_COMPONENT_ORDER_XUYV 0x00000008
160 
161 #define NVM_SURF_ATTR_COMPONENT_ORDER_XYUV 0x00000009
162 
163 #define NVM_SURF_ATTR_COMPONENT_ORDER_VUYX 0x0000000A
164 
167 #define NVM_SURF_ATTR_COMPONENT_ORDER_ALPHA 0x00000011
168 
169 #define NVM_SURF_ATTR_COMPONENT_ORDER_RGBA 0x00000012
170 
171 #define NVM_SURF_ATTR_COMPONENT_ORDER_ARGB 0x00000013
172 
173 #define NVM_SURF_ATTR_COMPONENT_ORDER_BGRA 0x00000014
174 
175 #define NVM_SURF_ATTR_COMPONENT_ORDER_RG 0x00000015
176 
179 #define NVM_SURF_ATTR_COMPONENT_ORDER_RGGB 0x00000021
180 
181 #define NVM_SURF_ATTR_COMPONENT_ORDER_BGGR 0x00000022
182 
183 #define NVM_SURF_ATTR_COMPONENT_ORDER_GRBG 0x00000023
184 
185 #define NVM_SURF_ATTR_COMPONENT_ORDER_GBRG 0x00000024
186 
188 #define NVM_SURF_ATTR_COMPONENT_ORDER_RCCB 0x00000025
189 
190 #define NVM_SURF_ATTR_COMPONENT_ORDER_BCCR 0x00000026
191 
192 #define NVM_SURF_ATTR_COMPONENT_ORDER_CRBC 0x00000027
193 
194 #define NVM_SURF_ATTR_COMPONENT_ORDER_CBRC 0x00000028
195 
197 #define NVM_SURF_ATTR_COMPONENT_ORDER_RCCC 0x00000029
198 
199 #define NVM_SURF_ATTR_COMPONENT_ORDER_CCCR 0x0000002A
200 
201 #define NVM_SURF_ATTR_COMPONENT_ORDER_CRCC 0x0000002B
202 
203 #define NVM_SURF_ATTR_COMPONENT_ORDER_CCRC 0x0000002C
204 
206 #define NVM_SURF_ATTR_COMPONENT_ORDER_CCCC 0x0000002D
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 0x00000001
372 
373 #define NVM_SURF_ATTR_CPU_ACCESS_CACHED 0x00000002
374 
375 #define NVM_SURF_ATTR_CPU_ACCESS_UNMAPPED 0x00000003
376 
380 #define NVM_SURF_ATTR_ALLOC_ISOCHRONOUS 0x00000001
381 
382 #define NVM_SURF_ATTR_ALLOC_SECURED 0x00000002
383 
387 #define NVM_SURF_ATTR_SCAN_PROGRESSIVE 0x00000001
388 
389 #define NVM_SURF_ATTR_SCAN_INTERLACED 0x00000002
390 
396 #define NVM_SURF_ATTR_COLOR_STD_SRGB 0x00000001
397 
400 #define NVM_SURF_ATTR_COLOR_STD_REC601_SR 0x00000002
401 
404 #define NVM_SURF_ATTR_COLOR_STD_REC601_ER 0x00000003
405 
408 #define NVM_SURF_ATTR_COLOR_STD_REC709_SR 0x00000004
409 
412 #define NVM_SURF_ATTR_COLOR_STD_REC709_ER 0x00000005
413 
418 #define NVM_SURF_ATTR_COLOR_STD_REC2020_RGB 0x00000006
419 
424 #define NVM_SURF_ATTR_COLOR_STD_REC2020_SR 0x00000007
425 
430 #define NVM_SURF_ATTR_COLOR_STD_REC2020_ER 0x00000008
431 
436 #define NVM_SURF_ATTR_COLOR_STD_YcCbcCrc_SR 0x00000009
437 
442 #define NVM_SURF_ATTR_COLOR_STD_YcCbcCrc_ER 0x0000000A
443 
450 #define NVM_SURF_ATTR_COLOR_STD_SENSOR_RGBA 0x0000000B
451 
455 #define NVM_SURF_ATTR_COLOR_STD_REC2020PQ_ER 0x0000000C
456 
460 typedef struct {
464  unsigned int value;
466 
470 #define NvMediaSurfaceType uint32_t
471 
475 #define NvMediaSurfaceType_Video_420 1000
476 #define NvMediaSurfaceType_Video_420_10bit 1001
477 #define NvMediaSurfaceType_Video_420_12bit 1002
478 
481 #define NvMediaSurfaceType_Video_422 1003
482 #define NvMediaSurfaceType_Video_422_10bit 1004
483 #define NvMediaSurfaceType_Video_422_12bit 1005
484 
487 #define NvMediaSurfaceType_Video_444 1006
488 #define NvMediaSurfaceType_Video_444_10bit 1007
489 #define NvMediaSurfaceType_Video_444_12bit 1008
490 
491 #define NvMediaSurfaceType_VideoCapture_422 1009
492 
493 #define NvMediaSurfaceType_VideoCapture_YUYV_422 1010
494 
495 #define NvMediaSurfaceType_R8G8B8A8 1011
496 
499 #define NvMediaSurfaceType_R8G8B8A8_BottomOrigin 1012
500 
501 #define NvMediaSurfaceType_Image_Monochrome 1013
502 
503 #define NvMediaSurfaceType_Image_YUV_420 1014
504 
505 #define NvMediaSurfaceType_Image_YUV_422 1015
506 
507 #define NvMediaSurfaceType_Image_YUV_444 1016
508 
509 #define NvMediaSurfaceType_Image_YUYV_422 1017
510 
511 #define NvMediaSurfaceType_Image_RGBA 1018
512 
513 #define NvMediaSurfaceType_Image_RAW 1019
514 
515 #define NvMediaSurfaceType_Image_V16Y16U16X16 1020
516 
517 #define NvMediaSurfaceType_Image_Y16 1021
518 
519 #define NvMediaSurfaceType_Image_X2U10Y10V10 1022
520 
521 #define NvMediaSurfaceType_Image_Y10U8V8_420 1023
522 
523 #define NvMediaSurfaceType_Image_Y10 1024
524 
525 #define NvMediaSurfaceType_A8 1025
526 
527 #define NvMediaSurfaceType_Unsupported 99999
528 
530 #define NvMediaSurfaceType_YV12 NvMediaSurfaceType_Video_420
531 
532 #define NvMediaSurfaceType_YV16 NvMediaSurfaceType_Video_422
533 
534 #define NvMediaSurfaceType_YV24 NvMediaSurfaceType_Video_444
535 
536 #define NvMediaSurfaceType_YV16x2 NvMediaSurfaceType_VideoCapture_422
537 
546  NvMediaSurfFormatAttr *attrs,
547  unsigned int numAttrs
548 );
549 
566  NvMediaSurfaceType type,
567  NvMediaSurfFormatAttr *attrs,
568  unsigned int numAttrs
569 );
570 
582  NvMediaVersion *version
583 );
584 
585 /*
586  * \defgroup history_nvmedia_surface History
587  * Provides change history for the NvMedia Surface API.
588  *
589  * \section history_nvmedia_surface Version History
590  *
591  * <b> Version 1.0 </b> March 1, 2017
592  * - Initial release
593  *
594  *
595  * <b> Version 1.1 </b> April 24, 2017
596  * - Added NVM_SURF_ATTR_COMPONENT_ORDER_XYUV and
597  * NVM_SURF_ATTR_COMPONENT_ORDER_RG component order flags
598  *
599  * <b> Version 1.2 </b> May 18, 2017
600  * - Added NVM_SURF_ATTR_COLOR_STD_TYPE and
601  * NVM_SURF_ATTR_COLOR_STD flags
602  *
603  * <b> Version 1.3 </b> June 08, 2017
604  * - Removed NvMediaSurfaceType_Image_NonColor_S16_XY and
605  * NvMediaSurfaceType_Image_NonColor_S16_X surface types
606  *
607  * <b> Version 1.4 </b> June 12, 2017
608  * - Added NVM_SURF_ATTR_COMPONENT_ORDER_VUYX flag
609  *
610  * <b> Version 1.5 </b> October 09, 2017
611  * - Added NVM_SURF_ATTR_COLOR_STD_SENSOR_RGBA and
612  * NVM_SURF_ATTR_COLOR_STD_REC2020PQ_ER flags
613  *
614  * <b> Version 1.6 </b> October 31, 2017
615  * - Added NVM_SURF_ATTR_DATA_TYPE_FLOATISP type
616  *
617  * <b> Version 1.7 </b> November 07, 2017
618  * - Added NVM_SURF_ATTR_BITS_PER_COMPONENT_20
619  *
620  * <b> Version 1.8 </b> June 04, 2018
621  * - Added NVM_SURF_ATTR_COMPONENT_ORDER_CCCC component order
622  *
623  * <b> Version 1.9 </b> July 10, 2018
624  * - Added NvMediaSurfaceGetVersion API
625  *
626  */
629 #ifdef __cplusplus
630 }; /* extern "C" */
631 #endif
632 
633 #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.