Skip to content

Commit

Permalink
update simd build
Browse files Browse the repository at this point in the history
  • Loading branch information
foobnix committed Feb 13, 2019
1 parent 064019a commit 9ec9df1
Show file tree
Hide file tree
Showing 146 changed files with 50,133 additions and 19,619 deletions.
3 changes: 2 additions & 1 deletion Builder/all-beta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ cd ../

cd Builder
./remove_all.sh
./install_all.sh
./install_all.sh
./clear-cache.sh
71 changes: 9 additions & 62 deletions Builder/jni-1.11/simd/Android.mk
Original file line number Diff line number Diff line change
@@ -1,42 +1,5 @@
# Makefile for libjpeg-turbo

LOCAL_PATH := $(call my-dir)

##################################################
### simd_arm ###
##################################################

include $(CLEAR_VARS)

LOCAL_MODULE := libsimd_arm

LOCAL_MODULE_TAGS := release

LOCAL_CFLAGS := $(APP_CFLAGS)
LOCAL_CPPFLAGS := $(APP_CPPFLAGS)
LOCAL_ARM_MODE := $(APP_ARM_MODE)

LOCAL_SRC_FILES := arm/src/jsimd_arm_neon.S

include $(BUILD_STATIC_LIBRARY)

##################################################
### simd_i386 ###
##################################################

include $(CLEAR_VARS)

LOCAL_MODULE := libsimd_i386

LOCAL_MODULE_TAGS := release

LOCAL_CFLAGS := $(APP_CFLAGS)
LOCAL_CPPFLAGS := $(APP_CPPFLAGS)

LOCAL_SRC_FILES := i386/lib/jsimd_i386.a

include $(PREBUILT_STATIC_LIBRARY)

##################################################
### simd ###
##################################################
Expand All @@ -54,41 +17,25 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/src \
$(LOCAL_PATH)/../jpeg-turbo/android \
$(LOCAL_PATH)/../jpeg-turbo/include \
$(LOCAL_PATH)/../standalone/include

ifeq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_ARM_MODE := $(APP_ARM_MODE)
LOCAL_SRC_FILES := src/jsimd_arm.c
LOCAL_STATIC_LIBRARIES := libsimd_arm
endif # TARGET_ARCH_ABI == armeabi

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_ARM_MODE := $(APP_ARM_MODE)
LOCAL_SRC_FILES := src/jsimd_arm.c
LOCAL_STATIC_LIBRARIES := libsimd_arm
endif # TARGET_ARCH_ABI == armeabi-v7a

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a-hard)
LOCAL_ARM_MODE := $(APP_ARM_MODE)
LOCAL_SRC_FILES := src/jsimd_arm.c
LOCAL_STATIC_LIBRARIES := libsimd_arm
endif # TARGET_ARCH_ABI == armeabi-v7a
LOCAL_SRC_FILES := jsimd_arm.c jsimd_arm_neon.S
endif

ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
LOCAL_SRC_FILES := src/jsimd_none.c
endif # TARGET_ARCH_ABI == arm64-v8a
LOCAL_ARM_MODE := $(APP_ARM_MODE)
LOCAL_SRC_FILES := jsimd_arm64.c jsimd_arm64_neon.S
endif

ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_SRC_FILES := src/jsimd_i386.c
LOCAL_STATIC_LIBRARIES := libsimd_i386
endif # TARGET_ARCH_ABI == x86
LOCAL_SRC_FILES := jsimd_i386.c
endif

ifeq ($(TARGET_ARCH_ABI),x86_64)
LOCAL_SRC_FILES := src/jsimd_none.c
endif # TARGET_ARCH_ABI == x86
LOCAL_SRC_FILES := jsimd_x86_64.c
endif

ifeq ($(TARGET_ARCH_ABI),mips)
LOCAL_SRC_FILES := src/jsimd_none.c
endif # TARGET_ARCH_ABI == mips

include $(BUILD_STATIC_LIBRARY)

Expand Down
81 changes: 81 additions & 0 deletions Builder/jni-1.11/simd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
if(NOT DEFINED NASM)
find_program(NASM NAMES nasm yasm DOC "Path to NASM/YASM executable")
endif()
message(STATUS "NASM = ${NASM}")

if(SIMD_X86_64)
set(NAFLAGS -fwin64 -DWIN64 -D__x86_64__)
else()
if(BORLAND)
set(NAFLAGS -fobj -DOBJ32)
else()
set(NAFLAGS -fwin32 -DWIN32)
endif()
endif()
set(NAFLAGS ${NAFLAGS} -I${CMAKE_SOURCE_DIR}/win/ -I${CMAKE_CURRENT_SOURCE_DIR}/)

