
MP3 file format analysis
![]()
MP3 encoding

Signal Description:
(1) MP3 encoding input signal: PCM (Pulse Code Modulation) sound signal, some audio files in .wav format are PCM signals.
( 2 ) MP3 encoded output signal: transmission in MP3 format
WAV format file capacity = (sampling frequency X quantization number of bits X channel) X time / 8 (byte = 8 bits). When the 2 bytes of 14H~15H have a value of 1 , it indicates the PCM encoding format of the data bit , which can be used as the input of the MP3 encoder .
3. Analysis of the SHINE program
SHINE is a MP coding program written in C language, consisting of 11 source files in total. Add the source file to the newly created VC purchase mode console application to run, but it must use command line mode when running.
1. File data structure
A config_t structure type is defined in types.h , and a global variable configuration is initialized with it, which is equivalent to an ” object ” in an object-oriented language, and is used to encode data and parameters throughout the process. coding Save and manage
Define a wave_t structure type to store PCM pulse format file information, and use wave_t to define the wave variable in config_t , which stores the MP3 encoded source information as the input to the MP3 encoder.
A type of structure mpeg_t is defined which is used to store MP3 encoded information, and the mpeg variable is defined in config_t with mpeg_t , and the information stored in this variable is output as MP3 encoded parameter information.
typedestruct {
time_tstart_time;
char*infile;
round_wave;
char* output file;
mpeg_tmpeg;
} config_t;
The above structure is mainly used to store the ” header ” information , and the byte stream entity information after encoding the output is stored in the bs structure ( defined in the bitstream.h file ), and the bs structure is defined as
static structure





