av1encode: reference_frames[2..7] left as surface 0 (memset only covers 8 bytes)

オープン 初心者向け
#390 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@0z5a がすでに取り組んでいます。

2026年11月21日 から。

  • #391 @0z5a による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c

調査の方向性

encode/av1encode.c の build_pps_buffer() から始め、memset(&(pps->reference_frames), VA_INVALID_ID, 8) の呼び出しを確認してください。reference_frames は VASurfaceID[8] なので、長さは 8 バイトではなく配列全体を覆う必要があります。前後の初期化処理と va_enc_av1.h を読み、未使用のスロットが VA_INVALID_SURFACE でなければならないことを確認してください。その後、再ビルドし、スタブの libva に対して報告者の av1encode -n 4 ... コマンドを再実行して、スロット 2〜7 が 0xffffffff を表示し、スロット 0 は実際の参照を保持し続けることを確認してください。memset が 8 個すべてのエントリを覆い、-Wmemset-elt-size の警告が残っていなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

build_pps_buffer() in encode/av1encode.c initializes the reference list with

memset(&(pps->reference_frames), VA_INVALID_ID, 8);

reference_frames is VASurfaceID[8], i.e. 32 bytes, so this only sets entries 0 and 1 to 0xffffffff. The caller zeroes the whole struct first, so entries 2–7 stay 0. Surface ID 0 is a real surface: it is src_surface[0], the first surface av1encode creates. GCC 15 also warns about it (-Wmemset-elt-size).

So every frame tells the driver that the first input surface is a reference in slots 2–7. va_enc_av1.h says unused entries must not point to a picture. iHD's AV1 DDI calls UpdateRegisteredRTSurfaceFlag() for every entry that is not VA_INVALID_SURFACE, then SetupCodecPicture() for all eight. So it registers that input surface as a reference render target on every frame and puts it in RefFrameList[2..7]. iHD numbers surfaces from 0 in a new context.

How I checked: I built av1encode against a small stub libva that prints reference_frames from each VAEncPictureParameterBufferType buffer. Then I ran av1encode -n 4 -f 30 --width 64 --height 64 --intra_period 8 --ip_period 1 -o out.ivf:

frame 0 type 0 reference_frames: 0xffffffff 0xffffffff 0 0 0 0 0 0
frame 1 type 1 reference_frames: 0x10 0xffffffff 0 0 0 0 0 0
frame 2 type 1 reference_frames: 0x11 0xffffffff 0 0 0 0 0 0
frame 3 type 1 reference_frames: 0x12 0xffffffff 0 0 0 0 0 0

Setting all eight entries to VA_INVALID_SURFACE gives 0xffffffff in slots 2–7, and slot 0 keeps the real reference. I don't have an Intel GPU here, so I haven't checked whether this changes the encoded stream on real hardware.

主要言語
C
スター
244
フォーク
175
平均マージ
9日 7時間
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

intel/libva-utils のほかの issue

intel/libva-utils の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。