Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(video2x VERSION 6.4.0 LANGUAGES CXX)

cmake_policy(SET CMP0074 NEW)
find_package(OpenMP COMPONENTS CXX REQUIRED)

include(CMakePackageConfigHelpers)
include(ExternalProject)
include(GNUInstallDirs)
Expand Down Expand Up @@ -41,7 +44,11 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_link_options(/LTCG /OPT:REF /OPT:ICF)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
add_compile_options(-O3 -ffunction-sections -fdata-sections)
add_link_options(-Wl,-s -flto -Wl,--gc-sections)
if(APPLE)
add_link_options(-flto -L/opt/homebrew/lib)
else()
add_link_options(-Wl,-s -flto -Wl,--gc-sections)
endif()
endif()
endif()

Expand Down
4 changes: 4 additions & 0 deletions src/encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ int Encoder::init(
return 0;
}

#ifndef __APPLE__
[[gnu::target_clones("arch=x86-64-v4", "arch=x86-64-v3", "default")]]
#endif
int Encoder::write_frame(AVFrame* frame, int64_t frame_idx) {
AVFrame* converted_frame = nullptr;
int ret;
Expand Down Expand Up @@ -357,7 +359,9 @@ int Encoder::write_frame(AVFrame* frame, int64_t frame_idx) {
return 0;
}

#ifndef __APPLE__
[[gnu::target_clones("arch=x86-64-v4", "arch=x86-64-v3", "default")]]
#endif
int Encoder::flush() {
int ret;
AVPacket* enc_pkt = av_packet_alloc();
Expand Down
2 changes: 2 additions & 0 deletions src/libvideo2x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ VideoProcessor::VideoProcessor(
hw_device_type_(hw_device_type),
benchmark_(benchmark) {}

#ifndef __APPLE__
[[gnu::target_clones("arch=x86-64-v4", "arch=x86-64-v3", "default")]]
#endif
int VideoProcessor::process(
const std::filesystem::path in_fname,
const std::filesystem::path out_fname
Expand Down
6 changes: 6 additions & 0 deletions tools/video2x/src/vulkan_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ static int enumerate_vulkan_devices(VkInstance* instance, std::vector<VkPhysical
// Create a Vulkan instance
VkInstanceCreateInfo create_info{};
create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
create_info.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;

std::vector<const char*> instance_extensions;
instance_extensions.push_back("VK_KHR_portability_enumeration");
create_info.enabledExtensionCount = static_cast<uint32_t>(instance_extensions.size());
create_info.ppEnabledExtensionNames = instance_extensions.data();

VkResult result = vkCreateInstance(&create_info, nullptr, instance);
if (result != VK_SUCCESS) {
Expand Down