image compression system
DESCRIPTION
Image Compression System. Megan Fuller and Ezzeldin Hamed. Transforms of Images. Original Image. Magnitude of DFT of Image-128 (otherwise DC component = ~8e6). Image Reconstructed from 25% of DFT coefficients. The 2D Discrete Fourier Transform. Where - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/1.jpg)
1
Image Compression System
Megan Fuller and Ezzeldin Hamed
![Page 2: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/2.jpg)
2
Transforms of Images
Original Image
Image Reconstructed from 25% of DFT coefficients
Magnitude of DFT of Image-128 (otherwise DC component = ~8e6)
![Page 3: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/3.jpg)
3
The 2D Discrete Fourier Transform
Where This can be computed separably by rearranging:
![Page 4: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/4.jpg)
4
The 2D Discrete Cosine Transform
• Computed separably• Computed as a DFT + 1 multiply• Generally gives better energy compaction than DFT
![Page 5: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/5.jpg)
5
High Level Architecture
Separable, in-place 2D DFT/DCTInput
Memory
Coefficient > Threshold?
Output Module (sending data to PC)
• The choice between DFT and DCT is provided at compile time• Threshold is provided by the user at run time
![Page 6: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/6.jpg)
6
What’s Interesting?
• Reducing the computation required
• Sharing resources in the DCT case
• Some memory organization tricks
• Reducing bit width
![Page 7: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/7.jpg)
7
Number of FFTs
• Using FFT to calculate the 1D-DFT
• We need FFTs to calculate the 2D-DFT
• Can we reduce the number of FFTs?
![Page 8: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/8.jpg)
8
Reduction for the DFT case• Using the DFT properties
– Input is real – Output is symmetric
– Combining rows
– Even/Odd decomposition
S00 S01 S02 S03
S10 S11 S12 S13
S20 S21 S22 S23
S30 S31 S32 S33• N/2 FFTs of the rows, followed by Even/Odd decomposition
• Output is symmetric (discard half the columns)
• N/2 FFTs of the columns
• Total of N FFT computations
S31S11
Real Imag
![Page 9: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/9.jpg)
9
Reduction in the DCT case• Again combining the rows in the same way as in DFT (N/2 FFTs)• Even/Odd decomposition then extra multiplication to calculate the DCT
S10 S11 S12 S13
S00 S01 S02 S03
S30 S31 S32 S33
S20 S21 S22 S23
• Results are not symmetric
• But the DCT is real
• We can combine the columns the same way we combined the rows (N/2 FFT)
• The same multiplier inside the FFT is used
• Another Even/Odd decomposition is required here with an extra complex multiplier
• Total of N FFT computations + few extra multiplications
Real Imag
![Page 10: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/10.jpg)
10
In-Place Radix-4 FFT
• Critical path
• Fixed point arithmetic
• Bit Width?
• Quantization noise
• Rounding instead of Truncation
• Avoid any overflow• additions• Needs extra bits
• Can we do better?
![Page 11: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/11.jpg)
11
Static Scaling Vs. Dynamic Scaling• Shift when you expect an overflow
– Shift after each addition
• The location of the fraction point is fixed at each computation step
• Almost no overhead compared to fixed point
• Higher effective bit width only in the first computation steps
• No effect on the critical path
• Shift only when overflow occurs– Track overflows and account for them
• The location of the fraction point is the same for each 1D-FFT frame
• Needs simple circuitry to track the overflow and shift when required
• Effective bit width depend on the data.
• No effect on the critical path
![Page 12: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/12.jpg)
12
Design Space ExploredDynamic Scaling
Yes No
DFT DCTDFT
8 12 16
DCT
8 12 16 8 12 16 8 12 16
• 8 bits with dynamic scaling considered later• 8 bits without dynamic scaling (and 12 for DCT) perform too poorly
to be considered• 12 does as good as 16 bits with dynamic scaling in the DFT
![Page 13: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/13.jpg)
13
Dynamic Scaling of DFT• 50% of coefficients is
sufficient for perfect reconstruction because of the symmetry of the DFT
• 16 bits without dynamic scaling does as well as floating point
• 12 bits with dynamic scaling also does nearly as well as floating point
![Page 14: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/14.jpg)
14
Dynamic Scaling of DFT(continued)• Improvement in
performance when dynamic scaling is used more than makes up for reduced compression because the scaling bits have to be saved
• 12 bits with dynamic scaling does nearly as well as 16 bits
![Page 15: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/15.jpg)
15
DCT Vs. DFT
• All cases are using dynamic scaling
• DCT provides better energy compaction
• For DCT, 12 bits gives a lower MSE for a given compression ratio (this was not the case for the DFT).
![Page 16: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/16.jpg)
16
8 Bits
Image reconstructed from 50% of the DFT coefficients, computed with 8 bits, using dynamic scaling. MSE = 452.
Image reconstructed from 6% of the DFT coefficients, computed with 16 bits, MSE = 129.
![Page 17: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/17.jpg)
17
Physical ConsiderationsTransform # of Bits Dynamic
Scaling?Critical Path Slice
RegistersSlice LUTs
BRAM DSP48Es
DFT 16 No 11.458ns 16% 23% 29% 7
DFT 16 Yes 11.763ns 17% 24% 29% 7
DFT 12 No 11.273ns 15% 22% 24% 7
DFT 12 Yes 11.464ns 16% 23% 24% 7
DFT 8 Yes 11.287ns 15% 22% 18% 6
DCT 16 Yes 11.458ns 19% 26% 29% 10
DCT 12 Yes 11.273ns 18% 25% 24% 10
DCT 8 Yes 11.066ns 17% 23% 18% 8
• Critical path about the same for all designs, could probably be improved with tighter synthesis constraints
• Resource usage increases with bitwidth, addition of dynamic scaling, and DCT, but overall doesn’t change much
• DCT uses extra DSP blocks because of the extra multiplication
![Page 18: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/18.jpg)
18
LatencyComponent Latency (clock cycles) Potential Frame Rate
with 50MHz ClockInitialization 870,000 -
DCT 263,900 189 images/second
DFT 262,200 191 images/second
N 𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝐶𝑦𝑐𝑙𝑒𝑠≅𝑁 2log 4𝑁
![Page 19: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/19.jpg)
19
Future Work
• Use of DRAM to allow compression of larger images
• Support for color images• Support for rectangular images of arbitrary
edge length• Combining the DCT and DFT into a single core
that could compute either transform, as selected by the user at runtime
![Page 20: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/20.jpg)
20
Relationship Between the DFT and the DCT
The N-point DFT of a sequence is the Fourier Series coefficients for that sequence made periodic with period N.
![Page 21: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/21.jpg)
21
Relationship Between the DFT and the DCT (continued)
The N-point DCT of a sequence is a twiddle factor multiplied by the first N Fourier Series coefficients of the 2N point sequence y(n) made periodic with period 2N.
y(n) = x(x) + x(2N-1-n)x(n)
![Page 22: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/22.jpg)
22
Relationship Between the DFT and the DCT (continued)
The DCT can be computed from the DFT as follows:• Define the sequences
y(n) = x(n) + x(2N-1-n)v(n) = y(2n)
• Compute the N-point DFT of v(n), V(k)
![Page 23: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/23.jpg)
23
Rounding
Design MSE Decrease with Rounding
12 bits, no dynamic scaling, DFT 20
16 bits, no dynamic scaling, DFT 0
12 bits, dynamic scaling, DFT 2
16 bits, no dynamic scaling, DCT 0
12 bits, dynamic scaling, DCT 2
16 bits, dynamic scaling, DCT 0
Conclusion: Never hurt, often helped. Free in hardware (just a register initialization), so always use it. All subsequent results will be using rounding.
![Page 24: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/24.jpg)
24
Dynamic Scaling of DCT
![Page 25: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/25.jpg)
25
Dynamic Scaling of DCT (continued)
![Page 26: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/26.jpg)
26
Limitations of MSE
Image reconstructed from 5.7% of the DCT coefficients, computed with dynamic scaling. MSE = 193
Image reconstructed from 6.1% of the DCT coefficients, computed without dynamic scaling. MSE = 338
![Page 27: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/27.jpg)
27
Performance of 8 Bit Systems
![Page 28: Image Compression System](https://reader035.vdocuments.us/reader035/viewer/2022062411/56816333550346895dd3ba09/html5/thumbnails/28.jpg)
28
More Limitations of MSE(Left) 8 bit DFT coefficients, computed with rounding. Compression ratio = 2.3, MSE = 869.
(Right) 8 bit DFT coefficients, computed without rounding. Compression ratio = 2.1, MSE = 664
(Left) 8 bit DCT coefficients, computed with rounding. Compression ratio = 2.2, MSE = 517.
(Right) 8 bit DCT coefficients, computed without rounding. Compression ratio = 2.4, MSE = 563