mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-15 04:08:52 +00:00
perf(*): change multiversioning target clones to x86-64-v3 and x86-64-v4
Signed-off-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
parent
7665cd217c
commit
a72c094588
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
|
||||
project(video2x VERSION 6.3.1 LANGUAGES CXX)
|
||||
|
||||
# The FindBoost module is removed in CMake 3.30
|
||||
@ -346,10 +346,10 @@ target_include_directories(libvideo2x PRIVATE
|
||||
)
|
||||
|
||||
# Set the compile options for the shared library
|
||||
if(MSVC)
|
||||
target_compile_options(libvideo2x PRIVATE $<$<CONFIG:Debug>:/Zi /DDEBUG>)
|
||||
else()
|
||||
target_compile_options(libvideo2x PRIVATE -fPIC $<$<CONFIG:Debug>:-g -DDEBUG>)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
target_compile_options(libvideo2x PRIVATE $<$<CONFIG:Debug>:/Zi /Od /MDd>)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
target_compile_options(libvideo2x PRIVATE -fPIC $<$<CONFIG:Debug>:-g -O0>)
|
||||
endif()
|
||||
|
||||
# Define the paths to the shared libraries
|
||||
|
@ -135,7 +135,7 @@ AVPixelFormat get_encoder_default_pix_fmt(const AVCodec *encoder, AVPixelFormat
|
||||
return best_pix_fmt;
|
||||
}
|
||||
|
||||
[[gnu::target_clones("default", "avx2", "avx512f")]]
|
||||
[[gnu::target_clones("arch=x86-64-v4", "arch=x86-64-v3", "default")]]
|
||||
float get_frame_diff(AVFrame *frame1, AVFrame *frame2) {
|
||||
if (!frame1 || !frame2) {
|
||||
logger()->error("Invalid frame(s) provided for comparison");
|
||||
|
@ -11,7 +11,7 @@ namespace video2x {
|
||||
namespace conversions {
|
||||
|
||||
// Convert AVFrame format
|
||||
[[gnu::target_clones("default", "avx2", "avx512f")]]
|
||||
[[gnu::target_clones("arch=x86-64-v4", "arch=x86-64-v3", "default")]]
|
||||
AVFrame *convert_avframe_pix_fmt(AVFrame *src_frame, AVPixelFormat pix_fmt) {
|
||||
AVFrame *dst_frame = av_frame_alloc();
|
||||
if (dst_frame == nullptr) {
|
||||
@ -68,7 +68,7 @@ AVFrame *convert_avframe_pix_fmt(AVFrame *src_frame, AVPixelFormat pix_fmt) {
|
||||
}
|
||||
|
||||
// Convert AVFrame to ncnn::Mat by copying the data
|
||||
[[gnu::target_clones("default", "avx2", "avx512f")]]
|
||||
[[gnu::target_clones("arch=x86-64-v4", "arch=x86-64-v3", "default")]]
|
||||
ncnn::Mat avframe_to_ncnn_mat(AVFrame *frame) {
|
||||
AVFrame *converted_frame = nullptr;
|
||||
|
||||
@ -108,7 +108,7 @@ ncnn::Mat avframe_to_ncnn_mat(AVFrame *frame) {
|
||||
}
|
||||
|
||||
// Convert ncnn::Mat to AVFrame with a specified pixel format (this part is unchanged)
|
||||
[[gnu::target_clones("default", "avx2", "avx512f")]]
|
||||
[[gnu::target_clones("arch=x86-64-v4", "arch=x86-64-v3", "default")]]
|
||||
AVFrame *ncnn_mat_to_avframe(const ncnn::Mat &mat, AVPixelFormat pix_fmt) {
|
||||
int ret;
|
||||
|
||||
|
@ -254,7 +254,7 @@ int Encoder::init(
|
||||
return 0;
|
||||
}
|
||||
|
||||
[[gnu::target_clones("default", "avx2", "avx512f")]]
|
||||
[[gnu::target_clones("arch=x86-64-v4", "arch=x86-64-v3", "default")]]
|
||||
int Encoder::write_frame(AVFrame *frame, int64_t frame_idx) {
|
||||
AVFrame *converted_frame = nullptr;
|
||||
int ret;
|
||||
@ -326,7 +326,7 @@ int Encoder::write_frame(AVFrame *frame, int64_t frame_idx) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
[[gnu::target_clones("default", "avx2", "avx512f")]]
|
||||
[[gnu::target_clones("arch=x86-64-v4", "arch=x86-64-v3", "default")]]
|
||||
int Encoder::flush() {
|
||||
int ret;
|
||||
AVPacket *enc_pkt = av_packet_alloc();
|
||||
|
@ -28,7 +28,7 @@ VideoProcessor::VideoProcessor(
|
||||
hw_device_type_(hw_device_type),
|
||||
benchmark_(benchmark) {}
|
||||
|
||||
[[gnu::target_clones("default", "avx2", "avx512f")]]
|
||||
[[gnu::target_clones("arch=x86-64-v4", "arch=x86-64-v3", "default")]]
|
||||
int VideoProcessor::process(
|
||||
const std::filesystem::path in_fname,
|
||||
const std::filesystem::path out_fname
|
||||
|
Loading…
Reference in New Issue
Block a user