# This only works if building from the command line. There is currently no way
# to set a variable's value based on the build type when using the MSVC IDE.
if(CMAKE_BUILD_TYPE STREQUAL "Debug"
OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(NAFLAGS ${NAFLAGS} -g)
endif()

if(SIMD_X86_64)
set(SIMD_BASENAMES jfdctflt-sse-64 jccolor-sse2-64 jcgray-sse2-64
jchuff-sse2-64 jcsample-sse2-64 jdcolor-sse2-64 jdmerge-sse2-64
jdsample-sse2-64 jfdctfst-sse2-64 jfdctint-sse2-64 jidctflt-sse2-64
jidctfst-sse2-64 jidctint-sse2-64 jidctred-sse2-64 jquantf-sse2-64
jquanti-sse2-64)
message(STATUS "Building x86_64 SIMD extensions")
else()
set(SIMD_BASENAMES jsimdcpu jfdctflt-3dn jidctflt-3dn jquant-3dn jccolor-mmx
jcgray-mmx jcsample-mmx jdcolor-mmx jdmerge-mmx jdsample-mmx jfdctfst-mmx
jfdctint-mmx jidctfst-mmx jidctint-mmx jidctred-mmx jquant-mmx jfdctflt-sse
jidctflt-sse jquant-sse jccolor-sse2 jcgray-sse2 jchuff-sse2 jcsample-sse2
jdcolor-sse2 jdmerge-sse2 jdsample-sse2 jfdctfst-sse2 jfdctint-sse2
jidctflt-sse2 jidctfst-sse2 jidctint-sse2 jidctred-sse2 jquantf-sse2
jquanti-sse2)
message(STATUS "Building i386 SIMD extensions")
endif()

if(MSVC_IDE)
set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
else()
set(OBJDIR ${CMAKE_CURRENT_BINARY_DIR})
endif()

file(GLOB INC_FILES *.inc)

foreach(file ${SIMD_BASENAMES})
set(DEPFILE "")
set(SIMD_SRC ${CMAKE_CURRENT_SOURCE_DIR}/${file}.asm)
if(${file} MATCHES jccolor)
set(DEPFILE ${file})
string(REGEX REPLACE "jccolor" "jccolext" DEPFILE ${DEPFILE})
set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm)
endif()
if(${file} MATCHES jcgray)
set(DEPFILE ${file})
string(REGEX REPLACE "jcgray" "jcgryext" DEPFILE ${DEPFILE})
set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm)
endif()
if(${file} MATCHES jdcolor)
set(DEPFILE ${file})
string(REGEX REPLACE "jdcolor" "jdcolext" DEPFILE ${DEPFILE})
set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm)
endif()
if(${file} MATCHES jdmerge)
set(DEPFILE ${file})
string(REGEX REPLACE "jdmerge" "jdmrgext" DEPFILE ${DEPFILE})
set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm)
endif()
set(SIMD_OBJ ${OBJDIR}/${file}.obj)
add_custom_command(OUTPUT ${SIMD_OBJ}
DEPENDS ${SIMD_SRC} ${DEPFILE} ${INC_FILES}
COMMAND ${NASM} ${NAFLAGS} ${SIMD_SRC} -o${SIMD_OBJ})
set(SIMD_OBJS ${SIMD_OBJS} ${SIMD_OBJ})
endforeach()

set(SIMD_OBJS ${SIMD_OBJS} PARENT_SCOPE)
add_custom_target(simd DEPENDS ${SIMD_OBJS})
102 changes: 102 additions & 0 deletions Builder/jni-1.11/simd/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
noinst_LTLIBRARIES = libsimd.la

BUILT_SOURCES = jsimdcfg.inc

EXTRA_DIST = nasm_lt.sh CMakeLists.txt \
jccolext-mmx.asm jcgryext-mmx.asm jdcolext-mmx.asm jdmrgext-mmx.asm \
jccolext-sse2.asm jcgryext-sse2.asm jdcolext-sse2.asm jdmrgext-sse2.asm \
jccolext-sse2-64.asm jcgryext-sse2-64.asm jdcolext-sse2-64.asm \
jdmrgext-sse2-64.asm jccolext-altivec.c jcgryext-altivec.c \
jdcolext-altivec.c jdmrgext-altivec.c

if SIMD_X86_64

