forked from webmproject/sjpeg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b286c97
Showing
41 changed files
with
14,443 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
*.l[ao] | ||
*.[ao] | ||
*.pc | ||
.deps | ||
.libs | ||
/aclocal.m4 | ||
/ar-lib | ||
/autom4te.cache | ||
/compile | ||
/config.* | ||
/configure | ||
/depcomp | ||
/dist | ||
/install-sh | ||
/libtool | ||
/ltmain.sh | ||
/missing | ||
/mkinstalldirs | ||
/stamp-h1 | ||
Makefile | ||
Makefile.in | ||
examples/anim_diff | ||
examples/[cdv]webp | ||
examples/gif2webp | ||
examples/img2webp | ||
examples/webpmux | ||
src/webp/config.h* | ||
src/webp/stamp-h1 | ||
/output | ||
/doc/output | ||
*.idb | ||
*.pdb | ||
/iosbuild | ||
/WebP.framework | ||
CMakeCache.txt | ||
CMakeFiles/ | ||
cmake_install.cmake | ||
.gradle | ||
/build | ||
extras/get_disto | ||
extras/webp_quality |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Main stuff: | ||
- Pascal Massimino ([email protected]) | ||
|
||
with a lot of help over time from: | ||
- Steinar H. Gunderson (sgunderson at bigfoot.com) | ||
- Iftach Hyams (paraduma at gmail.com) | ||
- James Zern (jzern at google.com) | ||
- Michel Lespinasse (walken at zoy.org) | ||
- Mikołaj Zalewski (mikolajz at google dot com) | ||
- Vincent Rabaud (vrabaud at google.com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
LOCAL_PATH:= $(call my-dir) | ||
|
||
SJPEG_CFLAGS := -Wall -DANDROID -DHAVE_MALLOC_H -DHAVE_PTHREAD | ||
SJPEG_CFLAGS += -fvisibility=hidden | ||
|
||
ifeq ($(APP_OPTIM),release) | ||
SJPEG_CFLAGS += -finline-functions -ffast-math \ | ||
-ffunction-sections -fdata-sections | ||
ifeq ($(findstring clang,$(NDK_TOOLCHAIN_VERSION)),) | ||
SJPEG_CFLAGS += -frename-registers -s | ||
endif | ||
endif | ||
|
||
ifneq ($(findstring armeabi-v7a, $(TARGET_ARCH_ABI)),) | ||
# Setting LOCAL_ARM_NEON will enable -mfpu=neon which may cause illegal | ||
# instructions to be generated for armv7a code. Instead target the neon code | ||
# specifically. | ||
NEON := cc.neon | ||
USE_CPUFEATURES := yes | ||
else | ||
NEON := cc | ||
endif | ||
|
||
enc_srcs := \ | ||
src/bit_writer.cc \ | ||
src/colors_rgb.$(NEON) \ | ||
src/enc.$(NEON) \ | ||
src/fdct.$(NEON) \ | ||
src/jpeg_tools.cc \ | ||
src/yuv_convert.$(NEON) \ | ||
src/score_7.cc \ | ||
|
||
################################################################################ | ||
|
||
include $(CLEAR_VARS) | ||
|
||
LOCAL_SRC_FILES := \ | ||
$(enc_srcs) \ | ||
|
||
LOCAL_CFLAGS := $(SJPEG_CFLAGS) | ||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src | ||
|
||
# prefer arm over thumb mode for performance gains | ||
LOCAL_ARM_MODE := arm | ||
|
||
LOCAL_MODULE := sjpeg_static | ||
|
||
include $(BUILD_STATIC_LIBRARY) | ||
|
||
ifeq ($(ENABLE_SHARED),1) | ||
include $(CLEAR_VARS) | ||
LOCAL_WHOLE_STATIC_LIBRARIES := sjpeg_static | ||
LOCAL_MODULE := sjpeg | ||
|
||
include $(BUILD_SHARED_LIBRARY) | ||
endif | ||
|
||
################################################################################ | ||
|
||
include $(LOCAL_PATH)/examples/Android.mk | ||
|
||
$(call import-module,android/cpufeatures) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
APP_STL := gnustl_shared |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
cmake_minimum_required(VERSION 2.8.7) | ||
project(sjpeg CXX) | ||
|
||
# Options for coder / decoder executables. | ||
option(SJPEG_ENABLE_SIMD "Enable any SIMD optimization." ON) | ||
option(SJPEG_BUILD_EXAMPLES "Build the sjpeg / vjpeg command line tools." ON) | ||
|
||
set(SJPEG_DEP_LIBRARIES) | ||
set(SJPEG_DEP_INCLUDE_DIRS) | ||
|
||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE "Release" CACHE | ||
"Build type: Release, Debug or RelWithDebInfo" STRING FORCE | ||
) | ||
endif() | ||
|
||
set(PROJECT_VERSION 0.1) | ||
|
||
################################################################################ | ||
# Android only. | ||
if(ANDROID) | ||
include_directories(${ANDROID_NDK}/sources/android/cpufeatures) | ||
add_library(cpufeatures STATIC | ||
${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c | ||
) | ||
target_link_libraries(cpufeatures dl) | ||
set(SJPEG_DEP_LIBRARIES ${SJPEG_DEP_LIBRARIES} cpufeatures) | ||
set(SJPEG_DEP_INCLUDE_DIRS ${SJPEG_DEP_INCLUDE_DIRS} | ||
${ANDROID_NDK}/sources/android/cpufeatures | ||
) | ||
endif() | ||
|
||
## Check for SIMD extensions. | ||
include(${CMAKE_CURRENT_LIST_DIR}/cmake/cpu.cmake) | ||
|
||
################################################################################ | ||
# sjpeg source files. | ||
|
||
# Build the sjpeg library. | ||
add_definitions(-Wall) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/ ${SJPEG_DEP_INCLUDE_DIRS}) | ||
add_library(sjpeg ${CMAKE_CURRENT_SOURCE_DIR}/src/bit_writer.cc | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/bit_writer.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/colors_rgb.cc | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/fdct.cc | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/enc.cc | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/jpeg_tools.cc | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/score_7.cc | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/sjpeg.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/sjpegi.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/yuv_convert.cc | ||
) | ||
if(SJPEG_DEP_LIBRARIES) | ||
target_link_libraries(sjpeg ${SJPEG_DEP_LIBRARIES}) | ||
endif() | ||
|
||
# Make sure the OBJECT libraries are built with position independent code | ||
# (it is not ON by default). | ||
set_target_properties(sjpeg PROPERTIES POSITION_INDEPENDENT_CODE ON) | ||
|
||
# Set the version numbers. | ||
set_target_properties(sjpeg PROPERTIES VERSION ${PROJECT_VERSION} | ||
SOVERSION ${PROJECT_VERSION}) | ||
|
||
# Find the standard image libraries. | ||
set(SJPEG_DEP_IMG_LIBRARIES) | ||
set(SJPEG_DEP_IMG_INCLUDE_DIRS) | ||
foreach(I_LIB PNG JPEG) | ||
find_package(${I_LIB}) | ||
set(SJPEG_HAVE_${I_LIB} ${${I_LIB}_FOUND}) | ||
if(${I_LIB}_FOUND) | ||
set(SJPEG_DEP_IMG_LIBRARIES ${SJPEG_DEP_IMG_LIBRARIES} | ||
${${I_LIB}_LIBRARIES}) | ||
set(SJPEG_DEP_IMG_INCLUDE_DIRS ${SJPEG_DEP_IMG_INCLUDE_DIRS} | ||
${${I_LIB}_INCLUDE_DIRS}) | ||
endif() | ||
endforeach() | ||
|
||
# Find the OpenGL/GLUT libraries. | ||
set(SJPEG_DEP_GL_LIBRARIES) | ||
set(SJPEG_DEP_GL_INCLUDE_DIRS) | ||
find_package(OpenGL) | ||
if(OPENGL_gl_LIBRARY) | ||
set(SJPEG_DEP_GL_LIBRARIES | ||
${SJPEG_DEP_GL_LIBRARIES} ${OPENGL_gl_LIBRARY}) | ||
set(SJPEG_DEP_GL_INCLUDE_DIRS | ||
${SJPEG_DEP_GL_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIR}) | ||
set(SJPEG_HAVE_OPENGL TRUE) | ||
endif() | ||
find_package(GLUT) | ||
if(GLUT_FOUND) | ||
set(SJPEG_DEP_GL_LIBRARIES | ||
${SJPEG_DEP_GL_LIBRARIES} ${GLUT_glut_LIBRARY}) | ||
set(SJPEG_DEP_GL_INCLUDE_DIRS | ||
${SJPEG_DEP_GL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR}) | ||
set(SJPEG_HAVE_GLUT TRUE) | ||
endif() | ||
|
||
# build the utils library | ||
include_directories(${SJPEG_DEP_IMG_INCLUDE_DIRS}) | ||
add_library(utils ${CMAKE_CURRENT_SOURCE_DIR}/examples/utils.cc | ||
${CMAKE_CURRENT_SOURCE_DIR}/examples/utils.h | ||
) | ||
if(SJPEG_HAVE_OPENGL) | ||
set(THREADS_PREFER_PTHREAD_FLAG ON) | ||
find_package(Threads) | ||
target_compile_definitions(utils PUBLIC SJPEG_HAVE_OPENGL) | ||
add_definitions(${OPENGL_DEFINITIONS}) | ||
endif() | ||
if(SJPEG_HAVE_GLUT) | ||
add_definitions(${GLUT_DEFINITIONS}) | ||
endif() | ||
if(SJPEG_HAVE_JPEG) | ||
target_compile_definitions(utils PUBLIC SJPEG_HAVE_JPEG) | ||
endif() | ||
if(SJPEG_HAVE_PNG) | ||
target_compile_definitions(utils PUBLIC SJPEG_HAVE_PNG) | ||
endif() | ||
if(SJPEG_DEP_IMG_LIBRARIES) | ||
target_link_libraries(utils Threads::Threads) | ||
target_link_libraries(utils ${SJPEG_DEP_IMG_LIBRARIES} | ||
${SJPEG_DEP_GL_LIBRARIES}) | ||
endif() | ||
# set_target_properties(utils PROPERTIES POSITION_INDEPENDENT_CODE ON) | ||
|
||
# Build the executables if asked for. | ||
if(SJPEG_BUILD_EXAMPLES) | ||
# sjpeg | ||
add_executable(sjpeg-bin ${CMAKE_CURRENT_SOURCE_DIR}/examples/sjpeg.cc) | ||
target_link_libraries(sjpeg-bin sjpeg utils) | ||
set_target_properties(sjpeg-bin PROPERTIES OUTPUT_NAME sjpeg) | ||
|
||
# vjpeg | ||
add_executable(vjpeg ${CMAKE_CURRENT_SOURCE_DIR}/examples/vjpeg.cc) | ||
target_link_libraries(vjpeg Threads::Threads) | ||
# Force to link against pthread. | ||
include(CheckCXXSourceCompiles) | ||
set(CMAKE_REQUIRED_FLAGS_INI ${CMAKE_REQUIRED_FLAGS}) | ||
set(CMAKE_REQUIRED_FLAGS "-Wl,--no-as-needed") | ||
check_cxx_source_compiles("int main(void){return 0;}" FLAG_NO_AS_NEEDED) | ||
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_INI}) | ||
if(FLAG_NO_AS_NEEDED) | ||
target_link_libraries(vjpeg "-Wl,--no-as-needed") | ||
endif() | ||
|
||
# check whether we need to include GLUT/glut.h or GL/glut.h | ||
find_path(FLAG_GLUT_GLUT_H GLUT/glut.h) | ||
if(FLAG_GLUT_GLUT_H) | ||
add_definitions(-DHAVE_GLUT_GLUT_H) | ||
endif() | ||
target_link_libraries(vjpeg ${SJPEG_DEP_GL_LIBRARIES} sjpeg utils) | ||
|
||
install(TARGETS sjpeg-bin vjpeg RUNTIME DESTINATION bin) | ||
endif() | ||
|
||
# Install the different headers and libraries. | ||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/sjpeg.h | ||
DESTINATION include) | ||
install(TARGETS sjpeg | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib) | ||
|
||
# Create the CMake version file. | ||
include(CMakePackageConfigHelpers) | ||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/sjpegConfigVersion.cmake" | ||
VERSION ${PROJECT_VERSION} | ||
COMPATIBILITY AnyNewerVersion | ||
) | ||
|
||
# Create the Config file. | ||
include(CMakePackageConfigHelpers) | ||
set(ConfigPackageLocation lib/sjpeg/cmake/) | ||
configure_package_config_file( | ||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/sjpegConfig.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/sjpegConfig.cmake | ||
INSTALL_DESTINATION ${ConfigPackageLocation} | ||
) | ||
|
||
# Install the generated CMake files. | ||
install( | ||
FILES "${CMAKE_CURRENT_BINARY_DIR}/sjpegConfigVersion.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/sjpegConfig.cmake" | ||
DESTINATION ${ConfigPackageLocation} | ||
) | ||
|
||
|
||
################################################################################ | ||
# Man page. | ||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/man/sjpeg.1 | ||
${CMAKE_CURRENT_SOURCE_DIR}/man/vjpeg.1 | ||
DESTINATION share/man/man1) |
Oops, something went wrong.