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

Đang mở Phù hợp với người mới
#390 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

@0z5a đang làm issue này rồi.

Từ ngày 21/11/2026.

  • #391 của @0z5a — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c
Lĩnh vực
audio-video-rtc

Hướng nghiên cứu

Bắt đầu tại build_pps_buffer() trong encode/av1encode.c và xem lời gọi memset(&(pps->reference_frames), VA_INVALID_ID, 8): reference_frames là một VASurfaceID[8], nên độ dài phải bao phủ toàn bộ mảng chứ không chỉ 8 byte. Đọc phần khởi tạo xung quanh và va_enc_av1.h để xác nhận các ô chưa dùng phải là VA_INVALID_SURFACE. Sau đó biên dịch lại và chạy lại lệnh av1encode -n 4 ... của người báo lỗi với một libva giả, để kiểm tra các ô 2-7 in ra 0xffffffff trong khi ô 0 vẫn giữ tham chiếu thật. Hoàn thành khi memset bao phủ cả tám phần tử và không còn cảnh báo -Wmemset-elt-size.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
C
Star
244
Fork
175
Merge trung bình
9 ngày 7 giờ
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của intel/libva-utils

Tất cả issue của intel/libva-utils

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.