NVIDIA Tegra
NVIDIA DRIVE OS 5.1 Linux SDK

Developer Guide
5.1.9.0 Release


 
Image JPEG Decode (nvmimg_jpgdec)
 
Example Commands
Configuration Format
Output YUV Resolution
Command Line Switches
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 parses the command line with required parameter sets for the 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 the NvMedia JPEG decoder. It saves the resulting image surfaces into the output YUV file.
The application also supports CRC generation and CRC checking modes. CRC generation is mainly for developers to provide an 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.
This diagram describes the basic function flow.
A screenshot of a video game Description generated with high confidence
Example Commands
To decode 100 JPEG files into 720 x 480 images in RGB format
Enter the command:
./nvmimg_jpgdec -f input%d.jpg -of outputfile -fn 100
To decode 100 JPEG files with CRC generation
Enter the command:
./nvmimg_jpgdec -f input%d.jpg -of outputfile -fn 100 -crcgen crc.txt
To decode 100 JPEG files with CRC checking
Enter the command:
./nvmimg_jpgdec -f input%d.jpg -of outputfile -fn 100 -crcchk crc.txt
To decode a monochrome (YUV400) file
Enter the command:
./nvmimg_jpgdec -f input.jpg -of outputfile -format 4
Default format value is 0 (yuv420). Format conversion from YUV400 to YUV420 is not supported. You must set the -format switch to 4 for monochrome decode.
Configuration Format
The ‑format parameter configures the color format of the decoded YUV. Supported formats are:
0: yuv420 (the default)
1: rgba
2: yuv422
3: yuv444
4: yuv400
The output format that can be configured for a JPEG input depends on the format of the JPEG:
JPEG Format
Supported Output Formats
YUV444 JPEG
All the output formats are supported.
YUV422 JEPG
The following output formats are supported:
0: yuv420
1: rgba
2: yuv422
YUV420 JPEG
The following output formats are supported:
0: yuv420
1: rgba
Unknown JPEG format
The application sets the output format to the default value of 0 (yuv420).
YUV400 JPEG
(Monochrome)
The following output formats are supported:
4: yuv400
Output YUV Resolution
The resolution of generated YUV is always aligned to the next multiple of 16. For example, if the input JPEG resolution is 800x600, the resolution of output YUV file is 800x608. Note that the image is not scaled from 800x600 to 800x608; the last eight lines must be ignored.
Command Line Switches
To run the Image Decode sample application, enter this command:
./nvmimg_jpgdec [switches]
This table describes the command line switches for the application:
Switch
Description
Default Settings
-h
Prints the help menu.
N/A
-f <file>
Specifies the input bitstream file. If the filename is inputd.jpg, the application tries to decode a set of input JPG files named input1.jpg, input2.jpg, etc. Otherwise, the single specified file’s bitstream is decoded.
N/A
-of <file>
Specifies the YUV file.
N/A
-fr <w>x<h>
Specifies the output file resolution as width and height separated by an ‘x’, e.g. 640x480 or 1080x960.
N/A
-fn <value>
Specifies the decode frame number.
1
-format <value>
Specifies the output format. Values are:
0: yuv420
1: rgba
2: yuv422
3: yuv444
4: yuv400
0
-ds <value>
Specifies the decode output downscale factor. Value may be [0,3].
0 (no downscale)
-crcgen <file>
Generates a CRC and saves it to the specified file.
N/A
-crcchk <file>
Generates a CRC and checks it against the specified CRC file.
N/A
-v <level>
Logging level. Value may be:
0 (Errors)
1 (Warnings)
2 (Information)
3 (Debug)
If the switch is omitted, 0.
If the switch is specified but <level> is omitted, 0.