logo

English

How video compression works 2/5 - Quantization, coding, and prediction

by digipine posted Nov 02, 2017
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print Attachment
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print Attachment

Quantization, coding, and prediction 

Choosing the bits: quantization and coding
After the block transform is performed, the transform coefficients for each block are compressed using quantization and coding. Quantization reduces the precision of the transform coefficients in a biased manner: more bits are used for low-frequency coefficients and fewer bits for high-frequency coefficients. This takes advantage of the fact, as noted above, that human vision is more sensitive to low-frequency information, so the high-frequency information can be more approximate. Many bits are discarded in this step. For example, a 12-bit coefficient may be rounded to the nearest of 32 predetermined values. Each of these 32 values can be represented with a five-bit symbol. In the decompression algorithm, the coefficients are "dequantized"; i.e., the five-bit symbol is converted back to the 12-bit predetermined value used in the encoder. As illustrated in Figure 3, the dequantized coefficients are not equal to the original coefficients, but are close enough so that after the inverse transform is applied, the resulting image contains few or no visible artifacts.

 

 b03ecd45ee1305761fd63759f1cc7d94.gif

 


In older video algorithms, such as MPEG-2, dequantization can require anywhere from about 3% up to about 15% of the processor cycles spent in a video decoding application. Cycles spent on dequantization in modern video algorithms (such as H.264) are negligible, as are the memory requirements. 

Statistically Speaking
Next, the number of bits used to represent the quantized DCT coefficients is reduced by "coding," which takes advantage of some of the statistical properties of the coefficients. After quantization, many of the DCT coefficients—often, the vast majority of the high-frequency coefficients—are zero. A technique called "run-length coding" takes advantage of this fact by grouping consecutive zero-valued coefficients (a "run") and encoding the number of coefficients (the "length") instead of encoding the individual zero-valued coefficients. 


Run-length coding is typically followed by variable-length coding (VLC). In variable-length coding, commonly occurring symbols (representing quantized DCT coefficients or runs of zero-valued quantized coefficients) are represented using code words that contain only a few bits, while less common symbols are represented with longer code words. By using fewer bits for the most common symbols, VLC reduces the average number of bits required to encode a symbol thereby reducing the number of bits required to encode the entire image.

On the decompression side, variable-length decoding (VLD) reverses the steps performed by the VLC block in the compression algorithm. Variable-length decoding is much more computationally demanding than variable-length coding. VLC performs one table lookup per symbol (where a symbol is encoded using multiple bits); in contrast, the most straightforward implementation of VLD requires a table lookup and some simple decision making to be applied for each bit. VLD requires an average of about 11 operations per input bit. Thus, the processing requirements of VLD are proportional to the video codec's selected bit rate. VLD can consume as much as 25% of the cycles spent in a video decoder implementation.

In a typical video decompression algorithm, the straightforward VLD implementation described above (which operates on one bit at a time) requires several kilobytes of lookup table memory. It is possible to improve the performance of the VLD by operating on multiple bits at a time, but this optimization requires the use of much larger lookup tables.

Some of the newer standards (such as H.264) replace or augment the run-length coding and VLC techniques described above to achieve greater compression. For example, H.264 supports both CAVLC (context-adaptive VLC) and CABAC (context-adaptive arithmetic coding). CAVLC augments VLC by adapting the coding scheme based on previously-coded coefficients. CABAC replaces VLC entirely, using instead a more efficient—but also more computationally demanding—scheme of arithmetic coding. CABAC can consume as many as 50% of the cycles in an H.264 decoder.

Looking at a bigger picture
All of the techniques described so far operate on each 8x8 block independently from any other block. Since images typically contain features that are much larger than an 8x8 block, more efficient compression can be achieved by taking into account the similarities between adjacent blocks in the image.


To take advantage of inter-block similarities, a prediction step is often added prior to quantization of the transform coefficients. In this step, codecs attempt to predict the image information within a block using the information from the surrounding blocks. Some codecs (such as MPEG-4) perform this step in the frequency domain, by predicting DCT coefficients. Other codecs (such as H.264) do this step in the spatial domain, and predict pixels directly. The latter approach is called "intra prediction."

In this step, the encoder attempts 

 
TAG •

List of Articles
No. Subject Author Date Views
27 서보 모터 (Servo-motor) 의 내부 구조와 회전 원리 file digipine 2017.11.02 807
26 이더리움 (Ethereum) digipine 2018.02.08 826
25 GDPR 유럽 일반 개인 정보보호법 시행 엉뚱도마뱀 2018.05.24 879
24 SECS 프로토콜 개요 digipine 2017.11.03 905
23 삼성의 새로운 갤럭시 S 폰 예상보다 빨리 출시 예정 file digipine 2020.11.05 926
22 L4 장비의 핵심 로드 밸런싱(Load Balancing) digipine 2017.11.03 946
21 영화의 매트릭스의 네오의 컴퓨터 화면 프로그램 digipine 2021.02.04 1051
20 True Wireless Stereo(TWS)와 LE Audio file digipine 2020.05.27 1176
19 파나소닉, 풀 스펙 8K 동영상 신호 전송용 단일 케이블 및 커넥터 솔루션 개발 file lizard2019 2019.06.07 1187
18 스니핑 개념, 공격기법, 방어법, 참고할만한 오픈소스 라이브러리 및 툴 digipine 2017.11.03 1301
17 무료 파티션 도구 AOMEI Partition Assistant v6.6 exFAT를 완벽하게 지원 file 엉뚱도마뱀 2017.11.27 1339
16 High Quality Mobile Experience (HQME) IEEE P2200TM file lizard2019 2020.02.18 1444
15 네트웍 용어중 bps, cps, BPS, pps 의 차이점 digipine 2017.11.03 1580
14 How video compression works 3/5 - Color and motion file digipine 2017.11.02 1595
13 How video compression works 1/5 file digipine 2017.11.02 1596
12 CISCO Router 설정 팁 - QOS 1 digipine 2017.11.03 1817
11 반도체 장비/공정 기술 용어집 digipine 2017.11.02 1890
10 블럭체인 기술자료 링크 digipine 2018.02.08 3103
9 암호화폐 (Crypto Currency) 비트코인 file digipine 2018.02.08 3515
8 임베디드 Linux 시스템 부팅 시 프로그램 자동 실행 digipine 2017.11.03 4154
Board Pagination Prev 1 ... 2 3 ... 4 Next
/ 4