DataCompressionLab_2014

22
5/27/2018 DataCompressionLab_2014-slidepdf.com http://slidepdf.com/reader/full/datacompressionlab2014 1/22 Laxmi Devi Institute of Engineering &Technology Chikani, Alwar Lab Manual Data Compression Techniques Lab Submitted By: Submitted To: Manish Kumar Mr. Brij Kishore IT, 8 th  Sem. (Asst. Prof. CSE/IT) 10ELDIT011 

description

Data Compression Techniques offers you to take DCT lab Manual

Transcript of DataCompressionLab_2014

Laxmi Devi Institute of Engineering &Technology Chikani, Alwar

Lab Manual

Data Compression Techniques Lab

Submitted By: Submitted To:Manish Kumar Mr. Brij KishoreIT, 8th Sem. (Asst. Prof. CSE/IT)10ELDIT011

Data Compression: In computer science and information theory, data compression, source coding, or bit-rate reduction involves encodinginformation using fewer bits than the original representation. Compression can be either lossy or lossless. Lossless compression reduces bits by identifying and eliminating statistical redundancy. No information is lost in lossless compression. Lossy compression reduces bits by identifying marginally important information and removing it.Compression is useful because it helps reduce the consumption of resources such as data space or transmission capacity. Because compressed data must be decompressed to be used, this extra processing imposes computational or other costs through decompression. For instance, a compression scheme for video may require expensive hardware for the video to be decompressed fast enough to be viewed as it is being decompressed, and the option to decompress the video in full before watching it may be inconvenient or require additional storage. The design of data compression schemes involve trade-offs among various factors, including the degree of compression, the amount of distortion introduced (e.g., when using lossy data compression), and the computational resources required to compress and uncompress the data.LossyLossless data compression algorithms usually exploit statistical redundancy to represent data more concisely without losing information. Lossless compression is possible because most real-world data has statistical redundancy. For example, an image may have areas of color that do not change over several pixels; instead of coding "red pixel, red pixel, ..." the data may be encoded as "279 red pixels". This is a simple example of run-length encoding; there are many schemes to reduce size by eliminating redundancy.Lossy image compression is used in digital cameras, to increase storage capacities with minimal degradation of picture quality. Similarly, DVDs use the lossyMPEG-2Video codec for video compression. In lossy audio compression, methods of psychoacoustics are used to remove non-audible (or less audible) components of the signal. Compression of human speech is often performed with even more specialized techniques, so that "speech compression" or "voice coding" is sometimes distinguished as a separate discipline from "audio compression". Different audio and speech compression standards are listed under audio codecs. Voice compression is used in Internet telephony for example, while audio compression is used for CD ripping and is decoded by audio players.LosslessThe theoretical background of compression is provided by information theory (which is closely related to algorithmic information theory) for lossless compression, and by ratedistortion theory for lossy compression. These fields of study were essentially created by Claude Shannon, who published fundamental papers on the topic in the late 1940s and early 1950s. Coding theory is also related. The idea of data compression is deeply connected with statistical inference.Machine learningThere is a close connection between machine learning and compression: a system that predicts the posterior probabilities of a sequence given its entire history can be used for optimal data compression (by using arithmetic coding on the output distribution), while an optimal compressor can be used for prediction (by finding the symbol that compresses best, given the previous history). Data differencing Data compression can be viewed as a special case of data differencing:[3][4] Data differencing consists of producing a difference given a source and a target, with patching producing a target given a source and a difference, while data compression consists of producing a compressed file given a target, and decompression consists of producing a target given only a compressed file. Thus, one can consider data compression as data differencing with empty source data, the compressed file corresponding to a "difference from nothing". This is the same as considering absolute entropy (corresponding to data compression) as a special case of relative entropy (corresponding to data differencing) with no initial data. Outlook and currently unused potentialIt is estimated that the total amount of the information that is stored on the world's storage devices could be further compressed with existing compression algorithms by a remaining average factor of 4.5: 1. It is estimated that the combined technological capacity of the world to store information provides 1,300 Exabytes of hardware digits in 2007, but when the corresponding content is optimally compressed, this only represents 295 Exabytes of Shannon information. Audio codec Audio data compression, as distinguished from dynamic range compression, reduces the transmission bandwidth and storage requirements of audio data. Audio compression algorithms are implemented in software as audio codecs. Lossy audio compression algorithms provide higher compression at the cost of fidelity, are used in numerous audio applications. These algorithms almost all rely on psychoacoustics to eliminate less audible or meaningful sounds, thereby reducing the space required to store or transmit them.In both lossy and lossless compression, information redundancy is reduced, using methods such as coding, pattern recognition and linear prediction to reduce the amount of information used to represent the uncompressed data.The acceptable trade-off between loss of audio quality and transmission or storage size depends upon the application. For example, one 640MB compact disc (CD) holds approximately one hour of uncompressed high fidelity music, less than 2 hours of music compressed lossless, or 7 hours of music compressed in the MP3 format at a medium bit rate. A digital sound recorder can typically store around 200 hours of clearly intelligible speech in 640MB.Lossless audio compression produces a representation of digital data that decompresses to an exact digital duplicate of the original audio stream, unlike playback from lossy compression techniques such as Vorbis and MP3. Compression ratios are around 5060% of original size [7], similar to those for generic lossless data compression. Lossy compression depends upon the quality required, but typically yields files of 5 to 20% of the size of the uncompressed original.[8] Lossless compression is unable to attain high compression ratios due to the complexity of wave forms and the rapid changes in sound forms. Codecs like FLAC, Shorten and TTA use linear prediction to estimate the spectrum of the signal. Many of these algorithms use convolution with the filter [-1 1] to slightly whiten or flatten the spectrum, thereby allowing traditional lossless compression to work more efficiently. The process is reversed upon decompression.When audio files are to be processed, either by further compression or for editing, it is desirable to work from an unchanged original (uncompressed or lossless compressed). Processing of a loosely compressed file for some purpose usually produces a final result inferior to creation of the same compressed file from an uncompressed original. In addition to sound editing or mixing, lossless audio compression is often used for archival storage, or as master copies.A number of lossless audio compression formats exist. Shorten was an early lossless format. Newer ones include Free Lossless Audio Codec (FLAC), Apple's Apple Lossless, MPEG-4 ALS, Microsoft's Windows Media Audio 9 Lossless (WMA Lossless), Monkey's Audio, and TTA. See list of lossless codecs for a complete list.Some audio formats feature a combination of a lossy format and a lossless correction; this allows stripping the correction to easily obtain a lossy file. Such formats include MPEG-4 SLS (Scalable to Lossless), WavPack, and OptimFROGDualStream.Other formats are associated with a distinct system, such as: Direct Stream Transfer, used in Super Audio CD Meridian Lossless Packing, used in DVD-Audio, Dolby TrueHD, Blu-ray and HD DVDLossy audio compression

Comparison of acoustic spectrograms of a song in an uncompressed format and various lossy formats. The fact that the lossy spectrograms are different from the uncompressed one indicates that they are in fact lossy, but nothing can be assumed about the effect of the changes on perceived quality.Lossy audio compression is used in a wide range of applications. In addition to the direct applications (mp3 players or computers), digitally compressed audio streams are used in most video DVDs; digital television; streaming media on the internet; satellite and cable radio; and increasingly in terrestrial radio broadcasts. Lossy compression typically achieves far greater compression than lossless compression (data of 5 percent to 20 percent of the original stream, rather than 50 percent to 60 percent), by discarding less-critical data.The innovation of lossy audio compression was to use psychoacoustics to recognize that not all data in an audio stream can be perceived by the human auditory system. Most lossy compression reduces perceptual redundancy by first identifying sounds which are considered perceptually irrelevant, that is, sounds that are very hard to hear. Typical examples include high frequencies, or sounds that occur at the same time as louder sounds. Those sounds are coded with decreased accuracy or not coded at all. Due to the nature of lossy algorithms, audio quality suffers when a file is decompressed and recompressed (digital generation loss). This makes lossy compression unsuitable for storing the intermediate results in professional audio engineering applications, such as sound editing and multitrack recording. However, they are very popular with end users (particularly MP3), as a megabyte can store about a minute's worth of music at adequate quality.Coding methodsIn order to determine what information in an audio signal is perceptually irrelevant, most lossy compression algorithms use transforms such as the modified discrete cosine transform (MDCT) to convert time domain sampled waveforms into a transform domain. Once transformed, typically into the frequency domain, component frequencies can be allocated bits according to how audible they are. Audibility of spectral components is determined by first calculating a masking threshold, below which it is estimated that sounds will be beyond the limits of human perception.The masking threshold is calculated using the absolute threshold of hearing and the principles of simultaneous maskingthe phenomenon wherein a signal is masked by another signal separated by frequency, and, in some cases, temporal maskingwhere a signal is masked by another signal separated by time. Equal-loudness contours may also be used to weight the perceptual importance of different components. Models of the human ear-brain combination incorporating such effects are often called psychoacoustic models.Other types of lossy compressors, such as the linear predictive coding (LPC) used with speech, are source-based coders. These coders use a model of the sound's generator (such as the human vocal tract with LPC) to whiten the audio signal (i.e., flatten its spectrum) prior to quantization. LPC may also be thought of as a basic perceptual coding technique; reconstruction of an audio signal using a linear predictor shapes the coder's quantization noise into the spectrum of the target signal, partially masking it.Lossy formats are often used for the distribution of streaming audio, or interactive applications (such as the coding of speech for digital transmission in cell phone networks). In such applications, the data must be decompressed as the data flows, rather than after the entire data stream has been transmitted. Not all audio codecs can be used for streaming applications, and for such applications a codec designed to stream data effectively will usually be chosen.Latency results from the methods used to encode and decode the data. Some codecs will analyze a longer segment of the data to optimize efficiency, and then code it in a manner that requires a larger segment of data at one time in order to decode. (Often codecs create segments called a "frame" to create discrete data segments for encoding and decoding.) The inherent latency of the coding algorithm can be critical; for example, when there is two-way transmission of data, such as with a telephone conversation, significant delays may seriously degrade the perceived quality.In contrast to the speed of compression, which is proportional to the number of operations required by the algorithm, here latency refers to the number of samples which must be analysed before a block of audio is processed. In the minimum case, latency is 0 zero samples (e.g., if the coder/decoder simply reduces the number of bits used to quantize the signal). Time domain algorithms such as LPC also often have low latencies, hence their popularity in speech coding for telephony. In algorithms such as MP3, however, a large number of samples have to be analyzed in order to implement a psychoacoustic model in the frequency domain, and latency is on the order of 23 ms (46 ms for two-way communication).Speech encodingSpeech encoding is an important category of audio data compression. The perceptual models used to estimate what a human ear can hear are generally somewhat different from those used for music. The range of frequencies needed to convey the sounds of a human voice are normally far narrower than that needed for music, and the sound is normally less complex. As a result, speech can be encoded at high quality using a relatively low bit rate.This is accomplished, in general, by some combination of two approaches: Only encoding sounds that could be made by a single human voice. Throwing away more of the data in the signalkeeping just enough to reconstruct an "intelligible" voice rather than the full frequency range of human hearing. Perhaps the earliest algorithms used in speech encoding (and audio data compression in general) were the A-law algorithm and the -law algorithm.History

