AV1 specification を読む 2018-04-17 (7.10.2.2. Motion Vector Scaling Process)


AV1 specification 日本語訳 (2018-04-17)

AV1では、カレントフレームと解像度が異なる参照フレームを持つことが許されています。
本節では、その様な場合における動きベクトルの補正や参照画像スケーリングのための、座標変換やサンプリングのステップサイズを計算します。


7.10.2.2. Motion Vector Scaling Process

The inputs to this process are:

  • a variable plane specifying which plane is being predicted,
  • variable refIdx specifying which reference frame is being used,
  • variables x and y specifying the location of the top left sample in the CurrFrame[ plane ] array of the region to be predicted,
  • a variable mv specifying the clamped motion vector (in units of 1/8 th of a luma pixel, i.e. with 3 fractional bits).

この処理の入力は以下のとおりです。

  • どのプレーンを予測するか plane
  • どの参照フレームを使うか refIdx
  • CurrFrame[plane] 内の予測すべき領域の左上画素の座標 x, y
  • クランプしたMV(luma画素の1/8精度;小数3bit) mv

The outputs of this process are the variables startX and startY giving the reference block location in units of 1/1024 th of a sample, and variables xStep and yStep giving the step size in units of 1/1024 th of a sample.

この処理の出力は、1/1024画素単位の参照ブロック座標 (startX, startY) と、1/1024画素単位のステップサイズ (xStep, yStep) です。

This process is responsible for computing the sampling locations in the reference frame based on the motion vector.
The sampling locations are also adjusted to compensate for any difference in the size of the reference frame compared to the current frame.

この処理は、MVに基づいて参照フレーム内のサンプリング座標を計算します。
サンプリング座標は、カレントフレームと産所フレームとのサイズの差を補償するために調整されます。

Note: When intra block copy is being used, refIdx will be equal to -1 to signal prediction from the frame currently being decoded.
The arrays RefFrameWidth, RefFrameHeight, and RefUpscaledWidth include values at index -1 giving the dimensions of the current frame.

イントラブロックコピーを使う場合には、今デコードされているフレームから予測することを示すために refIdx=-1 になります。
RefFrameWidth, RefFrameHeight, RefUpscaleWidth のインデックス-1 で、カレントフレームの大きさを与えます。

It is a requirement of bitstream conformance that all the following conditions are satisfied:

  • 2 * FrameWidth >= RefUpscaledWidth[ refIdx ]
  • 2 * FrameHeight >= RefFrameHeight[ refIdx ]
  • FrameWidth <= 16 * RefUpscaledWidth[ refIdx ]
  • FrameHeight <= 16 * RefFrameHeight[ refIdx ]

ビットストリーム適合のためには、以下の条件をすべて満たす必要があります。

  • 2 * FrameWidth >= RefUpscaledWidth[ refIdx ]
  • 2 * FrameHeight >= RefFrameHeight[ refIdx ]
  • FrameWidth <= 16 * RefUpscaledWidth[ refIdx ]
  • FrameHeight <= 16 * RefFrameHeight[ refIdx ]

A variable xScale is set equal to (RefUpscaledWidth[ refIdx ] << REF_SCALE_SHIFT + ( FrameWidth / 2 ) ) / FrameWidth.
A variable yScale is set equal to (RefFrameHeight[ refIdx ] << REF_SCALE_SHIFT + ( FrameHeight / 2 ) ) / FrameHeight.

(xScale and yScale specify the size of the reference frame relative to the current frame in units where (1 << 14) is equivalent to both frames having the same size.)

xScale = (RefUpscaledWidth[ refIdx ] << REF_SCALE_SHIFT + ( FrameWidth / 2 ) ) / FrameWidth
yScale = (RefFrameHeight[ refIdx ] << REF_SCALE_SHIFT + ( FrameHeight / 2 ) ) / FrameHeight.

(xScale, yScale は、参照フレームのカレントフレームとの相対的な大きさで、(1<<14)の時に同じ大きさを意味します。)

The variables subX and subY are set equal to the subsampling for the current plane as follows:

  • If plane is equal to 0, subX is set equal to 0 and subY is set equal to 0.
  • Otherwise, subX is set equal to subsampling_x and subY is set equal to subsampling_y.

