View
220
Download
0
Category
Preview:
Citation preview
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 1/23
JPEG & DIB FILEFORMATS FORSTILL ANDMOTION IMAGES
DONE BY:
BHUPESH JAWA (08BIT057)Slot: Morning
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 2/23
The JPEG Standard
JPEG is an image compression standard whichwas accepted as an international standard in1992.
Developed by the Joint Photographic ExpertGroup of the ISO/IEC
For coding and compression of color/gray scale
images
Yields acceptable compression in the 10:1range
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 3/23
The JPEG Standard
JPEG is a lossy compression technique
Based on the DCT
JPEG is a general image compression techniqueindependent of
● Image resolution
● Image and pixel aspect ratio
●
Color system● Image compexity
A scheme for video compression based on JPEGcalled Motion JPEG (MJPEG) exists
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 4/23
The JPEG Standard
JPEG is effective because of the following threeobservations
Image data usually changes slowly across animage, especially within an 8x8 block
● Therefore images contain much redundancy
Experiments indicate that humans are not very
sensitive to the high frequency data images● Therefore we can remove much of this data using
transform coding
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 5/23
The JPEG Standard
Humans are much more sensitive to brightness(luminance) information than to color(chrominance)
JPEG uses chroma subsampling (4:2:0)
The following slide gives an overview of thevarious steps in JPEG compression
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 6/23
JPEG Encoding Overview
The main steps in JPEG encoding are thefollowing
Transform RGB to YUV or YIQ and subsamplecolor
DCT on 8x8 image blocks
Quantization
Zig-zag ordering and run-length encoding
Entropy coding
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 7/23
DCT on Image Blocks
The image is divided up into 8x8 blocks
2D DCT is performed on each block
The DCT is performed independently for eachblock
This is why, when a high degree of compressionis requested, JPEG gives a “blocky” image result
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 8/23
Quantization
Quantization in JPEG aims at reducing the totalnumber of bits in the compressed image
Divide each entry in the frequency space blockby an integer, then round
Use a quantization matrix Q(u, v )
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 9/23
Quantization
Use larger entries in Q for the higher spatialfrequencies
These are entries to the lower right part of thematrix
The following slide shows the default Q(u, v )values for luminance and chrominance
●
Based on psychophysical studies intended tomaximize compression ratios while minimizingperceptual distortion
● Since after division the entries are smaller, we canuse fewer bits to encode them
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 10/23
Quantization
Multiple quantization matrices can be used(perhaps by scaling the defaults), allowing theuser to choose how much compression to use
Trades off quality vs. compression ratio
More compression means larger entries in Q
An example of JPEG coding and decoding onone image block is shown next
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 11/23
Preparation for EntropyCodingWe have seen two main steps in JPEG coding:DCT and quantization
The remaining steps all lead up to entropycoding of the quantized DCT coefficients
These additional data compression steps arelossless
Most of the lossiness is in the quantization step
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 12/23
Run-Length Coding
We now do run-length coding
The AC and DC components are treateddifferently
Since after quantization we have many 0 ACcomponents, RLC is a good idea
Note that most of the zero components are
towards the lower right corner (high spatialfrequencies)
To take advantage of this, use zigzag scanningto create a 64-vector
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 13/23
Zigzag Scan in JPEG
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 14/23
JPEG Modes
JPEG supports several different modes
Sequential Mode
Progresssive ModeSequential is the default mode
Each image component is encoded in a singleleft-to-right, top-to-bottom scan
● This is the mode we have been describing
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 15/23
Progressive Mode
Progressive mode delivers low-quality versionsof the image quickly, and then fills in thedetails in successive passes
This is useful for web browsers, where theimage download might take a long time
The user gets an approximate image quickly
Can be done by sending the DC coefficient and a fewAC coefficients first
Next send some more (low spatial resolution) ACcoefficients, and continue in this way until all of thecoefficients have been sent
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 16/23
Sequential vs. Progressive
Click to edit Master text stylesSecond level● Third level● Fourth level● Fifth level
Click to edit Master text styles
Second level● Third level● Fourth level● Fifth level
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 17/23
JPEG Bitstream
The JPEG hierarchical organization isdescribed in the next slide
Frame is a pictureScan is a picture component
Segment is a group of blocks
Frame header inlcudes
● Bits per pixel
● Size of image
● Quantization table etc.
Scan header includes●
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 18/23
JPEG Bitstream
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 19/23
DIB File Format
The BMP File Format, also known as BitmapImage File or Device Independent Bitmap(DIB) file format or simply a Bitmap, is
a Raster graphicsimage file format used tostore bitmap digital images, independently of the display device (such as a graphics adapter),especially on Microsoft
Windowsand OS/2 operating systems.
The BMP File Format is capable of storing2D digital images of arbitrary width, height, andresolution, both monochrome and color, invarious color depths, and optionally with data
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 20/23
DIBs in memory
A Bitmap Image File loaded into memorybecomes a DIB data structure - an importantcomponent of the Windows GDI API. The in-
memory DIB data structure is almost the sameas the BMP file format, but it does not containthe 14-byte Bitmap File Header and begins withthe DIB Header. For DIBs loaded in memory, the
Color Table can also consist of 16 bit entries,that constitute indexes to the currently realizedpalette(an additional level of indirection),instead of explicit RGB color definitions. In all
cases, the Pixel Array must begin at a memory-
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 21/23
When the size of Gap1 and Gap2 is zero, the in-memory DIB data structure is customarily
referred to as "packed DIB" and can bereferred to by a single pointer pointing to thebeginning of the DIB Header. In all cases, thePixel Array must begin at a memory address
that is a multiple of 4 bytes. In some cases itmay be necessary to adjust the number of entries in the Color Table in order to force thememory address of the Pixel Array to a multipleof 4 bytes. For "packed DIBs" loaded inmemory, the optional Color Profile data shouldimmediately follow the Pixel Array, as depictedin Diag.1 (with Gap1=0 and Gap2=0)."Packed DIBs" are required
by Windows clipboard API functions as well as
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 22/23
Bitmap file header
Click to edit Master text stylesSecond level● Third level●
Fourth level● Fifth level
8/3/2019 Computer Graphics Assignment (08bit057)
http://slidepdf.com/reader/full/computer-graphics-assignment-08bit057 23/23
DIB Header (BitmapInformation Header)
This block of bytes tells the application detailedinformation about the image, which will be usedto display the image on the screen. The block
also matches the header used internally byWindows and OS/2 and has several differentvariants. All of them contain a dword (32 bit)field, specifying their size, so that an application
can easily determine which header is used inthe image. The reason that there are differentheaders is that Microsoft extended the DIBformat several times. The new extended
headers can be used with some GDI functions
Recommended