AV1 specification を読む (出力処理・参照フレーム更新処理)


AV1 specification 日本語訳

デコードしたフレームを、どのように出力し、どのように参照フレームとしてほぞんするかです。
非常にシンプルにできているようです。


出力処理

この処理は、フレームを選択的に表示するために呼ばれます。

show_existing_frame==1 ならば、デコーダは以下のように過去のデコードされたフレームを出力します。

  • w = RefFrameWidth[frame_to_show_map_idx]
  • h = RefFrameHeight[frame_to_show_map_idx]
  • subX = RefSubsamplingX[frame_to_show_map_idx]
  • subY = RefSubsamplingY[frame_to_show_map_idx]
  • Yプレーンは w x h 画素で、座標 x,y の画素は FrameStore[frame_to_show_map_idx][0][x][y] です (x=0..w-1, y=0..h-1)
  • Uプレーンは (w+subX)>>subX x (h+subY)>>subY 画素で、座標 x,y の画素は FrameStore[frame_to_show_map_idx][1][x][y] です (x=0..w-1, y=0..h-1)
  • Vプレーンは (w+subX)>>subX x (h+subY)>>subY 画素で、座標 x,y の画素は FrameStore[frame_to_show_map_idx][2][x][y] です (x=0..w-1, y=0..h-1)
  • 各画素のビット深度は RefBitDepth[frame_to_show_map_idx]

そうではなく、show_frame_==1 ならば、デコードは以下のようにカレントフレームを出力します。

  • w = FrameWidth
  • h = FrameHeight
  • subX = subsampling_x
  • subY = subsampling_y
  • Yプレーンは w x h 画素で、座標 x,y の画素は CurrFrame[frame_to_show_map_idx][0][x][y] です (x=0..w-1, y=0..h-1)
  • Uプレーンは (w+subX)>>subX x (h+subY)>>subY 画素で、座標 x,y の画素は CurrFrame[frame_to_show_map_idx][1][x][y] です (x=0..w-1, y=0..h-1)
  • Vプレーンは (w+subX)>>subX x (h+subY)>>subY 画素で、座標 x,y の画素は CurrFrame[frame_to_show_map_idx][2][x][y] です (x=0..w-1, y=0..h-1)
  • 各画素のビット深度は BitDepth

参照フレーム更新処理

この処理は、フレームをデコードする際の最終ステップとして呼び出されます。

この処理の入力は、カレントフレーム CurrFrame[plane][x][y] の画素です。

この処理の出力は、更新された参照フレームと動きベクトルのセットです。

以下の手順を適用します。

  1. i=0..NUM_REF_FRAMES-1 について、refresh_frame_flagsのビットiが1である場合に、下記の手順を適用します(つまり、(refresh_frame_flags>>i)&1==1)
    • RefFrameWidth[i] = FrameWidth
    • RefFrameHeight[i] = FrameHeight
    • RefSubsamplingX[i] = subsampling_x
    • RefSubsamplingY[i] = subsampling_y
    • RefBitDepth[i] = BitDepth
    • FrameStore[i][0][y][x] = CurrFrame[0][y][x], x=0..FrameWidth-1, y=0..FrameHeigtht-1
    • FrameStore[i][plane][y][x] = CurrFrame[plane][y][x], plane=1..2, x=0..((FrameWidth+subsampling_x)>>subsampling_x)-1, y=0..((FrameHeight+subsampling_y)>>subsampling_y)-1
  2. show_existing_frame==0 ならば、以下を適用します。
    • PrevRefFraes[row][col][list] = RefFrames[row][col][list], row=0..MiRows-1, col=0..MiCols-1, list=0..1
    • PrevMvs[row][col][list][comp] = Mvs[row][col][list][comp], row=0..MiRows-1, col=0..MiCols-1, list=0..1, comp=0..1