mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-15 12:18: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)
|
project(video2x VERSION 6.3.1 LANGUAGES CXX)
|
||||||
|
|
||||||
# The FindBoost module is removed in CMake 3.30
|
# 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
|
# Set the compile options for the shared library
|
||||||
if(MSVC)
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
target_compile_options(libvideo2x PRIVATE $<$<CONFIG:Debug>:/Zi /DDEBUG>)
|
target_compile_options(libvideo2x PRIVATE $<$<CONFIG:Debug>:/Zi /Od /MDd>)
|
||||||
else()
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||||
target_compile_options(libvideo2x PRIVATE -fPIC $<$<CONFIG:Debug>:-g -DDEBUG>)
|
target_compile_options(libvideo2x PRIVATE -fPIC $<$<CONFIG:Debug>:-g -O0>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Define the paths to the shared libraries
|
# 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;
|
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) {
|
float get_frame_diff(AVFrame *frame1, AVFrame *frame2) {
|
||||||
if (!frame1 || !frame2) {
|
if (!frame1 || !frame2) {
|
||||||
logger()->error("Invalid frame(s) provided for comparison");
|
logger()->error("Invalid frame(s) provided for comparison");
|
||||||
|
@ -11,7 +11,7 @@ namespace video2x {
|
|||||||
namespace conversions {
|
namespace conversions {
|
||||||
|
|
||||||
// Convert AVFrame format
|
// 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 *convert_avframe_pix_fmt(AVFrame *src_frame, AVPixelFormat pix_fmt) {
|
||||||
AVFrame *dst_frame = av_frame_alloc();
|
AVFrame *dst_frame = av_frame_alloc();
|
||||||
if (dst_frame == nullptr) {
|
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
|
// 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) {
|
ncnn::Mat avframe_to_ncnn_mat(AVFrame *frame) {
|
||||||
AVFrame *converted_frame = nullptr;
|
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)
|
// 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) {
|
AVFrame *ncnn_mat_to_avframe(const ncnn::Mat &mat, AVPixelFormat pix_fmt) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ int Encoder::init(
|
|||||||
return 0;
|
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) {
|
int Encoder::write_frame(AVFrame *frame, int64_t frame_idx) {
|
||||||
AVFrame *converted_frame = nullptr;
|
AVFrame *converted_frame = nullptr;
|
||||||
int ret;
|
int ret;
|
||||||
@ -326,7 +326,7 @@ int Encoder::write_frame(AVFrame *frame, int64_t frame_idx) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[gnu::target_clones("default", "avx2", "avx512f")]]
|
[[gnu::target_clones("arch=x86-64-v4", "arch=x86-64-v3", "default")]]
|
||||||
int Encoder::flush() {
|
int Encoder::flush() {
|
||||||
int ret;
|
int ret;
|
||||||
AVPacket *enc_pkt = av_packet_alloc();
|
AVPacket *enc_pkt = av_packet_alloc();
|
||||||
|
@ -28,7 +28,7 @@ VideoProcessor::VideoProcessor(
|
|||||||
hw_device_type_(hw_device_type),
|
hw_device_type_(hw_device_type),
|
||||||
benchmark_(benchmark) {}
|
benchmark_(benchmark) {}
|
||||||
|
|
||||||
[[gnu::target_clones("default", "avx2", "avx512f")]]
|
[[gnu::target_clones("arch=x86-64-v4", "arch=x86-64-v3", "default")]]
|
||||||
int VideoProcessor::process(
|
int VideoProcessor::process(
|
||||||
const std::filesystem::path in_fname,
|
const std::filesystem::path in_fname,
|
||||||
const std::filesystem::path out_fname
|
const std::filesystem::path out_fname
|
||||||
|
Loading…
Reference in New Issue
Block a user