libsimd_la_SOURCES = jsimd_x86_64.c jsimd.h jsimdcfg.inc.h jsimdext.inc \
jcolsamp.inc jdct.inc jpeg_nbits_table.inc jfdctflt-sse-64.asm \
jccolor-sse2-64.asm jcgray-sse2-64.asm jchuff-sse2-64.asm \
jcsample-sse2-64.asm jdcolor-sse2-64.asm jdmerge-sse2-64.asm \
jdsample-sse2-64.asm jfdctfst-sse2-64.asm jfdctint-sse2-64.asm \
jidctflt-sse2-64.asm jidctfst-sse2-64.asm jidctint-sse2-64.asm \
jidctred-sse2-64.asm jquantf-sse2-64.asm jquanti-sse2-64.asm

jccolor-sse2-64.lo: jccolext-sse2-64.asm
jcgray-sse2-64.lo: jcgryext-sse2-64.asm
jdcolor-sse2-64.lo: jdcolext-sse2-64.asm
jdmerge-sse2-64.lo: jdmrgext-sse2-64.asm

endif

if SIMD_I386

libsimd_la_SOURCES = jsimd_i386.c jsimd.h jsimdcfg.inc.h jsimdext.inc \
jcolsamp.inc jdct.inc jpeg_nbits_table.inc jsimdcpu.asm \
jfdctflt-3dn.asm jidctflt-3dn.asm jquant-3dn.asm \
jccolor-mmx.asm jcgray-mmx.asm jcsample-mmx.asm \
jdcolor-mmx.asm jdmerge-mmx.asm jdsample-mmx.asm \
jfdctfst-mmx.asm jfdctint-mmx.asm jidctfst-mmx.asm \
jidctint-mmx.asm jidctred-mmx.asm jquant-mmx.asm \
jfdctflt-sse.asm jidctflt-sse.asm jquant-sse.asm \
jccolor-sse2.asm jcgray-sse2.asm jchuff-sse2.asm \
jcsample-sse2.asm jdcolor-sse2.asm jdmerge-sse2.asm \
jdsample-sse2.asm jfdctfst-sse2.asm jfdctint-sse2.asm \
jidctflt-sse2.asm jidctfst-sse2.asm jidctint-sse2.asm \
jidctred-sse2.asm jquantf-sse2.asm jquanti-sse2.asm

jccolor-mmx.lo: jccolext-mmx.asm
jcgray.-mmx.lo: jcgryext-mmx.asm
jdcolor-mmx.lo: jdcolext-mmx.asm
jdmerge-mmx.lo: jdmrgext-mmx.asm
jccolor-sse2.lo: jccolext-sse2.asm
jcgray-sse2.lo: jcgryext-sse2.asm
jdcolor-sse2.lo: jdcolext-sse2.asm
jdmerge-sse2.lo: jdmrgext-sse2.asm

endif

if SIMD_ARM

libsimd_la_SOURCES = jsimd_arm.c jsimd_arm_neon.S

endif

if SIMD_ARM_64

libsimd_la_SOURCES = jsimd_arm64.c jsimd_arm64_neon.S

endif

if SIMD_MIPS

libsimd_la_SOURCES = jsimd_mips.c jsimd_mips_dspr2_asm.h jsimd_mips_dspr2.S

endif

if SIMD_POWERPC

noinst_LTLIBRARIES += libsimd_altivec.la

libsimd_altivec_la_SOURCES = \
jccolor-altivec.c jcgray-altivec.c jcsample-altivec.c \
jdcolor-altivec.c jdmerge-altivec.c jdsample-altivec.c \
jfdctfst-altivec.c jfdctint-altivec.c \
jidctfst-altivec.c jidctint-altivec.c \
jquanti-altivec.c
libsimd_altivec_la_CFLAGS = -maltivec

jccolor-altivec.lo: jccolext-altivec.c
jcgray-altivec.lo: jcgryext-altivec.c
jdcolor-altivec.lo: jdcolext-altivec.c
jdmerge-altivec.lo: jdmrgext-altivec.c

libsimd_la_SOURCES = jsimd_powerpc.c jsimd_altivec.h jcsample.h
libsimd_la_LIBADD = libsimd_altivec.la

endif

AM_CPPFLAGS = -I$(top_srcdir)

.asm.lo:
$(AM_V_GEN) $(LIBTOOL) $(AM_V_lt) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(AM_V_lt) $(NASM) $(NAFLAGS) -I$(srcdir) -I. $< -o $@

jsimdcfg.inc: $(srcdir)/jsimdcfg.inc.h ../jpeglib.h ../jconfig.h ../jmorecfg.h
$(AM_V_GEN) $(CPP) -I$(top_builddir) -I$(top_builddir)/simd $(srcdir)/jsimdcfg.inc.h | $(EGREP) "^[\;%]|^\ %" | sed 's%_cpp_protection_%%' | sed 's@% define@%define@g' > $@
Loading

0 comments on commit 9ec9df1

Please sign in to comment.