Solidyne 922: The world's first commercial audio bit compression card for PC, 1990A literature compendium for a large variety of audio coding systems was published in the IEEE Journal on Selected Areas in Communications (JSAC), February 1988. While there were some papers from before that time, this collection documented an entire variety of finished, working audio coders, nearly all of them using perceptual (i.e. masking) techniques and some kind of frequency analysis and back-end noiseless coding.[9] Several of these papers remarked on the difficulty of obtaining good, clean digital audio for research purposes. Most, if not all, of the authors in the JSAC edition were also active in the MPEG-1 Audio committee.Video compression uses modern coding techniques to reduce redundancy in video data. Most video compression algorithms and codecs combine spatial image compression and temporal motion compensation. Video compression is a practical implementation of source coding in information theory. In practice most video codecs also use audio compression techniques in parallel to compress the separate, but combined data streams.The majority of video compression algorithms use lossy compression. Large amounts of data may be eliminated while being perceptually indistinguishable. As in all lossy compression, there is a tradeoff between video qualities, cost of processing the compression and decompression, and system requirements. Highly compressed video may present visible or distracting artifacts.Video compression typically operates on square-shaped groups of neighboring pixels, often called macro blocks. These pixel groups or blocks of pixels are compared from one frame to the next and the video compression codec sends only the differences within those blocks. In areas of video with more motion, the compression must encode more data to keep up with the larger number of pixels that are changing. Commonly during explosions, flames, flocks of animals, and in some panningshots, the high-frequency detail leads to quality decreases or to increases in the variable bitrate.Encoding theoryVideo data may be represented as a series of still image frames. The sequence of frames contains spatial and temporal redundancy that video compression algorithms attempt to eliminate or code in a smaller size. Similarities can be encoded by only storing differences between frames, or by using perceptual features of human vision. For example, small differences in color are more difficult to perceive than are changes in brightness. Compression algorithms can average a color across these similar areas to reduce space, in a manner similar to those used in JPEG image compression.[12] Some of these methods are inherently lossy while others may preserve all relevant information from the original, uncompressed video.Because interframe compression copies data from one frame to another, if the original frame is simply cut out (or lost in transmission), the following frames cannot be reconstructed properly. Some video formats, such as DV, compress each frame independently using intraframe compression. Making 'cuts' in intraframe-compressed video is almost as easy as editing uncompressed video: one finds the beginning and ending of each frame, and simply copies bit-for-bit each frame that one wants to keep, and discards the frames one doesn't want. Another difference between intraframe and interframe compression is that with intraframe systems, each frame uses a similar amount of data. In most interframe systems, certain frames (such as "I frames" in MPEG-2) aren't allowed to copy data from other frames, and so require much more data than other frames nearby.It is possible to build a computer-based video editor that spots problems caused when I frame are edited out while other frames need them. This has allowed newer formats like HDV to be used for editing. However, this process demands a lot more computing power than editing intraframe compressed video with the same picture quality.Today, nearly all commonly used video compression methods (e.g., those in standards approved by the ITU-T or ISO) apply a discrete cosine transform (DCT) for spatial redundancy reduction. Other methods, such as fractal compression, matching pursuit and the use of a discrete wavelet transform (DWT) have been the subject of some research, but are typically not used in practical products (except for the use of wavelet coding as still-image coders without motion compensation). Interest in fractal compression seems to be waning, due to recent theoretical analysis showing a comparative lack of effectiveness of such methods. [Citation needed]TimelineThe following table is a partial history of international video compression standards.History of Video Compression Standards

YearStandardPublisherPopular Implementations

1984H.120ITU-T

1990H.261ITU-TVideoconferencing, Video telephony

1993MPEG-1 Part 2ISO, IECVideo-CD

1995H.262/MPEG-2 Part 2ISO, IEC, ITU-TDVD Video, Blu-ray, Digital Video Broadcasting, SVCD

1996H.263ITU-TVideoconferencing, Video telephony, Video on Mobile Phones (3GP)

1999MPEG-4 Part 2ISO, IECVideo on Internet (DivX, Xvid ...)

2003H.264/MPEG-4 AVCISO, IEC, ITU-TBlu-ray, Digital Video Broadcasting, iPod Video, HD DVD

2008VC-2 (Dirac)ISO, BBCVideo on Internet, HDTV broadcast, UHDTV

Image CompressionThe LZW compression algorithm in its simplest form is shown in Figure 1. A quick examination of the algorithm shows that LZW is always trying to output codes for strings that are already known. And each time a new code is output, a new string is added to the string table.Routine LZW_COMPRESSPLAIN TEXTCODE:1. STRING = get input character2. WHILE there are still input characters DO3. CHARACTER = get input character4. IF STRING+CHARACTER is in the string table then5. STRING = STRING +character6. ELSE7. output the code for STRING8. add STRING+CHARACTER to the string table9. STRING = CHARACTER10. END of IF11. END of WHILE12. Output the code for STRING The Compression Algorithm : A sample string used to demonstrate the algorithm is shown in Figure 2. The input string is a short list of English words separated by the '/' character. Stepping through the start of the algorithm for this string, you can see that the first pass through the loop, a check is performed to see if the string "/W" is in the table. Since it isn't, the code for '/' is output, and the string "/W" is added to the table. Since we have 256 characters already defined for codes 0-255, the first string definition can be assigned to code 256. After the third letter, 'E', has been read in, the second string code, "WE" is added to the table, and the code for letter 'W' is output. This continues until in the second word, the characters '/' and 'W' are read in, matching string number 256. In this case, the code 256 is output, and a three character string is added to the string table. The process continues until the string is exhausted and all of the codes have been output.

Input String = /WED/WE/WEE/WEB/WET

Character InputCode OutputNew code valueNew String

/W/256/W

EW257WE

DE258ED

/D259D/

WE256260/WE

/E261E/

WEE260262/WEE

/W261263E/W

EB257264WEB

/B265B/

WET260266/WET

EOFT

The Compression ProcessThe sample output for the string is shown in Figure 2 along with the resulting string table. As can be seen, the string table fills up rapidly, since a new string is added to the table each time a code is output. In this highly redundant input, 5 code substitutions were output, along with 7 characters. If we were using 9 bit codes for output, the 19 character input string would be reduced to a 13.5 byte output string. Of course, this example was carefully chosen to demonstrate code substitution. In real world examples, compression usually doesn't begin until a sizable table has been built, usually after at least one hundred or so bytes have been read in.

DecompressionThe companion algorithm for compression is the decompression algorithm. It needs to be able to take the stream of codes output from the compression algorithm, and use them to exactly recreate the input stream. One reason for the efficiency of the LZW algorithm is that it does not need to pass the string table to the decompression code. The table can be built exactly as it was during compression, using the input stream as data. This is possible because the compression algorithm always outputs the STRING and CHARACTER components of a code before it uses it in the output stream. This means that the compressed data is not burdened with carrying a large string translation table.Routine LZW_DECOMPRESSPLAIN TEXTCODE:1. Read OLD_CODE2. output OLD_CODE3. WHILE there are still input characters DO4. Read NEW_CODE5. STRING = get translation of NEW_CODE6. output STRING7. CHARACTER = first character in STRING8. add OLD_CODE + CHARACTER to the translation table9. OLD_CODE = NEW_CODE10. END of WHILE

The Decompression AlgorithmJust like the compression algorithm, it adds a new string to the string table each time it reads in a new code. All it needs to do in addition to that is translate each incoming code into a string and send it to the output.Output of the algorithm given the input created by the compression earlier in the article. The important thing to note is that the string table ends up looking exactly like the table built up during compression. The output string is identical to the input string from the compression algorithm. Note that the first 256 codes are already defined to translate to single character strings, just like in the compression code.

Input Codes: / W E D 256 E 260 261 257 B 260 T

Input/NEW_CODEOLD_CODESTRING/OutputCHARACTERNew table entry

///

W/WW256 = /W

EWEE257 = WE

DEDD258 = ED

256D/W/259 = D/

E256EE260 = /WE

260E/WE/261 = E/

261260E/E262 = /WEE

257261WEW263 = E/W

B257BB264 = WEB

260B/WE/265 = B/

T260TT266 = /WET