subX, subY をカレントプレーンのサブサンプリングとします。

  • plane==0 ならば、subX=0, subY=
  • そうではなければ、subX = subsampling_x, subY = subsampling_y

The variable halfSample (representing half the size of a sample in units of 1/16 th of a sample) is set equal to ( 1 << ( SUBPEL_BITS - 1 ) ).

halfSample = ( 1 << ( SUBPEL_BITS - 1 ) )
(1/16画素単位で表現した、半画素サイズ)

The variable origX is set equal to ( (x << SUBPEL_BITS) + ( ( 2 * mv[1] ) >> subX ) + halfSample ).
The variable origY is set equal to ( (y << SUBPEL_BITS) + ( ( 2 * mv[0] ) >> subY ) + halfSample ).

(origX and origY specify the location of the centre of the sample at the top-left corner of the reference block in the current frame’s coordinate system in units of 1/16 th of a sample, i.e. with SUBPEL_BITS=4 fractional bits.)

origX = ( (x << SUBPEL_BITS) + ( ( 2 * mv[1] ) >> subX ) + halfSample ).
origY = ( (y << SUBPEL_BITS) + ( ( 2 * mv[0] ) >> subY ) + halfSample ).

(origX, origY は、カレントフレーム座標系で 1/16画素単位の、参照ブロックの左上角画素の中心の座標を示します。つまり、SUBPEL_BITS=4 の小数ビットとなります。)

The variable baseX is set equal to (origX * xScale - ( halfSample << REF_SCALE_SHIFT ) ).
The variable baseY is set equal to (origY * yScale - ( halfSample << REF_SCALE_SHIFT ) ).

(baseX and baseY specify the location of the top-left corner of the block in the reference frame in the reference frame’s coordinate system with 18 fractional bits.)

baseX = (origX * xScale - ( halfSample << REF_SCALE_SHIFT ) ).
baseY = (origY * yScale - ( halfSample << REF_SCALE_SHIFT ) ).

(baseX, baseY は、参照フレーム座標系で小数18ビットを持つ、参照ブロックの左上角座標を示します。)

The variable off (containing a rounding offset for the filter tap selection) is set equal to ( ( 1 << (SCALE_SUBPEL_BITS - SUBPEL_BITS) ) / 2 ).

off = ( ( 1 << (SCALE_SUBPEL_BITS - SUBPEL_BITS) ) / 2 ).
(フィルタタップ選択のための丸めオフセット)

The output variable startX is set equal to (Round2Signed( baseX, REF_SCALE_SHIFT + SUBPEL_BITS - SCALE_SUBPEL_BITS) + off).
The output variable startY is set equal to (Round2Signed( baseY, REF_SCALE_SHIFT + SUBPEL_BITS - SCALE_SUBPEL_BITS) + off).

(startX and startY specify the location of the top-left corner of the block in the reference frame in the reference frame’s coordinate system with SCALE_SUBPEL_BITS=10 fractional bits.)

出力変数 startX = (Round2Signed( baseX, REF_SCALE_SHIFT + SUBPEL_BITS - SCALE_SUBPEL_BITS) + off).
出力変数 startY = (Round2Signed( baseY, REF_SCALE_SHIFT + SUBPEL_BITS - SCALE_SUBPEL_BITS) + off).

(startX, startY は、参照フレーム座標系で、小数 SCALE_SUBPEL_BITS=10 ビットを持つ、参照フレームのブロックの左上角座標を示します)

The output variable stepX is set equal to Round2Signed( xScale, REF_SCALE_SHIFT - SCALE_SUBPEL_BITS).
The output variable stepY is set equal to Round2Signed( yScale, REF_SCALE_SHIFT - SCALE_SUBPEL_BITS).

(stepX and stepY are the size of one current frame sample in the reference frame’s coordinate system with 10 fractional bits.)

出力変数 stepX is set equal to Round2Signed( xScale, REF_SCALE_SHIFT - SCALE_SUBPEL_BITS).
出力変数 stepY is set equal to Round2Signed( yScale, REF_SCALE_SHIFT - SCALE_SUBPEL_BITS).

(stepX, stepY は、参照フレーム座標系で、小数10bitを持つ、カレントフレーム画素のサイズを示します。)