维基百科,自由的百科全书

        运动补偿是一种描述相邻帧(相邻在这里表示在编码关系上相邻,在播放顺序上两帧未必相邻) 差别的方法,具体来说是描述前面一帧(相邻在这里表示在编码关系上的前面,在播放顺序上未必在当前帧前面)的每个小块怎样移动到当前帧中的某个位置去。这种方法经常被视频压缩/视频编解码器用来减少视频序列中的空域冗余。它也可以用来进行去交织(deinterlacing)的操作。

一个视频序列包含一定数量的图片–通常称为。相邻的图片通常很相似,也就是说,包含了很多冗余。使用运动补偿的目的是通过消除这种冗余,来提高压缩比。

最早的运动补偿的设计只是简单的从当前帧中减去参考帧,从而得到通常含有较少能量(或者成为信息)的"残差",从而可以用较低的码率进行编码。解码器可以通过简单的加法完全恢复编码帧。

一个稍微复杂一点的设计是估计一下整帧场景的移动和场景中物体的移动,并将这些运动通过一定的参数编码到码流中去。这样预测帧上的像素值就是由参考帧上具有一定位移的相应像素值而生成的。这样的方法比简单的相减可以获得能量更小的残差,从而获得更好的压缩比–当然,用来描述运动的参数不能在码流中占据太大的部分,否则就会抵消复杂的运动估计带来的好处。

通常,图像帧是一组一组进行处理的。每组的第一帧(通常是第一帧)在编码的时候不使用运动估计的办法,这种帧称为帧内编码帧(Intra frame)或者I帧。该组中的其它帧使用帧间编码帧(Inter frame),通常是P帧。这种编码方式通常被称为IPPPP,表示编码的时候第一帧是I帧,其它帧是P帧

在进行预测的时候,不仅仅可以从过去的帧来预测当前帧,还可以使用未来的帧来预测当前帧。当然在编码的时候,未来的帧必须比当前帧更早的编码,也就是说,编码的顺序和播放的顺序是不同的。通常这样的当前帧是使用过去和未来的I帧或者P帧同时进行预测,被称为双向预测帧,即B帧。这种编码方式的编码顺序的一个例子为 IBBPBBPBBPBB。

目录

[隐藏]

全局运动补偿

全局运动补偿中, 运动模型基本上就是反映摄像机的各种运动,包括平移,旋转,变焦等等。这种模型特别适合对没有运动物体的静止场景的编码。 全局运动补偿有下面的一些优点:

  • 该模型仅仅使用少数的参数对全局的运行进行描述,参数所占用的码率基本上可以忽略不计。
  • 该方法不对帧进行分区编码,这避免了分区造成的块效应。
  • 在时间方向的一条直线的点如果在空间方向具有相等的间隔,就对应了在实际空间中连续移动的点。其它的运动估计算法通常会在时间方向引入非连续性。

但是,缺点是,如果场景中有运动物体的话,全局运动补偿就不足以表示了。这时候应该选用其它的方法。

分块运动补偿

在分块运动补偿 (BMC for block motion compensation) 中,每帧被分为若干像素块 (在大多数视频编码标准,如MPEG中,是分为16×16的像素块)。从参考帧的某个位置的等大小的块对当前块进行预测,预测的过程中只有平移,平移的大小被称为运动矢量

对分块运动补偿来说,运动矢量是模型的必要参数,必须一起编码加入码流中。由于运动矢量之间并不是独立的(例如属于同一个运动物体的相邻两块通常运动的相关性很大),通常使用差分编码来降低码率。这意味着在相邻的运动矢量编码之前对它们作差,只对差分的部分进行编码。使用熵编码对运动矢量的成分进行编码可以进一步消除运动矢量的统计冗余(通常运动矢量的差分集中于0矢量附近)。

运动矢量的值可以是非整数的,此时的运动补偿被称为亚像素精度的运动补偿。这是通过对参考帧像素值进行亚像素级插值,而后进行运动补偿做到的。最简单的亚像素精度运动补偿使用半像素精度,也有使用1/4像素和1/8像素精度的运动补偿算法。更高的亚像素精度可以提高运动补偿的精确度,但是大量的插值操作大大增加了计算复杂度。

分块运动补偿的一个大缺点在于在块之间引入的非连续性,通常称为块效应。当块效应严重时,解码图像看起来会有像马赛克一样的效果,严重影响视觉质量。另外一个缺点是,当高频分量较大时,会引起振铃效应。关于高频分量,请参见对运动补偿后的残差进行变换的方法: 变换编码

变块大小运动补偿

Variable block-size motion compensation (VBSMC) is the use of BMC with the ability for the encoder to dynamically select the size of the blocks. When coding video, the use of larger blocks can reduce the number of bits needed to represent the motion vectors, while the use of smaller blocks can result in a smaller amount of prediction residual information to encode. Older designs such as H.261 and MPEG-1 video typically use a fixed block size, while newer ones such as H.263, MPEG-4 Part 2, H.264/MPEG-4 AVC, and VC-1 give the encoder the ability to dynamically choose what block size will be used to represent the motion.


Overlapped分块运动补偿

Overlapped block motion compensation (OBMC) is a good solution to these problems because it not only increases prediction accuracy but also avoids blocking artifacts. When using OBMC, blocks are typically twice as big in each dimension and overlap quadrant-wise with all 8 neighbouring blocks. Thus, each pixel belongs to 4 blocks. In such a scheme, there are 4 predictions for each pixel which are summed up to a weighted mean. For this purpose, blocks are associated with a window function that has the property that the sum of 4 overlapped windows is equal to 1 everywhere.

Studies of methods for reducing the complexity of OBMC have shown that the contribution to the window function is smallest for the diagonally-adjacent block. Reducing the weight for this contribution to zero and increasing the other weights by an equal amount leads to a substantial reduction in complexity without a large penalty in quality. In such a scheme, each pixel then belongs to 3 blocks rather than 4, and rather than using 8 neighboring blocks, only 4 are used for each block to be compensated. Such a scheme is found in the H.263 Annex F Advanced Prediction mode.

运动估计

Motion estimation (BME, OBME) is the process of finding optimal or near-optimal motion vectors. The amount of prediction error for a block is often measured using the mean squared error (MSE) or sum-of-absolute-differences (SAD) between the predicted and actual pixel values over all pixels of the motion-compensated region.

To find optimal motion vectors, one basically has to calculate the block prediction error for each motion vector within a certain search range and pick the one that has the best compromise between the amount of error and the number of bits needed for motion vector data. The motion estimation technique of simply exhaustively testing all possible motion representations to perform such an optimization is called full search. A faster and sub-optimal method is to use a coarse search grid for a first approximation and to refine the grid in the surrounding of this approximation in further steps. One common method is the 3-step search, which uses search grids of 3×3 motion vectors and 3 refinement steps to get an overall search range of 15×15 pixel.

For OBME, the pixel-wise prediction errors of a block and its overlapping neighbouring blocks have to be weighted and summed according to the window function before being squared. As in the process of successively finding/refining motion vectors some neighbouring MVs are not known yet, the corresponding prediction errors can be ignored (not added) as a sub-optimal solution.

The major disadvantages of OBMC are increased computational complexity of OBME, and the fact that prediction errors and, thus, also the optimal motion vectors depend on neighbouring blocks/motion vectors. Therefore, there is no algorithm with polynomial computational complexity that guarantees optimal motion vectors. However, there are near-optimal iterative and non-iterative methods with acceptable computational complexity.


评论

该日志第一篇评论

发表评论

评论也有版权!