H266/JEM:帧间预测——Frame-Rate Up Conversion (FRUC)

Frame-Rate Up Conversion (FRUC)

由于FRUC复杂度过高,目前还未被写入标准,所以这篇博客的标题头为H266/JEM以示区别。

实际上是一种基于帧率上变换的特殊Merge模式,编码端不传输运动信息,仅仅传输一个标志位Flag,解码端通过某种运算导出运动信息。分为两个方法:双向匹配(bilateral matching,简称BM)和模板匹配(template matching,简称TM)。

1、基本原理

1.1、双向匹配(Bilateral matching,BM)

双向匹配主要通过在两个不同参考图片中,沿着当前CU的运动轨迹找到两个块之间最匹配的运动信息来导出当前CU的MV。

BM示意图
假设运动是连续的,那么指向两个参考块的运动矢量MV0MV1应该是和时域距离成正比的,(TD0和TD1,当前帧与两个参考帧之间时域距离,即POC之间的差值)。最特殊的情况,当TD0=TD1时,当前帧正好在两个参考帧的正中间,那么双向匹配也就变成了基于双向MV的镜像(即MV0MV1大小相等,方向相反)。

1.2、模板匹配(Template matching,TM)

模板匹配主要通过在当前帧的template(当前块的上方和左方相邻块)和参考帧的编码块(大小尺寸与template相同)中找到最匹配的块。

TM除了应用到FRUC模式中,还被使用在AMVP模式里面。在HEVC中,AMVP列表长度为2,通过TM获取的MV如果与AMVP列表中的MV不同,那么该MV被插入到AMVP列表的首位(即AMVP中的第二位被移出列表)。当TM应用于AMVP时,只使用CU级别的搜索。
TM示意图

2、具体过程

FRUC模式中的运动信息获取主要分为两个步骤,CU级和Sub-CU级。

在CU级别,先获得整个WxH大小的CU的MV(通过TM或BM获得);Sub-CU级别,再搜索得到Sub-CU的MV。

  1. 首先,建立一个MV候选列表,通过TM或BM从中选出一个最小cost项作为下一步CU级refinement的起始搜索点。
  2. 然后,在起始搜索点周围进行局部搜索(用TM或BM),cost最小的作为整个CU的MV。
  3. 随后,将CU划分为 M ∗ M M*M MM的Sub-CUs,每个Sub-CUs以上一步得到的整个CU的MV作为起始点进行Sub-CU refinement。M计算公式如下
    M = m a x { 4 , m i n { M 2 D , N 2 D } } M=max\{4, min\{\frac {M}{2^D},\frac {N}{2^D}\}\} M=max{4,min{2DM,2DN}}
2.1、CU级MV候选列表
  1. 原始AMVP候选(如果当前CU为AMVP模式);
  2. 所有的Merge候选;
  3. 差值MV运动场中的若干MV(详见2.3);
  4. 上方和左方相邻块MV

如果使用BM方法,那么在假设运动是连续的前提条件下,通过候选列表中的有效MV来生成一对MV(???没太懂);例如,候选列表中的一个有效MV为reference list A中的(MVa, refa),那么与其配对的MV将在reference list B中的参考帧refb中找到,这样可以保证refa和refb时域上在当前帧的不同方向。如果reference list B中找不到这样的refb,那么refb被判定为与refa不同的参考帧,且它与当前帧的时域距离是reference list B中最小的(???没懂)。当refb确定之后,MVb通过将MVa进行scaling得到。
(原文:When using bilateral matching, each valid MV of a merge candidate is used as an input to generate a MV pair with the assumption of bilateral matching. For example, one valid MV of a merge candidate is (MVa, refa) at reference list A. Then the reference picture refb of its paired bilateral MV is found in the other reference list B so that refa and refb are temporally at different sides of the current picture. If such a refb is not available in reference list B, refb is determined as a reference which is different from refa and its temporal distance to the current picture is the minimal one in list B. After refb is determined, MVb is derived by scaling MVa based on the temporal distance between the current picture and refa, refb.
)

  • 上述列表中的第3项,若干MV指的是当前CU中位置为(0, 0), (W/2, 0), (0, H/2) 和 (W/2, H/2)的MV;
  • 对于AMVP模式的CU,最多添加15个MV;对于merge模式的CU,最多添加13个MV;
