HEVC函数入门(10)——HM软件手册software-manual(GOP,RPS,POC)

前面讲到找tile相关的函数,结果发现调用来调用去,搞的都迷糊了。所以这里来使用HM自带的软件手册software-manual来查找相关的内容。这里建议大家对一些测试视频进行压缩,然后对应的在软件手册中找参数的含义,我直接来看软件手册也是没办法,因为目的只有tile,这里软件手册是在HM中的doc文件夹中,有很多文档,有空的话都点开看看也可以。

下面一部分内容将围绕软件手册的内容来讲。

首先是GOP的部分,主要围绕GOP中每一帧来讲,这里关于里面的缩写,原文并没有解释,所以可以参考我的另一篇博文:http://blog.csdn.net/qq_21747841/article/details/73332394
另外这里的中文主要通过Google简易的翻译,仅供参考。
3.1 GOP structure table
Defines the cyclic GOP structure that will be used repeatedly throughout the sequence. The table should contain GOPSize lines, named Frame1, Frame2, etc. The frames are listed in decoding order, so Frame1 is the first frame in decoding order, Frame2 is the second and so on. Among other things, the table specifies all reference pictures kept by the decoder for each frame. This includes pictures that are used for reference for the current picture as well as pictures that will be used for reference in the future. The
encoder will not automatically calculate which pictures have to be kept for future references, they must be specified. Note that some specified reference frames for pictures encoded in the very first GOP after an IDR frame might not be available. This is handled automatically by the encoder, so the reference pictures can be given in the GOP structure table as if there were infinitely many identical GOPs before the current one. Each line in the table contains the parameters used for the corresponding frame, separated by whitespace:
定义将在整个序列中重复使用的循环GOP结构。该表应包含GOPSize排列,名为Frame1,Frame2等。帧按照解码顺序列出,因此Frame1是解码顺序的第一帧,Frame2是第二帧等等。其中,表格指定了解码器为每个帧保存的所有参考图片。这包括用于当前图片参考的图片以及将来用于参考的图片。编码器不会自动计算哪些图片必须保留以备将来参考,它们必须被指定。注意,在IDR帧之后的第一GOP中编码的图像的一些指定的参考帧可能不可用。这由编码器自动处理,因此参考图像可以在GOP结构表中给出,就好像在当前GOP之前有无数多个相同的GOP。表中的每一行包含用于相应帧的参数,由空格分隔:
Type: Slice type, can be either I, P or B.
POC: Display order of the frame within a GOP, ranging from 1 to GOPSize.在GOP内显示帧的顺序,范围从1到GOPSize。图序计数
QPOffset: QP offset is added to the QP parameter to set the final QP value to use for this frame.△QP设置量化参数,越大质量越不好
QPFactor: Weight used during rate distortion optimization. Higher values mean lower quality and less bits. Typical range is between 0.3 and 1.速率失真优化时使用的权值。 较高的值意味着较低的质量和较少的位。 典型范围在0.3和1之间。
num_ref_pics_active: Size of reference picture lists L0 and L1, indicating how many reference pictures in each direction that are used during coding.
num_ref_pics: The number of reference pictures kept for this frame. This includes pictures that are used for reference for the current picture as well as pictures that will be used for reference in the future.
reference_pictures: A space-separated list of num_ref_pics integers, specifying the POC of the reference pictures kept, relative the POC of the current frame. The picture list shall be ordered,first with negative numbers from largest to smallest, followed by positive numbers from smallest to largest (e.g. -1 -3 -5 1 3). Note that any pictures not supplied in this list will be discarded and therefore not available as reference pictures later.
predict: Defines the value of the syntax element inter_ref_pic_set_prediction_flag. A value of 0 indicates that the reference picture set is encoded without inter RPS prediction and the subsequent parameters deltaRIdx-1, deltaRPS, num_ref_idcs and Reference_idcs are ignored and do not need to be present. A value of 1 indicates that the reference picture set is encoded with inter prediction RPS using the subsequent parameters deltaRIdx-1, deltaRPS, num_ref_idcs and Reference_idcs in the line. A value of 2 indicates that the reference picture set is encoded with inter RPS but only the deltaRIdx-1 parameters is needed. The deltaRPS, num_ref_idcs and Reference_idcs values are automatically derived by the encoder based on the POC and refPic values of the current line and the RPS pointed to by the deltaRIdx-1 parameters.
deltaRIdx-1: The difference between the index of the curent RPS and the predictor RPS minus 1.
deltaRPS: The difference between the POC of the predictor RPS and POC the current RPS. num_ref_idcs: The number of ref_idcs to encode for the current RPS. The value is equal to the value of num_ref_pics of the predictor RPS plus 1.
reference_idcs: A space-separated list of num_ref_idcs integers, specifying the ref idcs of the inter RPS prediction. The value of ref_idcs may be 0, 1 or 2 indicating that the reference picture is a reference picture used by the current picture, a reference picture used for future picture or not a reference picture anymore, respectively. The first num_ref_pics of ref_idcs correspond to the Reference pictures in the predictor RPS. The last ref_idcs corresponds to the predictor picture.
关于上面从predict开始的四个参数,首先看一下用博客http://blog.csdn.net/feixiaku/article/details/17886779中的内容来比较好,然后会用原文中的内容来解释。
分析HM参考帧的管理:
HEVC采用了参考帧集(RPS)的技术来管理已解码的帧,用作后续图像的参考。与之前的视频编码标准中参考侦管理策略不同的是,HEVC中的RPS技术,通过直接在每一帧开始的片头码流中传输DPB中各个帧的状态变化,而H.264/AVC中的滑动窗和MMCO (Memory ManagementControl Operation)这两种参考帧管理技术,是通过传输每一个片的DPB的相对变化来实现,一但发生数据丢失,将会有持续的影响。
1、参考帧管理基本知识
H.263, H.264/AVC和HEVC中都采用了多帧参考技术,来提高帧间预测的准确性。解码已经完成的图像,被缓存在DPB中,供后续的帧用作参考图像,因此,标准需要对DPB中的图像进行管理。DPB中的每一个图像,有三种状态“Unused for reference”、“Used for short-termreference”和”Used for long-term reference”,这三种状态之间的转换,是通过解码图像标记过程进行控制的。H。264/AVC中采用了滑动窗和MMCO两种方式。滑动窗管理方式,顾名思义,是以DPB可以存放的帧数为窗口,随着当前解码的图像,以先入先出的方式,将新的解码图像移入,将超出窗口的解码图像移出,因此,DPB中保存的是最近解码的多个图像。MMCO是通过在码流中传输控制命令,完成对DPB中图像的状态标记的,它可以将一个“Used for reference“ (short-term or long-term)标记为“Unused for reference也可以将当前帧或者“Used for short-termreference“的帧,标记为“ Used for long-term reference ”等。
2、HEVC 参考帧集技术(RPS)
为了增强参考帧管理的抗差错能力,HEVC采用了参考侦集技术,它通过直接在每一帧开始的片头码流中传输DPB中各个帧的状态变化,将当前帧以及后续帧可能用到的参考帧在DPB中都进行描述,描述以POC作为一帧贞的身份标识。因此,它不需要依赖于前面帧的DPB状态,从而增强了抗差错的性能。简言之,每帧的第一个片中包含一个RPS,它是由一组“ΔPOC”(当前帧POC与其POC的差)和“是否用作当前帧/后续侦的参考”这些标识信息组成,DPB根据片头中RPS的描述,对参考帧进行标记。例如,POC=4的B帧,只能参考POC=0的I帧,其 RPS 为{(ΔPOC =3,UsedByCurPic)}; POC=3 的 b 帧,可以参考 P0C=4和 P0C=2 的两个B帧,其 RPS 为{(ΔPOC = -1,UsedByCurPic), (ΔPOC=1,UsedByCurPic)};若POC=0的I帧,不再出现在RPS中,则它被标记为“Unused for reference”,然后从DPB中移除。
参考帧RPS更新:
a) 在解码P0C=1的帧前,DPB中有三个参考帧,分别是POC=0,4,2的帧;
b) 当接收到P0C=1的片头中传输的RPS信息(描述了解码P0C=1的帧时,DPB的状态,即POC=0和2的帧用作当前帧的short-term参考,P0C=4的帧用作后续帧的参考)后,对DPB中的帧进行状态的标记,将POC=0和2的帧标记为“Used for short-termreference”,并且保留POC=0的帧,以用作后续参考;然后解码P0C=1的帧,解码完成,将P0C=1的帧放入DPB中。此时,DPB中有POC=0, 4,2, 1四帧;
c) 当接收到P0C=3的片头中传输的RPS信息(描述了解码P0C=3的帧时,DPB中,P0C=2和4的帧用作当前帧的short-term参考,POC=0的帧用作后续帧的参考,POC=1的帧不再用作参考)后,对DPB中的帧进行状态的标记,将 P0C=2 和 4 的桢标记为 “Used for short-termreference将 P0C=1的帧移出DPB,然后解码P0C=3的帧,解码完成,将其放入DPB中。此时,DPB中有POC=0,4, 2,3四帧。
3 、RPS预测
从上述描述中可以看出,在用POC值对参考帧进行身份描述时,不同帧的RPS中的多个ΔPOC值的差值是相同的,例如上例中,POC为1的帧的RPS描述中,ΔPOC值分别是{1, -3,-1}, POC为3的帧的RPS描述中,ΔPOC值分别{3,-1,1}为ΔPOC之间的差值为2。因此,不同帧的RPS描述中,ΔPOC值仍然可以进行预测,即DeltaRPS = ΔPOC(RPScurr)- ΔPOC(RPSref),以进一步减少传输代价。
4、HM中的多参考帧配置
参考软件HM在Random Access配置中采用了 Hierachical-B的GOP结构,参考帧数目为4 (或者3),如图3-3所示,但在编码配置中,活动的参考帧数目为2,即只对最近的两个参考帧进行运动估计和运动补偿。与此类似,在LowDelay配置下,参考帧数目为4,活动的参考帧数目为4。
5、HM多参考帧优化选择
从前文的分析中,HEVC及其参考软件HM都支持多参考帧技术,HM中可以配置4或者2个活动参考帧,这使得每个PU的运动估计的复杂度成倍增加。HEVC参考软件中仍然采用传统的块匹配技术进行运动矢量的搜索,并选择最佳的预测方向和参考帧索引。其过程可以简单总结为以下流程:
(1) 从ListX=0开始(即前向预测),将参考索引iReflndex设置为0;
(2) 在当前iReflndex下,生成高级运动矢量预测(AMVP: Advanced MotionVector Prediction)候选列表,并进行AMVP索引的选择;
(3) 以(2)中选中的AMVP为起始点,在当前iReflndex帧内,以SA(T)D+λpred*Bits为代价进行运动估计,得到最佳的运动矢量和最小代价;
(4)设置 iRefIndex=iRefIndex+l,重复步骤(2)和(3),得到当前 iReflndex下的最佳运动矢量和最小代价;直到参考帧队列ListX中的所有标记为“Used for Reference“的参考帧都完成最佳运动矢量和最小代价的计算,并从中挑选代价最小的iReflndex作为当前预测方向下,最佳的参考索引;
(5) 将ListX=1 (即后向预测),重复(2)到(4)步骤,并挑选代价最小的iReflndex作为当前预测方向下的最佳的参考索引;
(6) 固定以List0 (或者List1)中最佳的参考索引和运动矢量为双向预测中的其中之一,对List1(或者list0)中所有参考索引进行(2)到(4)步骤,并找到最佳的双向预测参考索引和运动矢量。
(7) 比较前向预测、后向预测以及双向预测的最小代价,选择出最佳的预测方向。

下面用原文中的图来解释:

这里写图片描述

后面提到的是被参考的帧会有较低的QP偏移,且不作为参考帧的帧会被赋予较高的时间层。Here, the frames used for prediction have been given higher quality by assigning a lower QP offset. Also, the non-reference frames have been marked as belonging to a higher temporal layer, to make it possible to decode only every other frame. Note: each line should contain information for one frame, so this configuration would be specified as:

这里写图片描述
Note: The above (automatic) generation of the inter RPS parameter values has been integrated into the encoder, and is activated by the value of predict = 2 followed by the value of deltaRIdx-1, only, as described above.

来源:慢慢积累不怕寂寞

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2017年6月8日
下一篇 2017年6月8日

相关推荐