NVIDIA DRIVE OS Linux SDK API Reference

5.2.3 Release
For Test and Development only
nvmedia_image.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2020, 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_IMAGE_H
17 #define NVMEDIA_IMAGE_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include "nvmedia_core.h"
24 #include "nvmedia_surface.h"
25 
38 #define NVMEDIA_IMAGE_VERSION_MAJOR (1u)
39 
40 #define NVMEDIA_IMAGE_VERSION_MINOR (25u)
41 
60 #define NVMEDIA_MAX_IMAGE_GROUP_SIZE (3u)
61 
66 #define NVMEDIA_IMAGE_TIMEOUT_INFINITE (0xFFFFFFFFu)
67 
77  uint32_t width;
80  uint32_t height;
91  uint32_t colorStd;
94  void *tag;
97 #if (NV_IS_SAFETY == 0)
98 
99  uint32_t imageCount;
101  uint32_t attributes;
104 #endif
105 
107  struct NvMediaImagePriv_ *imgPriv;
108 };
109 
111 
115 typedef struct {
119  uint32_t numImages;
122  void *tag;
127 
137  NvMediaVersion *version
138 );
139 
140 #if (NV_IS_SAFETY == 0)
141 
152 NvMediaImage *
154  NvMediaDevice *device,
156  const NvMediaSurfAllocAttr *attrs,
157  uint32_t numAttrs,
158  uint32_t flags
159 );
160 #endif
161 
167 void
169  const NvMediaImage *image
170 );
171 
236  const NvMediaImage *image,
237  uint32_t imageIndex,
238  uint8_t *embeddedBufTop,
239  uint32_t *embeddedBufTopSize,
240  uint8_t *embeddedBufBottom,
241  uint32_t *embeddedBufBottomSize
242 );
243 
264  const NvMediaImage *image,
265  uint32_t millisecondWait,
266  NvMediaTaskStatus *taskStatus
267 );
268 
286  NvMediaImage *image,
287  void *tag
288 );
289 
306  const NvMediaImage *image,
307  void **tag
308 );
309 
310 #if (NV_IS_SAFETY == 0)
311 
322  const NvMediaImage *image,
323  NvMediaTime *timeStamp
324 );
325 
340  const NvMediaImage *image,
341  NvMediaGlobalTime *globalTimeStamp
342 );
343 
355  const NvMediaImage *image,
356  NvMediaTimeBase *timeBase
357 );
358 
371 typedef enum {
379 
384 typedef struct {
386  uint32_t pitch;
388  void *mapping;
390 
397 typedef struct {
401  uint32_t width;
403  uint32_t height;
405  uint32_t surfaces;
410  void *metaData;
412 
436  const NvMediaImage *image,
437  NvMediaImageLockAccess lockAccessType,
438  NvMediaImageSurfaceMap *surfaceMap
439 );
440 
447 void
449  const NvMediaImage *image
450 );
451 
527  NvMediaImage *image,
528  const NvMediaRect *dstRect,
529  void **srcPntrs,
530  const uint32_t *srcPitches
531 );
532 
595  const NvMediaImage *image,
596  const NvMediaRect *srcRect,
597  void **dstPntrs,
598  const uint32_t *dstPitches
599 );
600 #endif
601 
604 /*
605  * \defgroup history_nvmedia_image History
606  * Provides change history for the NvMedia Image API.
607  *
608  * \section history_nvmedia_image Version History
609  *
610  * <b> Version 1.1 </b> March 3, 2016
611  * - Initial release
612  *
613  * <b> Version 1.2 </b> May 11, 2016
614  * - Added \ref NvMediaImageCheckVersion API
615  *
616  * <b> Version 1.3 </b> Jan 17, 2017
617  * - Added atrribute NVMEDIA_IMAGE_ATTRIBUTE_CAPTURE in \ref NvMediaImageAttributes
618  *
619  * <b> Version 1.4 </b> Feb 9, 2017
620  * - Added new APIs
621  * NvMediaImageCreateNew()
622  *
623  * <b> Version 1.5 </b> March 16, 2017
624  * - Added \ref NVMEDIA_BITS_PER_PIXEL_16 in \ref NvMediaBitsPerPixel
625  *
626  * <b> Version 1.6 </b> May 9, 2017
627  * - Deprecated the following APIs
628  * - NvMediaImageAcquire
629  * - NvMediaImageRelease
630  * - NvMediaImageWaitForIdle
631  * - NvMediaImageWaitForCompletion
632  * - NvMediaImageCheckVersion
633  * - NvMediaImageGetVersion() is added to get the version of NvMedia Image library
634  * - All NvMedia data types are moved to standard data types
635  *
636  * <b> Version 1.7 </b> May 14, 2017
637  * - Added API to get status of operation on an image. \ref NvMediaImageGetStatus
638  *
639  * <b> Version 1.8 </b> May 15, 2017
640  * - Added deprecated warning message for \ref NvMediaImageCreate,
641  * \ref NvMediaImageSiblingCreate, \ref NvMediaImageSiblingDestroy,
642  * \ref NvMediaVideoCreateImageSibling, \ref NvMediaImageCreateVideoSibling
643  *
644  * <b> Version 1.9 </b> May 18, 2017
645  * - Added colorStd member in \ref NvMediaImage
646  *
647  * <b> Version 1.10 </b> June 12, 2017
648  * - Added \ref NvMediaImageGroup to hold a list of NvMediaImages.
649  *
650  * <b> Version 1.11 </b> September 12, 2017
651  * - Deprecated \ref NvMediaImageClass, \ref NvMediaImageAttributes, \ref NvMediaImageAdvancedConfig
652  * - Deprecated \ref NvMediaImageCreate, \ref NvMediaImageSiblingCreate,
653  * \ref NvMediaVideoCreateImageSibling, \ref NvMediaImageSiblingDestroy,
654  * \ref NvMediaImageCreateVideoSibling, \ref NvMediaVideoSurfaceSiblingDestroy
655  *
656  * <b> Version 1.12 </b> Dec 06, 2018
657  * - Fixed MISRA-C rule 10.4, 20.7 and 21.1 violations
658  * resulting from this header.
659  *
660  * <b> Version 1.13 </b> January 16, 2019
661  * Updated desciption for \ref NvMediaImageGetBits and \ref NvMediaImagePutBits
662  *
663  * <b> Version 1.14 </b> March 13, 2019
664  * - Data type of lockAcessType in NvMediaImageLock Api
665  is changed from unit32_t to NvMediaImageLockAccess.
666  *
667  * <b> Version 1.15 </b> March 16, 2019
668  * - Add required header include nvmedia_surface.h
669  *
670  * <b> Version 1.16 </b> March 20, 2019
671  * - Added \ref NvMediaImageSetTag and \ref NvMediaImageGetTag APIs
672  * - Tag member of NvMedia Image will be deprecated in later release.
673  *
674  * <b> Version 1.17 </b> March 22, 2019
675  * - Added \ref NVMEDIA_RAW_PIXEL_ORDER_RCCB, \ref NVMEDIA_RAW_PIXEL_ORDER_BCCR,
676  * \ref NVMEDIA_RAW_PIXEL_ORDER_CRBC, \ref NVMEDIA_RAW_PIXEL_ORDER_CBRC, and
677  * \ref NVMEDIA_RAW_PIXEL_ORDER_COUNT
678  * in \ref NvMediaRawPixelOrder
679  *
680  * <b> Version 1.18 </b> March 25, 2019
681  * - Added opaque pointer for image structure
682  * - Fixed MISRA-C rule 8.13 violations resulting from this header.
683  *
684  *<b> Version 1.19 </b> March 28, 2019
685  * - Unnecessary header include nvmedia_video.h has been removed
686  *
687  * <b> Version 1.20 </b> March 29, 2019
688  * - Added captureTimeStamp to \ref NvMediaImageGroup to hold timestamps
689  *
690  *<b> Version 1.21 </b> March 28, 2019
691  * - Move NvMediaBitsPerPixel and NVMEDIA_MAX_AGGREGATE_IMAGES to nvmedia_icp.h
692  * - Move NvMediaRawPixelOrder to nvmedia_ipp.h
693  *
694  *<b> Version 1.22 </b> Dec 24, 2019
695  * - Bypassed non-safety functions and non-safety NvMediaImage struct members
696  * using NV_IS_SAFETY macro to resolve MISRA-C rule 8.6 violations
697  * - Fixed MISRA 2.4 for unused NvMediaImageRec tag.
698  * - Changed arg type of NvMediaImageGetEmbeddedData from void* to unit8_t*.
699  *
700  *<b> Version 1.23 </b> Jan 23, 2020
701  * Modify comments: Add warning for lock/unlock APIs and format support info in
702  * GetEmbeddedData
703  *
704  *<b> Version 1.24 </b> Feb 7, 2020
705  * Removed non-safety debug APIs on safety build
706  *
707  * <b> Version 1.25 </b> Sept 23, 2020
708  * - Added API to time base from NvMediaImage. \ref NvMediaImageGetTimeBase
709  *
710  */
711 
712 #ifdef __cplusplus
713 }; /* extern "C" */
714 #endif
715 
716 #endif /* NVMEDIA_IMAGE_H */
NvMediaTime
struct timespec NvMediaTime
Holds the media time in timespec format as defined by the POSIX specification.
Definition: nvmedia_core.h:85
NvMediaImageRec::height
uint32_t height
Holds image height.
Definition: nvmedia_image.h:80
nvmedia_surface.h
NVIDIA Media Interface: Surface Handling
NVMEDIA_IMAGE_ACCESS_READ
@ NVMEDIA_IMAGE_ACCESS_READ
Specifies read access.
Definition: nvmedia_image.h:373
NvMediaImageRec::colorStd
uint32_t colorStd
Holds an image color standard type.
Definition: nvmedia_image.h:91
NvMediaImageGetTimeBase
NvMediaStatus NvMediaImageGetTimeBase(const NvMediaImage *image, NvMediaTimeBase *timeBase)
Returns time base of the given NvMediaImage.
NvMediaImageRec::captureGlobalTimeStamp
NvMediaGlobalTime captureGlobalTimeStamp
Holds an image capture global timestamp in microseconds.
Definition: nvmedia_image.h:96
NvMediaGlobalTime
uint64_t NvMediaGlobalTime
Media global time, measured in microseconds.
Definition: nvmedia_core.h:90
NvMediaImageGetBits
NvMediaStatus NvMediaImageGetBits(const NvMediaImage *image, const NvMediaRect *srcRect, void **dstPntrs, const uint32_t *dstPitches)
Reads an NvMedia image and writes the content into a client memory buffer.
NvMediaImageRec::imageCount
uint32_t imageCount
Holds the number of images stored in this image container.
Definition: nvmedia_image.h:99
NvMediaImageRec::captureTimeStamp
NvMediaTime captureTimeStamp
Holds an image capture timestamp.
Definition: nvmedia_image.h:103
NvMediaImageGetTag
NvMediaStatus NvMediaImageGetTag(const NvMediaImage *image, void **tag)
Gets the tag from an NvMediaImage.
NvMediaImageGetGlobalTimeStamp
NvMediaStatus NvMediaImageGetGlobalTimeStamp(const NvMediaImage *image, NvMediaGlobalTime *globalTimeStamp)
Gets the global capture timestamp of the image.
NvMediaImageDestroy
void NvMediaImageDestroy(const NvMediaImage *image)
Destroys an NvMediaImage object.
NvMediaImageUnlock
void NvMediaImageUnlock(const NvMediaImage *image)
Unlocks an image.
NvMediaImagePutBits
NvMediaStatus NvMediaImagePutBits(NvMediaImage *image, const NvMediaRect *dstRect, void **srcPntrs, const uint32_t *srcPitches)
Reads a client memory buffer and writes the content into an NvMedia image surface.
NvMediaDevice
struct NvMediaDevice NvMediaDevice
An opaque handle representing an NvMediaDevice object.
Definition: nvmedia_core.h:348
NvMediaImageSurface::pitch
uint32_t pitch
Holds pitch of the surface.
Definition: nvmedia_image.h:386
NvMediaImageLockAccess
NvMediaImageLockAccess
Specifies image lock access types.
Definition: nvmedia_image.h:371
NVMEDIA_MAX_IMAGE_GROUP_SIZE
#define NVMEDIA_MAX_IMAGE_GROUP_SIZE
Maximum number of images in an image group.
Definition: nvmedia_image.h:60
NvMediaVersion
Holds NvMedia version information.
Definition: nvmedia_core.h:237
NvMediaImageRec::embeddedDataBottomSize
uint32_t embeddedDataBottomSize
Holds the size of the bottom embedded data.
Definition: nvmedia_image.h:88
NvMediaImageSurfaceMap::type
NvMediaSurfaceType type
Holds image surface type.
Definition: nvmedia_image.h:399
NVMEDIA_IMAGE_ACCESS_READ_WRITE
@ NVMEDIA_IMAGE_ACCESS_READ_WRITE
Specifies read/write access.
Definition: nvmedia_image.h:377
NvMediaImageSurface
Holds an image surface descriptor used by NvMediaImageLock().
Definition: nvmedia_image.h:384
type
int const char int type
Definition: drm-nvdc-docs.h:1479
NvMediaImageRec
Holds a handle representing image objects.
Definition: nvmedia_image.h:71
NvMediaImageRec::tag
void * tag
Definition: nvmedia_image.h:94
NvMediaImageSurfaceMap::metaData
void * metaData
Holds a pointer to metadata associated with the surface.
Definition: nvmedia_image.h:410
NVMEDIA_IMAGE_ACCESS_WRITE
@ NVMEDIA_IMAGE_ACCESS_WRITE
Specifies write access.
Definition: nvmedia_image.h:375
NvMediaImageGetVersion
NvMediaStatus NvMediaImageGetVersion(NvMediaVersion *version)
Gets the version of the NvMedia Image library.
NvMediaImageSurfaceMap
Holds an image surface map descriptor used by NvMediaImageLock().
Definition: nvmedia_image.h:397
NvMediaImageRec::embeddedDataTopSize
uint32_t embeddedDataTopSize
Holds the size of the top embedded data.
Definition: nvmedia_image.h:84
NvMediaRect
Holds a rectangular region of a surface.
Definition: nvmedia_core.h:133
nvmedia_core.h
NVIDIA Media Interface: Core
NvMediaSurfaceType
#define NvMediaSurfaceType
Defines the set of NvMedia surface types.
Definition: nvmedia_surface.h:550
NvMediaImageRec::type
NvMediaSurfaceType type
Holds image surface type.
Definition: nvmedia_image.h:74
NvMediaImageCreateNew
NvMediaImage * NvMediaImageCreateNew(NvMediaDevice *device, NvMediaSurfaceType type, const NvMediaSurfAllocAttr *attrs, uint32_t numAttrs, uint32_t flags)
Allocates an image object.
NvMediaStatus
NvMediaStatus
Defines all possible error codes.
Definition: nvmedia_core.h:180
NvMediaImageRec::imgPriv
struct NvMediaImagePriv_ * imgPriv
Holds an opaque pointer for internal use.
Definition: nvmedia_image.h:107
NvMediaImageSurfaceMap::surfaces
uint32_t surfaces
Holds the number of surfaces in the image.
Definition: nvmedia_image.h:405
NvMediaImageSurfaceMap::width
uint32_t width
Holds image width.
Definition: nvmedia_image.h:401
NvMediaImageLock
NvMediaStatus NvMediaImageLock(const NvMediaImage *image, NvMediaImageLockAccess lockAccessType, NvMediaImageSurfaceMap *surfaceMap)
Locks an image and returns the associated mapped pointers to the image surface data.
NvMediaImageGroup::numImages
uint32_t numImages
Holds the number of NvMedia images in the group.
Definition: nvmedia_image.h:119
NvMediaImageRec::width
uint32_t width
Holds image width.
Definition: nvmedia_image.h:77
NvMediaImageGroup::tag
void * tag
Holds a tag for use by the application.
Definition: nvmedia_image.h:122
NvMediaSurfAllocAttr
Holds NvMedia Surface allocation attributes.
Definition: nvmedia_surface.h:540
NvMediaImageGetTimeStamp
NvMediaStatus NvMediaImageGetTimeStamp(const NvMediaImage *image, NvMediaTime *timeStamp)
Gets the capture timestamp of the image.
NvMediaImageSurfaceMap::height
uint32_t height
Holds image height.
Definition: nvmedia_image.h:403
NvMediaImageGroup
Holds a handle representing an image group.
Definition: nvmedia_image.h:115
NvMediaImageSetTag
NvMediaStatus NvMediaImageSetTag(NvMediaImage *image, void *tag)
Sets a tag for an NvMediaImage.
NvMediaTaskStatus
Holds status of latest operation for NvMedia managed data structure.
Definition: nvmedia_core.h:220
NvMediaImageGetStatus
NvMediaStatus NvMediaImageGetStatus(const NvMediaImage *image, uint32_t millisecondWait, NvMediaTaskStatus *taskStatus)
Gets status of the current or most recent operation for an image; optionally waits for the current op...
NvMediaImageGetEmbeddedData
NvMediaStatus NvMediaImageGetEmbeddedData(const NvMediaImage *image, uint32_t imageIndex, uint8_t *embeddedBufTop, uint32_t *embeddedBufTopSize, uint8_t *embeddedBufBottom, uint32_t *embeddedBufBottomSize)
Returns embedded data stored in a captured image.
NvMediaImageSurface::mapping
void * mapping
Holds a CPU accessible memory pointer to the surface.
Definition: nvmedia_image.h:388
NvMediaImageRec::attributes
uint32_t attributes
Holds image attributes.
Definition: nvmedia_image.h:101
NvMediaTimeBase
NvMediaTimeBase
Defines clock base for NvMediaTime.
Definition: nvmedia_core.h:94