Mp3 Encoding Core Implementation
12
MP3 ENCODER CORE IMPLEMENTATION Tianyu Su Liu Cheng University of Ottawa
-
Upload
liu-willow-cheng -
Category
Engineering
-
view
132 -
download
2
Transcript of Mp3 Encoding Core Implementation
- 1. MP3 ENCODER CORE IMPLEMENTATION Tianyu SuLiu Cheng University of Ottawa
- 2. SUMMARY MP3 is originally developed by Fraunhofer IIS partly under EUREKA project EU147, Digital Audio Broadcasting (DAB). It is then adopted as ISO- MPEAudioLayer - 3, 1991 (developed followed by Layer 1 and 2). MP3 FILE STRUCTURE IS DIVIDED BY 3 PARTS. TAG.V2FrameTAG.V1 TAG.V2 * Version * Reversion * Flag etc TAG.V1 * Title * Artist * Album etc Frame * IntBitrate * IntFrequency * IntLayer etc University of Ottawa
- 3. PRINCIPLES University of Ottawa Step 1: Subband Filtering Down sampling and take advantage of polyphase filterbank
- 4. PRINCIPLES University of Ottawa Step 2: Psychoacoustic Analysis Take into account of Threshold in Quiet, Frequency Masking and Temporal Masking
- 5. PRINCIPLES University of Ottawa Step 3: 18 Point MDCT Use previous analysis to decide Window Mode and reduce Noise Perception
- 6. PRINCIPLES University of Ottawa Step 4: Quantization & Bit Allocation Allocate bits and apply Huffman coding
- 7. APPLICATIONS University of Ottawa KEY CODES IN SHINE MP3 ENCODER PROGRAM THIS IS PART OF SHINE FIXED-POINT MP3 ENCODER LIBRARY OPEN PROJECT ("libshine-fxp") libshine-fxp_20070104/ libshine-fxp / types.h types.c bitstream.h bitstream.c Main.c Layer3.h Layer3.c L3subband.h L3subband.c L3mdct.h L3mdct.c L3loop.h L3loop.c L3bitstream.h L3bitstream.c
- 8. APPLICATIONS University of Ottawa KEY CODES IN SHINE MP3 ENCODER PROGRAM types.h typedef struct { time_t start_time; // define start time of encoding wave_t wave; // remain the head information of source before encoding mpeg_t mpeg; // generated head information after encoding /* These two app-supplied routines are used to read and write data */ int (*get_pcm)(short buffer[2][samp_per_frame], void *config_in); int (*write_mp3)(long bytes, void *buffer, void *config_in); } config_t; bitstream.h typedef struct bit_stream_struc { FILE *pt; // pointer to bit stream unsigned char *buf; // bit stream buffer int mode; /* bit stream open in read or write mode */ } bitstream_t;
- 9. APPLICATIONS University of Ottawa KEY CODES IN SHINE MP3 ENCODER PROGRAM Main.c #include "Layer3.h" int main(int argc, char **argv) { wave_open(&config); /* set up the read PCM stream and write MP3 stream functions */ config.get_pcm=&wave_get; config.write_mp3=&write_mp3; L3_compress(&config); wave_close(&config); }
- 10. APPLICATIONS University of Ottawa KEY CODES IN SHINE MP3 ENCODER PROGRAM Layer3.c #include "L3subband.h #include "L3mdct.h #include "L3loop.h #include "L3bitstream.h" void L3_compress(config_t *config) { for(gr=0; gr
- 11. DEMO University of Ottawa Shine MP3 Encoder Open Project
- 12. REFERENCES University of Ottawa 1. Shine Fixed-pt MP3 Encoder Library: Project Web Hosting - Open Source Software(n.d.). Retrieved November 17, 2014, from http://libshine- fxp.sourceforge.net 2. Brandenburg K. MP3 and AAC explained[C]//Audio Engineering Society Conference: 17th International Conference: High-Quality Audio Coding. Audio Engineering Society, 1999. 3. . MP3 [D]. , 2002. 4. Noll P. MPnn H G. Genesis of the MP3 audio coding standard[J]. Consumer Electronics, IEEE Transactions on, 2006, 52(3): 1043-1049EG digital audio coding[J]. Signal Processing Magazine, IEEE, 1997, 14(5): 59-81. 5. Herre J, Purnhagen H, Breebaart J, et al. The reference model architecture for MPEG spatial audio coding[C]//Audio Engineering Society Convention Paper. 2005, 6447: 28-31.