NVIDIA DRIVE OS Linux SDK API Reference

6.0.3 Release
nvmedia_image.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2022, 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 (27u)
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;
128  uint64_t sofTimeStamp[NVMEDIA_MAX_IMAGE_GROUP_SIZE];
130 
140  NvMediaVersion *version
141 );
142 
143 #if (NV_IS_SAFETY == 0)
144 
155 NvMediaImage *
157  NvMediaDevice *device,
158  NvMediaSurfaceType type,
159  const NvMediaSurfAllocAttr *attrs,
160  uint32_t numAttrs,
161  uint32_t flags
162 );
163 #endif
164 
180 void
182  const NvMediaImage *image
183 );
184 
259  const NvMediaImage *image,
260  uint32_t imageIndex,
261  uint8_t *embeddedBufTop,
262  uint32_t *embeddedBufTopSize,
263  uint8_t *embeddedBufBottom,
264  uint32_t *embeddedBufBottomSize
265 );
266 
297  const NvMediaImage *image,
298  uint32_t millisecondWait,
299  NvMediaTaskStatus *taskStatus
300 );
301 
327  NvMediaImage *image,
328  void *tag
329 );
330 
355  const NvMediaImage *image,
356  void **tag
357 );
358 
359 #if (NV_IS_SAFETY == 0)
360 
379  const NvMediaImage *image,
380  NvMediaTime *timeStamp
381 );
382 
405  const NvMediaImage *image,
406  NvMediaGlobalTime *globalTimeStamp
407 );
408 
428  const NvMediaImage *image,
429  NvMediaTimeBase *timeBase
430 );
431 
444 typedef enum {
452 
457 typedef struct {
459  uint32_t pitch;
461  void *mapping;
463 
470 typedef struct {
474  uint32_t width;
476  uint32_t height;
478  uint32_t surfaces;
483  void *metaData;
485 
517  const NvMediaImage *image,
518  NvMediaImageLockAccess lockAccessType,
519  NvMediaImageSurfaceMap *surfaceMap
520 );
521 
536 void
538  const NvMediaImage *image
539 );
540 
624  NvMediaImage *image,
625  const NvMediaRect *dstRect,
626  void **srcPntrs,
627  const uint32_t *srcPitches
628 );
629 
700  const NvMediaImage *image,
701  const NvMediaRect *srcRect,
702  void **dstPntrs,
703  const uint32_t *dstPitches
704 );
705 #endif
706 
709 /*
710  * \defgroup history_nvmedia_image History
711  * Provides change history for the NvMedia Image API.
712  *
713  * \section history_nvmedia_image Version History
714  *
715  * <b> Version 1.1 </b> March 3, 2016
716  * - Initial release
717  *
718  * <b> Version 1.2 </b> May 11, 2016
719  * - Added \ref NvMediaImageCheckVersion API
720  *
721  * <b> Version 1.3 </b> Jan 17, 2017
722  * - Added atrribute NVMEDIA_IMAGE_ATTRIBUTE_CAPTURE in \ref NvMediaImageAttributes
723  *
724  * <b> Version 1.4 </b> Feb 9, 2017
725  * - Added new APIs
726  * NvMediaImageCreateNew()
727  *
728  * <b> Version 1.5 </b> March 16, 2017
729  * - Added \ref NVMEDIA_BITS_PER_PIXEL_16 in \ref NvMediaBitsPerPixel
730  *
731  * <b> Version 1.6 </b> May 9, 2017
732  * - Deprecated the following APIs
733  * - NvMediaImageAcquire
734  * - NvMediaImageRelease
735  * - NvMediaImageWaitForIdle
736  * - NvMediaImageWaitForCompletion
737  * - NvMediaImageCheckVersion
738  * - NvMediaImageGetVersion() is added to get the version of NvMedia Image library
739  * - All NvMedia data types are moved to standard data types
740  *
741  * <b> Version 1.7 </b> May 14, 2017
742  * - Added API to get status of operation on an image. \ref NvMediaImageGetStatus
743  *
744  * <b> Version 1.8 </b> May 15, 2017
745  * - Added deprecated warning message for \ref NvMediaImageCreate,
746  * \ref NvMediaImageSiblingCreate, \ref NvMediaImageSiblingDestroy,
747  * \ref NvMediaVideoCreateImageSibling, \ref NvMediaImageCreateVideoSibling
748  *
749  * <b> Version 1.9 </b> May 18, 2017
750  * - Added colorStd member in \ref NvMediaImage
751  *
752  * <b> Version 1.10 </b> June 12, 2017
753  * - Added \ref NvMediaImageGroup to hold a list of NvMediaImages.
754  *
755  * <b> Version 1.11 </b> September 12, 2017
756  * - Deprecated \ref NvMediaImageClass, \ref NvMediaImageAttributes, \ref NvMediaImageAdvancedConfig
757  * - Deprecated \ref NvMediaImageCreate, \ref NvMediaImageSiblingCreate,
758  * \ref NvMediaVideoCreateImageSibling, \ref NvMediaImageSiblingDestroy,
759  * \ref NvMediaImageCreateVideoSibling, \ref NvMediaVideoSurfaceSiblingDestroy
760  *
761  * <b> Version 1.12 </b> Dec 06, 2018
762  * - Fixed MISRA-C rule 10.4, 20.7 and 21.1 violations
763  * resulting from this header.
764  *
765  * <b> Version 1.13 </b> January 16, 2019
766  * Updated desciption for \ref NvMediaImageGetBits and \ref NvMediaImagePutBits
767  *
768  * <b> Version 1.14 </b> March 13, 2019
769  * - Data type of lockAcessType in NvMediaImageLock Api
770  is changed from unit32_t to NvMediaImageLockAccess.
771  *
772  * <b> Version 1.15 </b> March 16, 2019
773  * - Add required header include nvmedia_surface.h
774  *
775  * <b> Version 1.16 </b> March 20, 2019
776  * - Added \ref NvMediaImageSetTag and \ref NvMediaImageGetTag APIs
777  * - Tag member of NvMedia Image will be deprecated in later release.
778  *
779  * <b> Version 1.17 </b> March 22, 2019
780  * - Added \ref NVMEDIA_RAW_PIXEL_ORDER_RCCB, \ref NVMEDIA_RAW_PIXEL_ORDER_BCCR,
781  * \ref NVMEDIA_RAW_PIXEL_ORDER_CRBC, \ref NVMEDIA_RAW_PIXEL_ORDER_CBRC, and
782  * \ref NVMEDIA_RAW_PIXEL_ORDER_COUNT
783  * in \ref NvMediaRawPixelOrder
784  *
785  * <b> Version 1.18 </b> March 25, 2019
786  * - Added opaque pointer for image structure
787  * - Fixed MISRA-C rule 8.13 violations resulting from this header.
788  *
789  *<b> Version 1.19 </b> March 28, 2019
790  * - Unnecessary header include nvmedia_video.h has been removed
791  *
792  * <b> Version 1.20 </b> March 29, 2019
793  * - Added captureTimeStamp to \ref NvMediaImageGroup to hold timestamps
794  *
795  *<b> Version 1.21 </b> March 28, 2019
796  * - Move NvMediaBitsPerPixel and NVMEDIA_MAX_AGGREGATE_IMAGES to nvmedia_icp.h
797  * - Move NvMediaRawPixelOrder to nvmedia_ipp.h
798  *
799  *<b> Version 1.22 </b> Dec 24, 2019
800  * - Bypassed non-safety functions and non-safety NvMediaImage struct members
801  * using NV_IS_SAFETY macro to resolve MISRA-C rule 8.6 violations
802  * - Fixed MISRA 2.4 for unused NvMediaImageRec tag.
803  * - Changed arg type of NvMediaImageGetEmbeddedData from void* to unit8_t*.
804  *
805  *<b> Version 1.23 </b> Jan 23, 2020
806  * Modify comments: Add warning for lock/unlock APIs and format support info in
807  * GetEmbeddedData
808  *
809  *<b> Version 1.24 </b> Feb 7, 2020
810  * Removed non-safety debug APIs on safety build
811  *
812  * <b> Version 1.25 </b> Sept 23, 2020
813  * - Added API to time base from NvMediaImage. \ref NvMediaImageGetTimeBase
814  *
815  * <b> Version 1.26 </b> August 27, 2021
816  * - Update doxygen comments for all APIs to have Thread safety information and API Group information
817  *
818  * <b> Version 1.27 </b> April 4, 2022
819  * - Added start of frame timestamp to \ref NvMediaImageGroup
820  */
821 
822 #ifdef __cplusplus
823 } /* extern "C" */
824 #endif
825 
826 #endif /* NVMEDIA_IMAGE_H */
NvMediaTime
struct timespec NvMediaTime
Holds the media time in timespec format as defined by the POSIX specification.
Definition: tvmr/include/nvmedia_core.h:85
nvmedia_core.h
NVIDIA Media Interface: Core
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:446
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: tvmr/include/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: tvmr/include/nvmedia_core.h:366
NvMediaImageSurface::pitch
uint32_t pitch
Holds pitch of the surface.
Definition: nvmedia_image.h:459
NvMediaImageLockAccess
NvMediaImageLockAccess
Specifies image lock access types.
Definition: nvmedia_image.h:444
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: tvmr/include/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:472
NVMEDIA_IMAGE_ACCESS_READ_WRITE
@ NVMEDIA_IMAGE_ACCESS_READ_WRITE
Specifies read/write access.
Definition: nvmedia_image.h:450
NvMediaImageSurface
Holds an image surface descriptor used by NvMediaImageLock().
Definition: nvmedia_image.h:457
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:483
NVMEDIA_IMAGE_ACCESS_WRITE
@ NVMEDIA_IMAGE_ACCESS_WRITE
Specifies write access.
Definition: nvmedia_image.h:448
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:470
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: tvmr/include/nvmedia_core.h:133
NvMediaSurfaceType
#define NvMediaSurfaceType
Defines the set of NvMedia surface types.
Definition: nvmedia_surface.h:568
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: tvmr/include/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:478
NvMediaImageSurfaceMap::width
uint32_t width
Holds image width.
Definition: nvmedia_image.h:474
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:558
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:476
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: tvmr/include/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:461
NvMediaImageRec::attributes
uint32_t attributes
Holds image attributes.
Definition: nvmedia_image.h:101
NvMediaTimeBase
NvMediaTimeBase
Defines clock base for NvMediaTime.
Definition: tvmr/include/nvmedia_core.h:94