Jetson Linux API Reference

35.4.1 Release
06_jpeg_decode (JPEG decode)

Overview

The JPEG decode sample demonstrates JPEG decode. If the decoder output is fd, video conversion is applied onto the output fd buffer.


Building and Running

Prerequisites

To build:

  • Enter:
     $ cd /usr/src/jetson_multimedia_api/samples/06_jpeg_decode
     $ make
    

To run

  • Enter:
     $ ./jpeg_decode num_files <number of files to decode> \
         <in-file1> <out-file1> ...<in-filen> <out-filen> [OPTIONS]
    

Example

   $ ./jpeg_decode num_files 1 ../../data/Picture/nvidia-logo.jpg ../../data/Picture/nvidia-logo.yuv


Flow

The following diagram shows the flow of data through the sample.

Additional Details

When calling decodeToFd, the data format matches Tegra hardware so that no format conversion is required. Calling decodeToBuffer requires converting the buffer to software format after hardware-accelerated JPEG decoding. The JPEG file format contains the standard software format.


Key Structure and Classes

This sample uses the following key structures and classes:

Element Description
NvJpegDecoder Contains elements and functions for decoding JPEG images.

The NvJpegDecoder class contains all of the functions for JPEG image decoding. Key members used are:

Function Description
decodeToFd Decode to hardware buffer (at a file descriptor) where the data is available to other components.
decodeToBuffer Decode to a software buffer.