21ic电子技术开发论坛 单片机与嵌入式系统 FPGA论坛 用vhdl写的mp3解码
发新帖我要提问
返回列表
打印

用vhdl写的mp3解码

[复制链接]
2104|8
手机看帖
扫描二维码
随时随地手机跟帖
沙发
atua| | 2011-3-22 12:00 | 只看该作者
Project Description:

In this design, the decoding process of MP3 decoder works as described as follows. Incoming MP3 streams are fed into the input module of the decoder and processed.  If the synchronization word is found and CRC word is successfully checked, the output main data containing scale factors and Huffman code bits are sent to a predefined buffer. Huffman decoder reads data from buffer and decodes them. The decoded scale factors are delivered to requantizer component. The output 576 frequency lines are written to main memory. Using the input scale factors, requantizer descales  the 576 small integer numbers output from Huffman decoder.  Reordering process is applied to reorder the frequency lines including short window blocks. The functionality of the last four components--- antialias, IMDCT, frequency inversion and filter bank is to transform the MP3 from frequency domain to time domain. By merging frequencies using butterfly calculations, antialias reduces the alias effects introduced from the non-ideal bandpass filter used in encoding process.  In IMDCT, 576 frequency lines are divided into 32 subbands with 18 frequency lines in each. Applying multiplications and cosine calculations to each 18 samples depending on four classes of window type, IMDCT generates samples for filter bank component. After the frequencies of the input samples are inverted by frequency inversion, filter bank exploits MCT to translate the aliased signals and filter out the undesired aliasing in translated signals by using windowing. Hence, the signals in frequency domain are converted back to their time domain origins.  A pcm sample file can be produced from filter bank component when the MP3 decoding process is completed.

File Structure:

This folder contains three directories: Huffman, IMDCT and Filterbank, each of them
includes all the VHDL source codes of the component.

Assumptions in Design:

In this design, it is assumed that a buffer sized as 1024x8 bits provides main data including scale factors and Huffman code bits to Huffman decoder.
Also, it is assumed that a memory with 1024x8 bits is ready for each component to write or read the output or input 576 frequency lines.

Components:

Huffman:
Under this directory, three vhdl files are provided, with which the functionality of
Huffman decoder can be fulfilled.

-all_types.vhd
This file contains all the definitions of the types of MP3 data frame.

-huffman_tables.vhd
This file contains all the Huffman tables used in Huffman decoder including 4 constant
tables and 34 Huffman tables.

-huffman.vhd
This file is the main module of Huffman decoder.The task of this module is to
transform the incoming bitstream data into scale factors and original frequency lines.

The Huffman decoder is implemented as a finite state machine, in which two different
decoding processes: scale factor decoding and Huffman decoding are performed.
In scale factor decoding, an individual process is implemented depending on the different
window type as long, short or mixed window switching. In Huffman decoding, 576
frequency lines are produced, which are divided into three partitions: big values, count1s
and zeros.

IMDCT:
Under this directory, seven VHDL files are provided.Inverse Modified Discrete Cosine Transform, IMDCT, produces time samples from frequency lines in cooperation with the synthesis polyphase filter bank.In  this module, all cosine and sine values are converted to 32-bit fix point values.Four components are used by imdct.vhd, corresponding to block type 0,1,2,3.These components  perform inverse modified discrete cosine transform  and windowing calculation.


-imdct.vhd
This component is the top level of IMDCT module.In IMDCT, one 18*32 bits array is defined  to store temporary results, and another 576*32 bits array for previous line results. According to different block types, four components are imiplemented to calculate the output results. Each component has 18 input values (one subband), 18 temporary output values which will finally be sent to the memory, and 18 previous line values. The top level invokes these components 32 times to get 576 results. The 576 previous lines are stored in the array to be used in the next frame calculation.


-imdct_gen0.vhd
This component is used to implement the inverse modified discrete cosine transform and windowing calculation based on block type 0.


-imdct_gen1.vhd
This component is used to implement the inverse modified discrete cosine transform and windowing calculation based on block type 1.

-imdct_gen2.vhd
This component is used to implement the inverse modified discrete cosine transform and windowing calculation based on block type 2.

-imdct_gen3.vhd
This component is used to implement the inverse modified discrete cosine transform and windowing calculation based on block type 3.

-mul.vhd
Three functions are defined including 2 32 bit fix point multipliers and 1 32-bit divider.

Filterbank:

Under this directory, three main VHDL files are provided. This module is the final step in the MP3 decoding process. Each time, 32 frequency line values from the IMDCT module are applied to synthesis polyphase filter band and 32 consecutive PCM samples are produced at a time.

It contains the following process steps:
-Matrixing: Discrete cosine transform using fix point multiplier. 64 values are produced and shift into a 1024-bit barrel shifter
-Shifting: Implemented a 1024 entry barrel shifter
-Building a 512 values vector using the values in the shifter
-Windowing by 512 coefficients
-Calculating 32 samples
-Producing 32 reconstructed PCM samples

-Filterbank.vhd:
This is the main component of this module,in which the primary processing procedures are implemented.

-Filterbank_package.vhd:
Constants, types, tables and functions for Filterbank component are defined.

-Mul.vhd:
Three functions are defined including 2 32 bit fix point multipliers and 1 32 bit divider.

使用特权

评论回复
板凳
bairan168| | 2011-3-30 15:28 | 只看该作者
:handshake

使用特权

评论回复
地板
七叶一枝花| | 2011-3-30 15:53 | 只看该作者
谢谢楼主分享。

使用特权

评论回复
5
奔腾2.0| | 2011-3-31 21:10 | 只看该作者
:)

使用特权

评论回复
6
lanmanck| | 2011-3-31 22:11 | 只看该作者
用中文描述下架构和原理嘛

使用特权

评论回复
7
styfr| | 2012-3-31 21:16 | 只看该作者
十分感谢

使用特权

评论回复
8
ooljo| | 2012-4-2 20:38 | 只看该作者
看看如何解码

使用特权

评论回复
9
liwsx| | 2012-4-2 22:05 | 只看该作者
好资料啊  
我的歌还来  ,
都是英文      ,
FPGA的好资料都是英文大      
要学好英文啊

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

0

主题

360

帖子

1

粉丝
关闭 热门推荐
快速回复 在线客服 返回列表 返回顶部