mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-10-28 18:07:12 +08:00
- Route 32-bit x86 (__i386__ / _M_IX86) to compare_win.cc intrinsics and restrict compare_gcc.cc to 64-bit x86 (__x86_64__), avoiding x87 float rounding and enabling SSE2, AVX2, and AVX-512 on 32-bit and 64-bit MinGW, GCC, Clang, and MSan (LIBYUV_ENABLE_ROWWIN). - Enable AVX-512BW on GCC >= 6 (GCC_HAS_AVX512) and add LIBYUV_TARGET_AVX512BW attributes to compare_gcc.cc and compare_win.cc. - Refactor SsimWindowRow_C and Ssim8x8_C to use int32_t and float, and add SsimWindowRow_SSE2, SsimWindowRow_AVX2, and SsimWindowRow_AVX512BW in both compare_win.cc and compare_gcc.cc. - Update TestSsimAnyWidth, Ssim, and BenchmarkSsim_Opt in compare_test.cc to use EXPECT_NEAR and deterministic test patterns (identical, different, similar). - Update util/compare.cc and linux.mk to compute I420Ssim. Performance (BenchmarkSsim_Opt, 1280x720): uArch Before After Improvement Intel Lion Cove (x64 AVX2) 120.2 us 68.1 us 1.76x Intel Skymont (x64 SSE2) 249.6 us 146.8 us 1.70x AMD Zen 3 (x64 AVX2) 314.9 us 150.2 us 2.10x Intel Lion Cove (MinGW686) 203.7 us 77.9 us 2.61x Intel Skymont (MinGW686) 338.8 us 167.5 us 2.02x AMD Zen 3 (i686 AVX2) 738.4 us 206.5 us 3.58x Quality (util/compare on 640x360 I420 test images): Image Comparison MSE PSNR SSIM Identical (orig vs orig) 0.00 128.00 dB 1.000000 Similar (light +/-3 noise) 4.57 41.53 dB 0.956556 Degraded (16x16 blocky) 98.18 28.21 dB 0.858893 Very different (inverted) 11160.29 7.65 dB 0.000181 Co-authored-by: Martin Storsjö <martin@martin.st> Bug: b/493910265 Test: out/Release/libyuv_unittest --gtest_filter=*Ssim* Change-Id: I8603dab3f752af32d07ae9039502ca5da5a05425 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/8618641 Reviewed-by: richard winterton <rrwinterton@gmail.com> Commit-Queue: Frank Barchard <fbarchard@google.com>
107 lines
3.1 KiB
Makefile
107 lines
3.1 KiB
Makefile
# This is a generic makefile for libyuv for gcc.
|
|
# make -f linux.mk CXX=clang++
|
|
|
|
CC?=gcc
|
|
CFLAGS?=-O2 -fomit-frame-pointer
|
|
CFLAGS+=-Iinclude/
|
|
|
|
CXX?=g++
|
|
CXXFLAGS?=-O2 -fomit-frame-pointer
|
|
CXXFLAGS+=-Iinclude/
|
|
|
|
LOCAL_OBJ_FILES := \
|
|
source/compare.o \
|
|
source/compare_common.o \
|
|
source/compare_gcc.o \
|
|
source/compare_hvx.o \
|
|
source/compare_neon.o \
|
|
source/compare_neon64.o \
|
|
source/compare_win.o \
|
|
source/convert.o \
|
|
source/convert_argb.o \
|
|
source/convert_from.o \
|
|
source/convert_from_argb.o \
|
|
source/convert_jpeg.o \
|
|
source/convert_to_argb.o \
|
|
source/convert_to_i420.o \
|
|
source/cpu_id.o \
|
|
source/mjpeg_decoder.o \
|
|
source/mjpeg_validate.o \
|
|
source/planar_functions.o \
|
|
source/rotate.o \
|
|
source/rotate_any.o \
|
|
source/rotate_argb.o \
|
|
source/rotate_common.o \
|
|
source/rotate_gcc.o \
|
|
source/rotate_hvx.o \
|
|
source/rotate_lasx.o \
|
|
source/rotate_lsx.o \
|
|
source/rotate_neon.o \
|
|
source/rotate_neon64.o \
|
|
source/rotate_rvv.o \
|
|
source/rotate_win.o \
|
|
source/row_any.o \
|
|
source/row_common.o \
|
|
source/row_gcc.o \
|
|
source/row_hvx.o \
|
|
source/row_lasx.o \
|
|
source/row_lsx.o \
|
|
source/row_neon.o \
|
|
source/row_neon64.o \
|
|
source/row_rvv.o \
|
|
source/row_win.o \
|
|
source/scale.o \
|
|
source/scale_any.o \
|
|
source/scale_argb.o \
|
|
source/scale_common.o \
|
|
source/scale_gcc.o \
|
|
source/scale_hvx.o \
|
|
source/scale_lsx.o \
|
|
source/scale_neon.o \
|
|
source/scale_neon64.o \
|
|
source/scale_rgb.o \
|
|
source/scale_rvv.o \
|
|
source/scale_uv.o \
|
|
source/scale_win.o \
|
|
source/video_common.o
|
|
|
|
.cc.o:
|
|
$(CXX) -c $(CXXFLAGS) $*.cc -o $*.o
|
|
|
|
.c.o:
|
|
$(CC) -c $(CFLAGS) $*.c -o $*.o
|
|
|
|
all: libyuv.a i444tonv12_eg yuvconvert yuvconstants cpuid psnr compare
|
|
|
|
libyuv.a: $(LOCAL_OBJ_FILES)
|
|
$(AR) $(ARFLAGS) $@ $(LOCAL_OBJ_FILES)
|
|
|
|
# A C++ test utility that compares two YUV files.
|
|
compare: util/compare.cc libyuv.a
|
|
$(CXX) $(CXXFLAGS) -Iutil/ -o $@ util/compare.cc libyuv.a
|
|
|
|
# A C++ test utility that uses libyuv conversion.
|
|
yuvconvert: util/yuvconvert.cc libyuv.a
|
|
$(CXX) $(CXXFLAGS) -Iutil/ -o $@ util/yuvconvert.cc libyuv.a
|
|
|
|
# A C test utility that generates yuvconstants for yuv to rgb.
|
|
yuvconstants: util/yuvconstants.c libyuv.a
|
|
$(CXX) $(CXXFLAGS) -Iutil/ -lm -o $@ util/yuvconstants.c libyuv.a
|
|
|
|
# A standalone test utility
|
|
psnr: util/psnr.cc
|
|
$(CXX) $(CXXFLAGS) -Iutil/ -o $@ util/psnr.cc util/psnr_main.cc util/ssim.cc
|
|
|
|
# A simple conversion example.
|
|
i444tonv12_eg: util/i444tonv12_eg.cc libyuv.a
|
|
$(CXX) $(CXXFLAGS) -o $@ util/i444tonv12_eg.cc libyuv.a
|
|
|
|
# A C test utility that uses libyuv conversion from C.
|
|
# gcc 4.4 and older require -fno-exceptions to avoid link error on __gxx_personality_v0
|
|
# CC=gcc-4.4 CXXFLAGS=-fno-exceptions CXX=g++-4.4 make -f linux.mk
|
|
cpuid: util/cpuid.c libyuv.a
|
|
$(CC) $(CFLAGS) -o $@ util/cpuid.c libyuv.a
|
|
|
|
clean:
|
|
/bin/rm -f source/*.o *.ii *.s libyuv.a i444tonv12_eg yuvconvert yuvconstants cpuid psnr compare
|