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

Aperta Adatta ai principianti
#390 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@0z5a ci sta già lavorando.

Dal 21/11/2026.

  • #391 di @0z5a — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c

Direzione di ricerca

Inizia da build_pps_buffer() in encode/av1encode.c e guarda la chiamata memset(&(pps->reference_frames), VA_INVALID_ID, 8): reference_frames è un VASurfaceID[8], quindi la lunghezza dovrebbe coprire l'intero array e non 8 byte. Leggi l'inizializzazione circostante e va_enc_av1.h per confermare che gli slot non usati devono essere VA_INVALID_SURFACE. Poi ricompila e riesegui il comando av1encode -n 4 ... del segnalatore con una libva stub, per verificare che gli slot 2-7 stampino 0xffffffff mentre lo slot 0 conserva ancora il riferimento reale. È completato quando il memset copre tutte e otto le voci e non resta alcun avviso -Wmemset-elt-size.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C
Stelle
244
Fork
175
Merge medio
9g 7h
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di intel/libva-utils

Tutte le issue di intel/libva-utils

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.