av1encode: reference_frames[2..7] left as surface 0 (memset only covers 8 bytes)
评估
- 难度
- 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 覆盖全部八个条目且不再出现 -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 小时
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
intel/libva-utils 的其他 Issue
-
难度 5/5 一周以上 新手友好度 35/100
intel/libva-utils#387 ·
-
难度 4/5 3-5 天 新手友好度 30/100
intel/libva-utils#378 · 6 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
intel/libva-utils#376 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
intel/libva-utils#374 ·
-
难度 4/5 3-5 天 新手友好度 25/100
intel/libva-utils#366 · 3 条评论 ·
查看 intel/libva-utils 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
SanderMertens/flecs#2444 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 74/100
Cisco-Talos/clamav#1941 ·
维护者通常 2 天内回复
-
Status: Opened
难度 2/5 1-3 小时 新手友好度 68/100
espressif/esp-eth-drivers#201 ·
-
难度 1/5 1 小时以内 新手友好度 74/100
libsdl-org/SDL#16788 ·
维护者通常 1 天内回复