/* * WiVRn VR streaming * Copyright (C) 2024 Patrick Nicolas * Copyright (C) 2026 Philipp Schlegel * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include "video_encoder_vulkan.h" #include #include #include #include #include #include #include namespace wivrn { class video_encoder_vulkan_av1 : public video_encoder_vulkan { StdVideoAV1ColorConfig color_config{}; StdVideoAV1SequenceHeader seq_header{}; StdVideoAV1TileInfo tile_info{}; StdVideoAV1Quantization quantization{}; StdVideoAV1LoopFilter loop_filter{}; StdVideoAV1CDEF cdef{}; StdVideoAV1LoopRestoration loop_restoration{}; StdVideoAV1GlobalMotion global_motion{}; StdVideoAV1Segmentation segmentation{}; StdVideoEncodeAV1PictureInfo std_picture_info{}; StdVideoEncodeAV1OperatingPointInfo operating_point{}; std::array reference_name_slot_indices{}; std::array mi_col_starts{}; std::array mi_row_starts{}; std::array tile_widths_sb{}; std::array tile_heights_sb{}; std::vector dpb_std_info; std::vector dpb_std_slots; vk::VideoEncodeAV1PictureInfoKHR picture_info{}; std::optional gop_info; vk::VideoEncodeQualityLevelInfoKHR quality_level_info{}; vk::VideoEncodeAV1RateControlInfoKHR rate_control_av1{}; vk::VideoEncodeAV1RateControlLayerInfoKHR rate_control_layer_av1{}; vk::VideoEncodeAV1StdFlagsKHR std_flags{}; uint32_t single_reference_name_mask = 0; uint32_t max_single_reference_count = 0; uint32_t max_q_index = 0; uint32_t min_q_index = 0; uint32_t superblock_size = 64; uint8_t order_hint_bits = 7; // Reference name (LAST_FRAME + index) used for the single reference of inter frames int32_t ref_name_index = 0; bool rate_control_enabled = false; StdVideoAV1Level level = STD_VIDEO_AV1_LEVEL_2_0; video_encoder_vulkan_av1(wivrn::vk_bundle & vk, const vk::VideoCapabilitiesKHR & video_caps, const vk::VideoEncodeCapabilitiesKHR & encode_caps, const vk::VideoEncodeAV1CapabilitiesKHR & encode_av1_caps, uint8_t stream_idx, const encoder_settings & settings); void configure_from_caps(const vk::VideoEncodeAV1CapabilitiesKHR & encode_av1_caps); protected: std::vector setup_slot_info(size_t dpb_size) override; void * encode_info_next(uint32_t frame_num, size_t slot, std::optional ref_slot) override; vk::ExtensionProperties std_header_version() override; const void * begin_coding_next(const void * next) override; void send_idr_data() override; public: static std::unique_ptr create(wivrn::vk_bundle & vk, const encoder_settings & settings, uint8_t stream_idx); }; } // namespace wivrn