2.2、Sub-CU级MV候选列表
  1. CU级得到的MV;
  2. 上方、左方、左上方和右上方相邻MV;
  3. 比例伸缩后的参考帧中的同位MV;
  4. 前4个ATMVP候选;
  5. 前4个STMVP候选;
  • 第3项中MV获取方式如下:遍历两个参考帧列表,将参考帧中位于Sub-CU同位位置的MV进行比例伸缩;
  • 最多允许17个候选;
2.3、插值MV场的生成(eneration of interpolated MV field)

Before coding a frame, interpolated motion field is generated for the whole picture based on unilateral ME. Then the motion field may be used later as CU level or sub-CU level MV candidates.
First, the motion field of each reference pictures in both reference lists is traversed at 4×4 block level. For each 4×4 block, if the motion associated to the block passing through a 4×4 block in the current picture (as shown in Figure 21) and the block has not been assigned any interpolated motion, the motion of the reference block is scaled to the current picture according to the temporal distance TD0 and TD1 (the same way as that of MV scaling of TMVP in HEVC) and the scaled motion is assigned to the block in the current frame. If no scaled MV is assigned to a 4×4 block, the block’s motion is marked as unavailable in the interpolated motion field.
FRUC中的单向ME

2.4、插值和匹配cost(Interpolation and matching cost)

当MV指向一个分像素样点位置时,那么运动补偿需要插值(因为MV指向的参考块没有准确落在每一个像素点上)。

  • 为了降低复杂度,BM和TM均采用双线性(bi-linear)插值(HEVC中采用的是8-tap插值);

不同阶段的matching cost不相同

  • 当从CU级别的cand list中选取最优候选时,matching cost为SAD;
  • 起始点确定以后,BM中Sub-CU级别的搜索matching cost计算公式如下
    C o s t = S A D + w ∗ ( ∣ M V x − M V x s ∣ + ∣ M V y − M V y s ∣ ) Cost = SAD + w*(|MV_x - MV^s_x| + |MV_y - MV^s_y|) Cost=SAD+w(MVxMVxs+MVyMVys)
    w根据经验设置为4, M V x MV_x MVx M V x s MV^s_x MVxs为当前MV和起始点MV;
  • 起始点确定后,TM中SUb-CU级别的搜索仍然使用SAD;

FRUC模式中,仅仅通过luma获得的MV应用于Luma和Chroma。当MV确定之后,最终MC通过8-taps和4-taps插值滤波器进行。

2.5、MV refinement

MV refinement is a pattern based MV search with the criterion of bilateral matching cost or template matching cost. In the JEM, two search patterns are supported – an unrestricted center-biased diamond search (UCBDS) and an adaptive cross search for MV refinement at the CU level and sub-CU level, respectively. For both CU and sub-CU level MV refinement, the MV is directly searched at quarter luma sample MV accuracy, and this is followed by one-eighth luma sample MV refinement. The search range of MV refinement for the CU and sub-CU step are set equal to 8 luma samples.

2.6、TM中的预测方向选取

由于BM需要沿着当前CU的运动轨迹从两个不同的块中获取MV,因此BM总是使用双向预测。但是TM可以是list0方向的单向预测、list1方向的单向预测或双向预测,具体选取规则如下:

If costBi <= factor * min (cost0, cost1)
	bi-prediction is used;
Otherwise, if cost0 <= cost1
	uni-prediction from list0 is used;
Otherwise,
	uni-prediction from list1 is used;
  • cost0、cost1、costBi分别表示list0方向TM的SAD,list1方向TM的SAD、双向TM的SAD;
  • factor=1.25,意味着偏向于选取双向预测;
  • 该选取规则仅仅应用于CU级别的TM过程。.

3、使用方法

  • 解码端:只有当Merge Flag为true时才可能使用FRUC。若FRUC Flag = true,传输FRUC-mode flag用来标识使用的是哪一种方法(双向匹配或模板匹配);否则使用正常的Merge模式。
  • 编码端:根据率失真代价决定是否使用FRUC模式以及使用哪种方法。

。。。只看文档好像理解得很模糊,之后有时间看了代码再补充。

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值