January 10, 2025

Design and Optimization of Embedded Audio Decoder Based on IPP

This article refers to the address: http://

Abstract : This article starts with Intel's IPP tools for a specific processor-based audio codec optimization scheme, briefly introduces the IPP embedded migration application and API programming specifications and optimization steps. Completed on the Intel XScale PXA255 PDA, using Linux The Qte/Qtopia GUI development environment completes the design and implementation of the audio decoder through IPP optimization.
Keywords : IPP Qte/Qtopia GUI PDA API Linux

1 Introduction

With the rapid development of information technology, various forms of digital products have begun to become information processing tools after PC. Under this digital trend, embedded systems have become one of the hotspots of current research and application. The audio and video multimedia applications of embedded handheld devices are also becoming more and more extensive. Due to the application requirements and cost factors of embedded systems, embedded systems are very streamlined and efficient in terms of system resources, including hardware resources and software resources. Therefore, the IPP low-level API function is used to implement program structure reorganization and optimization for specific key algorithms of a specific processor, which provides a good solution for low-power and high-code execution efficiency of embedded systems.

2 Introduction to Intel IPP

Intel Integrated High Performance Original (Intel IPP) is a cross-architecture cross-platform software library that provides extensive library functionality for multimedia, audio coding, video coding, computer vision cryptography, and the mathematical process of such processing. Platform compatibility and reduced development costs are achieved through a single API across multiple architectures. Improve the efficiency of signal, image, multimedia processing and vector calculations.

The first step in using IPP optimization is the redesign of the program structure. Since the interface provided by IPP is a fixed interface, it is replaced by IPP function on the basis of the original program, which means that additional variables and steps need to be added. If the program structure is improperly designed, the gain from using IPP will be offset to a considerable extent. In order to avoid this situation, the original program structure is often not limited to local adjustment, but the interface provided by IPP is the core, and large-scale adjustment and arrangement are carried out.

3 Linux-based system framework and the construction of an integrated development environment

3.1 Development platform construction

Since the embedded system itself does not have software development capabilities, the PC+ target development method is used to provide a development and cross-compilation environment for the PXA 255 board on a PC running the linux 2.4.20 kernel. Use the FF serial port of the PXA 255 board as the debugging port to connect to the serial port of the PC, which can be easily debugged. Connect the Ethernet interface of the PXA255 board to the PC, establish a point-to-point connection, establish an FTP server on the PC, and use the application and Files such as the kernel are transferred to the PXA255 board through the Ethernet interface.

3.2 Establishment of cross-compilation environment

To develop a program that can run on the PXA255 board on a PC, you must create a cross-compilation environment for the ARM chip on the PC. For this, you will use the cross-compilation toolchain, including: cross-compilation tool arm-linux -gcc, binary file processing tool arm-linux-binutils and link and runtime arm-linux-blibc.

Once the cross-compilation environment is established, you can use this cross-compiler to compile its kernel and applications for the PXA255 board. The block diagram of the entire development environment is as follows:


Figure (1) Block diagram of the development environment

3.3 Establishment of GUI development environment based on QT/Embedded library

In order for the program compiled on the general PC to run on the target platform PXA255 board, the correct library file must be installed on the development PC. The QT/E installation package only provides source files for all QT classes and some auxiliary tools. For the target platform PXA255 board, you also need to add touch screen library files to the QT/E library so that QT/E-based applications can receive correctly. Go to the touch screen event. The cross-compiler tool is compiled specifically for the Xscale series arm-linux-gcc.

In order to improve the efficiency of program development, you can install a tool for generating Makefiles for QT/E. Using it to generate a Makefile can save a lot of time. Add the path to the QT/E library in the Makefile and the parameters (-lts) for the touchscreen library to make. This way the QT/E program is properly compiled and connected to the executable file on the PXA 255 board.

4 MP3 audio player GUI interface design and implementation

This design uses QTE/QTopia as the class library and desktop development environment for the application GUI. Qt/Embedded is a Qt version of the embedded system developed by Trolltech. Framebuffer is used as the underlying graphics interface. The Qt/Embedded class library is fully encapsulated in C++. Rich control resources and good portability are the best aspects of Qt/Embedded. Qt Designer can be used to directly develop Qt/Embedded UI (User Interface) interface.

In view of the space, this article only gives the class definition and function interface description of the graphical interface. The member functions that encapsulate and port the IPP low-level API operations will be explained and described in the fifth part of the article. The player class is defined in Qt as follows:

Class MediaPlayer: public QWidget

{

Public: / * constructor initializes the player parameters * /

MediaPlayer (QWidget *parent=0, const char *name=0);

Public slots: The message response slot function in /*Qt defines various operator member functions of the player*/

Void fileopen();

...

Private:

/*Playback status control, player interface control and GUI plugin*/

Int stplayer; /* 0:stop 1:play 2:pause*/

QMenuBar *menu;

...

}; The screenshot of the player is as follows:

Figure (2) screenshot of the player interface

5 MP3 audio decoding process and key algorithm porting

5.1 Introduction to the Efficient Audio Processing API provided in IPP

This design adopts the efficient algorithm related to decoding in the MPP playback process of IPP, so that the task of MP3 playback is turned to process control without having to write a specific decoding code. MP3 decoding functions and functions are as follows:

(1) ippsUnpackFrameHeader_MP3/* unpacks the MP3 frame header and outputs the IppMP3FrameHeader structure*/

(2) ippsUnpackSideInfo_MP3/* unpacks the MP3 branch information and outputs the IppMP3SideInfo structure*/

