16 #ifndef _NVMEDIA_SURFACE_H
17 #define _NVMEDIA_SURFACE_H
46 #define NVMEDIA_SURFACE_VERSION_MAJOR 1
48 #define NVMEDIA_SURFACE_VERSION_MINOR 8
74 #define NVM_SURF_ATTR_SURF_TYPE_YUV 0x00000001
76 #define NVM_SURF_ATTR_SURF_TYPE_RGBA 0x00000002
78 #define NVM_SURF_ATTR_SURF_TYPE_RAW 0x00000003
82 #define NVM_SURF_ATTR_LAYOUT_BL 0x00000001
84 #define NVM_SURF_ATTR_LAYOUT_PL 0x00000002
88 #define NVM_SURF_ATTR_DATA_TYPE_UINT 0x00000001
90 #define NVM_SURF_ATTR_DATA_TYPE_INT 0x00000002
92 #define NVM_SURF_ATTR_DATA_TYPE_FLOAT 0x00000003
94 #define NVM_SURF_ATTR_DATA_TYPE_FLOATISP 0x00000004
98 #define NVM_SURF_ATTR_MEMORY_PLANAR 0x00000001
100 #define NVM_SURF_ATTR_MEMORY_SEMI_PLANAR 0x00000002
102 #define NVM_SURF_ATTR_MEMORY_PACKED 0x00000003
108 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_420 0x00000001
110 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_422 0x00000002
112 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_444 0x00000003
114 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_422R 0x00000004
116 #define NVM_SURF_ATTR_SUB_SAMPLING_TYPE_NONE 0x00000000
122 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_8 0x00000001
124 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_10 0x00000002
126 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_12 0x00000003
128 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_14 0x00000004
130 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_16 0x00000005
132 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_32 0x00000006
135 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_LAYOUT_16_8_8 0x00000007
137 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_LAYOUT_10_8_8 0x00000008
139 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_LAYOUT_2_10_10_10 0x00000009
141 #define NVM_SURF_ATTR_BITS_PER_COMPONENT_20 0x0000000A
145 #define NVM_SURF_ATTR_COMPONENT_ORDER_LUMA 0x00000001
147 #define NVM_SURF_ATTR_COMPONENT_ORDER_YUV 0x00000002
149 #define NVM_SURF_ATTR_COMPONENT_ORDER_YVU 0x00000003
151 #define NVM_SURF_ATTR_COMPONENT_ORDER_YUYV 0x00000004
153 #define NVM_SURF_ATTR_COMPONENT_ORDER_YVYU 0x00000005
155 #define NVM_SURF_ATTR_COMPONENT_ORDER_VYUY 0x00000006
157 #define NVM_SURF_ATTR_COMPONENT_ORDER_UYVY 0x00000007
159 #define NVM_SURF_ATTR_COMPONENT_ORDER_XUYV 0x00000008
161 #define NVM_SURF_ATTR_COMPONENT_ORDER_XYUV 0x00000009
163 #define NVM_SURF_ATTR_COMPONENT_ORDER_VUYX 0x0000000A
167 #define NVM_SURF_ATTR_COMPONENT_ORDER_ALPHA 0x00000011
169 #define NVM_SURF_ATTR_COMPONENT_ORDER_RGBA 0x00000012
171 #define NVM_SURF_ATTR_COMPONENT_ORDER_ARGB 0x00000013
173 #define NVM_SURF_ATTR_COMPONENT_ORDER_BGRA 0x00000014
175 #define NVM_SURF_ATTR_COMPONENT_ORDER_RG 0x00000015
179 #define NVM_SURF_ATTR_COMPONENT_ORDER_RGGB 0x00000021
181 #define NVM_SURF_ATTR_COMPONENT_ORDER_BGGR 0x00000022
183 #define NVM_SURF_ATTR_COMPONENT_ORDER_GRBG 0x00000023
185 #define NVM_SURF_ATTR_COMPONENT_ORDER_GBRG 0x00000024
188 #define NVM_SURF_ATTR_COMPONENT_ORDER_RCCB 0x00000025
190 #define NVM_SURF_ATTR_COMPONENT_ORDER_BCCR 0x00000026
192 #define NVM_SURF_ATTR_COMPONENT_ORDER_CRBC 0x00000027
194 #define NVM_SURF_ATTR_COMPONENT_ORDER_CBRC 0x00000028
197 #define NVM_SURF_ATTR_COMPONENT_ORDER_RCCC 0x00000029
199 #define NVM_SURF_ATTR_COMPONENT_ORDER_CCCR 0x0000002A
201 #define NVM_SURF_ATTR_COMPONENT_ORDER_CRCC 0x0000002B
203 #define NVM_SURF_ATTR_COMPONENT_ORDER_CCRC 0x0000002C
206 #define NVM_SURF_ATTR_COMPONENT_ORDER_CCCC 0x0000002D
221 #define NVM_SURF_FMT_DEFINE_ATTR(x) \
222 NvMediaSurfFormatAttr x[] = { \
224 .type = NVM_SURF_ATTR_SURF_TYPE, \
228 .type = NVM_SURF_ATTR_LAYOUT, \
232 .type = NVM_SURF_ATTR_DATA_TYPE, \
236 .type = NVM_SURF_ATTR_MEMORY, \
240 .type = NVM_SURF_ATTR_SUB_SAMPLING_TYPE, \
244 .type = NVM_SURF_ATTR_BITS_PER_COMPONENT, \
248 .type = NVM_SURF_ATTR_COMPONENT_ORDER, \
259 #define NVM_SURF_FMT_SET_ATTR_YUV(attr, order, samplingtype, memory, datatype, bpc, layout) \
261 attr[0].type = NVM_SURF_ATTR_SURF_TYPE; \
262 attr[0].value = NVM_SURF_ATTR_SURF_TYPE_YUV; \
264 attr[1].type = NVM_SURF_ATTR_LAYOUT; \
265 attr[1].value = NVM_SURF_ATTR_LAYOUT_##layout; \
267 attr[2].type = NVM_SURF_ATTR_DATA_TYPE; \
268 attr[2].value = NVM_SURF_ATTR_DATA_TYPE_##datatype; \
270 attr[3].type = NVM_SURF_ATTR_MEMORY; \
271 attr[3].value = NVM_SURF_ATTR_MEMORY_##memory; \
273 attr[4].type = NVM_SURF_ATTR_SUB_SAMPLING_TYPE; \
274 attr[4].value = NVM_SURF_ATTR_SUB_SAMPLING_TYPE_##samplingtype; \
276 attr[5].type = NVM_SURF_ATTR_BITS_PER_COMPONENT; \
277 attr[5].value = NVM_SURF_ATTR_BITS_PER_COMPONENT_##bpc; \
279 attr[6].type = NVM_SURF_ATTR_COMPONENT_ORDER; \
280 attr[6].value = NVM_SURF_ATTR_COMPONENT_ORDER_##order; \
287 #define NVM_SURF_FMT_SET_ATTR_RGBA(attr, order, datatype, bpc, layout) \
289 attr[0].type = NVM_SURF_ATTR_SURF_TYPE; \
290 attr[0].value = NVM_SURF_ATTR_SURF_TYPE_RGBA; \
292 attr[1].type = NVM_SURF_ATTR_LAYOUT; \
293 attr[1].value = NVM_SURF_ATTR_LAYOUT_##layout; \
295 attr[2].type = NVM_SURF_ATTR_DATA_TYPE; \
296 attr[2].value = NVM_SURF_ATTR_DATA_TYPE_##datatype; \
298 attr[3].type = NVM_SURF_ATTR_MEMORY; \
299 attr[3].value = NVM_SURF_ATTR_MEMORY_PACKED; \
301 attr[4].type = NVM_SURF_ATTR_SUB_SAMPLING_TYPE; \
304 attr[5].type = NVM_SURF_ATTR_BITS_PER_COMPONENT; \
305 attr[5].value = NVM_SURF_ATTR_BITS_PER_COMPONENT_##bpc; \
307 attr[6].type = NVM_SURF_ATTR_COMPONENT_ORDER; \
308 attr[6].value = NVM_SURF_ATTR_COMPONENT_ORDER_##order; \
315 #define NVM_SURF_FMT_SET_ATTR_RAW(attr, order, datatype, bpc, layout) \
317 attr[0].type = NVM_SURF_ATTR_SURF_TYPE; \
318 attr[0].value = NVM_SURF_ATTR_SURF_TYPE_RAW; \
320 attr[1].type = NVM_SURF_ATTR_LAYOUT; \
321 attr[1].value = NVM_SURF_ATTR_LAYOUT_##layout; \
323 attr[2].type = NVM_SURF_ATTR_DATA_TYPE; \
324 attr[2].value = NVM_SURF_ATTR_DATA_TYPE_##datatype; \
326 attr[3].type = NVM_SURF_ATTR_MEMORY; \
327 attr[3].value = NVM_SURF_ATTR_MEMORY_PACKED; \
329 attr[4].type = NVM_SURF_ATTR_SUB_SAMPLING_TYPE; \
332 attr[5].type = NVM_SURF_ATTR_BITS_PER_COMPONENT; \
333 attr[5].value = NVM_SURF_ATTR_BITS_PER_COMPONENT_##bpc; \
335 attr[6].type = NVM_SURF_ATTR_COMPONENT_ORDER; \
336 attr[6].value = NVM_SURF_ATTR_COMPONENT_ORDER_##order; \
371 #define NVM_SURF_ATTR_CPU_ACCESS_UNCACHED 0x00000001
373 #define NVM_SURF_ATTR_CPU_ACCESS_CACHED 0x00000002
375 #define NVM_SURF_ATTR_CPU_ACCESS_UNMAPPED 0x00000003
380 #define NVM_SURF_ATTR_ALLOC_ISOCHRONOUS 0x00000001
382 #define NVM_SURF_ATTR_ALLOC_SECURED 0x00000002
387 #define NVM_SURF_ATTR_SCAN_PROGRESSIVE 0x00000001
389 #define NVM_SURF_ATTR_SCAN_INTERLACED 0x00000002
396 #define NVM_SURF_ATTR_COLOR_STD_SRGB 0x00000001
400 #define NVM_SURF_ATTR_COLOR_STD_REC601_SR 0x00000002
404 #define NVM_SURF_ATTR_COLOR_STD_REC601_ER 0x00000003
408 #define NVM_SURF_ATTR_COLOR_STD_REC709_SR 0x00000004
412 #define NVM_SURF_ATTR_COLOR_STD_REC709_ER 0x00000005
418 #define NVM_SURF_ATTR_COLOR_STD_REC2020_RGB 0x00000006
424 #define NVM_SURF_ATTR_COLOR_STD_REC2020_SR 0x00000007
430 #define NVM_SURF_ATTR_COLOR_STD_REC2020_ER 0x00000008
436 #define NVM_SURF_ATTR_COLOR_STD_YcCbcCrc_SR 0x00000009
442 #define NVM_SURF_ATTR_COLOR_STD_YcCbcCrc_ER 0x0000000A
450 #define NVM_SURF_ATTR_COLOR_STD_SENSOR_RGBA 0x0000000B
455 #define NVM_SURF_ATTR_COLOR_STD_REC2020PQ_ER 0x0000000C
470 #define NvMediaSurfaceType unsigned int
475 #define NvMediaSurfaceType_Video_420 1000
476 #define NvMediaSurfaceType_Video_420_10bit 1001
477 #define NvMediaSurfaceType_Video_420_12bit 1002
481 #define NvMediaSurfaceType_Video_422 1003
482 #define NvMediaSurfaceType_Video_422_10bit 1004
483 #define NvMediaSurfaceType_Video_422_12bit 1005
487 #define NvMediaSurfaceType_Video_444 1006
488 #define NvMediaSurfaceType_Video_444_10bit 1007
489 #define NvMediaSurfaceType_Video_444_12bit 1008
491 #define NvMediaSurfaceType_VideoCapture_422 1009
493 #define NvMediaSurfaceType_VideoCapture_YUYV_422 1010
495 #define NvMediaSurfaceType_R8G8B8A8 1011
499 #define NvMediaSurfaceType_R8G8B8A8_BottomOrigin 1012
501 #define NvMediaSurfaceType_Image_Monochrome 1013
503 #define NvMediaSurfaceType_Image_YUV_420 1014
505 #define NvMediaSurfaceType_Image_YUV_422 1015
507 #define NvMediaSurfaceType_Image_YUV_444 1016
509 #define NvMediaSurfaceType_Image_YUYV_422 1017
511 #define NvMediaSurfaceType_Image_RGBA 1018
513 #define NvMediaSurfaceType_Image_RAW 1019
515 #define NvMediaSurfaceType_Image_V16Y16U16X16 1020
517 #define NvMediaSurfaceType_Image_Y16 1021
519 #define NvMediaSurfaceType_Image_X2U10Y10V10 1022
521 #define NvMediaSurfaceType_Image_Y10U8V8_420 1023
523 #define NvMediaSurfaceType_Image_Y10 1024
525 #define NvMediaSurfaceType_A8 1025
527 #define NvMediaSurfaceType_Unsupported 99999
530 #define NvMediaSurfaceType_YV12 NvMediaSurfaceType_Video_420
532 #define NvMediaSurfaceType_YV16 NvMediaSurfaceType_Video_422
534 #define NvMediaSurfaceType_YV24 NvMediaSurfaceType_Video_444
536 #define NvMediaSurfaceType_YV16x2 NvMediaSurfaceType_VideoCapture_422
547 unsigned int numAttrs
568 unsigned int numAttrs
#define NvMediaSurfaceType
Defines the set of NvMedia surface types.
! Maximum number of surface format attributes.
! Surface scan type (default: Progressive)
! Peer VM ID in case of shared buffers
NvMediaStatus
The set of all possible error codes.
! Maximum number of surface allocation attributes
! Surface layout type flags.
! Surface height (excluding embedded data lines)
! Allocation type, isochronous or secured (default: none)
! CPU access to surface flags (default: uncached)
! 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.
! Surface sub sampling type flags.
NvMediaSurfAllocAttrType
Defines NvMedia Surface Allocation attribute types.
! 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.