$30
1
CMPT 365 Multimedia Systems
Programming Assignment 2
Q. 1. (LZW coding) Read a sequence that consists of letters A, B, and C only and assume that the initial
dictionary is
0 A
1 B
2 C
(1) Print out the output sequence for the input sequence using the LZW coding algorithm.
(2) Print out the dictionary in the end of the LZW coding.
The length of the input sequence is no more than 64 letters.
Q.2. 2D (Discrete Cosine Transform) Read N (an integer between 2 and 10) and then an input matrix of size
NxN, print out the 2D DCT transform result (rounding to integers). See Slide 41 in Lossy compression for an
example. Note that you can’t call any lib to do this; you have to write your own code to implement the matrix
operation.