(3) ippsUnpackScaleFactors_MP3_1u8s/* unpacking the ratio factor, outputting the pointer of the ratio factor, etc. */

(4) ippsHuffmanDecode_MP3_1u32s/* Huffman decoding, output decoded data */

(5) ippsReQuantize_MP3_32s_I/* quantizes the codeword after Huffman decoding, and outputs the pointer of the quantized sample value*/

(6) ippsMDCTInv_MP3_32s, ippsSynthPQMF_MP3_32s16s/* first and second stage synthesis filter*/

5.2 MP3 audio decoding process

In order to play MP3 files continuously, you need to create a FIFO buffer in the memory for the original binary to ensure that there is enough data at each moment. This buffer should have enough size when the buffer data is less than a certain value. It is necessary to write new data in time. In the main loop of the program, it is necessary to have a FIFO data case and a program to fill in the data. The main data also needs a buffer to store the data used in decoding. The general flow of playing MP3 files is as follows:

Figure (3) MP3 audio decoding player program flow chart

In addition to decoding and playing MP3 programs, the user needs to control part of the program. MP3 playback requires high real-time performance, so it can't be put together with the user control program, you need to create a thread for it. Through the Pthread thread under Linux, it can share memory data, which makes inter-thread communication easy. The code for MP3 playback can be placed in a thread. The shared thread data is processed by the main thread to handle user operations, start, pause, and end the line program. After the introduction of multi-threading operation, the operations of the player user interface (such as button press, mouse click, etc.) do not have to wait for the MP3 decoding to complete without being able to respond in time.

5.3 MP3 audio decoding key algorithm API migration package interface for IPP key algorithm

In view of the length of the relationship, not every API porting and specific operations are elaborated. As mentioned above, the lowest audio decoding function of IPP is ippsUnpackFrameHeader_MP3...ippsSynthPQMF_MP3_32s16s, etc. We first transplant the above layer to form a reference. For the convenience and simpler operation of the API, all the porting operations are completed in a MyAudioApi.cpp file, and added to the project using Qt as the GUI GUI.

This makes it easy for each member function of the top-level QT graphical interface application to call a function interface that uses IPP-generated audio to play various operations. This can still take advantage of IPP's efficient algorithms for decoding optimization and mask the complexity of the underlying IPP API. It also facilitates the subsequent secondary development. The prototype of each function definition of the audio decoding itself is as follows:

Void mp3open(char filename);/*Open the MP3 file and create a decoding thread*/

Void mp3play(void); /*Set the ispause shared variable to false, re-enter the playback thread loop body*/

Void mp3pause(void);/*Set the ispause shared variable to true*/

Void mp3stop(void); /*Sets the done share variable to true, waiting for the playback thread to end*

It should be noted that the above function completes the function of starting audio playback, controlling pause and ending playback in the player user interface, and performs communication between threads by sharing memory data between multiple threads, thereby controlling the pause of the playing thread in the main thread. stop.

Void *MP3Start(void *arg) /* Explains and analyzes the main function of the MP3 player thread*/

{ InitMP3Decoder(&DecoderState,&bs);/*Initialize the decoder*/

While(!done)/*stop button or loop decoding before decoding is completed*/

{ if(!ispause)/* By judging the shared variable ispause between threads, there is a pause button to press */

Switch( DecodeMP3Frame(&bs,pcm,&DecoderState) )

{/*Select the next step according to the status returned by the decoding function*/

Case MP3_FRAME_COMPLETE:

/* There is enough data in the buffer to decode one frame of stream data*/

...}}

/*Turn off the I/O audio device and the MP3 file ends*/

}

6 Conclusion

IPP enables software development of the underlying cross-platform platform, providing highly integrated data communications, single-signal processing and multimedia capabilities, and Intel IPP can help optimize power consumption for optimal CPU execution efficiency. Its embedded porting application provides a feasible software optimization solution for low power consumption and high code execution efficiency on handheld devices.

references:

[1] Intel. Sitsang-PXA255 Evaluation Platform Linux User Guide[S] 2005
[2] Intel. Integrated Performance Primitives for Intel Architecture R eference M annual,develop[S]. Inte1. Corn 2002.
[3] TrollTec. QT/Embedded 2.3.2 Reference[S]
[4] Qi Qiong, Huang Jianhua. Embedded Streaming Media Player Design Based on Intel PXA270 Platform [J], Microcomputer Information, 2005, 10-2, 31
[5] Bai Yuxia. GU I Porting and Application Development Based on Qt/Embedded[J]. Embedded Systems, 2005.7
[6] Xteam Software Technology Co., Ltd. [M]. Qt Programming. Beijing: Tsinghua University Press, 2002
[7] Scott. Linux kernel source code analysis [M]. 2004

Travel Charger Adapter

Travel Charger Adapter is convenience for these people who always travel in many countries. Desktop Power Adapter have normal DC connector for your need, and wall power adapter have mutil plug, like US/UK/AU/EU etc. We also can produce the item according to your specific requirement. The material of this product is PC+ABS. All condition of our product is 100% brand new.

Our products built with input/output overvoltage protection, input/output overcurrent protection, over temperature protection, over power protection and short circuit protection. You can send more details of this product, so that we can offer best service to you!


Travel Charger Adapter,Portable Travel Charger Adapter,Mini Travel Charger Adapter,Travel Charger Supply

Shenzhen Waweis Technology Co., Ltd. , https://www.waweispowerasdapter.com