DSP C5000
Chapter 18
Image Compression and
Hardware Extensions
Copyright © 2003 Texas Instruments. All rights reserved.
Image Compression

Discrete Cosine Transform (DCT) based
compression

Still image: JPEG.


Video: H263, MPEG4.


ESIEE, Slide 2
Remove spatial redundancy
Remove spatial redundancy
Remove temporal redundancy
Copyright © 2003 Texas Instruments. All rights reserved.
JPEG Encoder

Image is split into 8x8 pixel block that are
processed .

DCT is applied on input block to obtain the
frequency data.
Values are read from low to high frequency
thanks to zig-zag addressing.
Data are then quantized according to a quality
factor.
This output is then run length and entropy
coded.



ESIEE, Slide 3
Copyright © 2003 Texas Instruments. All rights reserved.
JPEG Decoder




ESIEE, Slide 4
Data are entropy decoded.
They are dequantized according to a quality
factor.
Zig-zag addressing to re-order the data pixel by
pixel.
Inverse DCT to recover spatial data.
Copyright © 2003 Texas Instruments. All rights reserved.
H263 and MPEG4 encoder

Same basic building blocks
Hardware accelerator provided by C5509/10
ESIEE, Slide 5
Copyright © 2003 Texas Instruments. All rights reserved.
H263 and MPEG4 Decoder

Same basic building blocks
Hardware accelerator provided by C5509/10
ESIEE, Slide 6
Copyright © 2003 Texas Instruments. All rights reserved.
Hardware Extensions

‘C5509 and ‘C5510 provide H/W
extensions for video compression:




Hardware extensions are embedded coprocessors:


ESIEE, Slide 7
DCT, IDCT
Pixel interpolation
Motion estimation
Access to ACx, DARAM and SARAM.
Provide video codec with less than half of
the processing bandwidth.
Copyright © 2003 Texas Instruments. All rights reserved.
DCT H/W Extension 1 of 5

Allows 4x4 and 8x8 pixels DCT/IDCT
computation:

I (u, v ) 
 u v 
4

i( x, y) 
2D DCT
 2 x  1u
i
(
x
,
y
)
cos


16

x 0 y 0
7
7
  2 x  1v 
 cos

16
 

2D IDCT
 u v 
4
 2 x  1u
I
(
u
,
v
)
cos


16

u0 v 0
7
7
  2 x  1v 
 cos

16
 

1 / 2 if
z0
 z   
else
 1
ESIEE, Slide 8
Copyright © 2003 Texas Instruments. All rights reserved.
DCT H/W Extension 2 of 5

Basic steps to complete a 2D
DCT/IDCT:



ESIEE, Slide 9
Input Data: macro block (4x4 or 8x8) is
read in (DCT). DCT coefficient matrix is
read in (IDCT).
Column DCT/IDCT process: output to
temporary registers that will be transposed
for Row processing.
Row DCT/IDCT process: data read from
temporary register which are processed
column by column.
Copyright © 2003 Texas Instruments. All rights reserved.
DCT H/W Extension 3 of 5
ESIEE, Slide 10
Copyright © 2003 Texas Instruments. All rights reserved.
DCT H/W Extension 4 of 5

Instruction set:




Load+computation+transfer to accumulator:
ACy=copr(k8,ACx,Xmem,Ymem)
Computation+transfer to accumulator+memory
write:
ACy=copr(k8,ACx,ACy),Lmem=Acz
Special instructions:
ACy=copr(k8,ACx,ACy)
Refer to application note for details and listings
of macros realizing complete 8x8 DCT/IDCT.
ESIEE, Slide 11
Copyright © 2003 Texas Instruments. All rights reserved.
DCT H/W Extension 5 of 5

ESIEE, Slide 12
H/W extensions can be used through Ccallable functions provided by IMLIB
Copyright © 2003 Texas Instruments. All rights reserved.
Debug
•To look at the internal register of the hardware extension …
DCT and IDCT
Hardware accelerator
registers
ESIEE, Slide 13
Copyright © 2003 Texas Instruments. All rights reserved.
Tutorial DCT/IDCT with IMLIB




ESIEE, Slide 14
Describe step by step how to use H/W
extensions with IMLIB.
Requires installation of IMLIB before
continuing.
Requires special memory configuration
to obtain optimum performance.
CCS allows display of image contained
in DSP memory.
Copyright © 2003 Texas Instruments. All rights reserved.
Memory Configuration
hwdct.cdb
dct.cmd
ESIEE, Slide 15
Copyright © 2003 Texas Instruments. All rights reserved.
Display Input Image 1 of 2





ESIEE, Slide 16
Load hwdct.pjt
Build and load application
Input image is « goldhill » 128x128
which is included by the header file
(#include «imagesample.h») at the
address goldhill
To have the internal memory initialized
use Debug>go to main command.
You are now ready to display the input
image using view>Graph>image
Copyright © 2003 Texas Instruments. All rights reserved.
Display Input Image 2 of 2
ESIEE, Slide 17
Copyright © 2003 Texas Instruments. All rights reserved.
In place DCT Computation



ESIEE, Slide 18
Copyright © 2003 Texas Instruments. All rights reserved.
Actual dct.c Program





ESIEE, Slide 19
Copyright © 2003 Texas Instruments. All rights reserved.
Output Display and Initialization
ESIEE, Slide 20
Copyright © 2003 Texas Instruments. All rights reserved.
Output Buffer Update
ESIEE, Slide 21
Copyright © 2003 Texas Instruments. All rights reserved.
References



ESIEE, Slide 22
JPEG for digital panel (SPRA664)
TMS320C55x Hardware extensions for
image/video applications - Programmer’s
reference (SPRU098)
TMS320C55x image/video processing
library programmer’s reference (SPRU037)
Copyright © 2003 Texas Instruments. All rights reserved.