JPEG Decoding Overview
1. Overview
This section mainly describes the overall architecture, supported functions, and usage methods of the JPEG decoder. The system provides two JPEG decoding solutions: hardware decoding and software decoding to meet the needs of different scenarios.
For JPEG decoding example projects, please refer to:
For API reference, please refer to:
For detailed information about JPEG decoding, please refer to:
2. Architecture
The JPEG decoder provides two implementation methods:
Hardware Decoder: Uses dedicated hardware to accelerate the JPEG decoding process, featuring high performance and low CPU usage.
Software Decoder: Uses CPU to implement the JPEG decoding process, providing more flexible decoding options and output format support.
The hardware decoder and software decoder share similar interface designs, allowing users to easily switch between the two modes. Both decoders support the same callback mechanism and basic decoding process.
3. Supported Functions
Common features of both JPEG decoders:
Supports standard JPEG format decoding;
Supports obtaining image information (width, height, format, etc.);
Supports callback mechanism to handle decoding completion events;
Supports extended control interface.
Hardware decoder specific features:
High decoding speed;
No CPU resource occupation;
Software decoder specific features:
Supports multiple output formats such as GRAY, RGB565, RGB888, YUYV, VYUY, VUYY;
Supports big-endian and little-endian byte order configuration;
Supports multi-core optimized execution;
Provides rich image rotation and format conversion options;
Supports JPEG image decoding of multiple formats: YUV444, YUV422, YUV420.
4. Document Structure
This JPEG decoding documentation set includes the following parts:
JPEG Decoding Overview (current page): Provides an overview of the overall architecture and functions of JPEG decoding.
JPEG Hardware Decoding: Details the usage methods, APIs, and data structures of the hardware decoder.
JPEG Software Decoding: Details the usage methods, APIs, and data structures of the software decoder.
6. Usage Flow Comparison
The basic usage flows of hardware decoders and software decoders are similar, but there are differences in specific implementations and configuration options. Here is a comparison of the main usage flows for both decoders:
Hardware Decoder Usage Flow:
Create hardware decoder instance (bk_hardware_jpeg_decode_new)
Open hardware decoder (bk_jpeg_decode_hw_open)
Get image information (bk_jpeg_decode_hw_get_img_info)
Configure hardware decoder (optional, bk_jpeg_decode_hw_set_config)
Wait for decoding to complete
Close hardware decoder (bk_jpeg_decode_hw_close)
Delete hardware decoder instance (bk_jpeg_decode_hw_delete)
Software Decoder Usage Flow:
Create software decoder instance (bk_software_jpeg_decode_new or bk_software_jpeg_decode_on_multi_core_new)
Open software decoder (bk_jpeg_decode_sw_open)
Get image information (bk_jpeg_decode_sw_get_img_info)
Set output frame configuration (bk_jpeg_decode_sw_set_config, optional, called when changing the configuration passed during instance creation)
Execute decoding (synchronous or asynchronous)
Wait for decoding to complete
Close software decoder (bk_jpeg_decode_sw_close)
Delete software decoder instance (bk_jpeg_decode_sw_delete)
7. JPEG Decoder Selection Guide
How to choose the appropriate JPEG decoder? Here are some selection guidelines:
Choose Hardware Decoder When:
High performance requirements, need to quickly decode a large number of JPEG images
Moderate decoding resolution and not complex output format requirements
Other CPU-intensive tasks need to run
Choose Software Decoder When:
Need to support multiple output formats and special image processing
Have special requirements for decoding quality
Need to process some non-standard or special JPEG formats
Sufficient system resources and not strict power consumption requirements
Low decoding resolution and small number of images
Need to optimize performance on multi-core processors
In some application scenarios, a combination of both decoders can also be considered. For example, when processing JPEG images of different resolutions or formats, the most suitable decoder can be selected based on specific needs.
8. JPEG Decoding Reference Project
The complete JPEG decoding example project is located at:
./projects/jpeg_decode_exampleThis example provides detailed usage cases, including complete implementations of hardware decoding and software decoding, as well as demonstrations of error handling, callback mechanisms, and other functions. The example code shows how to use the JPEG decoder for image decoding in practical applications.
9. More Information
For detailed information about JPEG hardware decoding, please refer to:
jpeg_decoding_hwFor detailed information about JPEG software decoding, please refer to:
jpeg_decoding_sw