Skip to content

Add AV1 support v2#3

Merged
hgaiser merged 8 commits intomainfrom
av1-support-rebased
Feb 28, 2026
Merged

Add AV1 support v2#3
hgaiser merged 8 commits intomainfrom
av1-support-rebased

Conversation

@hgaiser
Copy link
Owner

@hgaiser hgaiser commented Feb 28, 2026

Continuation of #1

Thanks to @porkloin

This currently produces the following through the verify_all example:

Testing H264 Eight Yuv420...
  PASS: PSNR = 61.57 dB
------------------------------------------------
Testing H264 Eight Yuv444...
  PASS: PSNR = 58.82 dB
------------------------------------------------
Testing H264 Ten Yuv420...
  FAIL: Failed to create encoder: No suitable Vulkan physical device found: Failed to query Vulkan Video encode capabilities for requested H.264 profile: ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR
------------------------------------------------
Testing H264 Ten Yuv444...
  FAIL: Failed to create encoder: No suitable Vulkan physical device found: Failed to query Vulkan Video encode capabilities for requested H.264 profile: ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR
------------------------------------------------
Testing H265 Eight Yuv420...
  PASS: PSNR = 62.39 dB
------------------------------------------------
Testing H265 Eight Yuv444...
  PASS: PSNR = 64.04 dB
------------------------------------------------
Testing H265 Ten Yuv420...
  PASS: PSNR = 59.94 dB
------------------------------------------------
Testing H265 Ten Yuv444...
  PASS: PSNR = 61.29 dB
------------------------------------------------
Testing AV1 Eight Yuv420...
2026-02-28T22:53:01.793992Z  WARN pixelforge::encoder::av1::init: AV1 encoding is experimental. On NVIDIA GPUs, P-frames cannot reference other P-frames, causing all P-frames to reference the I-frame instead. This leads to progressively larger frame sizes over time. Consider using H.264 or HEVC until this is resolved.
  PASS: PSNR = 58.66 dB
------------------------------------------------
Testing AV1 Eight Yuv444...
2026-02-28T22:53:01.877619Z  WARN pixelforge::encoder::av1::init: AV1 encoding is experimental. On NVIDIA GPUs, P-frames cannot reference other P-frames, causing all P-frames to reference the I-frame instead. This leads to progressively larger frame sizes over time. Consider using H.264 or HEVC until this is resolved.
  FAIL: Failed to create encoder: No suitable Vulkan physical device found: Failed to query Vulkan Video encode capabilities for AV1: ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR
------------------------------------------------
Testing AV1 Ten Yuv420...
2026-02-28T22:53:01.877685Z  WARN pixelforge::encoder::av1::init: AV1 encoding is experimental. On NVIDIA GPUs, P-frames cannot reference other P-frames, causing all P-frames to reference the I-frame instead. This leads to progressively larger frame sizes over time. Consider using H.264 or HEVC until this is resolved.
  PASS: PSNR = 53.02 dB
------------------------------------------------
Testing AV1 Ten Yuv444...
2026-02-28T22:53:01.987419Z  WARN pixelforge::encoder::av1::init: AV1 encoding is experimental. On NVIDIA GPUs, P-frames cannot reference other P-frames, causing all P-frames to reference the I-frame instead. This leads to progressively larger frame sizes over time. Consider using H.264 or HEVC until this is resolved.
  FAIL: Failed to create encoder: No suitable Vulkan physical device found: Failed to query Vulkan Video encode capabilities for AV1: ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR

porkloin and others added 7 commits February 25, 2026 23:54
- Add missing virtual_buffer_size_ms fields to EncodeConfig::av1()
- Add use_layered parameter to create_dpb_images call
- Add upload_queue_family parameter to create_command_resources call
- Add upload_queue field to UploadParams
- Add upload_command_pool field to AV1Encoder struct
- Add clear_input_image call during AV1 encoder initialization
- Fix Drop impl to clean up upload_command_pool
- Revert verify_all resolution change to match main branch (320x240)
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds AV1 encoding support to PixelForge (Vulkan Video), extending codec discovery/device creation to include AV1 and introducing a new AV1 encoder implementation alongside small refactors to shared encode utilities and examples/docs.

Changes:

  • Add AV1 codec discovery, device extension enabling, and feature chaining in Vulkan device creation.
  • Introduce a new encoder::av1 module (init/encode/api) and wire it into the Encoder enum plus EncodeConfig::av1.
  • Update docs/examples to mention and exercise AV1, and refactor shared H.264/H.265 encode submission helpers.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/vulkan.rs Detect AV1 encode support + enable AV1 device extensions/features conditionally.
src/lib.rs Update crate docs to include AV1 and add AV1 example reference/warning.
src/image.rs Rework InputImage to be transfer-only staging image; add upload_yuv420_to.
src/encoder/resources.rs Tighten DPB barrier masks/stages and factor out shared encode CB prep + submit/read helpers.
src/encoder/mod.rs Add EncodeConfig::av1, add Encoder::AV1, and route encode/flush/idr calls.
src/encoder/h264/encode.rs Use shared encode command buffer prep + submit/read helper.
src/encoder/h265/encode.rs Use shared encode command buffer prep + submit/read helper; factor DPB post barrier.
src/encoder/av1/mod.rs New AV1 encoder core type + resource tracking + tests.
src/encoder/av1/init.rs New AV1 session setup, capabilities query, resource creation, session params.
src/encoder/av1/encode.rs New AV1 per-frame encode recording/submission path.
src/encoder/av1/api.rs New AV1 public API (encode/flush/request_idr) and sequence header retrieval.
examples/verify_all.rs Add AV1 to verification matrix; adjust testdata naming + upload path.
examples/query_capabilities.rs Add tracing init (RUST_LOG support).
examples/encode_h264.rs Switch tracing init to EnvFilter-based configuration.
examples/encode_h265.rs Switch tracing init to EnvFilter-based configuration.
examples/encode_av1.rs New AV1 encoding example.
README.md Document AV1 support and add AV1 example + warning.
Cargo.toml Pin ash to a specific git rev with needed Vulkan AV1 bindings.
Cargo.lock Update locked ash revision/version metadata accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hgaiser hgaiser force-pushed the av1-support-rebased branch 2 times, most recently from c1846b1 to d4895fc Compare February 28, 2026 23:12
@hgaiser hgaiser force-pushed the av1-support-rebased branch from d4895fc to f1dbf7e Compare February 28, 2026 23:27
@hgaiser hgaiser merged commit 48488d3 into main Feb 28, 2026
6 checks passed
@hgaiser hgaiser deleted the av1-support-rebased branch March 10, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants