style(*): format source code under tools with clang-format
Some checks failed
Build / ubuntu (push) Has been cancelled
Build / windows (push) Has been cancelled
Build / container (push) Has been cancelled
Build / appimage (push) Has been cancelled

Signed-off-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
k4yt3x 2025-01-12 00:00:00 +00:00
parent 031c0a72fb
commit 54b39643a9
No known key found for this signature in database
9 changed files with 38 additions and 38 deletions

View File

@ -16,11 +16,11 @@ struct Arguments {
[[nodiscard]] int parse_args(
int argc,
#ifdef _WIN32
wchar_t *argv[],
wchar_t* argv[],
#else
char *argv[],
char* argv[],
#endif
Arguments &arguments,
video2x::processors::ProcessorConfig &proc_cfg,
video2x::encoder::EncoderConfig &enc_cfg
Arguments& arguments,
video2x::processors::ProcessorConfig& proc_cfg,
video2x::encoder::EncoderConfig& enc_cfg
);

View File

@ -9,10 +9,10 @@ class newline_safe_sink : public spdlog::sinks::ansicolor_stdout_sink_mt {
newline_safe_sink() = default;
~newline_safe_sink() = default;
newline_safe_sink(const newline_safe_sink &) = delete;
newline_safe_sink &operator=(const newline_safe_sink &) = delete;
newline_safe_sink(const newline_safe_sink&) = delete;
newline_safe_sink& operator=(const newline_safe_sink&) = delete;
void log(const spdlog::details::log_msg &msg);
void log(const spdlog::details::log_msg& msg);
void set_needs_newline(bool needs_newline) { needs_newline_.store(needs_newline); };
bool get_needs_newline() { return needs_newline_.load(); };

View File

@ -6,7 +6,7 @@
namespace po = boost::program_options;
template <typename T>
void validate_positive(const T &value, const std::string &option_name) {
void validate_positive(const T& value, const std::string& option_name) {
if (value < 0) {
throw po::validation_error(
po::validation_error::invalid_option_value,
@ -17,7 +17,7 @@ void validate_positive(const T &value, const std::string &option_name) {
}
template <typename T>
void validate_min(const T &value, const std::string &option_name, const T &min) {
void validate_min(const T& value, const std::string& option_name, const T& min) {
if (value < min) {
throw po::validation_error(
po::validation_error::invalid_option_value,
@ -28,7 +28,7 @@ void validate_min(const T &value, const std::string &option_name, const T &min)
}
template <typename T>
void validate_max(const T &value, const std::string &option_name, const T &max) {
void validate_max(const T& value, const std::string& option_name, const T& max) {
if (value > max) {
throw po::validation_error(
po::validation_error::invalid_option_value,
@ -39,7 +39,7 @@ void validate_max(const T &value, const std::string &option_name, const T &max)
}
template <typename T>
void validate_range(const T &value, const std::string &option_name, const T &min, const T &max) {
void validate_range(const T& value, const std::string& option_name, const T& min, const T& max) {
if (value < min || value > max) {
throw po::validation_error(
po::validation_error::invalid_option_value,
@ -51,7 +51,7 @@ void validate_range(const T &value, const std::string &option_name, const T &min
}
template <typename T>
void validate_greater_equal_one(const T &value, const std::string &option_name) {
void validate_greater_equal_one(const T& value, const std::string& option_name) {
if (value < 1) {
throw po::validation_error(
po::validation_error::invalid_option_value,
@ -61,10 +61,10 @@ void validate_greater_equal_one(const T &value, const std::string &option_name)
}
}
void validate_anime4k_shader_name(const video2x::fsutils::StringType &shader_name);
void validate_anime4k_shader_name(const video2x::fsutils::StringType& shader_name);
void validate_realesrgan_model_name(const video2x::fsutils::StringType &model_name);
void validate_realesrgan_model_name(const video2x::fsutils::StringType& model_name);
void validate_realcugan_model_name(const video2x::fsutils::StringType &model_name);
void validate_realcugan_model_name(const video2x::fsutils::StringType& model_name);
void validate_rife_model_name(const video2x::fsutils::StringType &model_name);
void validate_rife_model_name(const video2x::fsutils::StringType& model_name);

View File

@ -4,4 +4,4 @@
int list_vulkan_devices();
int get_vulkan_device_prop(uint32_t vk_device_index, VkPhysicalDeviceProperties *dev_props);
int get_vulkan_device_prop(uint32_t vk_device_index, VkPhysicalDeviceProperties* dev_props);

View File

@ -25,7 +25,7 @@
namespace po = boost::program_options;
#ifdef _WIN32
std::string wstring_to_u8string(const std::wstring &wstr) {
std::string wstring_to_u8string(const std::wstring& wstr) {
if (wstr.empty()) {
return std::string();
}
@ -46,7 +46,7 @@ std::string wstring_to_u8string(const std::wstring &wstr) {
return converted_str;
}
#else
std::string wstring_to_u8string(const std::string &str) {
std::string wstring_to_u8string(const std::string& str) {
return str;
}
#endif
@ -54,13 +54,13 @@ std::string wstring_to_u8string(const std::string &str) {
int parse_args(
int argc,
#ifdef _WIN32
wchar_t *argv[],
wchar_t* argv[],
#else
char *argv[],
char* argv[],
#endif
Arguments &arguments,
video2x::processors::ProcessorConfig &proc_cfg,
video2x::encoder::EncoderConfig &enc_cfg
Arguments& arguments,
video2x::processors::ProcessorConfig& proc_cfg,
video2x::encoder::EncoderConfig& enc_cfg
) {
try {
// clang-format off
@ -310,7 +310,7 @@ int parse_args(
enc_cfg.codec = AV_CODEC_ID_H264;
if (vm.count("codec")) {
video2x::fsutils::StringType codec_str = vm["codec"].as<video2x::fsutils::StringType>();
const AVCodec *codec =
const AVCodec* codec =
avcodec_find_encoder_by_name(wstring_to_u8string(codec_str).c_str());
if (codec == nullptr) {
video2x::logger()->critical(
@ -342,7 +342,7 @@ int parse_args(
// Parse extra AVOptions
if (vm.count("extra-encoder-option")) {
for (const auto &opt :
for (const auto& opt :
vm["extra-encoder-option"].as<std::vector<video2x::fsutils::StringType>>()) {
size_t eq_pos = opt.find('=');
if (eq_pos != video2x::fsutils::StringType::npos) {
@ -467,10 +467,10 @@ int parse_args(
video2x::logger()->critical("Invalid processor type.");
return -1;
}
} catch (const po::error &e) {
} catch (const po::error& e) {
video2x::logger()->critical("Error parsing arguments: {}", e.what());
return -1;
} catch (const std::exception &e) {
} catch (const std::exception& e) {
video2x::logger()->critical(
"Unexpected exception caught while parsing options: {}", e.what()
);

View File

@ -1,6 +1,6 @@
#include "newline_safe_sink.h"
void newline_safe_sink::log(const spdlog::details::log_msg &msg) {
void newline_safe_sink::log(const spdlog::details::log_msg& msg) {
if (needs_newline_.exchange(false)) {
std::fputs("\n", stdout);
}

View File

@ -2,7 +2,7 @@
#include <unordered_set>
void validate_anime4k_shader_name(const video2x::fsutils::StringType &shader_name) {
void validate_anime4k_shader_name(const video2x::fsutils::StringType& shader_name) {
static const std::unordered_set<video2x::fsutils::StringType> valid_anime4k_shaders = {
STR("anime4k-v4-a"),
STR("anime4k-v4-a+a"),
@ -22,7 +22,7 @@ void validate_anime4k_shader_name(const video2x::fsutils::StringType &shader_nam
}
}
void validate_realesrgan_model_name(const video2x::fsutils::StringType &model_name) {
void validate_realesrgan_model_name(const video2x::fsutils::StringType& model_name) {
static const std::unordered_set<video2x::fsutils::StringType> valid_realesrgan_models = {
STR("realesrgan-plus"), STR("realesrgan-plus-anime"), STR("realesr-animevideov3")
};
@ -36,7 +36,7 @@ void validate_realesrgan_model_name(const video2x::fsutils::StringType &model_na
}
}
void validate_realcugan_model_name(const video2x::fsutils::StringType &model_name) {
void validate_realcugan_model_name(const video2x::fsutils::StringType& model_name) {
static const std::unordered_set<video2x::fsutils::StringType> valid_realcugan_models = {
STR("models-nose"), STR("models-pro"), STR("models-se")
};
@ -49,7 +49,7 @@ void validate_realcugan_model_name(const video2x::fsutils::StringType &model_nam
}
}
void validate_rife_model_name(const video2x::fsutils::StringType &model_name) {
void validate_rife_model_name(const video2x::fsutils::StringType& model_name) {
static const std::unordered_set<video2x::fsutils::StringType> valid_rife_models = {
STR("rife"),
STR("rife-HD"),

View File

@ -40,7 +40,7 @@ std::tuple<int, int, int> calculate_time_components(int time_elapsed) {
}
#ifdef _WIN32
int wmain(int argc, wchar_t *argv[]) {
int wmain(int argc, wchar_t* argv[]) {
// Set console output code page to UTF-8
SetConsoleOutputCP(CP_UTF8);
@ -51,7 +51,7 @@ int wmain(int argc, wchar_t *argv[]) {
console_mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
SetConsoleMode(console_handle, console_mode);
#else
int main(int argc, char **argv) {
int main(int argc, char** argv) {
#endif
// Initialize newline-safe logger with custom formatting pattern
std::shared_ptr<newline_safe_sink> logger_sink = std::make_shared<newline_safe_sink>();

View File

@ -5,7 +5,7 @@
#include <libvideo2x/logger_manager.h>
static int enumerate_vulkan_devices(VkInstance *instance, std::vector<VkPhysicalDevice> &devices) {
static int enumerate_vulkan_devices(VkInstance* instance, std::vector<VkPhysicalDevice>& devices) {
// Create a Vulkan instance
VkInstanceCreateInfo create_info{};
create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
@ -96,7 +96,7 @@ int list_vulkan_devices() {
return 0;
}
int get_vulkan_device_prop(uint32_t vk_device_index, VkPhysicalDeviceProperties *dev_props) {
int get_vulkan_device_prop(uint32_t vk_device_index, VkPhysicalDeviceProperties* dev_props) {
if (dev_props == nullptr) {
video2x::logger()->error("Invalid device properties pointer.");
return -1;