Image JPEG Decode (nvmimg_jpgdec)
The NvMedia Image JPEG Decode application (nvmimg_jpgdec) demonstrates how to decode a set of JPEG bitstreams into image surfaces using NvMedia JPEG decode APIs. It operates by parsing command line with required parameter sets for JPEG decoder including:
• input bitstream file name
• output file name
• output resolution
• output format, etc.
It then reads the input bitstream file into the local buffer frame by frame, and sends the information to NvMedia JPEG decoder. The resulting image surfaces are saved into the output YUV file. This chapter describes the platform set up and usage of the application.
The application also supports CRC generation and CRC checking modes. CRC generation is mainly for developers to provide the original CRC. It can be a different CRC for different Tegra chip versions. CRC checking mode is for QA to verify the application for new releases.
The following diagram describes the basic function flow.
Example Commands
The following command decodes 100 JPEG files into 720 x 480 images in RGB format:
./nvmimg_jpgdec -f input%d.jpg -of outputfile -fr 720x480 -fn 100
The following command decodes 100 JPEG files with CRC generation:
./nvmimg_jpgdec -f input%d.jpg -of outputfile -fr 720x480 -fn 100 -crcgen crc.txt
The following command decodes 100 JPEG files with CRC checking:
./nvmimg_jpgdec -f input%d.jpg -of outputfile -fr 720x480 -fn 100 -crcchk crc.txt
Command Options
To run the Image Decode sample application, run the following command:
./nvmimg_jpgdec [options]
The command line options for the Image Decode application are as follows:
Option | Parameter | Description | Default Settings |
-h | N/A | Prints the help menu. | N/A |
-f | [file] | Specifies the input bitstream file name. If given as inputd.jpg, the application tries to decode a set of input JPG files as input1.jpg, input2.jpg, etc. Otherwise, the one JPEG bitstream is decoded. | N/A |
-fr | [WxH] | Specifies the output file resolution in width x height format. | N/A |
-of | [file] | Specifies the YUV file. | N/A |
-fn | [value] | Specifies the decode frame number. | 1 |
-format | [value] | Specifies the output format: 0: yuv420 1: rgba 2: yuv422 3: yuv444 | 0 |
-ds | [value] | Specifies the decode output downscale factor [0..3]. | 0; no downscale |
-crcgen | [file] | Sets the CRC generation mode; CRC is saved to the specified file. | N/A |
-crcchk | [file] | Sets the CRC check mode. The result is checked against the specified CRC file. | N/A |
-v | [level] | Logging level = 0 (Errors) 1 (Warnings) 2 (Information) 3 (Debug) | If no level is provided, defaults to 3. If option is not provided, defaults to 0. |