Data Compression: by Dilip Jha Assistant Prof. GBPEC, Pauri
Data Compression: by Dilip Jha Assistant Prof. GBPEC, Pauri
Introduction
Fax machine: 40000 DPSI => 4 million dots per page 56 KBPS modem, time to transmit =? Video: 30 pictures per second Each picture = 200,000 dots or pixels 8-bits to represent each primary color Bits required for one picture = ? Two hour movie requires = ?
Introduction
Compression is a way to reduce the number of bits in a frame but retaining its meaning. Decreases space, time to transmit, and cost Technique is to identify redundancy and to eliminate it If a file contains only capital letters, we may encode all the 26 alphabets using 5-bit numbers instead of 8-bit
Introduction
If the file had n-characters, then the savings = (8n-5n)/8n => 37.5%
Relative Encoding
Relative Encoding: Some applications may not benefit from the above: video image -> little repetitive within, but much repetition from one image to the next Differential encoding is based on coding only the difference from one to the next
Relative Encoding
Relative Encoding: 1234 1334 0100 2537 2537 0000 3648 3647 0 0 0 -1 4759 3759 -1 0 0 0 1st Frame 2nd Frame Difference Resulting difference can be RLE.
Image Representation
BW pixels each represented by 8-bit level Color composed of R, G, B primaries, each is represented by 8-bit level -> Each color pixel can be represented by one of 28 .28.28 = 224 colors VGA screen: 640 * 480 pixels -> 640 * 480 * 24 = 7, 372, 800 bits
Image Compression
JPEG compression both for grayscale and color images Previous compression methods were lossless it was possible to recover all the information from the compressed code JPEG is lossy: image recovered may not be the same as the original
JPEG Compression
Case 1: all Ps are same => image of single color with no variation at all, AC coefficients are all zeros. Case 2: little variation in Ps => many, not all, AC coefficients are zeros. Case 3: large variation in Ps => a few AC coefficients are zeros.
JPEG Compression
Quantization: Provides an way of ignoring small differences in an image that may not be perceptible. Another array Q is obtained by dividing each element of T by some number and rounding-off to nearest integer => loss
Multimedia Compression
I (intra-picture) - frame: Just a JPEG encoded image. P (predicted) frame: Encoded by computing the differences between a current and a previous frame. B (bidirectional) - frame: Similar to Pframe except that it is interpolated between previous and future frame.