Presentation on theme: "SWE 423: Multimedia Systems"— Presentation transcript:
1 SWE 423: Multimedia Systems Chapter 7: Data Compression (6)
2 OutlineJPEGIntroductionJPEG RequirementsJPEG Modes and Procedure
3 IntroductionJPEG (Joint Photographic Experts Group) is the result of a joint project between ISO and CCITTISO (International Organization for Standardization)Founded in 1947An international standard-setting body composed of representatives from national standards bodies.CCITT (Comité Consultatif International Téléphonique et Télégraphique)i.e. International Telegraph and Telephone Consultative CommitteeSince 1992 onwards known as ITU-T (International Telecommunication Union - ITU Telecommunication Standardization Sector)Under UNDeveloped many standardsGroup 3 and Group 4 protocols for sending faxes.V.34 and V.90 standards for sending and receiving data from full duplex fax modemsJPEG became an ISO standard in 1992.
4 Introduction JPEG applies to color and gray-scaled still images. Motion JPEG handles video sequences through a fast coding and decoding of still images.Currently, implementations of parts of JPEG are available as s/w only packages or using special hardware support.Most products support the absolutely necessary algorithms.The commercially available JPEG includes the base mode with certain processing restrictions
5 JPEG RequirementsThese were put to ensure widespread distribution and application of JPEG.Independence from image sizeApplicability to any image aspect ratio and any pixel aspect ratioIndependence of the color space and the number of colors usedUnlimited complexity of image contentCurrency regarding the compression factor and image qualityPlatform independence of software solutions and major complexity reductions for h/w solutionsSupport for sequential and progressive decodingSupport for lossless hierarchical coding with different resolutions
7 JPEG Modes JPEG defines four modes Lossy sequential DCT-based mode Must be supported by every JPEG decoderExpanded lossy DCT-based modeProvides a set of enhancements for the base modeLossless modeLow compression ratio and perfect reconstruction of imagesHierarchical modeAccommodates images of different resolutions by using algorithms defined for the other three modes
8 JPEG: Image Preparation JPEG specifies a general image model that can describe most commonly used still image representationsThe mapping between coded color values and the colors they represent is not codedWhich requirements the above two properties satisfy?An image consists of at least one and at most N = 255 components or planes
9 JPEG: Image Preparation An image consists of at least one and at most N = 255 components or planesPlanes: RGB, YIQ, YUVGray-scale images will consist ofRGB color images will consist of ...YUV color images will consist of ...
11 JPEG: Image Preparation Each pixel is represented by p bitsValues in the range of ....Lossy modes of JPEG use p = 8 or 12 bits/pixelLossless modes can use 2 to 12 bits/pixel.Applications must conform to the standards above (if needed, it must transform the image to conform to the above)
12 JPEG: Image Preparation Compressed data includes values of X (maximum of all Xi’s) and Y (maximum of all Yi’s) as well as factors Hi and Vi for each plane representing the relative horizontal and vertical resolutions with respect to the minimal horizontal and vertical resolutions.Hi and Vi are integers ranging between 1 and 4Example: 512 512 image consisting of 3 planes with the following factors:Plane 0: H0 = 4 and V0 = 1Plane 1: H1 = 2 and V1 = 2Plane 2: H2 = 1 and V2 = 1leads to ....The image is divided into data units.Lossless mode: 1 pixel = 1 data unitLossy mode: 8 8 pixels = 1 data unit (block)Consequence of DCT which always transforms connected blocks.
13 JPEG: Image Preparation Within each component, the data units are processed from left to right, as shown below (non-interleaved data ordering).
14 JPEG: Image Preparation Interleaved processing order of data units of different components
16 JPEG: Lossy Sequential DCT Mode After image preparation, the uncompressed image samples are grouped into data units of 8 8 pixels.The order is defined by the MCUsEach sample is encoded using p=8bit.Each pixel is an integer between 0 and 255Image processing is carried out as followsDCT-based transformation coding is carried outPixel values are shifted into (-128, 127) intervalA forward DCT (FDCT) is applied to each transformed pixel valueFor later reconstruction, the decoder uses the IDCTNote that if the FDCT and IDCT computations were exact, it would be possible to reproduce the original 64 pixel values exactly. In practice, precision is limited, and therefore, the technique is lossy.JPEG does not specify a standard precision. Therefore, two different decoders may yield different images as output of the same compressed data.
17 JPEG: Lossy Sequential DCT Mode Image processing is followed by the quantization of all DCT coefficientsLossy process.Specific frequencies can be given more importance than othersTables are used for the quantization and dequantizationMust use the same tables for both processesImage quality may decrease due to quantization
19 JPEG: Lossy Sequential DCT Mode Quantization is followed by Entropy Encoding (using Huffman Coding only)DC coefficients are encoded by subtracting the DC coefficient of the previous data unitSince changes are little in DC values of neighboring data units, the differences are stored instead of the valuesHuffman coding is chosen because it is free (not patented)However, coding tables must be provided by the application (one for DC and one for AC coefficients)AC-Coefficients are processed using the zig-zag sequence
22 JPEG: Expanded Lossy DCT Mode Image preparation here differs from that of lossy sequential using p = 12 instead of p = 8 bits per pixel.The image processing step is analogue to that of lossy sequential.JPEG also provides progressive coding, in addition to sequential coding, where the first decoding run produces a rough unsharp image that is refined during successive runs.Arithmetic entropy coding can be used in addition to Huffman coding in expanded lossy DCT-based mode.
24 JPEG: Lossless Mode Use predictive technique (as explained earlier) One of eightpredictors isselected.
25 JPEG: Hierarchical Mode The main feature here is the encoding of an image at different resolutions.i.e. the compressed image contains images at several resolutionsThe process is done as followsThe prepared image is reduced by a factor of 2n and compressedThe original image is then reduced by a factor of 2n – 1 vertically and horizontally. The previously compressed image is subtracted from this one and the result is once again compressedThis process repeats until the image with full resolution is compressedCan use both lossy DCT-based techniques or lossless compression techniquesComputationally intensive and requires considerable storage space.The advantage of this mode is that applications working with lower resolution do not need to first decode the whole image and then reduce the resolution.