Drop xrt::drivers namespace

This commit is contained in:
Patrick Nicolas
2024-10-03 23:39:32 +02:00
parent 6946d5144a
commit fdb79b1939
78 changed files with 260 additions and 260 deletions
+12 -12
View File
@@ -37,7 +37,7 @@
#include "ffmpeg/video_encoder_va.h"
#endif
using namespace xrt::drivers::wivrn;
using namespace wivrn;
// TODO: size independent bitrate
static const uint64_t default_bitrate = 50'000'000;
@@ -50,7 +50,7 @@ static bool is_nvidia(vk::PhysicalDevice physical_device)
return props.vendorID == 0x10DE;
}
static void split_bitrate(std::vector<xrt::drivers::wivrn::encoder_settings> & encoders, uint64_t bitrate)
static void split_bitrate(std::vector<wivrn::encoder_settings> & encoders, uint64_t bitrate)
{
double total_weight = 0;
for (auto & encoder: encoders)
@@ -58,11 +58,11 @@ static void split_bitrate(std::vector<xrt::drivers::wivrn::encoder_settings> & e
double w = encoder.width * encoder.height;
switch (encoder.codec)
{
case xrt::drivers::wivrn::h264:
case wivrn::h264:
w *= 2;
break;
case xrt::drivers::wivrn::h265:
case xrt::drivers::wivrn::av1:
case wivrn::h265:
case wivrn::av1:
break;
}
encoder.bitrate = w;
@@ -75,7 +75,7 @@ static void split_bitrate(std::vector<xrt::drivers::wivrn::encoder_settings> & e
}
}
void print_encoders(const std::vector<xrt::drivers::wivrn::encoder_settings> & encoders)
void print_encoders(const std::vector<wivrn::encoder_settings> & encoders)
{
int group = -1;
for (auto & encoder: encoders)
@@ -117,7 +117,7 @@ static void check_scale(std::string_view encoder_name, video_codec codec, uint16
}
#if WIVRN_USE_VAAPI
static std::optional<xrt::drivers::wivrn::video_codec> filter_codecs_vaapi(wivrn_vk_bundle & bundle, const std::vector<xrt::drivers::wivrn::video_codec> & codecs)
static std::optional<wivrn::video_codec> filter_codecs_vaapi(wivrn_vk_bundle & bundle, const std::vector<wivrn::video_codec> & codecs)
{
VideoEncoderFFMPEG::mute_logs mute;
encoder_settings s{
@@ -148,7 +148,7 @@ static std::optional<xrt::drivers::wivrn::video_codec> filter_codecs_vaapi(wivrn
}
#endif
static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector<xrt::drivers::wivrn::video_codec> & headset_codecs, configuration::encoder & config)
static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector<wivrn::video_codec> & headset_codecs, configuration::encoder & config)
{
if (config.name.empty())
{
@@ -200,7 +200,7 @@ static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector<xrt::drive
config.codec = h265;
}
static std::vector<configuration::encoder> get_encoder_default_settings(wivrn_vk_bundle & bundle, const std::vector<xrt::drivers::wivrn::video_codec> & headset_codecs)
static std::vector<configuration::encoder> get_encoder_default_settings(wivrn_vk_bundle & bundle, const std::vector<wivrn::video_codec> & headset_codecs)
{
configuration::encoder base;
fill_defaults(bundle, headset_codecs, base);
@@ -258,7 +258,7 @@ static void make_even(uint16_t & value, uint16_t max)
value = std::min(value, max);
}
std::vector<encoder_settings> xrt::drivers::wivrn::get_encoder_settings(wivrn_vk_bundle & bundle, uint32_t & width, uint32_t & height, const from_headset::headset_info_packet & info)
std::vector<encoder_settings> wivrn::get_encoder_settings(wivrn_vk_bundle & bundle, uint32_t & width, uint32_t & height, const from_headset::headset_info_packet & info)
{
configuration config;
try
@@ -291,11 +291,11 @@ std::vector<encoder_settings> xrt::drivers::wivrn::get_encoder_settings(wivrn_vk
height *= scale[1];
height += height % 2;
std::vector<xrt::drivers::wivrn::encoder_settings> res;
std::vector<wivrn::encoder_settings> res;
int next_group = 0;
for (const auto & encoder: config.encoders)
{
xrt::drivers::wivrn::encoder_settings settings{};
wivrn::encoder_settings settings{};
settings.encoder_name = encoder.name;
settings.width = std::ceil(encoder.width.value_or(1) * width);
settings.height = std::ceil(encoder.height.value_or(1) * height);
+3 -3
View File
@@ -27,7 +27,7 @@
struct wivrn_vk_bundle;
namespace xrt::drivers::wivrn
namespace wivrn
{
struct encoder_settings : public to_headset::video_stream_description::item
@@ -43,6 +43,6 @@ struct encoder_settings : public to_headset::video_stream_description::item
std::vector<encoder_settings> get_encoder_settings(wivrn_vk_bundle &, uint32_t & width, uint32_t & height, const from_headset::headset_info_packet & info);
} // namespace xrt::drivers::wivrn
} // namespace wivrn
void print_encoders(const std::vector<xrt::drivers::wivrn::encoder_settings> & encoders);
void print_encoders(const std::vector<wivrn::encoder_settings> & encoders);
@@ -63,7 +63,7 @@ bool set_log_level()
bool VideoEncoderFFMPEG::once = set_log_level();
std::optional<xrt::drivers::wivrn::VideoEncoder::data> VideoEncoderFFMPEG::encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t slot)
std::optional<wivrn::VideoEncoder::data> VideoEncoderFFMPEG::encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t slot)
{
push_frame(idr, target_timestamp, slot);
std::shared_ptr<AVPacket> enc_pkt(av_packet_alloc(), [](AVPacket * d) { av_packet_free(&d); });
+3 -3
View File
@@ -23,10 +23,10 @@
#include "ffmpeg_helper.h"
#include <chrono>
class VideoEncoderFFMPEG : public xrt::drivers::wivrn::VideoEncoder
class VideoEncoderFFMPEG : public wivrn::VideoEncoder
{
public:
using Codec = xrt::drivers::wivrn::video_codec;
using Codec = wivrn::video_codec;
std::optional<data> encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t slot) override;
@@ -38,7 +38,7 @@ public:
protected:
VideoEncoderFFMPEG() :
xrt::drivers::wivrn::VideoEncoder(true) {}
wivrn::VideoEncoder(true) {}
virtual void push_frame(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot) = 0;
+1 -1
View File
@@ -127,7 +127,7 @@ vk::Format drm_to_vulkan_fmt(uint32_t drm_fourcc)
} // namespace
video_encoder_va::video_encoder_va(wivrn_vk_bundle & vk, xrt::drivers::wivrn::encoder_settings & settings, float fps) :
video_encoder_va::video_encoder_va(wivrn_vk_bundle & vk, wivrn::encoder_settings & settings, float fps) :
synchronization2(vk.vk.features.synchronization_2)
{
auto drm_hw_ctx = make_drm_hw_ctx(vk.physical_device, settings.device);
+2 -2
View File
@@ -24,7 +24,7 @@
#include "video_encoder_ffmpeg.h"
#include <vulkan/vulkan_raii.hpp>
namespace xrt::drivers::wivrn
namespace wivrn
{
struct encoder_settings;
}
@@ -45,7 +45,7 @@ class video_encoder_va : public VideoEncoderFFMPEG
bool synchronization2 = false;
public:
video_encoder_va(wivrn_vk_bundle &, xrt::drivers::wivrn::encoder_settings & settings, float fps);
video_encoder_va(wivrn_vk_bundle &, wivrn::encoder_settings & settings, float fps);
void present_image(vk::Image y_cbcr, vk::raii::CommandBuffer & cmd_buf, uint8_t slot) override;
+2 -2
View File
@@ -39,7 +39,7 @@
#include "video_encoder_x264.h"
#endif
namespace xrt::drivers::wivrn
namespace wivrn
{
VideoEncoder::sender::sender() :
@@ -293,4 +293,4 @@ void VideoEncoder::SendData(std::span<uint8_t> data, bool end_of_frame)
cnx->dump_time("send_end", shard.frame_idx, os_monotonic_get_ns(), stream_idx);
}
} // namespace xrt::drivers::wivrn
} // namespace wivrn
+2 -2
View File
@@ -35,7 +35,7 @@
struct wivrn_vk_bundle;
namespace xrt::drivers::wivrn
namespace wivrn
{
class wivrn_session;
@@ -126,4 +126,4 @@ protected:
void SendData(std::span<uint8_t> data, bool end_of_frame);
};
} // namespace xrt::drivers::wivrn
} // namespace wivrn
+2 -2
View File
@@ -60,7 +60,7 @@
} \
} while (0)
namespace xrt::drivers::wivrn
namespace wivrn
{
void VideoEncoderNvenc::deleter::operator()(CudaFunctions * fn)
@@ -445,4 +445,4 @@ std::array<int, 2> VideoEncoderNvenc::get_max_size(video_codec codec)
return result;
}
} // namespace xrt::drivers::wivrn
} // namespace wivrn
+2 -2
View File
@@ -26,7 +26,7 @@
#include <ffnvcodec/nvEncodeAPI.h>
#include <vulkan/vulkan_raii.hpp>
namespace xrt::drivers::wivrn
namespace wivrn
{
class VideoEncoderNvenc : public VideoEncoder
@@ -73,4 +73,4 @@ public:
static std::array<int, 2> get_max_size(video_codec);
};
} // namespace xrt::drivers::wivrn
} // namespace wivrn
+2 -2
View File
@@ -23,7 +23,7 @@
#include "utils/wivrn_vk_bundle.h"
#include <stdexcept>
namespace xrt::drivers::wivrn
namespace wivrn
{
void VideoEncoderX264::ProcessCb(x264_t * h, x264_nal_t * nal, void * opaque)
@@ -249,4 +249,4 @@ VideoEncoderX264::~VideoEncoderX264()
x264_encoder_close(enc);
}
} // namespace xrt::drivers::wivrn
} // namespace wivrn
+2 -2
View File
@@ -27,7 +27,7 @@
#include <mutex>
#include <vulkan/vulkan_raii.hpp>
namespace xrt::drivers::wivrn
namespace wivrn
{
class VideoEncoderX264 : public VideoEncoder
@@ -77,4 +77,4 @@ private:
void InsertInPendingNal(pending_nal && nal);
};
} // namespace xrt::drivers::wivrn
} // namespace wivrn