NAME: MATHEW MAKAU REG NO: 19/02580 COURSE: BSCiT UNIT: BIT3204A DISTRIBUTED MULTIMEDIA SYSTEMS ASSIGNMENT ONE SEP-DEC Demonstrate how the following Compression Algorithms work? a) Arithmetic Coding. Arithmetic coding is a popular compression algorithm particularly useful for a relatively small and skewed alphabet. In Theory, an arithmetic coding algorithm encodes an entire file as a sequence of symbols into a single decimal number. The input symbols are processed one at each iteration. Arithmetic coding is used in a variety of lossless and lossy compression applications. The initial interval [0,1) (or [0,1]) is successfully divided into subintervals on each iteration according to the probability distribution. The subinterval that corresponds to the input symbol is selected for next iteration. The interval derived at the end of this division process is used to decide the codeword for the entire sequence of symbols. The figure below illustrates the basic arithmetic coding process. Here, a five-symbol sequence or message, a1,a2,a3,a4 fro, a four symbol source is coded. At the start of the coding process, the message is assumed to occupy the entire half-open interval [0,1] This interval is divided into four regions based on the probabilities of each source symbol. Symbol ax for example is associated with subinterval [0,0.2) because it is the first symbol of the message being coded, the message interval is initially narrowed to [0,0.2] b) JPEG. The JPEG compression is a block based compression.. The data reduction is done by the subsampling of the color information, the quantization of the DCT-coefficients and the Huffman-coding(reorder and coding). The user can control the amount of image quality loss due to the data reduction by setting (or chose presets) The algorithm can be separated in different steps. The lossy compression of 8 bit RGB data “lossy means the compression will also reduce some of the image content. c) MPEG. MPEG achieves its high compression rate by storing only the changes from one frame to another, instead of each entire frame. The video information is then encoded using a technique called Discrete Cosine Transform (DCT) . MPEG uses a type of lossy compression, since some data is removed. The MPEG video compression algorithm relies on two basic techniques: Block based motion compensation for the reduction of the temporal redundancy and transform domain based compression for the reduction of spatial redundancy. Motion compensation techniques are applied with both predictive and interpolative technique. d) Shannon-Fano Algorithm. Shanno –Fano algorithm is an entropy encoding technique for lossless data compression of multimedia. Named after Cloude Shannon and Robert Fano. It assigns a code to each symbol based on their probabilities of occurrence. It is a variable-length encoding scheme, that is, the codes assigned to the symbols will be of varying length. How It Works: i. Create a list of probabilities or frequency counts for the given set of symbols so that the relative frequency of occurrence of each symbol is known. ii. Sort the list of symbols in decreasing order of probability, the most probable ones to the left and the least probable ones to the right. iii. Split the list into two parts with the total probability of both the parts being as close to each other as possible. iv. Assign the value 0 to the left part and 1 to the right part. v. Repeat steps 3 and 4 for each part, until all the symbols are split into individual subgroups. Example: The given task is to construct Shannon codes for the given set of symbols using the Shannon-fano lossless compression technique: Step: Tree: Solution: 1. Upon arranging the symbols in decreasing order of probability. P(D) + P(B) = 0.30 + 0.2 = 0.58 And, P(A) + P(C) + P(E) = 0.22 + 0.15 + 0.05 = 0.42 And since the equally split the table, assign them the values 0 and 1 respectively: Tree: 2. Now, in {D,B} group: P(D) = 0.30 and P(B) = 0.28 Which means that P(D)-P(B) so divide, {D,B} into {D} and {B} and assign 0 to D and 1 to B. Step: Tree: 3. In {A,C,E} group, P(A) = 0.22 and P(C) + P(E) = 0.20 So the group is divided into: {A} and {C, E} And they are assigned values 0 and 1 respectively. 4. In {C, E} group: P(C) = 0.15 and P(E) = 0.05 So divide them into{C} and {E} and assign 0 to {C} and 1 to {E}. Step: Tree: Note: The splitting is now stopped as each symbol is separated now. The Shannon codes for the set of symbols are: