HEVC核心编码技术之五.熵编码

本文详细介绍了HEVC标准中的熵编码方法CABAC,包括上下文模型选择、自适应系数扫描及系数编码等内容。HEVC通过改进上下文模型并引入自适应系数扫描等技术,实现了比H.264/MPEG-4AVC更好的压缩效果。
Overview of the High Efficiency Video Coding(HEVC) Standard之四

J. 熵编码 
Entropy Coding

HEVC specifies only one entropy coding method, CABAC
[13] rather than two as in H.264/MPEG-4 AVC. The core algorithm
of CABAC is unchanged, and the following subsections
present several aspects of how it is used in the HEVC design.
相比于H.264/MPEG-4 AVC,HEVC只指定了使用CABAC;
其核心算法并没有改变;

1) 上下文模型
Context Modeling: 

Appropriate selection of context
modeling is known to be a key factor to improve the efficiency
of CABAC coding. In HEVC, the splitting depth of
the coding tree or transform tree is exploited to derive the
context model indices of various syntax elements in addition
to the spatially neighboring ones used in H.264/AVC. For
example, the syntax element skip_flag specifying whether
the CB is coded as interpicture predictively skipped and the
syntax element split_coding_unit_flag specifying whether
the CB is further split are coded by using context models
based on the spatially neighboring information. The syntax
element split_transform_flag specifying whether the TB is
further split and three syntax elements specifying non-zero
transform coefficients for each color component, cbf_luma,
cbf_cb and cbf_cr, are coded based on the splitting depth of
the transform tree. Although the number of contexts used in
HEVC is substantially less than in H.264/MPEG-4 AVC, the
entropy coding design actually provides better compression
than would a straightforward extension of the H.264/MPEG-
4 AVC scheme. Moreover, more extensive use is made in
HEVC of the bypass mode of CABAC operation to increase
throughput by reducing the amount of data that needs to be
coded using CABAC contexts. Dependences between coded
data are also carefully considered to enable further throughput
maximization.
合适的上下文模型选择对于CABAC编码的效率改善是关键因素;
在HEVC中,除了使用H.264/MPEG-4 AVC中使用空域相邻语法因子外,
还使用编码树和变换树的划分深度来推导各种语法元素的上下文模型;
例如,
语法元素skip_flag指示了当前CB是否是帧间预测skip模式编码,
而语法元素split_coding_unit_flag指示了当前CB是否要更一步的划分;,
这些信息都会用作基于空间相邻信息的上下文模型;
语法元素split_transform_flag指示了当前TB是否需要更进一步划分,
并且这三个语法元素指明了每个颜色分量的非零变换系数,
cbf_luma,
cbf_cb,
cbf_cr; 
它们都基于变换树的深度进行编码;
尽管HEVC中,上下文个数少于H.264/MPEG-4 AVC,但它提供了更好的压缩效果;
而且,HEVC使用了更多的CABAC操作中的bypass模式,这增加了数据吞吐量;

2) 自适应系数扫描
Adaptive Coefficient Scanning: 

Coefficient scanning is
performed in 4×4 subblocks for all TB sizes (i.e., using only
one coefficient region for the 4×4 TB size, and using multiple
4×4 coefficient regions within larger transform blocks). Three
coefficient scanning methods, diagonal up-right, horizontal,
and vertical scans as shown in Fig. 9, are selected implicitly
for coding the transform coefficients of 4×4 and 8×8 TB
sizes in intrapicture-predicted regions. The selection of the
coefficient scanning order depends on the directionalities of
the intrapicture prediction. The vertical scan is used when the
prediction direction is close to horizontal and the horizontal
scan is used when the prediction direction is close to vertical.
For other prediction directions, the diagonal up-right scan is used.
对于所有TB尺寸的4x4子块,都要执行系数扫描操作,
HEVC定义了三种系数扫描方法:
朝右上的对角线扫描,
水平扫描,
垂直扫描,
如图9中所示;
对于在帧内预测区域的4×4 and 8×8 TB尺寸的变换系数编码来说 ,这三种扫描方式的选择是隐示的;
这个系数扫描的顺序要依靠帧内预测的方向来选择;
当预测方向接近水平时就使用垂直扫描;
当预测方向接近垂直时就使用水平扫描;
对于其它预测方向,使用朝右上的对角线扫描;

Fig. 9. Three coefficient scanning methods in HEVC. 
(a) Diagonal up-right scan. 
(b) Horizontal scan. 
(c) Vertical scan.

For the transform coefficients in interpicture prediction
modes of all block sizes and for the transform coefficients
of 16×16 or 32×32 intrapicture prediction, the 4×4 diagonal
up-right scan is exclusively applied to subblocks of transform coefficients.
对于所有块尺寸的帧间预测模式的变换系数,
以及16×16 or 32×32 帧内预测的变换系数,
不能对变换系数的子块使用4x4的朝右上的对角线扫描;

3) 系数编码
Coefficient Coding: 

Similar to H.264/MPEG-4 AVC,
HEVC transmits the position of the last nonzero transform
coefficient, a significance map, sign bits and levels for the
transform coefficients. However, various changes for each
part have been made, especially for better handling of the
significantly increased size of the TBs.
和H.264/MPEG-4 AVC一样,HEVC传输
最后一个非零变换系数的位置,
重要性映射,
符号位,
以及系数的级;
然而,HEVC对这些都做了改善,以更好地适应于TB尺寸的增加;

First, the horizontal and vertical frequency coordinate positions
of the last nonzero coefficient are coded for the TB before
sending the significance maps of 4×4 subblocks that indicate
which other transform coefficients have nonzero values, rather
than sending a series of last-coefficient identification flags
that are interleaved with the significance map as done in H.264/MPEG-4 AVC.
首先,对于当前TB,在发送4x4子块的重要性映射之前,
最后一个非零系数的水平和垂直频率坐标位置被编码;
这一点和H.264/MPEG-4 AVC不一样;

The significance map is derived for significance groups
relating to the fixed size 4×4 subblocks. For all groups having
at least one coefficient preceding the last coefficient position, a
significant group flag specifying a nonzero coefficient group is
transmitted, followed by coefficient significance flags for each
coefficient prior to the indicated position of the last significant
coefficient. The context models for the significant coefficient
flags are dependent on the coefficient position as well as the
values of the right and the bottom significant group flags.

A method known as sign data hiding is used for further compression
improvement. The sign bits are coded conditionally
based on the number and positions of coded coefficients. When
sign data hiding is used and there are at least two nonzero
coefficients in a 4×4 subblock and the difference between the
scan positions of the first and the last nonzero coefficients is
greater than 3, the sign bit of the first nonzero coefficient is inferred
from the parity of the sum of the coefficient amplitudes.
Otherwise, the sign bit is coded normally. At the encoder
side, this can be implemented by selecting one coefficient
with an amplitude close to the boundary of a quantization
interval to be forced to use the adjacent quantization interval
in cases where the parity would not otherwise indicate the
correct sign of the first coefficient. This allows the sign bit to
be encoded at a lower cost (in rate-distortion terms) than if it
were coded separately—by giving the encoder the freedom to
choose which transform coefficient amplitude can be altered
with the lowest rate-distortion cost.

For each position where the corresponding significant coefficient
flag is equal to one, two flags specifying whether the
level value is greater than one or two are coded, and then the
remaining level value is coded depending on those two values.
(这部分没有看很明白,得到具体做这个再说吧)

上六,龙战于野,其血玄黄。
【白话】上六,阴气盛极,与阳气相战郊外,天地混杂,乾坤莫辨,后果是不堪设想的。


《象》曰:“龙战于野”,其道穷也。
【白话】《象辞》说:“阴气盛极,与阳气相战于郊外”,说明阴气已经发展到尽头了。

新一代视频压缩编码技术!今年刚认证的H.265编码标准,前几天一直找不到白皮书,今天发上来,估计不少人也在找吧。下面是目录: CONTENTS Page Abstract i 0 Introduction 1 0.1 General 1 0.2 Prologue 1 0.3 Purpose 1 0.4 Applications 1 0.5 Publication and versions of this Specification 1 0.6 Profiles, tiers and levels 2 0.7 Overview of the design characteristics 2 0.8 How to read this Specification 2 1 Scope 3 2 Normative references 3 2.1 General 3 2.2 Identical Recommendations | International Standards 3 2.3 Paired Recommendations | International Standards equivalent in technical content 3 2.4 Additional references 3 3 Definitions 3 4 Abbreviations 12 5 Conventions 13 5.1 General 13 5.2 Arithmetic operators 13 5.3 Logical operators 13 5.4 Relational operators 14 5.5 Bit-wise operators 14 5.6 Assignment operators 14 5.7 Range notation 14 5.8 Mathematical functions 15 5.9 Order of operation precedence 15 5.10 Variables, syntax elements, and tables 16 5.11 Text description of logical operations 17 5.12 Processes 18 6 Bitstream and picture formats, partitionings, scanning processes, and neighbouring relationships 18 6.1 Bitstream formats 18 6.2 Source, decoded, and output picture formats 18 6.3 Partitioning of pictures, slices, slice segments, tiles, coding tree units, and coding tree blocks 21 6.3.1 Partitioning of pictures into slices, slice segments, and tiles 21 6.3.2 Block and quadtree structures 22 6.3.3 Spatial or component-wise partionings 23 6.4 Availability processes 23 6.4.1 Derivation process for z-scan order block availability 23 6.4.2 Derivation process for prediction block availability 24 6.5 Scanning processes 25 6.5.1 Coding tree block raster and tile scanning conversion process 25 6.5.2 Z-scan order array initialization process 26 6.5.3 Up-right diagonal scan order array initialization process 26 6.5.4 Horizontal scan order array initialization process 27 6.5.5 Vertical scan order array initialization process 27 7 Syntax and semantics 28 7.1 Method of specifying syntax in tabular form 28 7.2 Specification of syntax functions and descriptors 29 7.3 Syntax in tabular form 30 7.3.1 NAL unit syntax 30 7.3.1.1 General NAL unit syntax 30 7.3.1.2 NAL unit header syntax 30 7.3.2 Raw byte sequence payloads, trailing bits, and byte alignment syntax 31 7.3.2.1 Video parameter set RBSP syntax 31 7.3.2.2 Sequence parameter set RBSP syntax 32 7.3.2.3 Picture parameter set RBSP syntax 34 7.3.2.4 Supplemental enhancement information RBSP syntax 35 7.3.2.5 Access unit delimiter RBSP syntax 35 7.3.2.6 End of sequence RBSP syntax 35 7.3.2.7 End of bitstream RBSP syntax 35 7.3.2.8 Filler data RBSP syntax 36 7.3.2.9 Slice segment layer RBSP syntax 36 7.3.2.10 RBSP slice segment trailing bits syntax 36 7.3.2.11 RBSP trailing bits syntax 36 7.3.2.12 Byte alignment syntax 36 7.3.3 Profile, tier and level syntax 37 7.3.4 Scaling list data syntax 38 7.3.5 Supplemental enhancement information message syntax 38 7.3.6 Slice segment header syntax 39 7.3.6.1 General slice segment header syntax 39 7.3.6.2 Reference picture list modification syntax 41 7.3.6.3 Weighted prediction parameters syntax 42 7.3.7 Short-term reference picture set syntax 43 7.3.8 Slice segment data syntax 43 7.3.8.1 General slice segment data syntax 43 7.3.8.2 Coding tree unit syntax 44 7.3.8.3 Sample adaptive offset syntax 45 7.3.8.4 Coding quadtree syntax 46 7.3.8.5 Coding unit syntax 47 7.3.8.6 Prediction unit syntax 49 7.3.8.7 PCM sample syntax 49 7.3.8.8 Transform tree syntax 50 7.3.8.9 Motion vector difference syntax 50 7.3.8.10 Transform unit syntax 51 7.3.8.11 Residual coding syntax 52 7.4 Semantics 54 7.4.1 General 54 7.4.2 NAL unit semantics 54 7.4.2.1 General NAL unit semantics 54 7.4.2.2 NAL unit header semantics 55 7.4.2.3 Encapsulation of an SODB within an RBSP (informative) 58 7.4.2.4 Order of NAL units and association to coded pictures, access units, and coded video sequences 59 7.4.3 Raw byte sequence payloads, trailing bits, and byte alignment semantics 62 7.4.3.1 Video parameter set RBSP semantics 62 7.4.3.2 Sequence parameter set RBSP semantics 64 7.4.3.3 Picture parameter set RBSP semantics 69 7.4.3.4 Supplemental enhancement information RBSP semantics 72 7.4.3.5 Access unit delimiter RBSP semantics 72 7.4.3.6 End of sequence RBSP semantics 72 7.4.3.7 End of bitstream RBSP semantics 72 7.4.3.8 Filler data RBSP semantics 73 7.4.3.9 Slice segment layer RBSP semantics 73 7.4.3.10 RBSP slice segment trailing bits semantics 73 7.4.3.11 RBSP trailing bits semantics 73 7.4.3.12 Byte alignment semantics 73 7.4.4 Profile, tier and level semantics 73 7.4.5 Scaling list data semantics 75 7.4.6 Supplemental enhancement information message semantics 76 7.4.7 Slice segment header semantics 77 7.4.7.1 General slice segment header semantics 77 7.4.7.2 Reference picture list modification semantics 81 7.4.7.3 Weighted prediction parameters semantics 82 7.4.8 Short-term reference picture set semantics 83 7.4.9 Slice segment data semantics 85 7.4.9.1 General slice segment data semantics 85 7.4.9.2 Coding tree unit semantics 85 7.4.9.3 Sample adaptive offset semantics 85 7.4.9.4 Coding quadtree semantics 87 7.4.9.5 Coding unit semantics 87 7.4.9.6 Prediction unit semantics 89 7.4.9.7 PCM sample semantics 90 7.4.9.8 Transform tree semantics 90 7.4.9.9 Motion vector difference semantics 91 7.4.9.10 Transform unit semantics 91 7.4.9.11 Residual coding semantics 92 8 Decoding process 94 8.1 General decoding process 94 8.2 NAL unit decoding process 95 8.3 Slice decoding process 96 8.3.1 Decoding process for picture order count 96 8.3.2 Decoding process for reference picture set 96 8.3.3 Decoding process for generating unavailable reference pictures 100 8.3.3.1 General decoding process for generating unavailable reference pictures 100 8.3.3.2 Generation of one unavailable picture 101 8.3.4 Decoding process for reference picture lists construction 101 8.4 Decoding process for coding units coded in intra prediction mode 102 8.4.1 General decoding process for coding units coded in intra prediction mode 102 8.4.2 Derivation process for luma intra prediction mode 103 8.4.3 Derivation process for chroma intra prediction mode 105 8.4.4 Decoding process for intra blocks 105 8.4.4.1 General decoding process for intra blocks 105 8.4.4.2 Intra sample prediction 106 8.5 Decoding process for coding units coded in inter prediction mode 112 8.5.1 General decoding process for coding units coded in inter prediction mode 112 8.5.2 Inter prediction process 112 8.5.3 Decoding process for prediction units in inter prediction mode 115 8.5.3.1 General 115 8.5.3.2 Derivation process for motion vector components and reference indices 115 8.5.3.3 Decoding process for inter prediction samples 130 8.5.4 Decoding process for the residual signal of coding units coded in inter prediction mode 138 8.5.4.1 General 138 8.5.4.2 Decoding process for luma residual blocks 139 8.5.4.3 Decoding process for chroma residual blocks 140 8.6 Scaling, transformation and array construction process prior to deblocking filter process 141 8.6.1 Derivation process for quantization parameters 141 8.6.2 Scaling and transformation process 142 8.6.3 Scaling process for transform coefficients 143 8.6.4 Transformation process for scaled transform coefficients 144 8.6.4.1 General 144 8.6.4.2 Transformation process 144 8.6.5 Picture construction process prior to in-loop filter process 146 8.7 In-loop filter process 146 8.7.1 General 146 8.7.2 Deblocking filter process 147 8.7.2.1 General 147 8.7.2.2 Derivation process of transform block boundary 148 8.7.2.3 Derivation process of prediction block boundary 149 8.7.2.4 Derivation process of boundary filtering strength 150 8.7.2.5 Edge filtering process 151 8.7.3 Sample adaptive offset process 159 8.7.3.1 General 159 8.7.3.2 Coding tree block modification process 159 9 Parsing process 161 9.1 General 161 9.2 Parsing process for 0-th order Exp-Golomb codes 161 9.2.1 General 161 9.2.2 Mapping process for signed Exp-Golomb codes 163 9.3 CABAC parsing process for slice segment data 163 9.3.1 General 163 9.3.2 Initialization process 165 9.3.2.1 General 165 9.3.2.2 Initialization process for context variables 166 9.3.2.3 Storage process for context variables 174 9.3.2.4 Synchronization process for context variables 174 9.3.2.5 Initialization process for the arithmetic decoding engine 174 9.3.3 Binarization process 175 9.3.3.1 General 175 9.3.3.2 Truncated Rice (TR) binarization process 176 9.3.3.3 k-th order Exp-Golomb (EGk) binarization process 177 9.3.3.4 Fixed-length (FL) binarization process 178 9.3.3.5 Binarization process for part_mode 178 9.3.3.6 Binarization process for intra_chroma_pred_mode 178 9.3.3.7 Binarization process for inter_pred_idc 179 9.3.3.8 Binarization process for cu_qp_delta_abs 179 9.3.3.9 Binarization process for coeff_abs_level_remaining 179 9.3.4 Decoding process flow 180 9.3.4.1 General 180 9.3.4.2 Derivation process for ctxTable, ctxIdx and bypassFlag 180 9.3.4.3 Arithmetic decoding process 186 9.3.5 Arithmetic encoding process (informative) 192 9.3.5.1 General 192 9.3.5.2 Initialization process for the arithmetic encoding engine (informative) 192 9.3.5.3 Encoding process for a binary decision (informative) 193 9.3.5.4 Renormalization process in the arithmetic encoding engine (informative) 194 9.3.5.5 Bypass encoding process for binary decisions (informative) 195 9.3.5.6 Encoding process for a binary decision before termination (informative) 196 9.3.5.7 Byte stuffing process (informative) 197 10 Sub-bitstream extraction process 198 Annex A Profiles, tiers and levels 199 A.1 Overview of profiles, tiers and levels 199 A.2 Requirements on video decoder capability 199 A.3 Profiles 199 A.3.1 General 199 A.3.2 Main profile 199 A.3.3 Main 10 profile 200 A.3.4 Main Still Picture profile 200 A.4 Tiers and levels 201 A.4.1 General tier and level limits 201 A.4.2 Profile-specific level limits for the Main and Main 10 profiles 202 A.4.3 Effect of level limits on picture rate for the Main and Main 10 profiles (informative) 204 Annex B Byte stream format 208 B.1 General 208 B.2 Byte stream NAL unit syntax and semantics 208 B.2.1 Byte stream NAL unit syntax 208 B.2.2 Byte stream NAL unit semantics 208 B.3 Byte stream NAL unit decoding process 209 B.4 Decoder byte-alignment recovery (informative) 209 Annex C Hypothetical reference decoder 210 C.1 General 210 C.2 Operation of coded picture buffer (CPB) 214 C.2.1 General 214 C.2.2 Timing of decoding unit arrival 214 C.2.3 Timing of decoding unit removal and decoding of decoding unit 216 C.3 Operation of the decoded picture buffer (DPB) 218 C.3.1 General 218 C.3.2 Removal of pictures from the DPB 218 C.3.3 Picture output 219 C.3.4 Current decoded picture marking and storage 220 C.4 Bitstream conformance 220 C.5 Decoder conformance 221 C.5.1 General 221 C.5.2 Operation of the output order DPB 222 C.5.2.1 General 222 C.5.2.2 Output and removal of pictures from the DPB 222 C.5.2.3 Picture decoding, marking, additional bumping, and storage 223 C.5.2.4 "Bumping" process 223 Annex D Supplemental enhancement information 225 D.1 General 225 D.2 SEI payload syntax 226 D.2.1 General SEI message syntax 226 D.2.2 Buffering period SEI message syntax 228 D.2.3 Picture timing SEI message syntax 229 D.2.4 Pan-scan rectangle SEI message syntax 229 D.2.5 Filler payload SEI message syntax 230 D.2.6 User data registered by Rec. ITU-T T.35 SEI message syntax 230 D.2.7 User data unregistered SEI message syntax 230 D.2.8 Recovery point SEI message syntax 230 D.2.9 Scene information SEI message syntax 231 D.2.10 Picture snapshot SEI message syntax 231 D.2.11 Progressive refinement segment start SEI message syntax 231 D.2.12 Progressive refinement segment end SEI message syntax 231 D.2.13 Film grain characteristics SEI message syntax 232 D.2.14 Post-filter hint SEI message syntax 232 D.2.15 Tone mapping information SEI message syntax 233 D.2.16 Frame packing arrangement SEI message syntax 234 D.2.17 Display orientation SEI message syntax 234 D.2.18 Structure of pictures information SEI message syntax 235 D.2.19 Decoded picture hash SEI message syntax 235 D.2.20 Active parameter sets SEI message syntax 235 D.2.21 Decoding unit information SEI message syntax 236 D.2.22 Temporal sub-layer zero index SEI message syntax 236 D.2.23 Scalable nesting SEI message syntax 236 D.2.24 Region refresh information SEI message syntax 237 D.2.25 Reserved SEI message syntax 237 D.3 SEI payload semantics 237 D.3.1 General SEI payload semantics 237 D.3.2 Buffering period SEI message semantics 240 D.3.3 Picture timing SEI message semantics 242 D.3.4 Pan-scan rectangle SEI message semantics 247 D.3.5 Filler payload SEI message semantics 248 D.3.6 User data registered by Rec. ITU-T T.35 SEI message semantics 248 D.3.7 User data unregistered SEI message semantics 248 D.3.8 Recovery point SEI message semantics 248 D.3.9 Scene information SEI message semantics 249 D.3.10 Picture snapshot SEI message semantics 252 D.3.11 Progressive refinement segment start SEI message semantics 252 D.3.12 Progressive refinement segment end SEI message semantics 253 D.3.13 Film grain characteristics SEI message semantics 253 D.3.14 Post-filter hint SEI message semantics 258 D.3.15 Tone mapping information SEI message semantics 259 D.3.16 Frame packing arrangement SEI message semantics 263 D.3.17 Display orientation SEI message semantics 270 D.3.18 Structure of pictures information SEI message semantics 271 D.3.19 Decoded picture hash SEI message semantics 272 D.3.20 Active parameter sets SEI message semantics 273 D.3.21 Decoding unit information SEI message semantics 273 D.3.22 Temporal sub-layer zero index SEI message semantics 275 D.3.23 Scalable nesting SEI message semantics 275 D.3.24 Region refresh information SEI message semantics 276 D.3.25 Reserved SEI message semantics 277 Annex E Video usability information 278 E.1 General 278 E.1 VUI syntax 279 E.1.1 VUI parameters syntax 279 E.1.2 HRD parameters syntax 281 E.1.3 Sub-layer HRD parameters syntax 282 E.2 VUI semantics 282 E.2.1 VUI parameters semantics 282 E.2.2 HRD parameters semantics 294 E.2.3 Sub-layer HRD parameters semantics 296 Bibliography 298
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值