Loading [MathJax]/extensions/tex2jax.js
  • <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • NVIDIA DRIVE OS Linux SDK API Reference

    6.0.9 Release
    All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

    Detailed Description

    The NvMediaIJPE object takes uncompressed image data and turns it into a jpeg bitstream.

    6

    Data Structures

    struct  NvMediaJPHuffmanTableSpecfication
     image JPEG encoder HuffmanTable. More...
     
    struct  NvMediaJPEncAttributes
     image JPEG encoder attributes. More...
     

    Macros

    #define NVMEDIA_IJPE_VERSION_MAJOR   2
     Major Version number. More...
     
    #define NVMEDIA_IJPE_VERSION_MINOR   0
     Minor Version number. More...
     
    #define NVMEDIA_IJPE_VERSION_PATCH   0
     Patch Version number. More...
     
    #define NVMEDIA_IJPE_MAX_PRENVSCISYNCFENCES   (16U)
     Specifies the maximum number of times NvMediaIJPEInsertPreNvSciSyncFence() can be called before each call to NvMediaIJPEFeedFrame(). More...
     
    #define NVMEDIA_JPEG_ENC_FLAG_NONE
     JPEG encoder flag empty. More...
     
    #define NVMEDIA_JPEG_ENC_FLAG_SKIP_SOI
     JPEG encoder flag to skip SOI marker. More...
     
    #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_QUALITY
     Quality. More...
     
    #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_RESTARTINTERVAL
     Restart interval. More...
     
    #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_TARGETSIZE
     encode frame target size More...
     
    #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_QUANTTABLE
     Luma/Chroma quant table. More...
     
    #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_HUFFTABLE
     Huffmann table. More...
     

    Typedefs

    typedef struct NvMediaIJPE NvMediaIJPE
     An opaque NvMediaIJPE object created by NvMediaIJPECreate. More...
     

    Functions

    NvMediaStatus NvMediaIJPEGetVersion (NvMediaVersion *version)
     Retrieves the version information for the NvMedia IJPE library. More...
     
    NvMediaIJPENvMediaIJPECreate (NvSciBufAttrList bufAttrList, uint8_t maxOutputBuffering, uint32_t maxBitstreamBytes, NvMediaJPEGInstanceId instanceId)
     Creates a JPEG encoder object capable of turning a stream of surfaces of the inputFormat into a JPEG stream. More...
     
    NvMediaIJPENvMediaIJPECreateEx (uint8_t maxOutputBuffering, uint32_t maxBitstreamBytes, NvMediaJPEGInstanceId instanceId)
     Creates a JPEG encoder object capable of turning a stream of surfaces of the inputFormat into a JPEG stream. More...
     
    void NvMediaIJPEDestroy (NvMediaIJPE *encoder)
     Destroys an NvMedia image JPEG encoder. More...
     
    NvMediaStatus NvMediaIJPEFeedFrame (const NvMediaIJPE *encoder, NvSciBufObj bufObj, uint8_t quality, NvMediaJPEGInstanceId instanceId)
     Encodes the specified bufObj with input quality. More...
     
    NvMediaStatus NvMediaIJPEFeedFrameQuant (const NvMediaIJPE *encoder, NvSciBufObj bufObj, uint8_t *lumaQuant, uint8_t *chromaQuant, NvMediaJPEGInstanceId instanceId)
     Encodes the specified bufObj with input Luma and Chroma quant tables. More...
     
    NvMediaStatus NvMediaIJPEFeedFrameRateControl (const NvMediaIJPE *encoder, NvSciBufObj bufObj, uint8_t *lumaQuant, uint8_t *chromaQuant, uint32_t targetImageSize, NvMediaJPEGInstanceId instanceId)
     Encodes the specified bufObj with input Luma and Chroma quant tables and targetImageSize. More...
     
    NvMediaStatus NvMediaIJPESetAttributes (const NvMediaIJPE *encoder, uint32_t attributeMask, const void *attributes)
     Sets the JPEG encoder attributes. More...
     
    NvMediaStatus NvMediaIJPEGetBits (const NvMediaIJPE *encoder, uint32_t *numBytes, void *buffer, uint32_t flags)
     Returns a frame's worth of bitstream into the provided buffer. More...
     
    NvMediaStatus NvMediaIJPEBitsAvailable (const NvMediaIJPE *encoder, uint32_t *numBytesAvailable, NvMediaBlockingType blockingType, uint32_t millisecondTimeout)
     Returns the encode status and number of bytes available for the next frame (if any). More...
     
    NvMediaStatus NvMediaIJPERegisterNvSciBufObj (const NvMediaIJPE *encoder, NvSciBufObj bufObj)
     Registers NvSciBufObj for use with a NvMediaIJPE handle. More...
     
    NvMediaStatus NvMediaIJPEUnregisterNvSciBufObj (const NvMediaIJPE *encoder, NvSciBufObj bufObj)
     Un-registers NvSciBufObj which was previously registered with NvMediaIJPE using NvMediaIJPERegisterNvSciBufObj(). More...
     
    NvMediaStatus NvMediaIJPEFillNvSciBufAttrList (NvMediaJPEGInstanceId instanceId, NvSciBufAttrList attrlist)
     Fills the NvMediaIJPE specific NvSciBuf attributes which than then be used to allocate an NvSciBufObj that NvMediaIJPE can consume. More...
     
    NvMediaStatus NvMediaIJPEFillNvSciSyncAttrList (const NvMediaIJPE *encoder, NvSciSyncAttrList attrlist, NvMediaNvSciSyncClientType clienttype)
     Fills the NvMediaIJPE specific NvSciSync attributes. More...
     
    NvMediaStatus NvMediaIJPERegisterNvSciSyncObj (const NvMediaIJPE *encoder, NvMediaNvSciSyncObjType syncobjtype, NvSciSyncObj nvscisync)
     Registers an NvSciSyncObj with NvMediaIJPE. More...
     
    NvMediaStatus NvMediaIJPEUnregisterNvSciSyncObj (const NvMediaIJPE *encoder, NvSciSyncObj nvscisync)
     Unregisters an NvSciSyncObj with NvMediaIJPE. More...
     
    NvMediaStatus NvMediaIJPESetNvSciSyncObjforEOF (const NvMediaIJPE *encoder, NvSciSyncObj nvscisyncEOF)
     Specifies the NvSciSyncObj to be used for an EOF NvSciSyncFence. More...
     
    NvMediaStatus NvMediaIJPEInsertPreNvSciSyncFence (const NvMediaIJPE *encoder, const NvSciSyncFence *prenvscisyncfence)
     Sets an NvSciSyncFence as a prefence for an NvMediaIJPEFeedFrame() NvSciSyncFence operation. More...
     
    NvMediaStatus NvMediaIJPEGetEOFNvSciSyncFence (const NvMediaIJPE *encoder, NvSciSyncObj eofnvscisyncobj, NvSciSyncFence *eofnvscisyncfence)
     Gets EOF NvSciSyncFence for an NvMediaIJPEFeedFrame() operation. More...
     

    Macro Definition Documentation

    ◆ NVMEDIA_IJPE_MAX_PRENVSCISYNCFENCES

    #define NVMEDIA_IJPE_MAX_PRENVSCISYNCFENCES   (16U)

    Specifies the maximum number of times NvMediaIJPEInsertPreNvSciSyncFence() can be called before each call to NvMediaIJPEFeedFrame().

    Definition at line 56 of file nvmedia_ijpe.h.

    ◆ NVMEDIA_IJPE_VERSION_MAJOR

    #define NVMEDIA_IJPE_VERSION_MAJOR   2

    Major Version number.

    Definition at line 46 of file nvmedia_ijpe.h.

    ◆ NVMEDIA_IJPE_VERSION_MINOR

    #define NVMEDIA_IJPE_VERSION_MINOR   0

    Minor Version number.

    Definition at line 48 of file nvmedia_ijpe.h.

    ◆ NVMEDIA_IJPE_VERSION_PATCH

    #define NVMEDIA_IJPE_VERSION_PATCH   0

    Patch Version number.

    Definition at line 50 of file nvmedia_ijpe.h.

    ◆ NVMEDIA_IMAGE_JPEG_ATTRIBUTE_HUFFTABLE

    #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_HUFFTABLE

    Huffmann table.

    Definition at line 95 of file nvmedia_ijpe.h.

    ◆ NVMEDIA_IMAGE_JPEG_ATTRIBUTE_QUALITY

    #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_QUALITY

    Quality.

    Definition at line 75 of file nvmedia_ijpe.h.

    ◆ NVMEDIA_IMAGE_JPEG_ATTRIBUTE_QUANTTABLE

    #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_QUANTTABLE

    Luma/Chroma quant table.

    Definition at line 90 of file nvmedia_ijpe.h.

    ◆ NVMEDIA_IMAGE_JPEG_ATTRIBUTE_RESTARTINTERVAL

    #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_RESTARTINTERVAL

    Restart interval.

    Definition at line 80 of file nvmedia_ijpe.h.

    ◆ NVMEDIA_IMAGE_JPEG_ATTRIBUTE_TARGETSIZE

    #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_TARGETSIZE

    encode frame target size

    Definition at line 85 of file nvmedia_ijpe.h.

    ◆ NVMEDIA_JPEG_ENC_FLAG_NONE

    #define NVMEDIA_JPEG_ENC_FLAG_NONE

    JPEG encoder flag empty.

    Definition at line 62 of file nvmedia_ijpe.h.

    ◆ NVMEDIA_JPEG_ENC_FLAG_SKIP_SOI

    #define NVMEDIA_JPEG_ENC_FLAG_SKIP_SOI

    JPEG encoder flag to skip SOI marker.

    Normally, app inserts EXIF data in jpeg image which occurs after SOI marker. This flag be used to skip SOI marker insertion.

    Definition at line 69 of file nvmedia_ijpe.h.

    Typedef Documentation

    ◆ NvMediaIJPE

    typedef struct NvMediaIJPE NvMediaIJPE

    An opaque NvMediaIJPE object created by NvMediaIJPECreate.

    Definition at line 160 of file nvmedia_ijpe.h.

    Function Documentation

    ◆ NvMediaIJPEBitsAvailable()

    NvMediaStatus NvMediaIJPEBitsAvailable ( const NvMediaIJPE encoder,
    uint32_t *  numBytesAvailable,
    NvMediaBlockingType  blockingType,
    uint32_t  millisecondTimeout 
    )

    Returns the encode status and number of bytes available for the next frame (if any).

    The specific behavior depends on the specified blockingType. It is safe to call this function from a separate thread.

    Precondition
    NvMediaIJPEFeedFrame() or NvMediaIJPEFeedFrameQuant() or NvMediaIJPEFeedFrameRateControl()


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: No
      • Runtime: Yes
      • De-Init: No
    Parameters
    [in]encoderThe encoder to use.
    [in]numBytesAvailableThe number of bytes available in the next encoded frame. This is valid only when the return value is NVMEDIA_STATUS_OK.
    [in]blockingTypeThe following are the supported blocking types:
    [in]millisecondTimeoutTimeout in milliseconds or NVMEDIA_VIDEO_ENCODER_TIMEOUT_INFINITE if a timeout is not desired.
    Returns
    NvMediaStatus The completion status of the operation. Possible values are:

    ◆ NvMediaIJPECreate()

    NvMediaIJPE* NvMediaIJPECreate ( NvSciBufAttrList  bufAttrList,
    uint8_t  maxOutputBuffering,
    uint32_t  maxBitstreamBytes,
    NvMediaJPEGInstanceId  instanceId 
    )

    Creates a JPEG encoder object capable of turning a stream of surfaces of the inputFormat into a JPEG stream.

    Surfaces are fed to the encoder with NvMediaIJPEFeedFrame() and bitstream buffers are retrieved with NvMediaIJPEGetBits().

    Precondition
    NvMediaIJPEGetVersion()
    NvMediaIJPEFillNvSciBufAttrList()
    Postcondition
    NvMediaIJPE object is created


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: Yes
      • Runtime: No
      • De-Init: No
        Parameters
        [in]bufAttrListNvSciBufAttrList that contains reconciled attributes that characterizes the input surface that needs to be encoded
        Input range: An NvSciBufObjGetAttrList called with a valid NvSciBufObj that will contain the input content Supported surface format attributes: Buffer Type: NvSciBufType_Image Layout: NvSciBufImage_PitchLinearType Scan Type: NvSciBufScan_ProgressiveType Plane base address alignment: 256 Sub-sampling type: YUV420 (planar/semi-planar) Bit Depth: 8
        [in]maxOutputBufferingThis determines how many frames of encoded bitstream can be held by the NvMediaIJPE object before it must be retrieved using NvMediaIJPEGetBits(). If maxOutputBuffering frames worth of encoded bitstream are yet unretrieved by NvMediaIJPEGetBits(), then NvMediaIJPEFeedFrame() returns NVMEDIA_STATUS_INSUFFICIENT_BUFFERING. One or more frames must be retrieved with NvMediaIJPEGetBits() before frame feeding can continue.
        Input range: The values between 1 and 16, in increments of 1
        [in]maxBitstreamBytesDetermines the maximum bytes that JPEG encoder can produce for each feed frame.
        [in]instanceIdThe ID of the engine instance.
        Input range: The following instances are supported:
        Return values
        NvMediaIJPEThe new image JPEG encoder device's handle or NULL if unsuccessful.

    ◆ NvMediaIJPECreateEx()

    NvMediaIJPE* NvMediaIJPECreateEx ( uint8_t  maxOutputBuffering,
    uint32_t  maxBitstreamBytes,
    NvMediaJPEGInstanceId  instanceId 
    )

    Creates a JPEG encoder object capable of turning a stream of surfaces of the inputFormat into a JPEG stream.

    Surfaces are fed to the encoder with NvMediaIJPEFeedFrame() and bitstream buffers are retrieved with NvMediaIJPEGetBits().

    Precondition
    NvMediaIJPEGetVersion()
    Postcondition
    NvMediaIJPE object is created


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: Yes
      • Runtime: No
      • De-Init: No
        Parameters
        [in]maxOutputBufferingThis determines how many frames of encoded bitstream can be held by the NvMediaIJPE object before it must be retrieved using NvMediaIJPEGetBits(). If maxOutputBuffering frames worth of encoded bitstream are yet unretrieved by NvMediaIJPEGetBits(), then NvMediaIJPEFeedFrame() returns NVMEDIA_STATUS_INSUFFICIENT_BUFFERING. One or more frames must be retrieved with NvMediaIJPEGetBits() before frame feeding can continue.
        Input range: The values between 1 and 16, in increments of 1
        [in]maxBitstreamBytesDetermines the maximum bytes that JPEG encoder can produce for each feed frame.
        [in]instanceIdThe ID of the engine instance.
        Input range: The following instances are supported:
        Return values
        NvMediaIJPEThe new image JPEG encoder device's handle or NULL if unsuccessful.

    ◆ NvMediaIJPEDestroy()

    void NvMediaIJPEDestroy ( NvMediaIJPE encoder)

    Destroys an NvMedia image JPEG encoder.

    Precondition
    NvMediaIJPEUnregisterNvSciBufObj()
    NvMediaIJPEUnregisterNvSciSyncObj()
    Postcondition
    NvMediaIJPE object is destroyed


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: No
      • Runtime: No
      • De-Init: Yes
    Parameters
    [in]encoderThe JPEG encoder to destroy.

    ◆ NvMediaIJPEFeedFrame()

    NvMediaStatus NvMediaIJPEFeedFrame ( const NvMediaIJPE encoder,
    NvSciBufObj  bufObj,
    uint8_t  quality,
    NvMediaJPEGInstanceId  instanceId 
    )

    Encodes the specified bufObj with input quality.

    Precondition
    NvMediaIJPERegisterNvSciBufObj()
    NvMediaIJPERegisterNvSciSyncObj()
    NvMediaIJPESetNvSciSyncObjforEOF()
    NvMediaIJPEInsertPreNvSciSyncFence()
    NvMediaIJPESetAttributes() must be called at least once to configure NvMediaIJPE
    Postcondition
    JPEG encoding task is submitted


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Async
    • Required privileges: None
    • API group
      • Init: No
      • Runtime: Yes
      • De-Init: No
    Parameters
    [in]encoderThe encoder to use.
    Input range: Non-NULL - valid pointer address
    [in]bufObjInput bufObj that contains the input content that needs to be encoded, allocated with a call to NvSciBufObjAlloc. The characteristics of the allocated NvSciBufObj should be equivalent to the bufAttrList passed in NvMediaIJPECreate. There is no limit on the size of this surface.
    Input range: A valid NvSciBufObj
    [in]qualityThis specifies the encode quality. JPEG encode will generate quant tables for luma and chroma according to the quality value
    Input range: The values between 1 and 100, in increments of 1
    [in]instanceIdThe ID of the engine instance.
    Input range: The following instances are supported:
    Returns
    NvMediaStatus The completion status of the operation. Possible values are:

    ◆ NvMediaIJPEFeedFrameQuant()

    NvMediaStatus NvMediaIJPEFeedFrameQuant ( const NvMediaIJPE encoder,
    NvSciBufObj  bufObj,
    uint8_t *  lumaQuant,
    uint8_t *  chromaQuant,
    NvMediaJPEGInstanceId  instanceId 
    )

    Encodes the specified bufObj with input Luma and Chroma quant tables.

    Precondition
    NvMediaIJPERegisterNvSciBufObj()
    NvMediaIJPERegisterNvSciSyncObj()
    NvMediaIJPESetNvSciSyncObjforEOF()
    NvMediaIJPEInsertPreNvSciSyncFence()
    NvMediaIJPESetAttributes() must be called at least once to configure NvMediaIJPE
    Postcondition
    JPEG encoding task is submitted


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Async
    • Required privileges: None
    • API group
      • Init: No
      • Runtime: Yes
      • De-Init: No
    Parameters
    [in]encoderThe encoder to use.
    Input range: Non-NULL - valid pointer address
    [in]bufObjInput bufObj that contains the input content that needs to be encoded, allocated with a call to NvSciBufObjAlloc. The characteristics of the allocated NvSciBufObj should be equivalent to the bufAttrList passed in NvMediaIJPECreate. There is no limit on the size of this surface.
    Input range: A valid NvSciBufObj
    [in]lumaQuantThis specifies Luma quant table used for encode
    Input range: Non-NULL - valid pointer address
    [in]chromaQuantThis specifies Chroma quant table used for encode
    Input range: Non-NULL - valid pointer address
    [in]instanceIdThe ID of the engine instance.
    Input range: The following instances are supported:
    Returns
    NvMediaStatus The completion status of the operation. Possible values are:

    ◆ NvMediaIJPEFeedFrameRateControl()

    NvMediaStatus NvMediaIJPEFeedFrameRateControl ( const NvMediaIJPE encoder,
    NvSciBufObj  bufObj,
    uint8_t *  lumaQuant,
    uint8_t *  chromaQuant,
    uint32_t  targetImageSize,
    NvMediaJPEGInstanceId  instanceId 
    )

    Encodes the specified bufObj with input Luma and Chroma quant tables and targetImageSize.

    Precondition
    NvMediaIJPERegisterNvSciBufObj()
    NvMediaIJPERegisterNvSciSyncObj()
    NvMediaIJPESetNvSciSyncObjforEOF()
    NvMediaIJPEInsertPreNvSciSyncFence()
    NvMediaIJPESetAttributes() must be called at least once to configure NvMediaIJPE
    Postcondition
    JPEG encoding task is submitted


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Async
    • Required privileges: None
    • API group
      • Init: No
      • Runtime: Yes
      • De-Init: No
    Parameters
    [in]encoderThe encoder to use.
    Input range: Non-NULL - valid pointer address
    [in]bufObjInput bufObj that contains the input content that needs to be encoded, allocated with a call to NvSciBufObjAlloc. The characteristics of the allocated NvSciBufObj should be equivalent to the bufAttrList passed in NvMediaIJPECreate. There is no limit on the size of this surface.
    Input range: A valid NvSciBufObj
    [in]lumaQuantThis specifies Luma quant table used for encode
    Input range: Non-NULL - valid pointer address
    [in]chromaQuantThis specifies Chroma quant table used for encode
    Input range: Non-NULL - valid pointer address
    [in]targetImageSizeThis specifies target image size in bytes
    Input range: Non-NULL - valid pointer address
    [in]instanceIdThe ID of the engine instance.
    Input range: The following instances are supported:
    Returns
    NvMediaStatus The completion status of the operation. Possible values are:

    ◆ NvMediaIJPEFillNvSciBufAttrList()

    NvMediaStatus NvMediaIJPEFillNvSciBufAttrList ( NvMediaJPEGInstanceId  instanceId,
    NvSciBufAttrList  attrlist 
    )

    Fills the NvMediaIJPE specific NvSciBuf attributes which than then be used to allocate an NvSciBufObj that NvMediaIJPE can consume.

    This function updates the input NvSciBufAttrList with values equivalent to the following public attribute key-values: NvSciBufGeneralAttrKey_PeerHwEngineArray set to

    • NvSciBufHwEngName: NvSciBufHwEngName_NVJPG
    • NvSciBufPlatformName: The platform this API is used on

    This function assumes that attrlist is a valid NvSciBufAttrList created by the caller by a call to NvSciBufAttrListCreate.

    Precondition
    NvMediaIJPEGetVersion()
    Postcondition
    NvSciBufAttrList populated with NvMediaIJPE specific NvSciBuf attributes. The caller can then set attributes specific to the type of surface, reconcile attribute lists and allocate an NvSciBufObj.


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: Yes
      • Runtime: No
      • De-Init: No
    Parameters
    [in]instanceIdThe ID of the engine instance.
    Input range: The following instances are supported:
    [out]attrlistA pointer to an NvSciBufAttrList structure where NvMediaIJPE places the NvSciBuf attributes.
    Returns
    NvMediaStatus The status of the operation. Possible values are:

    ◆ NvMediaIJPEFillNvSciSyncAttrList()

    NvMediaStatus NvMediaIJPEFillNvSciSyncAttrList ( const NvMediaIJPE encoder,
    NvSciSyncAttrList  attrlist,
    NvMediaNvSciSyncClientType  clienttype 
    )

    Fills the NvMediaIJPE specific NvSciSync attributes.

    This function assumes that attrlist is a valid NvSciSyncAttrList.

    This function updates the input NvSciSyncAttrList with values equivalent to the following public attribute key-values: NvSciSyncAttrKey_RequiredPerm set to

    • NvSciSyncAccessPerm_WaitOnly for clienttype NVMEDIA_WAITER
    • NvSciSyncAccessPerm_SignalOnly for clienttype NVMEDIA_SIGNALER
    • NvSciSyncAccessPerm_WaitSignal for clienttype NVMEDIA_SIGNALER_WAITER NvSciSyncAttrKey_PrimitiveInfo set to
    • NvSciSyncAttrValPrimitiveType_Syncpoint

    The application must not set these attributes in the NvSciSyncAttrList passed as an input to this function.

    Precondition
    NvMediaIJPECreate()
    Postcondition
    NvSciSyncAttrList populated with NvMediaIJPE specific NvSciSync attributes


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: Yes
      • Runtime: No
      • De-Init: No
    Note
    This API is mandatory when multiple engines are pipelined in order to achieve synchronization between the engines
    Parameters
    [in]encoderA pointer to the NvMediaIJPE object.
    Input range: Non-NULL - valid pointer address
    [out]attrlistA pointer to an NvSciSyncAttrList structure where NvMedia places NvSciSync attributes.
    [in]clienttypeIndicates whether the NvSciSyncAttrList requested for an NvMediaIJPE signaler or an NvMediaIJPE waiter.
    Input range: Entries in NvMediaNvSciSyncClientType enumeration
    Returns
    NvMediaStatus The status of the operation. Possible values are:

    ◆ NvMediaIJPEGetBits()

    NvMediaStatus NvMediaIJPEGetBits ( const NvMediaIJPE encoder,
    uint32_t *  numBytes,
    void *  buffer,
    uint32_t  flags 
    )

    Returns a frame's worth of bitstream into the provided buffer.


    numBytes returns the size of this bitstream. It is safe to call this function from a separate thread. The return value and behavior is the same as that of NvMediaIJPEBitsAvailable() when called with NVMEDIA_ENCODE_BLOCKING_TYPE_NEVER except that when NVMEDIA_STATUS_OK is returned, the buffer will be filled in addition to the numBytes.

    Before calling this function:

    1. Call NvMediaIJPEBitsAvailable() to determine the number of bytes required for the next frame.
    2. Allocate a buffer that can hold the next frame.
    Precondition
    NvMediaIJPEBitsAvailable()
    NvMediaIJPEFeedFrame() or NvMediaIJPEFeedFrameQuant() or NvMediaIJPEFeedFrameRateControl()
    Postcondition
    Encoded bitstream corresponding to the submitted task is retrieved.


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: No
      • Runtime: Yes
      • De-Init: No
    Parameters
    [in]encoderThe encoder to use.
    [out]numBytesReturns the size of the filled bitstream.
    [in,out]bufferThe buffer to be filled with the encoded data. If buffer is NULL, this function returns without copying the encoded bitstream.
    [in]flagsThe flags for special handlings Current support flag NVMEDIA_JPEG_ENC_FLAG_NONE or NVMEDIA_JPEG_ENC_FLAG_SKIP_SOI
    Returns
    NvMediaStatus The completion status of the operation. Possible values are:

    ◆ NvMediaIJPEGetEOFNvSciSyncFence()

    NvMediaStatus NvMediaIJPEGetEOFNvSciSyncFence ( const NvMediaIJPE encoder,
    NvSciSyncObj  eofnvscisyncobj,
    NvSciSyncFence eofnvscisyncfence 
    )

    Gets EOF NvSciSyncFence for an NvMediaIJPEFeedFrame() operation.

    The EOF NvSciSyncFence associated with an NvMediaIJPEFeedFrame() operation is an NvSciSyncFence. Its expiry indicates that the corresponding NvMediaIJPEFeedFrame() operation has finished.

    This function returns the EOF NvSciSyncFence associated with the last NvMediaIJPEFeedFrame() call. NvMediaIJPEGetEOFNvSciSyncFence() must be called after an NvMediaIJPEFeedFrame() call.

    For example, in this sequence of code:

    nvmstatus = NvMediaIJPEFeedFrame(handle, srcsurf, srcrect, picparams, instanceid);
    nvmstatus = NvMediaIJPEGetEOFNvSciSyncFence(handle, nvscisyncEOF, eofnvscisyncfence);

    expiry of eofnvscisyncfence indicates that the preceding NvMediaIJPEFeedFrame() operation has finished.

    Precondition
    NvMediaIJPESetNvSciSyncObjforEOF()
    NvMediaIJPEFeedFrame()
    Postcondition
    EOF NvSciSync fence for a submitted task is obtained


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: No
      • Runtime: Yes
      • De-Init: No
    Note
    This API is mandatory when multiple engines are pipelined in order to achieve synchronization between the engines
    Parameters
    [in]encoderA pointer to the NvMediaIJPE object.
    Input range: Non-NULL - valid pointer address
    [in]eofnvscisyncobjAn EOF NvSciSyncObj associated with the NvSciSyncFence which is being requested.
    Input range: A valid NvSciSyncObj
    [out]eofnvscisyncfenceA pointer to the EOF NvSciSyncFence.
    Returns
    NvMediaStatus The status of the operation. Possible values are:

    ◆ NvMediaIJPEGetVersion()

    NvMediaStatus NvMediaIJPEGetVersion ( NvMediaVersion version)

    Retrieves the version information for the NvMedia IJPE library.

    Precondition
    None
    Postcondition
    None


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: Yes
      • Runtime: No
      • De-Init: No
        Parameters
        [in]versionA pointer to a NvMediaVersion structure of the client.
        Returns
        NvMediaStatus The status of the operation. Possible values are:
    • NVMEDIA_STATUS_OK
    • NVMEDIA_STATUS_BAD_PARAMETER if the pointer is invalid.

    ◆ NvMediaIJPEInsertPreNvSciSyncFence()

    NvMediaStatus NvMediaIJPEInsertPreNvSciSyncFence ( const NvMediaIJPE encoder,
    const NvSciSyncFence prenvscisyncfence 
    )

    Sets an NvSciSyncFence as a prefence for an NvMediaIJPEFeedFrame() NvSciSyncFence operation.

    You must call NvMediaIJPEInsertPreNvSciSyncFence() before you call NvMediaIJPEFeedFrame(). The NvMediaIJPEFeedFrame() operation is started only after the expiry of the prenvscisyncfence.

    For example, in this sequence of code:

    nvmstatus = NvMediaIJPEInsertPreNvSciSyncFence(handle, prenvscisyncfence);
    nvmstatus = NvMediaIJPEFeedFrame(handle, srcsurf, srcrect, picparams, instanceid);

    the NvMediaIJPEFeedFrame() operation is assured to start only after the expiry of prenvscisyncfence.

    You can set a maximum of NVMEDIA_IJPE_MAX_PRENVSCISYNCFENCES prefences by calling NvMediaIJPEInsertPreNvSciSyncFence() before NvMediaIJPEFeedFrame(). After the call to NvMediaIJPEFeedFrame(), all NvSciSyncFences previously inserted by NvMediaIJPEInsertPreNvSciSyncFence() are removed, and they are not reused for the subsequent NvMediaIJPEFeedFrame() calls.

    Precondition
    Pre-NvSciSync fence obtained from previous engine in the pipeline
    Postcondition
    Pre-NvSciSync fence is set


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: No
      • Runtime: Yes
      • De-Init: No
    Note
    This API is mandatory when multiple engines are pipelined in order to achieve synchronization between the engines
    Parameters
    [in]encoderA pointer to the NvMediaIJPE object.
    Input range: Non-NULL - valid pointer address
    [in]prenvscisyncfenceA pointer to NvSciSyncFence.
    Input range: Non-NULL - valid pointer address
    Returns
    NvMediaStatus The status of the operation. Possible values are:

    ◆ NvMediaIJPERegisterNvSciBufObj()

    NvMediaStatus NvMediaIJPERegisterNvSciBufObj ( const NvMediaIJPE encoder,
    NvSciBufObj  bufObj 
    )

    Registers NvSciBufObj for use with a NvMediaIJPE handle.

    NvMediaIJPE handle maintains a record of all the objects registered using this API and only the registered NvSciBufObj handles are accepted when submitted for encoding via NvMediaIJPEFeedFrame. Even duplicated NvSciBufObj objects need to be registered using this API prior.

    This needs to be used in tandem with NvMediaIJPEUnregisterNvSciBufObj(). The pair of APIs for registering and unregistering NvSciBufObj are optional, but it is highly recommended to use them as they ensure deterministic execution of NvMediaIJPEFeedFrame().

    To ensure deterministic execution time of NvMediaIJPEFeedFrame API:

    Registration of the bufObj (input) is always with read-only permission.

    Maximum of 32 NvSciBufObj handles can be registered.

    Precondition
    NvMediaIJPECreate()
    NvMediaIJPERegisterNvSciSyncObj()
    Postcondition
    NvSciBufObj is registered with NvMediaIJPE object


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: Yes
      • Runtime: No
      • De-Init: No
    Parameters
    [in]encoderA pointer to the NvMediaIJPE object.
    Input range: Non-NULL - valid pointer address
    [in]bufObjNvSciBufObj object
    Input range: A valid NvSciBufObj
    Returns
    NvMediaStatus, the completion status of operation:

    ◆ NvMediaIJPERegisterNvSciSyncObj()

    NvMediaStatus NvMediaIJPERegisterNvSciSyncObj ( const NvMediaIJPE encoder,
    NvMediaNvSciSyncObjType  syncobjtype,
    NvSciSyncObj  nvscisync 
    )

    Registers an NvSciSyncObj with NvMediaIJPE.

    Every NvSciSyncObj (even duplicate objects) used by NvMediaIJPE must be registered by a call to this function before it is used. Only the exact same registered NvSciSyncObj can be passed to NvMediaIJPESetNvSciSyncObjforEOF(), NvMediaIJPEGetEOFNvSciSyncFence(), or NvMediaIJPEUnregisterNvSciSyncObj().

    For a given NvMediaIJPE handle, one NvSciSyncObj can be registered as one NvMediaNvSciSyncObjType only. For each NvMediaNvSciSyncObjType, a maximum of 16 NvSciSyncObjs can be registered.

    Precondition
    NvMediaIJPEFillNvSciSyncAttrList()
    Postcondition
    NvSciSyncObj registered with NvMediaIJPE


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: Yes
      • Runtime: No
      • De-Init: No
    Note
    This API is mandatory when multiple engines are pipelined in order to achieve synchronization between the engines
    Parameters
    [in]encoderA pointer to the NvMediaIJPE object.
    Input range: Non-NULL - valid pointer address
    [in]syncobjtypeDetermines how nvscisync is used by encoder.
    Input range: Entries in NvMediaNvSciSyncObjType enumeration
    [in]nvscisyncThe NvSciSyncObj to be registered with encoder.
    Input range: A valid NvSciSyncObj
    Returns
    NvMediaStatus The status of the operation. Possible values are:
    • NVMEDIA_STATUS_OK if the function is successful.
    • NVMEDIA_STATUS_BAD_PARAMETER if encoder is NULL or syncobjtype is not a valid NvMediaNvSciSyncObjType.
    • NVMEDIA_STATUS_NOT_SUPPORTED if nvscisync is not a compatible NvSciSyncObj which NvMediaIJPE can support.
    • NVMEDIA_STATUS_ERROR if the maximum number of NvSciScynObjs are already registered for the given syncobjtype, or if nvscisync is already registered with the same encoder handle for a different syncobjtype.

    ◆ NvMediaIJPESetAttributes()

    NvMediaStatus NvMediaIJPESetAttributes ( const NvMediaIJPE encoder,
    uint32_t  attributeMask,
    const void *  attributes 
    )

    Sets the JPEG encoder attributes.

    These go into effect at the next encode frame.

    Precondition
    NvMediaIJPECreate()
    Postcondition
    NvMediaIJPE object is configured


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: No
      • Runtime: Yes
      • De-Init: No
    Parameters
    [in]encoderThe encoder to use.
    [in]attributeMaskAttribute mask.
    [in]attributesAttributes data.
    Supported attribute structures:
    Returns
    NvMediaStatus The completion status of the operation. Possible values are:

    ◆ NvMediaIJPESetNvSciSyncObjforEOF()

    NvMediaStatus NvMediaIJPESetNvSciSyncObjforEOF ( const NvMediaIJPE encoder,
    NvSciSyncObj  nvscisyncEOF 
    )

    Specifies the NvSciSyncObj to be used for an EOF NvSciSyncFence.

    To use NvMediaIJPEGetEOFNvSciSyncFence(), the application must call NvMediaIJPESetNvSciSyncObjforEOF() before it calls NvMediaIJPEFeedFrame().

    NvMediaIJPESetNvSciSyncObjforEOF() currently may be called only once before each call to NvMediaIJPEFeedFrame(). The application may choose to call this function only once before the first call to NvMediaIJPEFeedFrame().

    Precondition
    NvMediaIJPERegisterNvSciSyncObj()
    Postcondition
    NvSciSyncObj to be used as EOF NvSciSyncFence is set


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: No
      • Runtime: Yes
      • De-Init: No
    Note
    This API is mandatory when multiple engines are pipelined in order to achieve synchronization between the engines
    Parameters
    [in]encoderA pointer to the NvMediaIJPE object.
    Input range: Non-NULL - valid pointer address
    [in]nvscisyncEOFA registered NvSciSyncObj which is to be associated with EOF NvSciSyncFence.
    Input range: A valid NvSciSyncObj
    Returns
    NvMediaStatus The status of the operation. Possible values are:

    ◆ NvMediaIJPEUnregisterNvSciBufObj()

    NvMediaStatus NvMediaIJPEUnregisterNvSciBufObj ( const NvMediaIJPE encoder,
    NvSciBufObj  bufObj 
    )

    Un-registers NvSciBufObj which was previously registered with NvMediaIJPE using NvMediaIJPERegisterNvSciBufObj().

    For all NvSciBufObj handles registered with NvMediaIJPE using NvMediaIJPERegisterNvSciBufObj API, NvMediaIJPEUnregisterNvSciBufObj must be called before calling NvMediaIJPEDestroy API. For unregistration to succeed, it should be ensured that none of the submitted tasks on the bufObj are pending prior to calling NvMediaIJPEUnregisterNvSciBufObj. In order to ensure this, NvMediaIJPEGetBits API needs to be called prior to unregistration, until the output of all the submitted tasks are retrieved, following which NvMediaIJPEUnregisterNvSciSyncObj should be called on all registered NvSciSyncObj.

    This needs to be used in tandem with NvMediaIJPERegisterNvSciBufObj(). The pair of APIs for registering and unregistering NvSciBufObj are optional, but it is highly recommended to use them as they ensure deterministic execution of NvMediaIJPEFeedFrame().

    To ensure deterministic execution time of NvMediaIJPEFeedFrame API:

    Precondition
    NvMediaIJPEGetBits()
    NvMediaIJPEUnregisterNvSciSyncObj() [verify that processing is complete]
    Postcondition
    NvSciBufObj is un-registered from NvMediaIJPE object


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: No
      • Runtime: No
      • De-Init: Yes
    Parameters
    [in]encoderA pointer to the NvMediaIJPE object.
    Input range: Non-NULL - valid pointer address
    [in]bufObjNvSciBufObj object
    Input range: A valid NvSciBufObj
    Returns
    NvMediaStatus, the completion status of operation:

    ◆ NvMediaIJPEUnregisterNvSciSyncObj()

    NvMediaStatus NvMediaIJPEUnregisterNvSciSyncObj ( const NvMediaIJPE encoder,
    NvSciSyncObj  nvscisync 
    )

    Unregisters an NvSciSyncObj with NvMediaIJPE.

    Every NvSciSyncObj registered with NvMediaIJPE by NvMediaIJPERegisterNvSciSyncObj() must be unregistered before calling NvMediaIJPEUnregisterNvSciBufObj() to unregister the NvSciBufObjs.

    Before the application calls this function, it must ensure that any NvMediaIJPEFeedFrame() operation that uses the NvSciSyncObj has completed. If this function is called while NvSciSyncObj is still in use by any NvMediaIJPEFeedFrame() operation, the API returns NVMEDIA_STATUS_PENDING to indicate the same. NvSciSyncFenceWait() API can be called on the EOF NvSciSyncFence obtained post the last call to NvMediaIJPEFeedFrame() to wait for the associated tasks to complete. The EOF NvSciSyncFence would have been previously obtained via a call to NvMediaIJPEGetEOFNvSciSyncFence(). The other option would be to call NvMediaIJPEGetBits() till there is no more output to retrieve.

    Precondition
    NvMediaIJPEFeedFrame()
    NvMediaIJPEGetBits() or NvSciSyncFenceWait() [verify that processing is complete]
    Postcondition
    NvSciSyncObj un-registered with NvMediaIJPE


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: Yes, with the following conditions
        • Every thread should be invoked with relevant NvMediaIJPE object.
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: None
    • API group
      • Init: No
      • Runtime: No
      • De-Init: Yes
    Note
    This API is mandatory when multiple engines are pipelined in order to achieve synchronization between the engines
    Parameters
    [in]encoderA pointer to the NvMediaIJPE object.
    Input range: Non-NULL - valid pointer address
    [in]nvscisyncAn NvSciSyncObj to be unregistered with encoder.
    Input range: A valid NvSciSyncObj
    Returns
    NvMediaStatus The status of the operation. Possible values are:
    NvMediaIJPEInsertPreNvSciSyncFence
    NvMediaStatus NvMediaIJPEInsertPreNvSciSyncFence(const NvMediaIJPE *encoder, const NvSciSyncFence *prenvscisyncfence)
    Sets an NvSciSyncFence as a prefence for an NvMediaIJPEFeedFrame() NvSciSyncFence operation.
    NvMediaIJPEGetEOFNvSciSyncFence
    NvMediaStatus NvMediaIJPEGetEOFNvSciSyncFence(const NvMediaIJPE *encoder, NvSciSyncObj eofnvscisyncobj, NvSciSyncFence *eofnvscisyncfence)
    Gets EOF NvSciSyncFence for an NvMediaIJPEFeedFrame() operation.
    NvMediaIJPEFeedFrame
    NvMediaStatus NvMediaIJPEFeedFrame(const NvMediaIJPE *encoder, NvSciBufObj bufObj, uint8_t quality, NvMediaJPEGInstanceId instanceId)
    Encodes the specified bufObj with input quality.
    人人超碰97caoporen国产