NVIDIA DRIVE OS Linux API Reference

5.1.6.1 Release
For Test and Development only

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nvmedia_ijpe.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2019, 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 
15 #ifndef NVMEDIA_IJPE_H
16 #define NVMEDIA_IJPE_H
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #include "nvmedia_common.h"
23 #include "nvmedia_core.h"
24 #include "nvmedia_image.h"
25 #include "nvmedia_surface.h"
26 
38 #define NVMEDIA_IJPE_VERSION_MAJOR 1
39 
40 #define NVMEDIA_IJPE_VERSION_MINOR 6
41 
46 #define NVMEDIA_JPEG_ENC_FLAG_NONE (0 << 0)
47 
53 #define NVMEDIA_JPEG_ENC_FLAG_SKIP_SOI (1 << 0)
54 
59 #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_QUALITY (1 << 0)
60 
64 #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_RESTARTINTERVAL (1 << 1)
65 
69 #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_TARGETSIZE (1 << 2)
70 
74 #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_QUANTTABLE (1 << 3)
75 
79 #define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_HUFFTABLE (1 << 4)
80 
84 typedef struct {
85  uint8_t length[16];
86  uint8_t *values;
88 
92 typedef struct {
98  uint8_t quality;
102  uint32_t restartInterval;
106  uint32_t targetImageSize;
110  uint8_t lumaQuant[64];
114  uint8_t chromaQuant[64];
140 
144 typedef struct {
148  struct NvMediaIJPEPriv_ *jpegEncPriv;
149 } NvMediaIJPE;
150 
162  NvMediaVersion *version
163 );
164 
188 NvMediaIJPE *
190  const NvMediaDevice *device,
191  NvMediaSurfaceType inputFormat,
192  uint8_t maxOutputBuffering,
193  uint32_t maxBitstreamBytes
194 );
195 
200 void NvMediaIJPEDestroy(NvMediaIJPE *encoder);
201 
223  const NvMediaIJPE *encoder,
224  NvMediaImage *frame,
225  uint8_t quality
226 );
227 
249  const NvMediaIJPE *encoder,
250  NvMediaImage *frame,
251  uint8_t *lumaQuant,
252  uint8_t *chromaQuant
253 );
254 
279  const NvMediaIJPE *encoder,
280  NvMediaImage *frame,
281  uint8_t *lumaQuant,
282  uint8_t *chromaQuant,
283  uint32_t targetImageSize
284 );
285 
301  const NvMediaIJPE *encoder,
302  uint32_t attributeMask,
303  const void *attributes
304 );
305 
339  const NvMediaIJPE *encoder,
340  uint32_t *numBytes,
341  void *buffer,
342  uint32_t flags
343 );
344 
371  const NvMediaIJPE *encoder,
372  uint32_t *numBytes,
373  uint32_t numBitstreamBuffers,
374  const NvMediaBitstreamBuffer *bitstreams,
375  uint32_t flags
376 );
377 
424  const NvMediaIJPE *encoder,
425  uint32_t *numBytesAvailable,
426  NvMediaBlockingType blockingType,
427  uint32_t millisecondTimeout
428 );
429 
430 /*
431  * \defgroup history_nvmedia_ijpe History
432  * Provides change history for the NvMedia Image Jpeg Encode API.
433  *
434  * \section history_nvmedia_ijpe Version History
435  *
436  * <b> Version 1.0 </b> November 9, 2015
437  * - Initial release
438  *
439  * <b> Version 1.1 </b> May 11, 2016
440  * - Added \ref NvMediaIJPECheckVersion API
441  *
442  * <b> Version 1.2 </b> Sep 19, 2016
443  * - Added \ref NvMediaIJPEGetBitsEx API
444  *
445  * <b> Version 1.3 </b> May 15, 2017
446  * - Added \ref NvMediaIJPEGetVersion API to get the version of NvMedia IJPE library
447  * - NvMediaIJPECheckVersion is deprecated. Use NvMediaIJPEGetVersion() instead
448  * - All NvMedia data types are moved to standard data types
449  *
450  * <b> Version 1.4 </b> January 15, 2019
451  * - Fix MISRA violations 8.13, 21.1 and 21.2
452  *
453  * <b> Version 1.5 </b> Feb 20, 2019
454  * - Added opaque pointer for jpeg encoder
455  * internal usage into jpeg encoder object
456  * - Fix MISRA violations 11.3
457  *
458  * <b> Version 1.6 </b> February 28, 2019
459  * - Add dependent header includes nvmedia_core.h, nvmedia_image.h and nvmedia_surface.h
460  */
461 
464 #ifdef __cplusplus
465 }; /* extern "C" */
466 #endif
467 
468 #endif /* NVMEDIA_IJPE_H */
NvMediaIJPE * NvMediaIJPECreate(const NvMediaDevice *device, NvMediaSurfaceType inputFormat, uint8_t maxOutputBuffering, uint32_t maxBitstreamBytes)
Creates a JPEG encoder object capable of turning a stream of surfaces of the inputFormat into a JPEG ...
Holds a handle representing image objects.
Definition: nvmedia_image.h:69
#define NvMediaSurfaceType
Defines the set of NvMedia surface types.
Holds an application data buffer containing compressed video data.
NvMediaJPHuffmanTableSpecfication * lumaDC
A Huffmann table for Luma DC sample, initialized to NULL for using default table in JPEG specificatio...
Definition: nvmedia_ijpe.h:120
NvMediaStatus NvMediaIJPEFeedFrameQuant(const NvMediaIJPE *encoder, NvMediaImage *frame, uint8_t *lumaQuant, uint8_t *chromaQuant)
Encodes the specified frame with input Luma and Chroma quant tables.
NvMediaStatus NvMediaIJPEGetVersion(NvMediaVersion *version)
Gets the version compatibility for the NvMedia IJPE library.
NVIDIA Media Interface: Surface Handling
uint32_t restartInterval
A value to specify restart interval, initialized to 0 at NvMediaIJPE creation.
Definition: nvmedia_ijpe.h:102
NVIDIA Media Interface: Image Processing
image JPEG encoder attributes.
Definition: nvmedia_ijpe.h:92
NvMediaStatus NvMediaIJPESetAttributes(const NvMediaIJPE *encoder, uint32_t attributeMask, const void *attributes)
Sets the JPEG encoder attributes.
Holds NvMedia version information.
Definition: nvmedia_core.h:226
struct NvMediaDevice NvMediaDevice
An opaque handle representing an NvMediaDevice object.
Definition: nvmedia_core.h:337
image JPEG encoder object created by NvMediaIJPECreate.
Definition: nvmedia_ijpe.h:144
NVIDIA Media Interface: Common Types for Video/Image Encode/Decode
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).
uint8_t quality
A value clamped to between 1 and 100, set to generate luma/chroma Quant tables.
Definition: nvmedia_ijpe.h:98
NVIDIA Media Interface: Core
NvMediaStatus
Defines all possible error codes.
Definition: nvmedia_core.h:169
NvMediaJPHuffmanTableSpecfication * chromaDC
A Huffmann table for Chroma DC sample, initialized to NULL for using default table in JPEG specificat...
Definition: nvmedia_ijpe.h:132
NvMediaStatus NvMediaIJPEFeedFrame(const NvMediaIJPE *encoder, NvMediaImage *frame, uint8_t quality)
Encodes the specified frame with input quality.
int uint32_t uint32_t uint32_t const uint32_t const uint32_t const uint32_t const uint64_t uint32_t uint32_t flags
void NvMediaIJPEDestroy(NvMediaIJPE *encoder)
Destroys an NvMedia image JPEG encoder.
NvMediaStatus NvMediaIJPEGetBitsEx(const NvMediaIJPE *encoder, uint32_t *numBytes, uint32_t numBitstreamBuffers, const NvMediaBitstreamBuffer *bitstreams, uint32_t flags)
Performs the same operation as NvMediaIJPEGetBits() except NvMediaIJPEGetBitsEx() consumes an array o...
struct NvMediaIJPEPriv_ * jpegEncPriv
An Opaque pointer for internal use.
Definition: nvmedia_ijpe.h:148
NvMediaBlockingType
Blocking type.
image JPEG encoder HuffmanTable.
Definition: nvmedia_ijpe.h:84
NvMediaJPHuffmanTableSpecfication * chromaAC
A Huffmann table for Chroma AC sample, initialized to NULL for using default table in JPEG specificat...
Definition: nvmedia_ijpe.h:138
NvMediaJPHuffmanTableSpecfication * lumaAC
A Huffmann table for Luma AC sample, initialized to NULL for using default table in JPEG specificatio...
Definition: nvmedia_ijpe.h:126
uint32_t targetImageSize
A value to specify target encode size, initialized to 0xffffffff at NvMediaIJPE creation.
Definition: nvmedia_ijpe.h:106
NvMediaStatus NvMediaIJPEGetBits(const NvMediaIJPE *encoder, uint32_t *numBytes, void *buffer, uint32_t flags)
Returns a frame's worth of bitstream into the provided buffer.
NvMediaStatus NvMediaIJPEFeedFrameRateControl(const NvMediaIJPE *encoder, NvMediaImage *frame, uint8_t *lumaQuant, uint8_t *chromaQuant, uint32_t targetImageSize)
Encodes the specified frame with input Luma and Chroma quant tables and targetImageSize.
NvMediaSurfaceType inputFormat
Input Image surface type.
Definition: nvmedia_ijpe.h:146