NVIDIA DRIVE 5.0 Linux SDK API Reference

5.0.5.0 Release

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nvmedia_surface.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, 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 4
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 
96 #define NVM_SURF_ATTR_MEMORY_PLANAR 0x00000001
97 
98 #define NVM_SURF_ATTR_MEMORY_SEMI_PLANAR 0x00000002
99 
100 #define NVM_SURF_ATTR_MEMORY_PACKED 0x00000003
101 
106 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_420 0x00000001
107 
108 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_422 0x00000002
109 
110 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_444 0x00000003
111 
112 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_422R 0x00000004
113 
114 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_NONE 0x00000000
115 
120 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_8 0x00000001
121 
122 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_10 0x00000002
123 
124 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_12 0x00000003
125 
126 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_14 0x00000004
127 
128 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_16 0x00000005
129 
130 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_32 0x00000006
131 
133 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_LAYOUT_16_8_8 0x00000007
134 
135 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_LAYOUT_10_8_8 0x00000008
136 
137 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_LAYOUT_2_10_10_10 0x00000009
138 
141 #define NVM_SURF_ATTR_COMPONENT_ORDER_LUMA 0x00000001
142 
143 #define NVM_SURF_ATTR_COMPONENT_ORDER_YUV 0x00000002
144 
145 #define NVM_SURF_ATTR_COMPONENT_ORDER_YVU 0x00000003
146 
147 #define NVM_SURF_ATTR_COMPONENT_ORDER_YUYV 0x00000004
148 
149 #define NVM_SURF_ATTR_COMPONENT_ORDER_YVYU 0x00000005
150 
151 #define NVM_SURF_ATTR_COMPONENT_ORDER_VYUY 0x00000006
152 
153 #define NVM_SURF_ATTR_COMPONENT_ORDER_UYVY 0x00000007
154 
155 #define NVM_SURF_ATTR_COMPONENT_ORDER_XUYV 0x00000008
156 
157 #define NVM_SURF_ATTR_COMPONENT_ORDER_XYUV 0x00000009
158 
159 #define NVM_SURF_ATTR_COMPONENT_ORDER_VUYX 0x0000000A
160 
163 #define NVM_SURF_ATTR_COMPONENT_ORDER_ALPHA 0x00000011
164 
165 #define NVM_SURF_ATTR_COMPONENT_ORDER_RGBA 0x00000012
166 
167 #define NVM_SURF_ATTR_COMPONENT_ORDER_ARGB 0x00000013
168 
169 #define NVM_SURF_ATTR_COMPONENT_ORDER_BGRA 0x00000014
170 
171 #define NVM_SURF_ATTR_COMPONENT_ORDER_RG 0x00000015
172 
175 #define NVM_SURF_ATTR_COMPONENT_ORDER_RGGB 0x00000021
176 
177 #define NVM_SURF_ATTR_COMPONENT_ORDER_BGGR 0x00000022
178 
179 #define NVM_SURF_ATTR_COMPONENT_ORDER_GRBG 0x00000023
180 
181 #define NVM_SURF_ATTR_COMPONENT_ORDER_GBRG 0x00000024
182 
184 #define NVM_SURF_ATTR_COMPONENT_ORDER_RCCB 0x00000025
185 
186 #define NVM_SURF_ATTR_COMPONENT_ORDER_BCCR 0x00000026
187 
188 #define NVM_SURF_ATTR_COMPONENT_ORDER_CRBC 0x00000027
189 
190 #define NVM_SURF_ATTR_COMPONENT_ORDER_CBRC 0x00000028
191 
193 #define NVM_SURF_ATTR_COMPONENT_ORDER_RCCC 0x00000029
194 
195 #define NVM_SURF_ATTR_COMPONENT_ORDER_CCCR 0x0000002A
196 
197 #define NVM_SURF_ATTR_COMPONENT_ORDER_CRCC 0x0000002B
198 
199 #define NVM_SURF_ATTR_COMPONENT_ORDER_CCRC 0x0000002C
200 
204 typedef struct {
208  unsigned int value;
210 
214 #define NVM_SURF_FMT_DEFINE_ATTR(x) \
215  NvMediaSurfFormatAttr x[] = { \
216  { \
217  .type = NVM_SURF_ATTR_SURF_TYPE, \
218  .value = 0, \
219  }, \
220  { \
221  .type = NVM_SURF_ATTR_LAYOUT, \
222  .value = 0, \
223  }, \
224  { \
225  .type = NVM_SURF_ATTR_DATA_TYPE, \
226  .value = 0, \
227  }, \
228  { \
229  .type = NVM_SURF_ATTR_MEMORY, \
230  .value = 0, \
231  }, \
232  { \
233  .type = NVM_SURF_ATTR_SUB_SAMPLING_TYPE, \
234  .value = 0, \
235  }, \
236  { \
237  .type = NVM_SURF_ATTR_BITS_PER_COMPONENT, \
238  .value = 0, \
239  }, \
240  { \
241  .type = NVM_SURF_ATTR_COMPONENT_ORDER, \
242  .value = 0, \
243  }, \
244  }; \
245 
246 
252 #define NVM_SURF_FMT_SET_ATTR_YUV(attr, order, samplingtype, memory, datatype, bpc, layout) \
253 { \
254  attr[0].type = NVM_SURF_ATTR_SURF_TYPE; \
255  attr[0].value = NVM_SURF_ATTR_SURF_TYPE_YUV; \
256  \
257  attr[1].type = NVM_SURF_ATTR_LAYOUT; \
258  attr[1].value = NVM_SURF_ATTR_LAYOUT_##layout; \
259  \
260  attr[2].type = NVM_SURF_ATTR_DATA_TYPE; \
261  attr[2].value = NVM_SURF_ATTR_DATA_TYPE_##datatype; \
262  \
263  attr[3].type = NVM_SURF_ATTR_MEMORY; \
264  attr[3].value = NVM_SURF_ATTR_MEMORY_##memory; \
265  \
266  attr[4].type = NVM_SURF_ATTR_SUB_SAMPLING_TYPE; \
267  attr[4].value = NVM_SURF_ATTR_SUB_SAMPLING_TYPE_##samplingtype; \
268  \
269  attr[5].type = NVM_SURF_ATTR_BITS_PER_COMPONENT; \
270  attr[5].value = NVM_SURF_ATTR_BITS_PER_COMPONENT_##bpc; \
271  \
272  attr[6].type = NVM_SURF_ATTR_COMPONENT_ORDER; \
273  attr[6].value = NVM_SURF_ATTR_COMPONENT_ORDER_##order; \
274 }
275 
280 #define NVM_SURF_FMT_SET_ATTR_RGBA(attr, order, datatype, bpc, layout) \
281 { \
282  attr[0].type = NVM_SURF_ATTR_SURF_TYPE; \
283  attr[0].value = NVM_SURF_ATTR_SURF_TYPE_RGBA; \
284  \
285  attr[1].type = NVM_SURF_ATTR_LAYOUT; \
286  attr[1].value = NVM_SURF_ATTR_LAYOUT_##layout; \
287  \
288  attr[2].type = NVM_SURF_ATTR_DATA_TYPE; \
289  attr[2].value = NVM_SURF_ATTR_DATA_TYPE_##datatype; \
290  \
291  attr[3].type = NVM_SURF_ATTR_MEMORY; \
292  attr[3].value = NVM_SURF_ATTR_MEMORY_PACKED; \
293  \
294  attr[4].type = NVM_SURF_ATTR_SUB_SAMPLING_TYPE; \
295  attr[4].value = 0; \
296  \
297  attr[5].type = NVM_SURF_ATTR_BITS_PER_COMPONENT; \
298  attr[5].value = NVM_SURF_ATTR_BITS_PER_COMPONENT_##bpc; \
299  \
300  attr[6].type = NVM_SURF_ATTR_COMPONENT_ORDER; \
301  attr[6].value = NVM_SURF_ATTR_COMPONENT_ORDER_##order; \
302 }
303 
308 #define NVM_SURF_FMT_SET_ATTR_RAW(attr, order, datatype, bpc, layout) \
309 { \
310  attr[0].type = NVM_SURF_ATTR_SURF_TYPE; \
311  attr[0].value = NVM_SURF_ATTR_SURF_TYPE_RAW; \
312  \
313  attr[1].type = NVM_SURF_ATTR_LAYOUT; \
314  attr[1].value = NVM_SURF_ATTR_LAYOUT_##layout; \
315  \
316  attr[2].type = NVM_SURF_ATTR_DATA_TYPE; \
317  attr[2].value = NVM_SURF_ATTR_DATA_TYPE_##datatype; \
318  \
319  attr[3].type = NVM_SURF_ATTR_MEMORY; \
320  attr[3].value = NVM_SURF_ATTR_MEMORY_PACKED; \
321  \
322  attr[4].type = NVM_SURF_ATTR_SUB_SAMPLING_TYPE; \
323  attr[4].value = 0; \
324  \
325  attr[5].type = NVM_SURF_ATTR_BITS_PER_COMPONENT; \
326  attr[5].value = NVM_SURF_ATTR_BITS_PER_COMPONENT_##bpc; \
327  \
328  attr[6].type = NVM_SURF_ATTR_COMPONENT_ORDER; \
329  attr[6].value = NVM_SURF_ATTR_COMPONENT_ORDER_##order; \
330 }
331 
335 typedef enum {
360 
364 #define NVM_SURF_ATTR_CPU_ACCESS_UNCACHED 0x00000001
365 
366 #define NVM_SURF_ATTR_CPU_ACCESS_CACHED 0x00000002
367 
368 #define NVM_SURF_ATTR_CPU_ACCESS_UNMAPPED 0x00000003
369 
373 #define NVM_SURF_ATTR_ALLOC_ISOCHRONOUS 0x00000001
374 
375 #define NVM_SURF_ATTR_ALLOC_SECURED 0x00000002
376 
380 #define NVM_SURF_ATTR_SCAN_PROGRESSIVE 0x00000001
381 
382 #define NVM_SURF_ATTR_SCAN_INTERLACED 0x00000002
383 
389 #define NVM_SURF_ATTR_COLOR_STD_SRGB 0x00000001
390 
393 #define NVM_SURF_ATTR_COLOR_STD_REC601_SR 0x00000002
394 
397 #define NVM_SURF_ATTR_COLOR_STD_REC601_ER 0x00000003
398 
401 #define NVM_SURF_ATTR_COLOR_STD_REC709_SR 0x00000004
402 
405 #define NVM_SURF_ATTR_COLOR_STD_REC709_ER 0x00000005
406 
411 #define NVM_SURF_ATTR_COLOR_STD_REC2020_RGB 0x00000006
412 
417 #define NVM_SURF_ATTR_COLOR_STD_REC2020_SR 0x00000007
418 
423 #define NVM_SURF_ATTR_COLOR_STD_REC2020_ER 0x00000008
424 
429 #define NVM_SURF_ATTR_COLOR_STD_YcCbcCrc_SR 0x00000009
430 
435 #define NVM_SURF_ATTR_COLOR_STD_YcCbcCrc_ER 0x0000000A
436 
437 
441 typedef struct {
445  unsigned int value;
447 
451 #define NvMediaSurfaceType unsigned int
452 
456 #define NvMediaSurfaceType_Video_420 1000
457 #define NvMediaSurfaceType_Video_420_10bit 1001
458 #define NvMediaSurfaceType_Video_420_12bit 1002
459 
462 #define NvMediaSurfaceType_Video_422 1003
463 #define NvMediaSurfaceType_Video_422_10bit 1004
464 #define NvMediaSurfaceType_Video_422_12bit 1005
465 
468 #define NvMediaSurfaceType_Video_444 1006
469 #define NvMediaSurfaceType_Video_444_10bit 1007
470 #define NvMediaSurfaceType_Video_444_12bit 1008
471 
472 #define NvMediaSurfaceType_VideoCapture_422 1009
473 
474 #define NvMediaSurfaceType_VideoCapture_YUYV_422 1010
475 
476 #define NvMediaSurfaceType_R8G8B8A8 1011
477 
480 #define NvMediaSurfaceType_R8G8B8A8_BottomOrigin 1012
481 
482 #define NvMediaSurfaceType_Image_Monochrome 1013
483 
484 #define NvMediaSurfaceType_Image_YUV_420 1014
485 
486 #define NvMediaSurfaceType_Image_YUV_422 1015
487 
488 #define NvMediaSurfaceType_Image_YUV_444 1016
489 
490 #define NvMediaSurfaceType_Image_YUYV_422 1017
491 
492 #define NvMediaSurfaceType_Image_RGBA 1018
493 
494 #define NvMediaSurfaceType_Image_RAW 1019
495 
496 #define NvMediaSurfaceType_Image_V16Y16U16X16 1020
497 
498 #define NvMediaSurfaceType_Image_Y16 1021
499 
500 #define NvMediaSurfaceType_Image_X2U10Y10V10 1022
501 
502 #define NvMediaSurfaceType_Image_Y10U8V8_420 1023
503 
504 #define NvMediaSurfaceType_Image_Y10 1024
505 
506 #define NvMediaSurfaceType_A8 1025
507 
508 #define NvMediaSurfaceType_Unsupported 99999
509 
511 #define NvMediaSurfaceType_YV12 NvMediaSurfaceType_Video_420
512 
513 #define NvMediaSurfaceType_YV16 NvMediaSurfaceType_Video_422
514 
515 #define NvMediaSurfaceType_YV24 NvMediaSurfaceType_Video_444
516 
517 #define NvMediaSurfaceType_YV16x2 NvMediaSurfaceType_VideoCapture_422
518 
527  NvMediaSurfFormatAttr *attrs,
528  unsigned int numAttrs
529 );
530 
547  NvMediaSurfaceType type,
548  NvMediaSurfFormatAttr *attrs,
549  unsigned int numAttrs
550 );
551 
552 
553 /*
554  * \defgroup history_nvmedia_surface History
555  * Provides change history for the NvMedia Surface API.
556  *
557  * \section history_nvmedia_surface Version History
558  *
559  * <b> Version 1.0 </b> March 1, 2017
560  * - Initial release
561  *
562  *
563  * <b> Version 1.1 </b> April 24, 2017
564  * - Added NVM_SURF_ATTR_COMPONENT_ORDER_XYUV and
565  * NVM_SURF_ATTR_COMPONENT_ORDER_RG component order flags
566  *
567  * <b> Version 1.2 </b> May 18, 2017
568  * - Added NVM_SURF_ATTR_COLOR_STD_TYPE and
569  * NVM_SURF_ATTR_COLOR_STD flags
570  *
571  * <b> Version 1.3 </b> June 08, 2017
572  * - Removed NvMediaSurfaceType_Image_NonColor_S16_XY and
573  * NvMediaSurfaceType_Image_NonColor_S16_X surface types
574  *
575  * <b> Version 1.4 </b> June 12, 2017
576  * - Added NVM_SURF_ATTR_COMPONENT_ORDER_VUYX flag
577  *
578  */
581 #ifdef __cplusplus
582 }; /* extern "C" */
583 #endif
584 
585 #endif /* _NVMEDIA_SURFACE_H */
#define NvMediaSurfaceType
Defines the set of NvMedia surface types.
! Surface type flags.
! Maximum number of surface format attributes.
! Surface scan type (default: Progressive)
NvMediaSurfFormatAttrType type
Surface Format Attribute Type.
! Surface width
NVIDIA Media Interface: Core
! Peer VM ID in case of shared buffers
NvMediaStatus
The set of all possible error codes.
Definition: nvmedia_core.h:178
! 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.