The Decompression Process Audio compression IntroductionThe first question to my previous article (C Sharp Ripper) was about how to rip directly to MP3 format. Then I looked for some MP3 compressor done for .NET framework and I couldn't find the exact solution, so I decided to write one. The solution was to use the LAME MP3 encoder, specifically to wrap in C# the functions of lame_enc.dll. See this website for technical and copyright information regarding the LAME project.In this work, there is code from the article: A low level audio player in C# by Ianier Munoz.BackgroundWhile it is true that the LAME encoder is written in C and all source code is available, one could think of compiling these source files in managed C++ to obtain a managed compressor. However, an easier way to achieve that goal is to use the LAME compressor through the functions exposed by the lame_enc.dll. This DLL exports a few functions and it is relatively easy to use. One problem to mention about the use of the DLL is that in the current version, it is not possible to compress two streams at the same time. The compressor I describe in this article (Mp3Writer) is a class derived from Audio Writer, which is a binary writer that can be used as a base of writers for different audio streams (different audio formatters, compressors, etc.). Audio Writer receives audio data in PCM format, then the data is compressed and written to the resulting stream, or just written without modifications using a specific format (WAV format, for instance, as in the Wave Writer class).Using the codeAudio Writer and other base and tools classes are in a library named yeti.media. All other classes related to the MP3 compressor are in a library yeti.mp3. Within this library, I included all the translation of structures, constants, and functions needed to use lame_enc.dll. The following code shows the simplest way to use the MP3 compressor with the default configuration:Collapse | Copy Code...using WaveLib;using Yeti.MMedia; using Yeti.MMedia.Mp3;WaveStream InStr = new WaveStream("SomeFile.wav");try{ Mp3Writer writer = new Mp3Writer(newFileStream("SomeFile.mp3", FileMode.Create), InStr.Format);try {byte[] buff = newbyte[writer.OptimalBufferSize];int read = 0;while ( (read = InStr.Read(buff, 0, buff.Length)) >0 ) { writer.Write(buff, 0, read); } }finally { writer.Close(); }}finally{ InStr.Close();}

