]> granicus.if.org Git - libjpeg-turbo/commitdiff
Back-port code from jpeg-8 that removes unpopulated (and unneeded) tables for AC...
authorDRC <dcommander@users.sourceforge.net>
Wed, 6 Nov 2013 07:45:39 +0000 (07:45 +0000)
committerDRC <dcommander@users.sourceforge.net>
Wed, 6 Nov 2013 07:45:39 +0000 (07:45 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.2.x@1082 632fc199-4ca6-4c93-a231-07263d6284db

1  2 
CMakeLists.txt
Makefile.am
jcmarker.c
testimages/testimgpa.jpg

diff --cc CMakeLists.txt
index dfb46c3de7dc4bfa828eca9e7fd9fca123ae3c80,0000000000000000000000000000000000000000..618beb3d321596247f294754a77c5d64e2454ce1
mode 100644,000000..100644
--- /dev/null
@@@ -1,436 -1,0 +1,440 @@@
 +#
 +# Setup
 +#
 +
 +cmake_minimum_required(VERSION 2.6)
 +
 +project(libjpeg-turbo C)
 +set(VERSION 1.2.2)
 +
 +if(MINGW OR CYGWIN)
 +  execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD)
 +  string(REGEX REPLACE "\n" "" BUILD ${BUILD})
 +elseif(WIN32)
 +  execute_process(COMMAND "wmic.exe" "os" "get" "LocalDateTime" OUTPUT_VARIABLE
 +    BUILD)
 +  string(REGEX REPLACE "[^0-9]" "" BUILD "${BUILD}")
 +  if (BUILD STREQUAL "")
 +    execute_process(COMMAND "cmd.exe" "/C" "DATE" "/T" OUTPUT_VARIABLE BUILD)
 +    string(REGEX REPLACE ".*[ ]([0-9]*)[/.]([0-9]*)[/.]([0-9]*).*" "\\3\\2\\1" BUILD "${BUILD}")
 +  else()
 +    string(SUBSTRING "${BUILD}" 0 8 BUILD)
 +  endif()
 +else()
 +  message(FATAL_ERROR "Platform not supported by this build system.  Use autotools instead.")
 +endif()
 +
 +# This does nothing except when using MinGW.  CMAKE_BUILD_TYPE has no meaning
 +# in Visual Studio, and it always defaults to Debug when using NMake.
 +if(NOT CMAKE_BUILD_TYPE)
 +  set(CMAKE_BUILD_TYPE Release)
 +endif()
 +
 +message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
 +
 +# 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 Visual Studio.
 +if(CMAKE_BUILD_TYPE STREQUAL "Debug")
 +  set(BUILD "${BUILD}d")
 +endif()
 +
 +message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
 +
 +option(WITH_SIMD "Include SIMD extensions" TRUE)
 +option(WITH_ARITH_ENC "Include arithmetic encoding support" TRUE)
 +option(WITH_ARITH_DEC "Include arithmetic decoding support" TRUE)
 +option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
 +option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
 +option(WITH_JAVA "Build Java wrapper for the TurboJPEG/OSS library" FALSE)
 +
 +if(WITH_ARITH_ENC)
 +  set(C_ARITH_CODING_SUPPORTED 1)
 +  message(STATUS "Arithmetic encoding support enabled")
 +else()
 +  message(STATUS "Arithmetic encoding support disabled")
 +endif()
 +
 +if(WITH_ARITH_DEC)
 +  set(D_ARITH_CODING_SUPPORTED 1)
 +  message(STATUS "Arithmetic decoding support enabled")
 +else()
 +  message(STATUS "Arithmetic decoding support disabled")
 +endif()
 +
 +if(WITH_JAVA)
 +  message(STATUS "TurboJPEG/OSS Java wrapper enabled")
 +else()
 +  message(STATUS "TurboJPEG/OSS Java wrapper disabled")
 +endif()
 +
 +set(JPEG_LIB_VERSION 62)
 +set(DLL_VERSION ${JPEG_LIB_VERSION})
 +set(FULLVERSION ${DLL_VERSION}.0.0)
 +if(WITH_JPEG8)
 +  set(JPEG_LIB_VERSION 80)
 +  set(DLL_VERSION 8)
 +  set(FULLVERSION ${DLL_VERSION}.0.2)
 +  message(STATUS "Emulating libjpeg v8 API/ABI")
 +elseif(WITH_JPEG7)
 +  set(JPEG_LIB_VERSION 70)
 +  set(DLL_VERSION 7)
 +  set(FULLVERSION ${DLL_VERSION}.0.0)
 +  message(STATUS "Emulating libjpeg v7 API/ABI")
 +endif(WITH_JPEG8)
 +
 +if(MSVC)
 +  # Use the static C library for all build types
 +  foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
 +    CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
 +    if(${var} MATCHES "/MD")
 +      string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}")
 +    endif()
 +  endforeach()
 +
 +  add_definitions(-W3 -wd4996)
 +endif()
 +
 +# Detect whether compiler is 64-bit
 +if(MSVC AND CMAKE_CL_64)
 +  set(SIMD_X86_64 1)
 +  set(64BIT 1)
 +elseif(CMAKE_SIZEOF_VOID_P MATCHES 8)
 +  set(SIMD_X86_64 1)
 +  set(64BIT 1)
 +endif()
 +
 +if(64BIT)
 +  message(STATUS "64-bit build")
 +else()
 +  message(STATUS "32-bit build")
 +endif()
 +
 +configure_file(win/jconfig.h.in jconfig.h)
 +configure_file(win/config.h.in config.h)
 +
 +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
 +
 +if(WITH_JAVA)
 +  find_package(Java)
 +  find_package(JNI)
 +  if(DEFINED JAVACFLAGS)
 +    message(STATUS "Java compiler flags = ${JAVACFLAGS}")
 +  endif()
 +endif()
 +
 +
 +#
 +# Targets
 +#
 +
 +set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c
 +  jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c
 +  jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c
 +  jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c
 +  jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c
 +  jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c
 +  jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c)
 +
 +if(WITH_ARITH_ENC OR WITH_ARITH_DEC)
 +  set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c)
 +endif()
 +
 +if(WITH_ARITH_ENC)
 +  set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c)
 +endif()
 +
 +if(WITH_ARITH_DEC)
 +  set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c)
 +endif()
 +
 +if(WITH_SIMD)
 +  add_definitions(-DWITH_SIMD)
 +  add_subdirectory(simd)
 +  if(SIMD_X86_64)
 +    set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_x86_64.c)
 +  else()
 +    set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_i386.c)
 +  endif()
 +  # This tells CMake that the "source" files haven't been generated yet
 +  set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1)
 +else()
 +  set(JPEG_SOURCES ${JPEG_SOURCES} jsimd_none.c)
 +  message(STATUS "Not using SIMD acceleration")
 +endif()
 +
 +if(WITH_JAVA)
 +  add_subdirectory(java)
 +endif()
 +
 +add_subdirectory(sharedlib)
 +
 +add_library(jpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS})
 +if(NOT MSVC)
 +  set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg)
 +endif()
 +if(WITH_SIMD)
 +  add_dependencies(jpeg-static simd)
 +endif()
 +
 +set(TURBOJPEG_SOURCES turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c)
 +if(WITH_JAVA)
 +  set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c)
 +  include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
 +endif()
 +
 +add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES})
 +set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE)
 +if(MINGW)
 +  set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at)
 +endif()
 +target_link_libraries(turbojpeg jpeg-static)
 +set_target_properties(turbojpeg PROPERTIES LINK_INTERFACE_LIBRARIES "")
 +
 +add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS}
 +  turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c)
 +if(NOT MSVC)
 +  set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg)
 +endif()
 +if(WITH_SIMD)
 +  add_dependencies(turbojpeg-static simd)
 +endif()
 +
 +add_executable(tjunittest tjunittest.c tjutil.c)
 +target_link_libraries(tjunittest turbojpeg)
 +
 +add_executable(tjunittest-static tjunittest.c tjutil.c)
 +target_link_libraries(tjunittest-static turbojpeg-static)
 +
 +add_executable(tjbench tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c
 +  wrppm.c)
 +target_link_libraries(tjbench turbojpeg jpeg-static)
 +set_property(TARGET tjbench PROPERTY COMPILE_FLAGS
 +  "-DBMP_SUPPORTED -DPPM_SUPPORTED")
 +
 +add_executable(tjbench-static tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c
 +  wrppm.c)
 +target_link_libraries(tjbench-static turbojpeg-static jpeg-static)
 +set_property(TARGET tjbench-static PROPERTY COMPILE_FLAGS
 +  "-DBMP_SUPPORTED -DPPM_SUPPORTED")
 +
 +add_executable(cjpeg-static cjpeg.c cdjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c
 +  rdtarga.c)
 +set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS
 +  "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
 +target_link_libraries(cjpeg-static jpeg-static)
 +
 +add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c
 +  wrppm.c wrtarga.c)
 +set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS
 +  "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
 +target_link_libraries(djpeg-static jpeg-static)
 +
 +add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c)
 +target_link_libraries(jpegtran-static jpeg-static)
 +set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS "-DUSE_SETMODE")
 +
 +add_executable(rdjpgcom rdjpgcom.c)
 +
 +add_executable(wrjpgcom rdjpgcom.c)
 +
 +
 +#
 +# Tests
 +#
 +
 +if(MSVC_IDE)
 +  set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/")
 +else()
 +  set(OBJDIR "")
 +endif()
 +
 +enable_testing()
 +if(WITH_JAVA)
 +add_test(TJUnitTest ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest)
 +add_test(TJUnitTest-yuv ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -yuv)
 +add_test(TJUnitTest-bi ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi)
 +add_test(TJUnitTest-bi-yuv ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi -yuv)
 +endif()
 +add_test(tjunittest tjunittest)
 +add_test(tjunittest-alloc tjunittest -alloc)
 +add_test(tjunittest-yuv tjunittest -yuv)
 +add_test(cjpeg-int sharedlib/cjpeg -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +add_test(cjpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg testoutint.jpg)
 +add_test(cjpeg-fast sharedlib/cjpeg -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +add_test(cjpeg-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgfst.jpg testoutfst.jpg)
 +add_test(cjpeg-fast-100 sharedlib/cjpeg -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +add_test(cjpeg-fast-100-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgfst100.jpg testoutfst100.jpg)
 +add_test(cjpeg-float sharedlib/cjpeg -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +if(WITH_SIMD)
 +add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgflt.jpg testoutflt.jpg)
 +else()
 +add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgflt-nosimd.jpg testoutflt.jpg)
 +endif()
 +add_test(cjpeg-int-gray sharedlib/cjpeg -dct int -grayscale -outfile testoutgray.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +add_test(cjpeg-int-gray-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimggray.jpg testoutgray.jpg)
 +add_test(djpeg-int sharedlib/djpeg -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint.ppm testoutint.ppm)
 +add_test(djpeg-fast sharedlib/djpeg -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgfst.ppm testoutfst.ppm)
 +add_test(djpeg-float sharedlib/djpeg -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +if(WITH_SIMD)
 +add_test(djpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgflt.ppm testoutflt.ppm)
 +else()
 +add_test(djpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm testoutflt.ppm)
 +endif()
 +add_test(djpeg-int-1_2 sharedlib/djpeg -dct int -scale 1/2 -ppm -outfile testoutint1_2.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-int-1_2-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint1_2.ppm testoutint1_2.ppm)
 +add_test(djpeg-fast-1_2 sharedlib/djpeg -dct fast -scale 1/2 -ppm -outfile testoutfst1_2.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-fast-1_2-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgfst1_2.ppm testoutfst1_2.ppm)
 +add_test(djpeg-int-1_4 sharedlib/djpeg -dct int -scale 1/4 -ppm -outfile testoutint1_4.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-int-1_4-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint1_4.ppm testoutint1_4.ppm)
 +add_test(djpeg-fast-1_4 sharedlib/djpeg -dct fast -scale 1/4 -ppm -outfile testoutfst1_4.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-fast-1_4-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgfst1_4.ppm testoutfst1_4.ppm)
 +add_test(djpeg-int-1_8 sharedlib/djpeg -dct int -scale 1/8 -ppm -outfile testoutint1_8.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-int-1_8-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint1_8.ppm testoutint1_8.ppm)
 +add_test(djpeg-fast-1_8 sharedlib/djpeg -dct fast -scale 1/8 -ppm -outfile testoutfst1_8.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-fast-1_8-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgfst1_8.ppm testoutfst1_8.ppm)
 +add_test(djpeg-256 sharedlib/djpeg -dct int -bmp -colors 256 -outfile testout.bmp  ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-256-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimg.bmp testout.bmp)
 +add_test(cjpeg-prog sharedlib/cjpeg -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +add_test(cjpeg-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgp.jpg testoutp.jpg)
 +add_test(jpegtran-prog sharedlib/jpegtran -outfile testoutt.jpg testoutp.jpg)
 +add_test(jpegtran-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg testoutt.jpg)
 +if(WITH_ARITH_ENC)
 +add_test(cjpeg-ari sharedlib/cjpeg -dct int -arithmetic -outfile testoutari.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +add_test(cjpeg-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg testoutari.jpg)
 +add_test(jpegtran-toari sharedlib/jpegtran -arithmetic -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg)
 +add_test(jpegtran-toari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg testouta.jpg)
++add_test(cjpeg-prog-ari sharedlib/cjpeg -dct int -progressive -arithmetic -sample 1x1 -outfile testoutpa.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
++add_test(cjpeg-prog-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgpa.jpg testoutpa.jpg)
 +endif()
 +if(WITH_ARITH_DEC)
 +add_test(djpeg-ari sharedlib/djpeg -dct int -fast -ppm -outfile testoutari.ppm ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg)
 +add_test(djpeg-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgari.ppm testoutari.ppm)
 +add_test(jpegtran-fromari     sharedlib/jpegtran -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg)
 +add_test(jpegtran-fromari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg testouta.jpg)
 +endif()
 +add_test(jpegtran-crop sharedlib/jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(jpegtran-crop-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgcrop.jpg testoutcrop.jpg)
 +
 +add_test(tjunittest-static tjunittest-static)
 +add_test(tjunittest-static-alloc tjunittest-static -alloc)
 +add_test(tjunittest-static-yuv tjunittest-static -yuv)
 +add_test(cjpeg-static-int cjpeg-static -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +add_test(cjpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg testoutint.jpg)
 +add_test(cjpeg-static-fast cjpeg-static -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +add_test(cjpeg-static-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgfst.jpg testoutfst.jpg)
 +add_test(cjpeg-static-fast-100 cjpeg-static -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +add_test(cjpeg-static-fast-100-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgfst100.jpg testoutfst100.jpg)
 +add_test(cjpeg-static-float cjpeg-static -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +if(WITH_SIMD)
 +add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgflt.jpg testoutflt.jpg)
 +else()
 +add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgflt-nosimd.jpg testoutflt.jpg)
 +endif()
 +add_test(cjpeg-static-int-gray cjpeg-static -dct int -grayscale -outfile testoutgray.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +add_test(cjpeg-static-int-gray-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimggray.jpg testoutgray.jpg)
 +add_test(djpeg-static-int djpeg-static -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint.ppm testoutint.ppm)
 +add_test(djpeg-static-fast djpeg-static -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-static-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgfst.ppm testoutfst.ppm)
 +add_test(djpeg-static-float djpeg-static -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +if(WITH_SIMD)
 +add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgflt.ppm testoutflt.ppm)
 +else()
 +add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm testoutflt.ppm)
 +endif()
 +add_test(djpeg-static-int-1_2 djpeg-static -dct int -scale 1/2 -ppm -outfile testoutint1_2.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-static-int-1_2-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint1_2.ppm testoutint1_2.ppm)
 +add_test(djpeg-static-fast-1_2 djpeg-static -dct fast -scale 1/2 -ppm -outfile testoutfst1_2.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-static-fast-1_2-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgfst1_2.ppm testoutfst1_2.ppm)
 +add_test(djpeg-static-int-1_4 djpeg-static -dct int -scale 1/4 -ppm -outfile testoutint1_4.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-static-int-1_4-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint1_4.ppm testoutint1_4.ppm)
 +add_test(djpeg-static-fast-1_4 djpeg-static -dct fast -scale 1/4 -ppm -outfile testoutfst1_4.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-static-fast-1_4-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgfst1_4.ppm testoutfst1_4.ppm)
 +add_test(djpeg-static-int-1_8 djpeg-static -dct int -scale 1/8 -ppm -outfile testoutint1_8.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-static-int-1_8-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint1_8.ppm testoutint1_8.ppm)
 +add_test(djpeg-static-fast-1_8 djpeg-static -dct fast -scale 1/8 -ppm -outfile testoutfst1_8.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-static-fast-1_8-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgfst1_8.ppm testoutfst1_8.ppm)
 +add_test(djpeg-static-256 djpeg-static -dct int -bmp -colors 256 -outfile testout.bmp  ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(djpeg-static-256-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimg.bmp testout.bmp)
 +add_test(cjpeg-static-prog cjpeg-static -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +add_test(cjpeg-static-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgp.jpg testoutp.jpg)
 +add_test(jpegtran-static-prog jpegtran-static -outfile testoutt.jpg testoutp.jpg)
 +add_test(jpegtran-static-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg testoutt.jpg)
 +if(WITH_ARITH_ENC)
 +add_test(cjpeg-static-ari cjpeg-static -dct int -arithmetic -outfile testoutari.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
 +add_test(cjpeg-static-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg testoutari.jpg)
 +add_test(jpegtran-static-toari jpegtran-static -arithmetic -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg)
 +add_test(jpegtran-static-toari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg testouta.jpg)
++add_test(cjpeg-static-prog-ari cjpeg-static -dct int -progressive -arithmetic -sample 1x1 -outfile testoutpa.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
++add_test(cjpeg-static-prog-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgpa.jpg testoutpa.jpg)
 +endif()
 +if(WITH_ARITH_DEC)
 +add_test(djpeg-static-ari djpeg-static -dct int -fast -ppm -outfile testoutari.ppm ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg)
 +add_test(djpeg-static-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgari.ppm testoutari.ppm)
 +add_test(jpegtran-static-fromari      jpegtran-static -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg)
 +add_test(jpegtran-static-fromari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg testouta.jpg)
 +endif()
 +add_test(jpegtran-static-crop jpegtran-static -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
 +add_test(jpegtran-static-crop-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimages/testimgcrop.jpg testoutcrop.jpg)
 +
 +add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P
 +  ${CMAKE_SOURCE_DIR}/cmakescripts/testclean.cmake)
 +
 +
 +#
 +# Installer
 +#
 +
 +if(MSVC)
 +  set(INST_PLATFORM "Visual C++")
 +  set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc)
 +  set(INST_DIR ${CMAKE_PROJECT_NAME})
 +elseif(MINGW)
 +  set(INST_PLATFORM GCC)
 +  set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc)
 +  set(INST_DIR ${CMAKE_PROJECT_NAME}-gcc)
 +  set(INST_DEFS -DGCC)
 +endif()
 +
 +if(64BIT)
 +  set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
 +  set(INST_NAME ${INST_NAME}64)
 +  set(INST_DIR ${INST_DIR}64)
 +  set(INST_DEFS ${INST_DEFS} -DWIN64)
 +endif()
 +
 +if(WITH_JAVA)
 +  set(INST_DEFS ${INST_DEFS} -DJAVA)
 +endif()
 +
 +if(MSVC_IDE)
 +  set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\")
 +else()
 +  set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
 +endif()
 +
 +configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY)
 +
 +add_custom_target(installer
 +  makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi
 +  DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
 +    cjpeg djpeg jpegtran tjbench
 +  SOURCES libjpeg-turbo.nsi)
 +
 +install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom tjbench
 +  ARCHIVE DESTINATION lib
 +  LIBRARY DESTINATION lib
 +  RUNTIME DESTINATION bin
 +)
 +
 +install(FILES ${CMAKE_SOURCE_DIR}/README ${CMAKE_SOURCE_DIR}/README-turbo.txt
 +  ${CMAKE_SOURCE_DIR}/example.c ${CMAKE_SOURCE_DIR}/libjpeg.txt 
 +  ${CMAKE_SOURCE_DIR}/structure.txt ${CMAKE_SOURCE_DIR}/usage.txt
 +  ${CMAKE_SOURCE_DIR}/wizard.txt
 +  DESTINATION doc)
 +
 +install(FILES ${CMAKE_BINARY_DIR}/jconfig.h ${CMAKE_SOURCE_DIR}/jerror.h
 +  ${CMAKE_SOURCE_DIR}/jmorecfg.h ${CMAKE_SOURCE_DIR}/jpeglib.h
 +  ${CMAKE_SOURCE_DIR}/turbojpeg.h DESTINATION include)
diff --cc Makefile.am
index aa2426be6b622b62272ec3cd3c431193784773b9,42cff57f7bc7629dd3e5c3574a58d91f59c9ea0b..35050e2b20158fdbfa604bc38d9ee8aa738adda9
 -## Process this file with automake to produce Makefile.in
 -#
 -#  Automake Makefile for the JPEG library
 -#
 -#  This file is written by Bob Friesenhahn, Guido Vollbeding
 -#
 -
 -# Sources to build library
 -LIBSOURCES = jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c \
 -        jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \
 -        jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c \
 -        jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \
 -        jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \
 -        jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c \
 -        jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \
 -        jquant2.c jutils.c jmemmgr.c @MEMORYMGR@.c
 -
 -# System dependent sources
 -SYSDEPSOURCES = jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
 -
 -# Headers which are installed to support the library
 -INSTINCLUDES  = jerror.h jmorecfg.h jpeglib.h
 -
 -# Headers which are not installed
 -OTHERINCLUDES = cderror.h cdjpeg.h jdct.h jinclude.h jmemsys.h jpegint.h \
 -        jversion.h transupp.h
 -
 -# Manual pages (Automake uses 'MANS' for itself)
 -DISTMANS= cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1
 -
 -# Other documentation files
 -DOCS= README install.txt usage.txt wizard.txt example.c libjpeg.txt \
 -        structure.txt coderules.txt filelist.txt change.log
 -
 -# Makefiles for various systems
 -MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \
 -        makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \
 -        makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \
 -        makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \
 -        maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \
 -        makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 \
 -        makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 \
 -        makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 \
 -        makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st \
 -        makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas \
 -        makefile.mms makefile.vms makvms.opt
 -
 -# Configuration files
 -CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
 -        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
 -        jconfig.vms
 -
 -# Support scripts for configure
 -CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp missing
 -
 -# Miscellaneous support files
 -OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \
 -        libjpeg.map
 -
 -# Test support files
 -TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
 -        testimgp.jpg
 -
 -# libtool libraries to build
 -lib_LTLIBRARIES = libjpeg.la
 -
 -# Library sources for libjpeg.la
 -libjpeg_la_SOURCES = $(LIBSOURCES)
 -
 -# LDFLAGS for libjpeg.la
 -libjpeg_la_LDFLAGS = -no-undefined \
 -        -version-info $(JPEG_LIB_VERSION)
 -
 -if HAVE_LD_VERSION_SCRIPT
 -  libjpeg_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libjpeg.map
 +lib_LTLIBRARIES = libjpeg.la libturbojpeg.la
 +libjpeg_la_LDFLAGS = -version-info ${SO_MAJOR_VERSION}:${SO_MINOR_VERSION} -no-undefined
 +libturbojpeg_la_LDFLAGS = -avoid-version -no-undefined
 +include_HEADERS = jerror.h jmorecfg.h jpeglib.h turbojpeg.h
 +nodist_include_HEADERS = jconfig.h
 +
 +HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
 +      jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h jpegcomp.h
 +
 +libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \
 +      jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \
 +      jcomapi.c jcparam.c jcphuff.c jcprepct.c jcsample.c jctrans.c \
 +      jdapimin.c jdapistd.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \
 +      jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \
 +      jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c \
 +      jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c \
 +      jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c
 +
 +if WITH_ARITH
 +
 +libjpeg_la_SOURCES += jaricom.c
 +
 +endif
 +
 +if WITH_ARITH_ENC
 +
 +libjpeg_la_SOURCES += jcarith.c
 +
 +endif
 +
 +if WITH_ARITH_DEC
 +
 +libjpeg_la_SOURCES += jdarith.c
 +
  endif
  
 -# Executables to build
 -bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom
 -
 -# Executable sources & libs
 -cjpeg_SOURCES    = cjpeg.c rdppm.c rdgif.c rdtarga.c rdrle.c rdbmp.c \
 -        rdswitch.c cdjpeg.c
 -cjpeg_LDADD      = libjpeg.la
 -djpeg_SOURCES    = djpeg.c wrppm.c wrgif.c wrtarga.c wrrle.c wrbmp.c \
 -        rdcolmap.c cdjpeg.c
 -djpeg_LDADD      = libjpeg.la
 -jpegtran_SOURCES = jpegtran.c rdswitch.c cdjpeg.c transupp.c
 -jpegtran_LDADD   = libjpeg.la
 +libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpeg.c turbojpeg.h \
 +      transupp.c transupp.h jdatadst-tj.c jdatasrc-tj.c
 +
 +SUBDIRS = java
 +
 +if WITH_JAVA
 +
 +libturbojpeg_la_SOURCES += turbojpeg-jni.c
 +libturbojpeg_la_CFLAGS = ${JNI_CFLAGS}
 +TJMAPFILE = turbojpeg-mapfile.jni
 +
 +else
 +
 +TJMAPFILE = turbojpeg-mapfile
 +
 +endif
 +
 +libturbojpeg_la_SOURCES += $(TJMAPFILE)
 +
 +if VERSION_SCRIPT
 +
 +libturbojpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)$(srcdir)/$(TJMAPFILE)
 +libjpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)libjpeg.map
 +
 +endif
 +
 +if WITH_SIMD
 +
 +SUBDIRS += simd
 +libjpeg_la_LIBADD = simd/libsimd.la
 +libturbojpeg_la_LIBADD = simd/libsimd.la
 +
 +else
 +
 +libjpeg_la_SOURCES += jsimd_none.c
 +
 +endif
 +
 +bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom tjbench
 +noinst_PROGRAMS = tjunittest jcstest
 +
 +tjbench_SOURCES = tjbench.c bmp.h bmp.c tjutil.h tjutil.c rdbmp.c rdppm.c \
 +      wrbmp.c wrppm.c
 +
 +tjbench_LDADD = libturbojpeg.la libjpeg.la -lm
 +
 +tjbench_CFLAGS = -DBMP_SUPPORTED -DPPM_SUPPORTED
 +
 +tjunittest_SOURCES = tjunittest.c tjutil.h tjutil.c
 +
 +tjunittest_LDADD = libturbojpeg.la
 +
 +cjpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c cjpeg.c rdbmp.c rdgif.c \
 +      rdppm.c rdswitch.c rdtarga.c 
 +
 +cjpeg_LDADD = libjpeg.la
 +
 +cjpeg_CFLAGS = -DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED \
 +      -DTARGA_SUPPORTED
 +
 +djpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c djpeg.c rdcolmap.c rdswitch.c \
 +      wrbmp.c wrgif.c wrppm.c wrtarga.c
 +
 +djpeg_LDADD = libjpeg.la
 +
 +djpeg_CFLAGS = -DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED \
 +      -DTARGA_SUPPORTED
 +
 +jpegtran_SOURCES = jpegtran.c rdswitch.c cdjpeg.c transupp.c transupp.h
 +
 +jpegtran_LDADD = libjpeg.la
 +
  rdjpgcom_SOURCES = rdjpgcom.c
 +
 +rdjpgcom_LDADD = libjpeg.la
 +
  wrjpgcom_SOURCES = wrjpgcom.c
  
 -# Manual pages to install
 -man_MANS = $(DISTMANS)
 +wrjpgcom_LDADD = libjpeg.la
 +
 +jcstest_SOURCES = jcstest.c
 +
 +jcstest_LDADD = libjpeg.la
 +
 +dist_man1_MANS = cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1
 +
 +DOCS= install.txt coderules.txt filelist.txt jconfig.txt change.log \
 +      rdrle.c wrrle.c BUILDING.txt ChangeLog.txt
 +
 +docdir = $(datadir)/doc
 +dist_doc_DATA = README README-turbo.txt libjpeg.txt structure.txt usage.txt \
 +      wizard.txt 
 +
 +exampledir = $(datadir)/doc
 +dist_example_DATA = example.c
  
 -# Headers to install
 -include_HEADERS = $(INSTINCLUDES)
  
 -# Other distributed headers
 -noinst_HEADERS = $(OTHERINCLUDES)
 +EXTRA_DIST = win release $(DOCS) testimages CMakeLists.txt \
 +      sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in doc doxygen.config \
 +      jccolext.c jdcolext.c jdmrgext.c
  
 -# Other distributed files
 -EXTRA_DIST =  $(DOCS) $(DISTMANS) $(MKFILES) $(CONFIGFILES) $(SYSDEPSOURCES) \
 -        $(OTHERFILES) $(TESTFILES)
 +dist-hook:
 +      rm -rf `find $(distdir) -name .svn`
  
 -# Files to be cleaned
 -CLEANFILES = testout.ppm testout.bmp testout.jpg testoutp.ppm testoutp.jpg \
 -        testoutt.jpg
  
 -# Install jconfig.h
 -install-data-local:
 -      $(mkinstalldirs) $(DESTDIR)$(includedir)
 -      $(INSTALL_HEADER) jconfig.h $(DESTDIR)$(includedir)/jconfig.h
 +test: testclean all
 +if WITH_JAVA
 +      $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest
 +      $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -bi
 +      $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv
 +      $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -bi
 +endif
 +      ./tjunittest
 +      ./tjunittest -alloc
 +      ./tjunittest -yuv
 +      ./cjpeg -dct int -outfile testoutint.jpg $(srcdir)/testimages/testorig.ppm
 +      cmp $(srcdir)/testimages/testimgint.jpg testoutint.jpg
 +      ./cjpeg -dct fast -opt -outfile testoutfst.jpg $(srcdir)/testimages/testorig.ppm
 +      cmp $(srcdir)/testimages/testimgfst.jpg testoutfst.jpg
 +      ./cjpeg -dct fast -quality 100 -opt -outfile testoutfst100.jpg $(srcdir)/testimages/testorig.ppm
 +      cmp $(srcdir)/testimages/testimgfst100.jpg testoutfst100.jpg
 +      ./cjpeg -dct float -outfile testoutflt.jpg $(srcdir)/testimages/testorig.ppm
 +if WITH_SSE_FLOAT_DCT
 +      cmp $(srcdir)/testimages/testimgflt.jpg testoutflt.jpg
 +else
 +      cmp $(srcdir)/testimages/testimgflt-nosimd.jpg testoutflt.jpg
 +endif
 +      ./cjpeg -dct int -grayscale -outfile testoutgray.jpg $(srcdir)/testimages/testorig.ppm
 +      cmp $(srcdir)/testimages/testimggray.jpg testoutgray.jpg
 +      ./djpeg -dct int -fast -ppm -outfile testoutint.ppm $(srcdir)/testimages/testorig.jpg
 +      cmp $(srcdir)/testimages/testimgint.ppm testoutint.ppm
 +      ./djpeg -dct fast -ppm -outfile testoutfst.ppm $(srcdir)/testimages/testorig.jpg
 +      cmp $(srcdir)/testimages/testimgfst.ppm testoutfst.ppm
 +      ./djpeg -dct float -ppm -outfile testoutflt.ppm $(srcdir)/testimages/testorig.jpg
 +if WITH_SSE_FLOAT_DCT
 +      cmp $(srcdir)/testimages/testimgflt.ppm testoutflt.ppm
 +else
 +      cmp $(srcdir)/testimages/testorig.ppm testoutflt.ppm
 +endif
 +      ./djpeg -dct int -scale 1/2 -ppm -outfile testoutint1_2.ppm $(srcdir)/testimages/testorig.jpg
 +      cmp $(srcdir)/testimages/testimgint1_2.ppm testoutint1_2.ppm
 +      ./djpeg -dct fast -scale 1/2 -ppm -outfile testoutfst1_2.ppm $(srcdir)/testimages/testorig.jpg
 +      cmp $(srcdir)/testimages/testimgfst1_2.ppm testoutfst1_2.ppm
 +      ./djpeg -dct int -scale 1/4 -ppm -outfile testoutint1_4.ppm $(srcdir)/testimages/testorig.jpg
 +      cmp $(srcdir)/testimages/testimgint1_4.ppm testoutint1_4.ppm
 +      ./djpeg -dct fast -scale 1/4 -ppm -outfile testoutfst1_4.ppm $(srcdir)/testimages/testorig.jpg
 +      cmp $(srcdir)/testimages/testimgfst1_4.ppm testoutfst1_4.ppm
 +      ./djpeg -dct int -scale 1/8 -ppm -outfile testoutint1_8.ppm $(srcdir)/testimages/testorig.jpg
 +      cmp $(srcdir)/testimages/testimgint1_8.ppm testoutint1_8.ppm
 +      ./djpeg -dct fast -scale 1/8 -ppm -outfile testoutfst1_8.ppm $(srcdir)/testimages/testorig.jpg
 +      cmp $(srcdir)/testimages/testimgfst1_8.ppm testoutfst1_8.ppm
 +      ./djpeg -dct int -bmp -colors 256 -outfile testout.bmp  $(srcdir)/testimages/testorig.jpg
 +      cmp $(srcdir)/testimages/testimg.bmp testout.bmp
 +if WITH_ARITH_ENC
 +      ./cjpeg -dct int -arithmetic -outfile testoutari.jpg $(srcdir)/testimages/testorig.ppm
 +      cmp $(srcdir)/testimages/testimgari.jpg testoutari.jpg
 +      ./jpegtran -arithmetic -outfile testouta.jpg $(srcdir)/testimages/testimgint.jpg
 +      cmp $(srcdir)/testimages/testimgari.jpg testouta.jpg
++      ./cjpeg -dct int -progressive -arithmetic -sample 1x1 -outfile testoutpa.jpg $(srcdir)/testimages/testorig.ppm
++      cmp $(srcdir)/testimages/testimgpa.jpg testoutpa.jpg
 +endif
 +if WITH_ARITH_DEC
 +      ./djpeg -dct int -fast -ppm -outfile testoutari.ppm $(srcdir)/testimages/testimgari.jpg
 +      cmp $(srcdir)/testimages/testimgari.ppm testoutari.ppm
 +      ./jpegtran -outfile testouta.jpg $(srcdir)/testimages/testimgari.jpg
 +      cmp $(srcdir)/testimages/testimgint.jpg testouta.jpg
 +endif
 +      ./cjpeg -dct int -progressive -outfile testoutp.jpg $(srcdir)/testimages/testorig.ppm
 +      cmp $(srcdir)/testimages/testimgp.jpg testoutp.jpg
 +      ./jpegtran -outfile testoutt.jpg testoutp.jpg
 +      cmp $(srcdir)/testimages/testimgint.jpg testoutt.jpg
 +      ./jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg $(srcdir)/testimages/testorig.jpg
 +      cmp $(srcdir)/testimages/testimgcrop.jpg testoutcrop.jpg
  
 -# Uninstall jconfig.h
 -uninstall-local:
 -      rm -f $(DESTDIR)$(includedir)/jconfig.h
  
 -# Run tests
 -test: check-local
 -check-local:
 +testclean:
        rm -f testout*
 -      ./djpeg -dct int -ppm -outfile testout.ppm  $(srcdir)/testorig.jpg
 -      ./djpeg -dct int -bmp -colors 256 -outfile testout.bmp  $(srcdir)/testorig.jpg
 -      ./cjpeg -dct int -outfile testout.jpg  $(srcdir)/testimg.ppm
 -      ./djpeg -dct int -ppm -outfile testoutp.ppm $(srcdir)/testprog.jpg
 -      ./cjpeg -dct int -progressive -opt -outfile testoutp.jpg $(srcdir)/testimg.ppm
 -      ./jpegtran -outfile testoutt.jpg $(srcdir)/testprog.jpg
 -      cmp $(srcdir)/testimg.ppm testout.ppm
 -      cmp $(srcdir)/testimg.bmp testout.bmp
 -      cmp $(srcdir)/testimg.jpg testout.jpg
 -      cmp $(srcdir)/testimg.ppm testoutp.ppm
 -      cmp $(srcdir)/testimgp.jpg testoutp.jpg
 -      cmp $(srcdir)/testorig.jpg testoutt.jpg
 +      rm -f *_GRAY_*.bmp
 +      rm -f *_GRAY_*.png
 +      rm -f *_GRAY_*.ppm
 +      rm -f *_GRAY_*.jpg
 +      rm -f *_GRAY.yuv
 +      rm -f *_420_*.bmp
 +      rm -f *_420_*.png
 +      rm -f *_420_*.ppm
 +      rm -f *_420_*.jpg
 +      rm -f *_420.yuv
 +      rm -f *_422_*.bmp
 +      rm -f *_422_*.png
 +      rm -f *_422_*.ppm
 +      rm -f *_422_*.jpg
 +      rm -f *_422.yuv
 +      rm -f *_444_*.bmp
 +      rm -f *_444_*.png
 +      rm -f *_444_*.ppm
 +      rm -f *_444_*.jpg
 +      rm -f *_444.yuv
 +      rm -f *_440_*.bmp
 +      rm -f *_440_*.png
 +      rm -f *_440_*.ppm
 +      rm -f *_440_*.jpg
 +      rm -f *_440.yuv
 +
 +
 +tjtest:
 +      sh ./tjbenchtest
 +if WITH_JAVA
 +      sh ./tjexampletest
 +endif
 +
 +
 +if X86_64
 +
 +install-exec-hook:
 +      __PREFIX=`echo ${prefix} | sed -e 's@\/*$$@@'`;  \
 +      if [ "$$__PREFIX" = "/opt/libjpeg-turbo" ]; then  \
 +              cd $(DESTDIR)/${prefix};  \
 +              if [ -d lib -a ! -d lib64 -a ! -h lib64 ]; then  \
 +                      $(LN_S) lib lib64;  \
 +              fi  \
 +      fi
 +
 +else
 +
 +install-exec-hook:
 +      __PREFIX=`echo ${prefix} | sed -e 's@\/*$$@@'`;  \
 +      if [ "$$__PREFIX" = "/opt/libjpeg-turbo" ]; then  \
 +              cd $(DESTDIR)/${prefix};  \
 +              if [ -d lib -a ! -d lib32 -a ! -h lib32 ]; then  \
 +                      $(LN_S) lib lib32;  \
 +              fi  \
 +      fi
 +
 +endif
 +
 +rpm: all
 +      TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \
 +      mkdir -p $$TMPDIR/RPMS; \
 +      ln -fs `pwd` $$TMPDIR/BUILD; \
 +      rm -f ${PACKAGE_NAME}-${VERSION}.${RPMARCH}.rpm; \
 +      rpmbuild -bb --define "_blddir $$TMPDIR/buildroot"  \
 +              --define "_topdir $$TMPDIR" \
 +              --target ${RPMARCH} pkgscripts/libjpeg-turbo.spec; \
 +      cp $$TMPDIR/RPMS/${RPMARCH}/${PACKAGE_NAME}-${VERSION}-${BUILD}.${RPMARCH}.rpm \
 +              ${PACKAGE_NAME}-${VERSION}.${RPMARCH}.rpm; \
 +      rm -rf $$TMPDIR
 +
 +srpm: dist-gzip
 +      TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \
 +      mkdir -p $$TMPDIR/RPMS; \
 +      mkdir -p $$TMPDIR/SRPMS; \
 +      mkdir -p $$TMPDIR/BUILD; \
 +      mkdir -p $$TMPDIR/SOURCES; \
 +      mkdir -p $$TMPDIR/SPECS; \
 +      rm -f ${PACKAGE_NAME}-${VERSION}.src.rpm; \
 +      cp ${PACKAGE_NAME}-${VERSION}.tar.gz $$TMPDIR/SOURCES; \
 +      cat pkgscripts/libjpeg-turbo.spec | sed s/%{_blddir}/%{_tmppath}/g \
 +              | sed s/#--\>//g \
 +              > $$TMPDIR/SPECS/libjpeg-turbo.spec; \
 +      rpmbuild -bs --define "_topdir $$TMPDIR" $$TMPDIR/SPECS/libjpeg-turbo.spec; \
 +      cp $$TMPDIR/SRPMS/${PACKAGE_NAME}-${VERSION}-${BUILD}.src.rpm \
 +              ${PACKAGE_NAME}-${VERSION}.src.rpm; \
 +      rm -rf $$TMPDIR
 +
 +deb: all
 +      sh pkgscripts/makedpkg
 +
 +if X86_64
 +
 +udmg: all
 +      sh pkgscripts/makemacpkg -build32 ${BUILDDIR32}
 +
 +iosdmg: all
 +      sh pkgscripts/makemacpkg -build32 ${BUILDDIR32} -buildarmv6 ${BUILDDIRARMV6} -buildarmv7 ${BUILDDIRARMV7}
 +
 +else
 +
 +iosdmg: all
 +      sh pkgscripts/makemacpkg -buildarmv6 ${BUILDDIRARMV6} -buildarmv7 ${BUILDDIRARMV7}
 +
 +endif
 +
 +dmg: all
 +      sh pkgscripts/makemacpkg
 +
 +if X86_64
 +
 +csunpkg: all
 +      sh pkgscripts/makesunpkg combined ${BUILDDIR32}
 +
 +endif
 +
 +sunpkg: all
 +      sh pkgscripts/makesunpkg
 +
 +cygwinpkg: all
 +      sh pkgscripts/makecygwinpkg
diff --cc jcmarker.c
Simple merge
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..815a6917eb8578f26df48733fb281b1d17fcd235
new file mode 100644 (file)
Binary files differ