This sample demonstrates how to:
This sample does not require a camera.
$ cd /usr/src/jetson_multimedia_api/samples/05_jpeg_encode $ make
$ ./jpeg_encode <in-file> <in-width> <in-height> <out-file> [OPTIONS]
$ ./jpeg_encode ../../data/Picture/nvidia-logo.yuv 1920 1080 test.jpg
jpeg_encode
sample consumes a YUV file. If you do not already have a YUV file, you can use the jpeg_decode
sample to generate one. For example: $ cd /usr/src/jetson_multimedia_api/samples/06_jpeg_decode/ $ ./jpeg_decode num_files 1 ../../data/Picture/nvidia-logo.jpg ../../data/Picture/nvidia-logo.yuv
The following diagram shows the flow of data through this sample.
The YUV data format prior to entering the JPEG encoder can be block, linear, or pitch linear. This results in 2 different encode processes: encodeFromFD and encodeFromBuffer. encodeFromFD
allows JPEG encode hardware to process the data directly. encodeFromBuffer
requires extra format conversion prior to writing to the JPEG file.
The struct context_t
global structure manages all of the resources in the application.
NvJPEGEncoder | Description |
---|---|
class NvJPEGEncoder | Contains the elements and functions to encode JPEG images. |
The NvJPEGEncoder class contains all of the functions for JPEG encoding. Key members used are:
NvJPEGEncoder | Description |
---|---|
encodeFromFd | Encode from FD of buffer exported by V4L2 element. |
encodeFromBuffer | Encode from pointers of buffer data. |