Title: Huffman Decoder
1Huffman Decoder
- Team White Project Presentation
- Wei Jiang
- Suresh Polisetty
- Xiang Li
2Background
- MPEG-1 layer-III, also known as MP3, is a highly
compressed digital audio format. - It was standardized in 1991 by the Moving
Pictures Expert Group, popularly referred to as
MPEG. - Huffman Decoder is used in MP3 decoding process
- In the MPEG-1 layer-III, 32 Huffman tables based
on statistics for audio information are defined.
The Huffman table to use for the current frame in
the decoding stage is defined in the side
information.
3MP3 Decoding Process
4MP3 Compression
- Lossless coding like zip can only reduce file
size by 15. - Perceptual coding can remove 90 from the
original file without a significant audible
difference. - MP3 (MPEG Audio Layer 3) uses both perceptual and
lossless coding
5Overview - Perceptual coding
- If a dominating frequency is present, it will
suppress the perception of other frequencies in
the vicinity. This is called frequency masking - if a transient occurs in the audio signal, the
human ear will for a short period become less
sensitive to frequencies lower than the
transient. This is called temporal masking.
6MP3 Audio
- Audio compressed into frames (26 ms of sound)
- All frames have equal size
- Frame N can put some of its information in frame
N-1 if there are free space, using the Bit
Reservoir
7Huffman Coding
- Huffman coding is one of the best known
compression methods. The idea is to assign a
variable-length encoding in bits to each symbol. - Compression is achieved by assigning shorter
codes to more frequent symbols. - Decompression uniqueness is guaranteed because no
code is a prefix of another.
8Huffman Decoding
- A Huffman table can be viewed as a tree-like
look-up table that must be processed from the
root, referred to as a start node.
9Huffman Decoding
- The stream of bits in the compressed file is
traverse the Huffman compression tree, starting
at the root. Whenever a leaf node is reached, the
corresponding symbol is printed out and the tree
traversal is restarted.
Example Huffman Table 1, 2, 2, 3, 0, 0, // x
0, y 0 2, 3, 0, 16, // x 1, y 0 0, 17, // x
1, y 1 0, 1 // x 0, y 1
Table1 of 32 Huffman tables
10Huffman Decoding
- 576 bands are reproduced
- Only the most important values are huffman coded,
the others are expected to be zero - 31 tables are used for Bigvalues and only one
table for count1.
11Huffman Decoding
Actual output from Huffman Decoder
12Huffman Implementation
1332 Huffman Lookup Tables
LIBRARY IEEE use ieee.std_logic_1164.all entity
mylut is port( number IN
std_logic_vector(12 downto 0) dataout
OUT std_logic_vector(7 downto 0) ) end
mylut architecture behavior of mylut
is begin process(number) begin case number is
when "0000000000000" dataout when "0000000000001" dataout "00000000" when "0000000000010" dataout
dataout dataout "0000000000101" dataout when "0000000000110" dataout when "0000000000111" dataout "00000000" when "0000000001000" dataout
dataout dataout "0000000001011" dataout when "0000000001100" dataout when "0000000001101" dataout "00010001" when "0000000001110" dataout
dataout dataout "0000000010001" dataout when "0000000010010" dataout
Integrated as one table 5546 entries (13 bits) 8 bits output Generated by MatLab from text file Synthesized as a separate module Use 20 logic cells in the chip 4 sub-tables are used for each frame according to side info. 14Decoding Procedure (BigValue Band)
- Wait for GO signal from the controller (Mem
management) - Moving inside the Huffman tree until it reaches
the leaf - Build 2/4 decoded values according to the side
info - Send the result (and the number of bits used)
back to - the controller and wait for the next bitstring.
15Decoder Pre-layout Simulation
16Decoder Post-layout Simulation
17Decoder Layout
18Communication between C VHDL
- 1. C code reads all the side info from frame
header, and place them in 0 1 64-bits words. - 2. C code reads the bit stream and place them
from 2 65 words. - 3. C code sends a start signal by writing to
0XFF. C code will listen to OXFE for DONE signal. - 4. VHDL start to work
- Read bit stream from DP ROM
- Write result to 100 244 words
- After done, send DONE signal by writing to 0XFE.
- 5. Go back to step 1 and restart for a new frame
19Data Flow
20FSM for Communication and Memory Management
- 1. 128 bits buffer to hold the bitstream
- 2. Each time send 64 bits to decoder module
- 3. Use an integer to trace the first bit in the
buffer.
21Test bench for pcore
- In our test bench, we simulate the communication
process between C and VHDL - We generate the side info and bitstream from a
real frame and repeat this frame for N times - The simulation result is correct.
22Pre-layout simulation 1
23Pre-layout simulation 2
24Layout
25Post-layout simulation
26Final Virtex Layout
Virtex Layout, 45 of Chip used
27Demo on pilchard
- 20 sec mp3 file(257k)
- Decoded into wav file (2.4 M,no header)
- Playable in MatLab
- Even frames correct, odd frames not
28Whats next
- Implementation on ASIC tsmc1.8
- Fix the bug, demo on pilchard
29References
- http//www.es.lth.se/home/tlt/dicp/2002/index.html
- http//www.dv.co.yu/mpgscript/mpeghdr.htm
- Modern Information Retrieval