First, a Wave Stream is created to read the uncompressed audio data from a WAV file, and then a Mp3Writer is created. The Mp3Writer constructor is called passing as the first parameter the stream where to write the resulting MP3 stream (in this case, a File Stream), and as second parameter the Wave Format that specifies the format of the input data. The input stream is read until the end and all the data is written to the writer, which converts it to MP3 format and saves the result to the output stream.There are two other overloads of the Mp3Writer constructor: one that accepts a BE_CONFIG instance, which is a structure translated from LAME that describes how the stream must be compressed (bit rate, compression method, quality, etc.). The other overload accepts aMp3WriterConfig instance, which wraps BE_CONFIG and it is serializable, so it can be used to persist the compressor configuration using serialization. Another important class is EditMp3Writer, which is a custom control that can be included in a form or dialog to configure the parameters of the compressor, as shown in the sample code.Another example of using the writer could be an improved version of the ripper described in my article C Sharp Ripper to rip directly to MP3 format. In the fileForm1.cs, inside the handler of the "Save as... button, there is the line:Collapse | Copy Codem_Writer = new WaveWriter(WaveFile, Format); This may be changed to:Collapse | Copy Codem_Writer = new Mp3Writer(WaveFile, Format);The rest of the code remains without change and, of course, if you need more control on the compressor parameters then you should add extra code to use BE_CONFIG and/or Mp3WriterConfig.ConclusionAs shown here, the use of this compressor is relatively easy. When more control about the compression process is required, then a deeper knowledge about the meaning and use of all fields of each LAME structure is mandatory. It is also important to note that if you use this code in any product, you should observe the LAME product licensing details.Any use of this product does not convey a license under the relevant intellectual property of Thomson and/or FraunhoferGesellschaft nor imply any right to use this product in any finished end user or ready-to-use final product. An independent license for such use is required. For details, please visit http://www.mp3licensing.com.You can find a first version of a Widows Media Audio (WMA) compressor in my article, Windows Media Audio Compressor. A better compressor and a translation of the Windows Media Format SDK could be found in my article, C Sharp Windows Media Format SDK translation.Video CompressionA video codec is a device or software that enables video compression and/or decompression for digital video. The compression usually employs lossy data compression. Historically, video was stored as an analog signal on magnetic tape. Around the time when the compact disc entered the market as a digital-format replacement for analog audio, it became feasible to also begin storing and using video in digital form and a variety of such technologies began to emerge.Audio and video call for customized methods of compression. Engineers and mathematicians have tried a number of solutions for tackling this problem.There is a complex balance between the video quality, the quantity of the data needed to represent it (also known as the bit rate), the complexity of the encoding and decoding algorithms, robustness to data losses and errors, ease of editing, random access, the state of the art of compression algorithm design, end-to-end delay, and a number of other factors.ApplicationsDigital video codecs are found in DVD systems (players, recorders), Video CD systems, in emerging satellite and digital terrestrial broadcast systems, various digital devices and software products with video recording and/or playing capability. Online video material is encoded by a variety of codecs, and this has led to the availability of codec packs - a pre-assembled set of commonly used codecs combined with an installer available as a software package for PCs, such as K-Lite Codec Pack. Encoding media by the public has seen an upsurge with the availability of CD and DVD-writers.Video codec designVideo codecs seek to represent a fundamentally analog data set in a digital format. Because of the design of analog video signals, which represent luma and color information separately, a common first step in image compression in codec design is to represent and store the image in an YCbCr color space. The conversion to YCbCr provides two benefits: first, it improves compressibility by providing decor relation of the color signals; and second, it separates the luma signal, which is perceptually much more important, from the chroma signal, which is less perceptually important and which can be represented at lower resolution to achieve more efficient data compression. It is common to represent the ratios of information stored in these different channels in the following way Y: Cb: Cr. Refer to the following article for more information about Chroma subsampling.Different codecs will use different chroma sub sampling ratios as appropriate to their compression needs. Video compression schemes for Web and DVD make use of a 4:2:0 color sampling pattern and the DV standard uses 4:1:1 sampling ratios. Professional video codecs designed to function at much higher bitrates and to record a greater amount of color information for post-production manipulation sample in 3:1:1 (uncommon), 4:2:2 and 4:4:4 ratios. Examples of these codecs include Panasonic's DVCPRO50 and DVCPROHD codecs (4:2:2), and then Sony's HDCAM-SR (4:4:4) or Panasonic's HDD5 (4:2:2). Apple's new Prores HQ 422 codec also samples in 4:2:2 color space. More codecs that sample in 4:4:4 patterns exist as well, but are less common, and tend to be used internally in post-production houses. It is also worth noting that video codecs can operate in RGB space as well. These codecs tend not to sample the red, green, and blue channels in different ratios, since there is less perceptual motivation for doing so just the blue channel could be under sampled. Some amount of spatial and temporal down sampling may also be used to reduce the raw data rate before the basic encoding process. The most popular such transform is the 8x8 discrete cosines transform (DCT). Codecs which make use of a wavelet transform are also entering the market, especially in camera workflows which involve dealing with RAW image formatting in motion sequences. The output of the transform is first quantized, and then entropy encoding is applied to the quantized values. When a DCT has been used, the coefficients are typically scanned using a zigzag scan order, and the entropy coding typically combines a number of consecutive zero-valued quantized coefficients with the value of the next non-zero quantized coefficient into a single symbol, and also has special ways of indicating when all of the remaining quantized coefficient values are equal to zero. The entropy coding method typically uses variable-length coding tables. Some encoders can compress the video in a multiple step process called n-pass encoding, which performs a slower but potentially better quality compression.Video codec designs are often standardized or will be in the future- i.e., specified precisely in a published document. However, only the decoding process needs to be standardized to enable interoperability. The encoding process is typically not specified at all in a standard, and implementers are free to design their encoder however they want, as long as the video can be decoded in the specified manner. For this reason, the quality of the video produced by decoding the results of different encoders that use the same video codec standard can vary dramatically from one encoder implementation to another.Commonly used video codecsA variety of video compression formats can be implemented on PCs and in consumer electronics equipment. It is therefore possible for multiple codecs to be available in the same product, avoiding the need to choose a single dominant video compression format for compatibility reasons.Video in most of the publicly documented or standardized video compression formats can be created with multiple encoders made by different people. Many video codecs use common, standard video compression formats, which makes them compatible. For example, video created with a standard MPEG-4Part2 codec such as Xvid can be decoded (played back) using any other standard MPEG-4Part2 codec such as FFmpegMPEG-4 or DivXProCodec, because they all use the same video format.

Some widely-used software codecs are listed below:Lossless codecs FFv1: FFv1's compression factor is comparable to Motion JPEG 2000, but based on quicker algorithms (allows real-time capture). Written by Michael Niedermayer and published as part of FFmpeg under to GNU GPL. Huffyuv: Huffyuv (or HuffYUV) is a very fast, lossless Win32 video codec written by Ben Rudiak-Gould and published under the terms of the GNU GPL as free software, meant to replace uncompressed YCbCr as a video capture format. Lagarith: A more up-to-date fork of Huffyuv is available as Lagarith. YULS X264 has a lossless mode. MPEG-4 Part 2 codecs DivX Pro Codec: A proprietary MPEG-4 ASP codec made by DivX, Inc. Xvid: Free/open-source implementation of MPEG-4 ASP, originally based on the OpenDivX project. FFmpeg MPEG-4: Included in the open-source libavcodec codec library, which is used by default for decoding and/or encoding in many open-source video players, frameworks, editors and encoding tools such as MPlayer, VLC, ffdshow or GStreamer. Compatible with other standard MPEG-4 codecs like Xvid or DivX Pro Codec. 3ivx: A commercial MPEG-4 codec created by 3ivx Technologies. H.264/MPEG-4 AVC codecs X264: A GPL-licensed implementation of the H.264 video standard. X264 is only an encoder. Nero Digital: Commercial MPEG-4 ASP and AVC codecs developed by Nero AG. QuickTime H.264: H.264 implementation released by Apple. DivX Pro Codec: An H.264 decoder and encoder were added in version 7. Microsoft codecs WMV (Windows Media Video): Microsoft's family of proprietary video codec designs including WMV 7, WMV 8, and WMV 9. The latest generation of WMV is standardized by SMPTE as the VC-1 standard. MS MPEG-4v3: A proprietary and not MPEG-4 compliant video codec created by Microsoft. Released as a part of Windows Media Tools 4. A hacked version of Microsoft's MPEG-4v3 codec became known as DivX;-). On2 codecslibtheora: A reference implementation of the Theora video compression format developed by the Xiph.org Foundation, based upon On2 Technologies' VP3 codec, and christened by On2 as the successor in VP3's lineage. Theora is targeted at competing with MPEG-4 video and similar lower-bitrate video compression schemes. Other codecs Schrdinger and Dirac-research: implementations of the Dirac compression format developed by BBC Research at the BBC. Dirac provides video compression from web video up to ultra HD and beyond. DNxHD codec: a lossy high-definition video production codec developed by Avid Technology. It is an implementation of VC-3. Sorenson 3: A video compression format and codec that is popularly used by Apple's QuickTime, sharing many features with H.264. Many movie trailers found on the web use this compression format. Sorenson Spark: A codec and compression format that was licensed to Macromedia for use in its Flash Video starting with Flash Player 6. It is considered as an incomplete implementation of the H.263 standard. Real Video: Developed by Real Networks. A popular compression format and codec technology a few years ago, now fading in importance for a variety of reasons. Cinepak: A very early codec used by Apple's QuickTime. Indio, an older video compression format and codec initially developed by Intel.