From: DRC Date: Sat, 9 Aug 2014 23:06:07 +0000 (+0000) Subject: 12-bit JPEG support X-Git-Tag: 1.3.90~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aee4f721602b86fae0057b517933ae1624972907;p=libjpeg-turbo 12-bit JPEG support git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1337 632fc199-4ca6-4c93-a231-07263d6284db --- aee4f721602b86fae0057b517933ae1624972907 diff --cc CMakeLists.txt index 42cb70a,0000000..c34f45e mode 100644,000000..100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@@ -1,738 -1,0 +1,809 @@@ +# +# Setup +# + +cmake_minimum_required(VERSION 2.8.8) +# Use LINK_INTERFACE_LIBRARIES instead of INTERFACE_LINK_LIBRARIES +if(POLICY CMP0022) + cmake_policy(SET CMP0022 OLD) +endif() + +project(libjpeg-turbo C) +set(VERSION 1.3.80) + +if(CYGWIN OR NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + 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_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE) ++option(WITH_TURBOJPEG "Include the TurboJPEG wrapper library and associated test programs" TRUE) +option(WITH_JAVA "Build Java wrapper for the TurboJPEG library" FALSE) ++option(WITH_12BIT "Encode/decode JPEG images with 12-bit samples (implies WITH_SIMD=0 WITH_TURBOJPEG=0 WITH_ARITH_ENC=0 WITH_ARITH_DEC=0)" FALSE) ++ ++if(WITH_12BIT) ++ set(WITH_SIMD FALSE) ++ set(WITH_TURBOJPEG FALSE) ++ set(WITH_ARITH_ENC FALSE) ++ set(WITH_ARITH_DEC FALSE) ++ set(BITS_IN_JSAMPLE 12) ++ message(STATUS "12-bit JPEG support enabled") ++else() ++ set(BITS_IN_JSAMPLE 8) ++endif() + +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_TURBOJPEG) ++ message(STATUS "TurboJPEG C wrapper enabled") ++else() ++ message(STATUS "TurboJPEG C wrapper disabled") ++endif() ++ +if(WITH_JAVA) + message(STATUS "TurboJPEG Java wrapper enabled") +else() + message(STATUS "TurboJPEG Java wrapper disabled") +endif() + +set(SO_AGE 0) +if(WITH_MEM_SRCDST) + set(SO_AGE 1) +endif() + +set(JPEG_LIB_VERSION 62) +set(DLL_VERSION ${JPEG_LIB_VERSION}) +set(FULLVERSION ${DLL_VERSION}.${SO_AGE}.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}.${SO_AGE}.0) + message(STATUS "Emulating libjpeg v7 API/ABI") +endif(WITH_JPEG8) + +if(WITH_MEM_SRCDST) + set(MEM_SRCDST_SUPPORTED 1) + message(STATUS "In-memory source/destination managers enabled") +else() + message(STATUS "In-memory source/destination managers disabled") +endif() + +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() + +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + if(MSVC) + set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME}) + else() + set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME}-gcc) + endif() + if(64BIT) + set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_INSTALL_PREFIX_DEFAULT}64) + endif() + set(CMAKE_INSTALL_PREFIX "c:/${CMAKE_INSTALL_PREFIX_DEFAULT}" CACHE PATH + "Directory into which to install libjpeg-turbo (default: c:/${CMAKE_INSTALL_PREFIX_DEFAULT})" + FORCE) +endif() + +message(STATUS "Install directory = ${CMAKE_INSTALL_PREFIX}") + +configure_file(win/jconfig.h.in jconfig.h) +configure_file(win/jconfigint.h.in jconfigint.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() ++if(WITH_TURBOJPEG) ++ 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 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_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 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(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 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(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") ++endif() + - 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") ++if(WITH_12BIT) ++ set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED -DUSE_SETMODE") ++else() ++ set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") ++ set(CJPEG_BMP_SOURCES rdbmp.c rdtarga.c) ++ set(DJPEG_BMP_SOURCES wrbmp.c wrtarga.c) ++endif() ++ ++add_executable(cjpeg-static cjpeg.c cdjpeg.c rdgif.c rdppm.c rdswitch.c ++ ${CJPEG_BMP_SOURCES}) ++set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) +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") ++add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrgif.c ++ wrppm.c ${DJPEG_BMP_SOURCES}) ++set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) +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 wrjpgcom.c) + + +# +# Tests +# + +if(MSVC_IDE) + set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/") +else() + set(OBJDIR "") +endif() + +enable_testing() + - set(MD5_JPEG_RGB_ISLOW 768e970dd57b340ff1b83c9d3d47c77b) - set(MD5_PPM_RGB_ISLOW 00a257f5393fef8821f2b88ac7421291) - set(MD5_BMP_RGB_ISLOW_565 f07d2e75073e4bb10f6c6f4d36e2e3be) - set(MD5_BMP_RGB_ISLOW_565D 4cfa0928ef3e6bb626d7728c924cfda4) - set(MD5_JPEG_422_IFAST_OPT 2540287b79d913f91665e660303ab2c8) - set(MD5_PPM_422_IFAST 35bd6b3f833bad23de82acea847129fa) - set(MD5_PPM_422M_IFAST 8dbc65323d62cca7c91ba02dd1cfa81d) - set(MD5_BMP_422M_IFAST_565 3294bd4d9a1f2b3d08ea6020d0db7065) - set(MD5_BMP_422M_IFAST_565D da98c9c7b6039511be4a79a878a9abc1) - set(MD5_JPEG_420_IFAST_Q100_PROG 990cbe0329c882420a2094da7e5adade) - set(MD5_PPM_420_Q100_IFAST 5a732542015c278ff43635e473a8a294) - set(MD5_PPM_420M_Q100_IFAST ff692ee9323a3b424894862557c092f1) - set(MD5_JPEG_GRAY_ISLOW 72b51f894b8f4a10b3ee3066770aa38d) - set(MD5_PPM_GRAY_ISLOW 8d3596c56eace32f205deccc229aa5ed) - set(MD5_PPM_GRAY_ISLOW_RGB 116424ac07b79e5e801f00508eab48ec) - set(MD5_BMP_GRAY_ISLOW_565 12f78118e56a2f48b966f792fedf23cc) - set(MD5_BMP_GRAY_ISLOW_565D bdbbd616441a24354c98553df5dc82db) - set(MD5_JPEG_420S_IFAST_OPT 388708217ac46273ca33086b22827ed8) - if(WITH_SIMD) - set(MD5_JPEG_3x2_FLOAT_PROG 343e3f8caf8af5986ebaf0bdc13b5c71) - set(MD5_PPM_3x2_FLOAT 1a75f36e5904d6fc3a85a43da9ad89bb) ++if(WITH_12BIT) ++ set(TESTORIG testorig12.jpg) ++ set(MD5_JPEG_RGB_ISLOW 9620f424569594bb9242b48498ad801f) ++ set(MD5_PPM_RGB_ISLOW f3301d2219783b8b3d942b7239fa50c0) ++ set(MD5_JPEG_422_IFAST_OPT 7322e3bd2f127f7de4b40d4480ce60e4) ++ set(MD5_PPM_422_IFAST 79807fa552899e66a04708f533e16950) ++ set(MD5_PPM_422M_IFAST 07737bfe8a7c1c87aaa393a0098d16b0) ++ set(MD5_JPEG_420_IFAST_Q100_PROG a1da220b5604081863a504297ed59e55) ++ set(MD5_PPM_420_Q100_IFAST 1b3730122709f53d007255e8dfd3305e) ++ set(MD5_PPM_420M_Q100_IFAST 980a1a3c5bf9510022869d30b7d26566) ++ set(MD5_JPEG_GRAY_ISLOW 235c90707b16e2e069f37c888b2636d9) ++ set(MD5_PPM_GRAY_ISLOW 7213c10af507ad467da5578ca5ee1fca) ++ set(MD5_PPM_GRAY_ISLOW_RGB e96ee81c30a6ed422d466338bd3de65d) ++ set(MD5_JPEG_420S_IFAST_OPT 7af8e60be4d9c227ec63ac9b6630855e) ++ set(MD5_JPEG_3x2_FLOAT_PROG a8c17daf77b457725ec929e215b603f8) ++ set(MD5_PPM_3x2_FLOAT 42876ab9e5c2f76a87d08db5fbd57956) ++ set(MD5_PPM_420M_ISLOW_2_1 4ca6be2a6f326ff9eaab63e70a8259c0) ++ set(MD5_PPM_420M_ISLOW_15_8 12aa9f9534c1b3d7ba047322226365eb) ++ set(MD5_PPM_420M_ISLOW_13_8 f7e22817c7b25e1393e4ec101e9d4e96) ++ set(MD5_PPM_420M_ISLOW_11_8 800a16f9f4dc9b293197bfe11be10a82) ++ set(MD5_PPM_420M_ISLOW_9_8 06b7a92a9bc69f4dc36ec40f1937d55c) ++ set(MD5_PPM_420M_ISLOW_7_8 3ec444a14a4ab4eab88ffc49c48eca43) ++ set(MD5_PPM_420M_ISLOW_3_4 3e726b7ea872445b19437d1c1d4f0d93) ++ set(MD5_PPM_420M_ISLOW_5_8 a8a771abdc94301d20ffac119b2caccd) ++ set(MD5_PPM_420M_ISLOW_1_2 b419124dd5568b085787234866102866) ++ set(MD5_PPM_420M_ISLOW_3_8 343d19015531b7bbe746124127244fa8) ++ set(MD5_PPM_420M_ISLOW_1_4 35fd59d866e44659edfa3c18db2a3edb) ++ set(MD5_PPM_420M_ISLOW_1_8 ccaed48ac0aedefda5d4abe4013f4ad7) ++ set(MD5_JPEG_CROP cdb35ff4b4519392690ea040c56ea99c) +else() - set(MD5_JPEG_3x2_FLOAT_PROG 9bca803d2042bd1eb03819e2bf92b3e5) - set(MD5_PPM_3x2_FLOAT f6bfab038438ed8f5522fbd33595dcdc) - endif() - set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1) - set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617) - set(MD5_PPM_420M_IFAST_ARI 72b59a99bcf1de24c5b27d151bde2437) - set(MD5_JPEG_420_ISLOW 9a68f56bc76e466aa7e52f415d0f4a5f) - set(MD5_PPM_420M_ISLOW_2_1 9f9de8c0612f8d06869b960b05abf9c9) - set(MD5_PPM_420M_ISLOW_15_8 b6875bc070720b899566cc06459b63b7) - set(MD5_PPM_420M_ISLOW_13_8 bc3452573c8152f6ae552939ee19f82f) - set(MD5_PPM_420M_ISLOW_11_8 d8cc73c0aaacd4556569b59437ba00a5) - set(MD5_PPM_420M_ISLOW_9_8 d25e61bc7eac0002f5b393aa223747b6) - set(MD5_PPM_420M_ISLOW_7_8 ddb564b7c74a09494016d6cd7502a946) - set(MD5_PPM_420M_ISLOW_3_4 8ed8e68808c3fbc4ea764fc9d2968646) - set(MD5_PPM_420M_ISLOW_5_8 a3363274999da2366a024efae6d16c9b) - set(MD5_PPM_420M_ISLOW_1_2 e692a315cea26b988c8e8b29a5dbcd81) - set(MD5_PPM_420M_ISLOW_3_8 79eca9175652ced755155c90e785a996) - set(MD5_PPM_420M_ISLOW_1_4 79cd778f8bf1a117690052cacdd54eca) - set(MD5_PPM_420M_ISLOW_1_8 391b3d4aca640c8567d6f8745eb2142f) - set(MD5_BMP_420_ISLOW_256 4980185e3776e89bd931736e1cddeee6) - set(MD5_BMP_420_ISLOW_565 bf9d13e16c4923b92e1faa604d7922cb) - set(MD5_BMP_420_ISLOW_565D 6bde71526acc44bcff76f696df8638d2) - set(MD5_BMP_420M_ISLOW_565 8dc0185245353cfa32ad97027342216f) - set(MD5_BMP_420M_ISLOW_565D d1be3a3339166255e76fa50a0d70d73e) - set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d) ++ set(TESTORIG testorig.jpg) ++ set(MD5_JPEG_RGB_ISLOW 768e970dd57b340ff1b83c9d3d47c77b) ++ set(MD5_PPM_RGB_ISLOW 00a257f5393fef8821f2b88ac7421291) ++ set(MD5_BMP_RGB_ISLOW_565 f07d2e75073e4bb10f6c6f4d36e2e3be) ++ set(MD5_BMP_RGB_ISLOW_565D 4cfa0928ef3e6bb626d7728c924cfda4) ++ set(MD5_JPEG_422_IFAST_OPT 2540287b79d913f91665e660303ab2c8) ++ set(MD5_PPM_422_IFAST 35bd6b3f833bad23de82acea847129fa) ++ set(MD5_PPM_422M_IFAST 8dbc65323d62cca7c91ba02dd1cfa81d) ++ set(MD5_BMP_422M_IFAST_565 3294bd4d9a1f2b3d08ea6020d0db7065) ++ set(MD5_BMP_422M_IFAST_565D da98c9c7b6039511be4a79a878a9abc1) ++ set(MD5_JPEG_420_IFAST_Q100_PROG 990cbe0329c882420a2094da7e5adade) ++ set(MD5_PPM_420_Q100_IFAST 5a732542015c278ff43635e473a8a294) ++ set(MD5_PPM_420M_Q100_IFAST ff692ee9323a3b424894862557c092f1) ++ set(MD5_JPEG_GRAY_ISLOW 72b51f894b8f4a10b3ee3066770aa38d) ++ set(MD5_PPM_GRAY_ISLOW 8d3596c56eace32f205deccc229aa5ed) ++ set(MD5_PPM_GRAY_ISLOW_RGB 116424ac07b79e5e801f00508eab48ec) ++ set(MD5_BMP_GRAY_ISLOW_565 12f78118e56a2f48b966f792fedf23cc) ++ set(MD5_BMP_GRAY_ISLOW_565D bdbbd616441a24354c98553df5dc82db) ++ set(MD5_JPEG_420S_IFAST_OPT 388708217ac46273ca33086b22827ed8) ++ if(WITH_SIMD) ++ set(MD5_JPEG_3x2_FLOAT_PROG 343e3f8caf8af5986ebaf0bdc13b5c71) ++ set(MD5_PPM_3x2_FLOAT 1a75f36e5904d6fc3a85a43da9ad89bb) ++ else() ++ set(MD5_JPEG_3x2_FLOAT_PROG 9bca803d2042bd1eb03819e2bf92b3e5) ++ set(MD5_PPM_3x2_FLOAT f6bfab038438ed8f5522fbd33595dcdc) ++ endif() ++ set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1) ++ set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617) ++ set(MD5_PPM_420M_IFAST_ARI 72b59a99bcf1de24c5b27d151bde2437) ++ set(MD5_JPEG_420_ISLOW 9a68f56bc76e466aa7e52f415d0f4a5f) ++ set(MD5_PPM_420M_ISLOW_2_1 9f9de8c0612f8d06869b960b05abf9c9) ++ set(MD5_PPM_420M_ISLOW_15_8 b6875bc070720b899566cc06459b63b7) ++ set(MD5_PPM_420M_ISLOW_13_8 bc3452573c8152f6ae552939ee19f82f) ++ set(MD5_PPM_420M_ISLOW_11_8 d8cc73c0aaacd4556569b59437ba00a5) ++ set(MD5_PPM_420M_ISLOW_9_8 d25e61bc7eac0002f5b393aa223747b6) ++ set(MD5_PPM_420M_ISLOW_7_8 ddb564b7c74a09494016d6cd7502a946) ++ set(MD5_PPM_420M_ISLOW_3_4 8ed8e68808c3fbc4ea764fc9d2968646) ++ set(MD5_PPM_420M_ISLOW_5_8 a3363274999da2366a024efae6d16c9b) ++ set(MD5_PPM_420M_ISLOW_1_2 e692a315cea26b988c8e8b29a5dbcd81) ++ set(MD5_PPM_420M_ISLOW_3_8 79eca9175652ced755155c90e785a996) ++ set(MD5_PPM_420M_ISLOW_1_4 79cd778f8bf1a117690052cacdd54eca) ++ set(MD5_PPM_420M_ISLOW_1_8 391b3d4aca640c8567d6f8745eb2142f) ++ set(MD5_BMP_420_ISLOW_256 4980185e3776e89bd931736e1cddeee6) ++ set(MD5_BMP_420_ISLOW_565 bf9d13e16c4923b92e1faa604d7922cb) ++ set(MD5_BMP_420_ISLOW_565D 6bde71526acc44bcff76f696df8638d2) ++ set(MD5_BMP_420M_ISLOW_565 8dc0185245353cfa32ad97027342216f) ++ set(MD5_BMP_420M_ISLOW_565D d1be3a3339166255e76fa50a0d70d73e) ++ set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d) ++endif() + +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-yuv-nopad + ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -yuv -noyuvpad) + 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) + add_test(TJUnitTest-bi-yuv-nopad + ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -bi -yuv -noyuvpad) +endif() + +foreach(libtype shared static) + if(libtype STREQUAL "shared") + set(dir sharedlib/) + else() + set(dir "") + set(suffix -static) + endif() - add_test(tjunittest${suffix} tjunittest${suffix}) - add_test(tjunittest${suffix}-alloc tjunittest${suffix} -alloc) - add_test(tjunittest${suffix}-yuv tjunittest${suffix} -yuv) - add_test(tjunittest${suffix}-yuv-alloc tjunittest${suffix} -yuv -alloc) - add_test(tjunittest${suffix}-yuv-nopad tjunittest${suffix} -yuv -noyuvpad) ++ if(WITH_TURBOJPEG) ++ add_test(tjunittest${suffix} tjunittest${suffix}) ++ add_test(tjunittest${suffix}-alloc tjunittest${suffix} -alloc) ++ add_test(tjunittest${suffix}-yuv tjunittest${suffix} -yuv) ++ add_test(tjunittest${suffix}-yuv-alloc tjunittest${suffix} -yuv -alloc) ++ add_test(tjunittest${suffix}-yuv-nopad tjunittest${suffix} -yuv -noyuvpad) ++ endif() + + # These tests are carefully chosen to provide full coverage of as many of the + # underlying algorithms as possible (including all of the SIMD-accelerated + # ones.) + + # CC: null SAMP: fullsize FDCT: islow ENT: huff + add_test(cjpeg${suffix}-rgb-islow + ${dir}cjpeg${suffix} -rgb -dct int -outfile testout_rgb_islow.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-rgb-islow-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_RGB_ISLOW} -DFILE=testout_rgb_islow.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: null SAMP: fullsize IDCT: islow ENT: huff + add_test(djpeg${suffix}-rgb-islow + ${dir}djpeg${suffix} -dct int -ppm -outfile testout_rgb_islow.ppm + testout_rgb_islow.jpg) + add_test(djpeg${suffix}-rgb-islow-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_RGB_ISLOW} -DFILE=testout_rgb_islow.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff - add_test(djpeg${suffix}-rgb-islow-565 - ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp - -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg) - add_test(djpeg${suffix}-rgb-islow-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565} - -DFILE=testout_rgb_islow_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff - add_test(djpeg${suffix}-rgb-islow-565D - ${dir}djpeg${suffix} -dct int -rgb565 -bmp - -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg) - add_test(djpeg${suffix}-rgb-islow-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565D} - -DFILE=testout_rgb_islow_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ if(NOT WITH_12BIT) ++ # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff ++ add_test(djpeg${suffix}-rgb-islow-565 ++ ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp ++ -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg) ++ add_test(djpeg${suffix}-rgb-islow-565-cmp ++ ${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565} ++ -DFILE=testout_rgb_islow_565.bmp ++ -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ # CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff ++ add_test(djpeg${suffix}-rgb-islow-565D ++ ${dir}djpeg${suffix} -dct int -rgb565 -bmp ++ -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg) ++ add_test(djpeg${suffix}-rgb-islow-565D-cmp ++ ${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565D} ++ -DFILE=testout_rgb_islow_565D.bmp ++ -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ endif() + + # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff + add_test(cjpeg${suffix}-422-ifast-opt + ${dir}cjpeg${suffix} -sample 2x1 -dct fast -opt + -outfile testout_422_ifast_opt.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-422-ifast-opt-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_422_IFAST_OPT} + -DFILE=testout_422_ifast_opt.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff + add_test(djpeg${suffix}-422-ifast + ${dir}djpeg${suffix} -dct fast -outfile testout_422_ifast.ppm + testout_422_ifast_opt.jpg) + add_test(djpeg${suffix}-422-ifast-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_422_IFAST} -DFILE=testout_422_ifast.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff + add_test(djpeg${suffix}-422m-ifast + ${dir}djpeg${suffix} -dct fast -nosmooth -outfile testout_422m_ifast.ppm + testout_422_ifast_opt.jpg) + add_test(djpeg${suffix}-422m-ifast-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_422M_IFAST} -DFILE=testout_422m_ifast.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff - add_test(djpeg${suffix}-422m-ifast-565 - ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp - -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg) - add_test(djpeg${suffix}-422m-ifast-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565} - -DFILE=testout_422m_ifast_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff - add_test(djpeg${suffix}-422m-ifast-565D - ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp - -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg) - add_test(djpeg${suffix}-422m-ifast-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565D} - -DFILE=testout_422m_ifast_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ if(NOT WITH_12BIT) ++ # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff ++ add_test(djpeg${suffix}-422m-ifast-565 ++ ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp ++ -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg) ++ add_test(djpeg${suffix}-422m-ifast-565-cmp ++ ${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565} ++ -DFILE=testout_422m_ifast_565.bmp ++ -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ # CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff ++ add_test(djpeg${suffix}-422m-ifast-565D ++ ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp ++ -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg) ++ add_test(djpeg${suffix}-422m-ifast-565D-cmp ++ ${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565D} ++ -DFILE=testout_422m_ifast_565D.bmp ++ -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ endif() + + # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff + add_test(cjpeg${suffix}-420-q100-ifast-prog + ${dir}cjpeg${suffix} -sample 2x2 -quality 100 -dct fast -prog + -outfile testout_420_q100_ifast_prog.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-420-q100-ifast-prog-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_IFAST_Q100_PROG} + -DFILE=testout_420_q100_ifast_prog.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff + add_test(djpeg${suffix}-420-q100-ifast-prog + ${dir}djpeg${suffix} -dct fast -outfile testout_420_q100_ifast.ppm + testout_420_q100_ifast_prog.jpg) + add_test(djpeg${suffix}-420-q100-ifast-prog-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420_Q100_IFAST} + -DFILE=testout_420_q100_ifast.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff + add_test(djpeg${suffix}-420m-q100-ifast-prog + ${dir}djpeg${suffix} -dct fast -nosmooth + -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg) + add_test(djpeg${suffix}-420m-q100-ifast-prog-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_Q100_IFAST} + -DFILE=testout_420m_q100_ifast.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + + # CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff + add_test(cjpeg${suffix}-gray-islow + ${dir}cjpeg${suffix} -gray -dct int -outfile testout_gray_islow.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-gray-islow-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_GRAY_ISLOW} + -DFILE=testout_gray_islow.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff + add_test(djpeg${suffix}-gray-islow + ${dir}djpeg${suffix} -dct int -outfile testout_gray_islow.ppm + testout_gray_islow.jpg) + add_test(djpeg${suffix}-gray-islow-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_ISLOW} + -DFILE=testout_gray_islow.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff + add_test(djpeg${suffix}-gray-islow-rgb + ${dir}djpeg${suffix} -dct int -rgb -outfile testout_gray_islow_rgb.ppm + testout_gray_islow.jpg) + add_test(cjpeg${suffix}-gray-islow-rgb-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_ISLOW_RGB} + -DFILE=testout_gray_islow_rgb.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff - add_test(djpeg${suffix}-gray-islow-565 - ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp - -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg) - add_test(djpeg${suffix}-gray-islow-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565} - -DFILE=testout_gray_islow_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff - add_test(djpeg${suffix}-gray-islow-565D - ${dir}djpeg${suffix} -dct int -rgb565 -bmp - -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg) - add_test(djpeg${suffix}-gray-islow-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565D} - -DFILE=testout_gray_islow_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ if(NOT WITH_12BIT) ++ # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff ++ add_test(djpeg${suffix}-gray-islow-565 ++ ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp ++ -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg) ++ add_test(djpeg${suffix}-gray-islow-565-cmp ++ ${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565} ++ -DFILE=testout_gray_islow_565.bmp ++ -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ # CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff ++ add_test(djpeg${suffix}-gray-islow-565D ++ ${dir}djpeg${suffix} -dct int -rgb565 -bmp ++ -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg) ++ add_test(djpeg${suffix}-gray-islow-565D-cmp ++ ${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565D} ++ -DFILE=testout_gray_islow_565D.bmp ++ -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ endif() + + # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow + # ENT: 2-pass huff + add_test(cjpeg${suffix}-420s-ifast-opt + ${dir}cjpeg${suffix} -sample 2x2 -smooth 1 -dct int -opt -outfile + testout_420s_ifast_opt.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-420s-ifast-opt-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420S_IFAST_OPT} + -DFILE=testout_420s_ifast_opt.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + + # CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff + add_test(cjpeg${suffix}-3x2-float-prog + ${dir}cjpeg${suffix} -sample 3x2 -dct float -prog + -outfile testout_3x2_float_prog.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-3x2-float-prog-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_3x2_FLOAT_PROG} + -DFILE=testout_3x2_float_prog.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff + add_test(djpeg${suffix}-3x2-float-prog + ${dir}djpeg${suffix} -dct float -outfile testout_3x2_float.ppm + testout_3x2_float_prog.jpg) + add_test(djpeg${suffix}-3x2-float-prog-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_3x2_FLOAT} -DFILE=testout_3x2_float.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + + if(WITH_ARITH_ENC) + # CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith + add_test(cjpeg${suffix}-420-islow-ari + ${dir}cjpeg${suffix} -dct int -arithmetic + -outfile testout_420_islow_ari.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-420-islow-ari-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW_ARI} + -DFILE=testout_420_islow_ari.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + add_test(jpegtran${suffix}-420-islow-ari + ${dir}jpegtran${suffix} -arithmetic + -outfile testout_420_islow_ari.jpg + ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg) + add_test(jpegtran${suffix}-420-islow-ari-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW_ARI} + -DFILE=testout_420_islow_ari.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith + add_test(cjpeg${suffix}-444-islow-progari + ${dir}cjpeg${suffix} -sample 1x1 -dct int -progressive -arithmetic + -outfile testout_444_islow_progari.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-444-islow-progari-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_444_ISLOW_PROGARI} + -DFILE=testout_444_islow_progari.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + endif() + if(WITH_ARITH_DEC) + # CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith + add_test(cjpeg${suffix}-420m-ifast-ari + ${dir}djpeg${suffix} -fast -ppm -outfile testout_420m_ifast_ari.ppm + ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) + add_test(cjpeg${suffix}-420m-ifast-ari-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_IFAST_ARI} + -DFILE=testout_420m_ifast_ari.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + add_test(jpegtran${suffix}-420-islow + ${dir}jpegtran${suffix} -outfile testout_420_islow.jpg + ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) + add_test(jpegtran${suffix}-420-islow-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW} + -DFILE=testout_420_islow.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + endif() + + # 2/1-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff + # 15/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff + # 13/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff + # 11/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff + # 9/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff + # 7/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow + # ENT: huff + # 3/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow + # ENT: huff + # 5/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow + # ENT: huff + # 1/2-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow + # ENT: huff + # 3/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow + # ENT: huff + # 1/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow + # ENT: huff + # 1/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow + # ENT: huff + foreach(scale 2_1 15_8 13_8 11_8 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8) + string(REGEX REPLACE "_" "/" scalearg ${scale}) + add_test(djpeg${suffix}-420m-islow-${scale} + ${dir}djpeg${suffix} -dct int -scale ${scalearg} -nosmooth -ppm + -outfile testout_420m_islow_${scale}.ppm - ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) ++ ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + add_test(djpeg${suffix}-420m-islow-${scale}-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_ISLOW_${scale}} + -DFILE=testout_420m_islow_${scale}.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + endforeach() + - # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff - add_test(djpeg${suffix}-420-islow-256 - ${dir}djpeg${suffix} -dct int -colors 256 -bmp - -outfile testout_420_islow_256.bmp - ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) - add_test(djpeg${suffix}-420-islow-256-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_256} - -DFILE=testout_420_islow_256.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff - add_test(djpeg${suffix}-420-islow-565 - ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp - -outfile testout_420_islow_565.bmp - ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) - add_test(djpeg${suffix}-420-islow-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565} - -DFILE=testout_420_islow_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff - add_test(djpeg${suffix}-420-islow-565D - ${dir}djpeg${suffix} -dct int -rgb565 -bmp - -outfile testout_420_islow_565D.bmp - ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) - add_test(djpeg${suffix}-420-islow-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565D} - -DFILE=testout_420_islow_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff - add_test(djpeg${suffix}-420m-islow-565 - ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp - -outfile testout_420m_islow_565.bmp - ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) - add_test(djpeg${suffix}-420m-islow-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565} - -DFILE=testout_420m_islow_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff - add_test(djpeg${suffix}-420m-islow-565D - ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp - -outfile testout_420m_islow_565D.bmp - ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) - add_test(djpeg${suffix}-420m-islow-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565D} - -DFILE=testout_420m_islow_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - ++ if(NOT WITH_12BIT) ++ # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff ++ add_test(djpeg${suffix}-420-islow-256 ++ ${dir}djpeg${suffix} -dct int -colors 256 -bmp ++ -outfile testout_420_islow_256.bmp ++ ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) ++ add_test(djpeg${suffix}-420-islow-256-cmp ++ ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_256} ++ -DFILE=testout_420_islow_256.bmp ++ -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff ++ add_test(djpeg${suffix}-420-islow-565 ++ ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp ++ -outfile testout_420_islow_565.bmp ++ ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) ++ add_test(djpeg${suffix}-420-islow-565-cmp ++ ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565} ++ -DFILE=testout_420_islow_565.bmp ++ -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff ++ add_test(djpeg${suffix}-420-islow-565D ++ ${dir}djpeg${suffix} -dct int -rgb565 -bmp ++ -outfile testout_420_islow_565D.bmp ++ ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) ++ add_test(djpeg${suffix}-420-islow-565D-cmp ++ ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565D} ++ -DFILE=testout_420_islow_565D.bmp ++ -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff ++ add_test(djpeg${suffix}-420m-islow-565 ++ ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp ++ -outfile testout_420m_islow_565.bmp ++ ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) ++ add_test(djpeg${suffix}-420m-islow-565-cmp ++ ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565} ++ -DFILE=testout_420m_islow_565.bmp ++ -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff ++ add_test(djpeg${suffix}-420m-islow-565D ++ ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp ++ -outfile testout_420m_islow_565D.bmp ++ ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) ++ add_test(djpeg${suffix}-420m-islow-565D-cmp ++ ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565D} ++ -DFILE=testout_420m_islow_565D.bmp ++ -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) ++ endif() + add_test(jpegtran${suffix}-crop + ${dir}jpegtran${suffix} -crop 120x90+20+50 -transpose -perfect - -outfile testout_crop.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) ++ -outfile testout_crop.jpg ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + add_test(jpegtran${suffix}-crop-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_CROP} -DFILE=testout_crop.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + +endforeach() + +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_REG_NAME ${CMAKE_PROJECT_NAME}) +elseif(MINGW) + set(INST_PLATFORM GCC) + set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc) + set(INST_REG_NAME ${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_REG_NAME ${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() + +STRING(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX}) + +configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY) + +if(WITH_JAVA) + set(JAVA_DEPEND java) +endif() +add_custom_target(installer + makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi + DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom + cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND} + SOURCES libjpeg-turbo.nsi) + - install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom tjbench ++if(WITH_TURBOJPEG) ++ set(TURBOJPEG_TARGETS turbojpeg turbojpeg-static tjbench) ++endif() ++install(TARGETS jpeg-static rdjpgcom wrjpgcom ${TURBOJPEG_TARGETS} + 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 ChangeLog.txt index b690133,0000000..a463254 mode 100644,000000..100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@@ -1,540 -1,0 +1,547 @@@ +1.4 pre-beta +============ + +[1] New features in the TurboJPEG API: +-- YUV planar images can now be generated with an arbitrary line padding +(previously only 4-byte padding, which was compatible with X Video, was +supported.) +-- The decompress-to-YUV function has been extended to support image scaling. +-- JPEG images can now be compressed from YUV planar source images. +-- YUV planar images can now be decoded into RGB or grayscale images. +-- 4:1:1 subsampling is now supported. This is mainly included for +compatibility, since 4:1:1 is not fully accelerated in libjpeg-turbo and has no +significant advantages relative to 4:2:0. +-- CMYK images are now supported. This feature allows CMYK source images to be +compressed to YCCK JPEGs and YCCK or CMYK JPEGs to be decompressed to CMYK +destination images. Conversion between CMYK and RGB or YUV images is not +supported. Such conversion requires a color management system and is out of +scope for a codec library. +-- The handling of YUV images in the Java API has been significantly refactored +and should now be much more intuitive. +-- The Java API now supports encoding a YUV image from an arbitrary position in +a large image buffer. + +[2] Added SIMD acceleration for DSPr2-capable MIPS platforms. This speeds up +the compression of full-color JPEGs by 70-80% on such platforms and +decompression by 25-35%. + +[3] If an application attempts to decompress a Huffman-coded JPEG image whose +header does not contain Huffman tables, libjpeg-turbo will now insert the +default Huffman tables. In order to save space, many motion JPEG video frames +are encoded without the default Huffman tables, so these frames can now be +successfully decompressed by libjpeg-turbo without additional work on the part +of the application. An application can still override the Huffman tables, for +instance to re-use tables from a previous frame of the same video. + +[4] The Mac packaging system now uses pkgbuild and productbuild rather than +PackageMaker (which is obsolete and no longer supported.) This means that +OS X 10.6 "Snow Leopard" or later must be used when packaging libjpeg-turbo, +although the packages produced can be installed on OS X 10.5 "Leopard" or +later. OS X 10.4 "Tiger" is no longer supported. + +[5] The Huffman encoder now uses clz and bsr instructions for bit counting on +ARM platforms rather than a lookup table. This reduces the memory footprint +by 64k, which may be important for some mobile applications. Out of four +Android devices that were tested, two demonstrated a small overall performance +loss (~3-4% on average) with ARMv6 code and a small gain (also ~3-4%) with +ARMv7 code when enabling this new feature, but the other two devices +demonstrated a significant overall performance gain with both ARMv6 and ARMv7 +code (~10-20%.) Actual mileage may vary. + +[6] Worked around an issue with Visual C++ 2010 and later that caused incorrect +pixels to be generated when decompressing a JPEG image to a 256-color bitmap, +if compiler optimization was enabled when libjpeg-turbo was built. This caused +the regression tests to fail when doing a release build under Visual C++ 2010 +and later. + +[7] Improved the accuracy and performance of the non-SIMD implementation of the +floating point inverse DCT (using code borrowed from libjpeg v8a and later.) +The accuracy of this implementation now matches the accuracy of the SSE/SSE2 +implementation. Note, however, that the floating point DCT/IDCT algorithms are +mainly a legacy feature. They generally do not produce significantly better +accuracy than the slow integer DCT/IDCT algorithms, and they are quite a bit +slower. + +[8] Added a new output colorspace (JCS_RGB565) to the libjpeg API that allows +for decompressing JPEG images into RGB565 (16-bit) pixels. + +[9] Numerous obsolete features, such as support for compilers that can't +handle prototypes and support for the MS-DOS memory model, were removed from +the libjpeg code, greatly improving its readability and making it easier to +maintain and extend. + +[10] Fixed a segfault that occurred when calling output_message() with msg_code +set to JMSG_COPYRIGHT. + +[11] Fixed an issue whereby wrjpgcom was allowing comments longer than 65k +characters to be passed on the command line, which was causing it to generate +incorrect JPEG files. + +[12] Fixed a bug in the build system that was causing the Windows version of +wrjpgcom to be built using the rdjpgcom code. + ++[13] Restored 12-bit-per-component JPEG support. A 12-bit version of ++libjpeg-turbo can now be built by passing an argument of --with-12bit to ++configure (Unix) or -DWITH_12BIT=1 to cmake (Windows.) 12-bit JPEG support is ++included only for convenience. Enabling this feature disables all of the ++performance features in libjpeg-turbo, as well as arithmetic coding and the ++TurboJPEG API. The resulting library behaves no differently than libjpeg v6b. ++ + +1.3.1 +===== + +[1] On Un*x systems, 'make install' now installs the libjpeg-turbo libraries +into /opt/libjpeg-turbo/lib32 by default on any 32-bit system, not just x86, +and into /opt/libjpeg-turbo/lib64 by default on any 64-bit system, not just +x86-64. You can override this by overriding either the 'prefix' or 'libdir' +configure variables. + +[2] The Windows installer now places a copy of the TurboJPEG DLLs in the same +directory as the rest of the libjpeg-turbo binaries. This was mainly done +to support TurboVNC 1.3, which bundles the DLLs in its Windows installation. +When using a 32-bit version of CMake on 64-bit Windows, it is impossible to +access the c:\WINDOWS\system32 directory, which made it impossible for the +TurboVNC build scripts to bundle the 64-bit TurboJPEG DLL. + +[3] Fixed a bug whereby attempting to encode a progressive JPEG with arithmetic +entropy coding (by passing arguments of -progressive -arithmetic to cjpeg or +jpegtran, for instance) would result in an error, "Requested feature was +omitted at compile time". + +[4] Fixed a couple of issues whereby malformed JPEG images would cause +libjpeg-turbo to use uninitialized memory during decompression. + +[5] Fixed an error ("Buffer passed to JPEG library is too small") that occurred +when calling the TurboJPEG YUV encoding function with a very small (< 5x5) +source image, and added a unit test to check for this error. + +[6] The Java classes should now build properly under Visual Studio 2010 and +later. + +[7] Fixed an issue that prevented SRPMs generated using the in-tree packaging +tools from being rebuilt on certain newer Linux distributions. + +[8] Numerous minor fixes to eliminate compilation and build/packaging system +warnings, fix cosmetic issues, improve documentation clarity, and other general +source cleanup. + + +1.3.0 +===== + +[1] 'make test' now works properly on FreeBSD, and it no longer requires the +md5sum executable to be present on other Un*x platforms. + +[2] Overhauled the packaging system: +-- To avoid conflict with vendor-supplied libjpeg-turbo packages, the +official RPMs and DEBs for libjpeg-turbo have been renamed to +"libjpeg-turbo-official". +-- The TurboJPEG libraries are now located under /opt/libjpeg-turbo in the +official Linux and Mac packages, to avoid conflict with vendor-supplied +packages and also to streamline the packaging system. +-- Release packages are now created with the directory structure defined +by the configure variables "prefix", "bindir", "libdir", etc. (Un*x) or by the +CMAKE_INSTALL_PREFIX variable (Windows.) The exception is that the docs are +always located under the system default documentation directory on Un*x and Mac +systems, and on Windows, the TurboJPEG DLL is always located in the Windows +system directory. +-- To avoid confusion, official libjpeg-turbo packages on Linux/Unix platforms +(except for Mac) will always install the 32-bit libraries in +/opt/libjpeg-turbo/lib32 and the 64-bit libraries in /opt/libjpeg-turbo/lib64. +-- Fixed an issue whereby, in some cases, the libjpeg-turbo executables on Un*x +systems were not properly linking with the shared libraries installed by the +same package. +-- Fixed an issue whereby building the "installer" target on Windows when +WITH_JAVA=1 would fail if the TurboJPEG JAR had not been previously built. +-- Building the "install" target on Windows now installs files into the same +places that the installer does. + +[3] Fixed a Huffman encoder bug that prevented I/O suspension from working +properly. + + +1.2.90 (1.3 beta1) +================== + +[1] Added support for additional scaling factors (3/8, 5/8, 3/4, 7/8, 9/8, 5/4, +11/8, 3/2, 13/8, 7/4, 15/8, and 2) when decompressing. Note that the IDCT will +not be SIMD-accelerated when using any of these new scaling factors. + +[2] The TurboJPEG dynamic library is now versioned. It was not strictly +necessary to do so, because TurboJPEG uses versioned symbols, and if a function +changes in an ABI-incompatible way, that function is renamed and a legacy +function is provided to maintain backward compatibility. However, certain +Linux distro maintainers have a policy against accepting any library that isn't +versioned. + +[3] Extended the TurboJPEG Java API so that it can be used to compress a JPEG +image from and decompress a JPEG image to an arbitrary position in a large +image buffer. + +[4] The tjDecompressToYUV() function now supports the TJFLAG_FASTDCT flag. + +[5] The 32-bit supplementary package for amd64 Debian systems now provides +symlinks in /usr/lib/i386-linux-gnu for the TurboJPEG libraries in /usr/lib32. +This allows those libraries to be used on MultiArch-compatible systems (such as +Ubuntu 11 and later) without setting the linker path. + +[6] The TurboJPEG Java wrapper should now find the JNI library on Mac systems +without having to pass -Djava.library.path=/usr/lib to java. + +[7] TJBench has been ported to Java to provide a convenient way of validating +the performance of the TurboJPEG Java API. It can be run with +'java -cp turbojpeg.jar TJBench'. + +[8] cjpeg can now be used to generate JPEG files with the RGB colorspace +(feature ported from jpeg-8d.) + +[9] The width and height in the -crop argument passed to jpegtran can now be +suffixed with "f" to indicate that, when the upper left corner of the cropping +region is automatically moved to the nearest iMCU boundary, the bottom right +corner should be moved by the same amount. In other words, this feature causes +jpegtran to strictly honor the specified width/height rather than the specified +bottom right corner (feature ported from jpeg-8d.) + +[10] JPEG files using the RGB colorspace can now be decompressed into grayscale +images (feature ported from jpeg-8d.) + +[11] Fixed a regression caused by 1.2.1[7] whereby the build would fail with +multiple "Mismatch in operand sizes" errors when attempting to build the x86 +SIMD code with NASM 0.98. + +[12] The in-memory source/destination managers (jpeg_mem_src() and +jpeg_mem_dest()) are now included by default when building libjpeg-turbo with +libjpeg v6b or v7 emulation, so that programs can take advantage of these +functions without requiring the use of the backward-incompatible libjpeg v8 +ABI. The "age number" of the libjpeg-turbo library on Un*x systems has been +incremented by 1 to reflect this. You can disable this feature with a +configure/CMake switch in order to retain strict API/ABI compatibility with the +libjpeg v6b or v7 API/ABI (or with previous versions of libjpeg-turbo.) See +README-turbo.txt for more details. + +[13] Added ARM v7s architecture to libjpeg.a and libturbojpeg.a in the official +libjpeg-turbo binary package for OS X, so that those libraries can be used to +build applications that leverage the faster CPUs in the iPhone 5 and iPad 4. + + +1.2.1 +===== + +[1] Creating or decoding a JPEG file that uses the RGB colorspace should now +properly work when the input or output colorspace is one of the libjpeg-turbo +colorspace extensions. + +[2] When libjpeg-turbo was built without SIMD support and merged (non-fancy) +upsampling was used along with an alpha-enabled colorspace during +decompression, the unused byte of the decompressed pixels was not being set to +0xFF. This has been fixed. TJUnitTest has also been extended to test for the +correct behavior of the colorspace extensions when merged upsampling is used. + +[3] Fixed a bug whereby the libjpeg-turbo SSE2 SIMD code would not preserve the +upper 64 bits of xmm6 and xmm7 on Win64 platforms, which violated the Win64 +calling conventions. + +[4] Fixed a regression caused by 1.2.0[6] whereby decompressing corrupt JPEG +images (specifically, images in which the component count was erroneously set +to a large value) would cause libjpeg-turbo to segfault. + +[5] Worked around a severe performance issue with "Bobcat" (AMD Embedded APU) +processors. The MASKMOVDQU instruction, which was used by the libjpeg-turbo +SSE2 SIMD code, is apparently implemented in microcode on AMD processors, and +it is painfully slow on Bobcat processors in particular. Eliminating the use +of this instruction improved performance by an order of magnitude on Bobcat +processors and by a small amount (typically 5%) on AMD desktop processors. + +[6] Added SIMD acceleration for performing 4:2:2 upsampling on NEON-capable ARM +platforms. This speeds up the decompression of 4:2:2 JPEGs by 20-25% on such +platforms. + +[7] Fixed a regression caused by 1.2.0[2] whereby, on Linux/x86 platforms +running the 32-bit SSE2 SIMD code in libjpeg-turbo, decompressing a 4:2:0 or +4:2:2 JPEG image into a 32-bit (RGBX, BGRX, etc.) buffer without using fancy +upsampling would produce several incorrect columns of pixels at the right-hand +side of the output image if each row in the output image was not evenly +divisible by 16 bytes. + +[8] Fixed an issue whereby attempting to build the SIMD extensions with Xcode +4.3 on OS X platforms would cause NASM to return numerous errors of the form +"'%define' expects a macro identifier". + +[9] Added flags to the TurboJPEG API that allow the caller to force the use of +either the fast or the accurate DCT/IDCT algorithms in the underlying codec. + + +1.2.0 +===== + +[1] Fixed build issue with YASM on Unix systems (the libjpeg-turbo build system +was not adding the current directory to the assembler include path, so YASM +was not able to find jsimdcfg.inc.) + +[2] Fixed out-of-bounds read in SSE2 SIMD code that occurred when decompressing +a JPEG image to a bitmap buffer whose size was not a multiple of 16 bytes. +This was more of an annoyance than an actual bug, since it did not cause any +actual run-time problems, but the issue showed up when running libjpeg-turbo in +valgrind. See http://crbug.com/72399 for more information. + +[3] Added a compile-time macro (LIBJPEG_TURBO_VERSION) that can be used to +check the version of libjpeg-turbo against which an application was compiled. + +[4] Added new RGBA/BGRA/ABGR/ARGB colorspace extension constants (libjpeg API) +and pixel formats (TurboJPEG API), which allow applications to specify that, +when decompressing to a 4-component RGB buffer, the unused byte should be set +to 0xFF so that it can be interpreted as an opaque alpha channel. + +[5] Fixed regression issue whereby DevIL failed to build against libjpeg-turbo +because libjpeg-turbo's distributed version of jconfig.h contained an INLINE +macro, which conflicted with a similar macro in DevIL. This macro is used only +internally when building libjpeg-turbo, so it was moved into config.h. + +[6] libjpeg-turbo will now correctly decompress erroneous CMYK/YCCK JPEGs whose +K component is assigned a component ID of 1 instead of 4. Although these files +are in violation of the spec, other JPEG implementations handle them +correctly. + +[7] Added ARM v6 and ARM v7 architectures to libjpeg.a and libturbojpeg.a in +the official libjpeg-turbo binary package for OS X, so that those libraries can +be used to build both OS X and iOS applications. + + +1.1.90 (1.2 beta1) +================== + +[1] Added a Java wrapper for the TurboJPEG API. See java/README for more +details. + +[2] The TurboJPEG API can now be used to scale down images during +decompression. + +[3] Added SIMD routines for RGB-to-grayscale color conversion, which +significantly improves the performance of grayscale JPEG compression from an +RGB source image. + +[4] Improved the performance of the C color conversion routines, which are used +on platforms for which SIMD acceleration is not available. + +[5] Added a function to the TurboJPEG API that performs lossless transforms. +This function is implemented using the same back end as jpegtran, but it +performs transcoding entirely in memory and allows multiple transforms and/or +crop operations to be batched together, so the source coefficients only need to +be read once. This is useful when generating image tiles from a single source +JPEG. + +[6] Added tests for the new TurboJPEG scaled decompression and lossless +transform features to tjbench (the TurboJPEG benchmark, formerly called +"jpgtest".) + +[7] Added support for 4:4:0 (transposed 4:2:2) subsampling in TurboJPEG, which +was necessary in order for it to read 4:2:2 JPEG files that had been losslessly +transposed or rotated 90 degrees. + +[8] All legacy VirtualGL code has been re-factored, and this has allowed +libjpeg-turbo, in its entirety, to be re-licensed under a BSD-style license. + +[9] libjpeg-turbo can now be built with YASM. + +[10] Added SIMD acceleration for ARM Linux and iOS platforms that support +NEON instructions. + +[11] Refactored the TurboJPEG C API and documented it using Doxygen. The +TurboJPEG 1.2 API uses pixel formats to define the size and component order of +the uncompressed source/destination images, and it includes a more efficient +version of TJBUFSIZE() that computes a worst-case JPEG size based on the level +of chrominance subsampling. The refactored implementation of the TurboJPEG API +now uses the libjpeg memory source and destination managers, which allows the +TurboJPEG compressor to grow the JPEG buffer as necessary. + +[12] Eliminated errors in the output of jpegtran on Windows that occurred when +the application was invoked using I/O redirection +(jpegtran output.jpg). + +[13] The inclusion of libjpeg v7 and v8 emulation as well as arithmetic coding +support in libjpeg-turbo v1.1.0 introduced several new error constants in +jerror.h, and these were mistakenly enabled for all emulation modes, causing +the error enum in libjpeg-turbo to sometimes have different values than the +same enum in libjpeg. This represents an ABI incompatibility, and it caused +problems with rare applications that took specific action based on a particular +error value. The fix was to include the new error constants conditionally +based on whether libjpeg v7 or v8 emulation was enabled. + +[14] Fixed an issue whereby Windows applications that used libjpeg-turbo would +fail to compile if the Windows system headers were included before jpeglib.h. +This issue was caused by a conflict in the definition of the INT32 type. + +[15] Fixed 32-bit supplementary package for amd64 Debian systems, which was +broken by enhancements to the packaging system in 1.1. + +[16] When decompressing a JPEG image using an output colorspace of +JCS_EXT_RGBX, JCS_EXT_BGRX, JCS_EXT_XBGR, or JCS_EXT_XRGB, libjpeg-turbo will +now set the unused byte to 0xFF, which allows applications to interpret that +byte as an alpha channel (0xFF = opaque). + + +1.1.1 +===== + +[1] Fixed a 1-pixel error in row 0, column 21 of the luminance plane generated +by tjEncodeYUV(). + +[2] libjpeg-turbo's accelerated Huffman decoder previously ignored unexpected +markers found in the middle of the JPEG data stream during decompression. It +will now hand off decoding of a particular block to the unaccelerated Huffman +decoder if an unexpected marker is found, so that the unaccelerated Huffman +decoder can generate an appropriate warning. + +[3] Older versions of MinGW64 prefixed symbol names with underscores by +default, which differed from the behavior of 64-bit Visual C++. MinGW64 1.0 +has adopted the behavior of 64-bit Visual C++ as the default, so to accommodate +this, the libjpeg-turbo SIMD function names are no longer prefixed with an +underscore when building with MinGW64. This means that, when building +libjpeg-turbo with older versions of MinGW64, you will now have to add +-fno-leading-underscore to the CFLAGS. + +[4] Fixed a regression bug in the NSIS script that caused the Windows installer +build to fail when using the Visual Studio IDE. + +[5] Fixed a bug in jpeg_read_coefficients() whereby it would not initialize +cinfo->image_width and cinfo->image_height if libjpeg v7 or v8 emulation was +enabled. This specifically caused the jpegoptim program to fail if it was +linked against a version of libjpeg-turbo that was built with libjpeg v7 or v8 +emulation. + +[6] Eliminated excessive I/O overhead that occurred when reading BMP files in +cjpeg. + +[7] Eliminated errors in the output of cjpeg on Windows that occurred when the +application was invoked using I/O redirection (cjpeg output.jpg). + + +1.1.0 +===== + +[1] The algorithm used by the SIMD quantization function cannot produce correct +results when the JPEG quality is >= 98 and the fast integer forward DCT is +used. Thus, the non-SIMD quantization function is now used for those cases, +and libjpeg-turbo should now produce identical output to libjpeg v6b in all +cases. + +[2] Despite the above, the fast integer forward DCT still degrades somewhat for +JPEG qualities greater than 95, so the TurboJPEG wrapper will now automatically +use the slow integer forward DCT when generating JPEG images of quality 96 or +greater. This reduces compression performance by as much as 15% for these +high-quality images but is necessary to ensure that the images are perceptually +lossless. It also ensures that the library can avoid the performance pitfall +created by [1]. + +[3] Ported jpgtest.cxx to pure C to avoid the need for a C++ compiler. + +[4] Fixed visual artifacts in grayscale JPEG compression caused by a typo in +the RGB-to-luminance lookup tables. + +[5] The Windows distribution packages now include the libjpeg run-time programs +(cjpeg, etc.) + +[6] All packages now include jpgtest. + +[7] The TurboJPEG dynamic library now uses versioned symbols. + +[8] Added two new TurboJPEG API functions, tjEncodeYUV() and +tjDecompressToYUV(), to replace the somewhat hackish TJ_YUV flag. + + +1.0.90 (1.1 beta1) +================== + +[1] Added emulation of the libjpeg v7 and v8 APIs and ABIs. See +README-turbo.txt for more details. This feature was sponsored by CamTrace SAS. + +[2] Created a new CMake-based build system for the Visual C++ and MinGW builds. + +[3] Grayscale bitmaps can now be compressed from/decompressed to using the +TurboJPEG API. + +[4] jpgtest can now be used to test decompression performance with existing +JPEG images. + +[5] If the default install prefix (/opt/libjpeg-turbo) is used, then +'make install' now creates /opt/libjpeg-turbo/lib32 and +/opt/libjpeg-turbo/lib64 sym links to duplicate the behavior of the binary +packages. + +[6] All symbols in the libjpeg-turbo dynamic library are now versioned, even +when the library is built with libjpeg v6b emulation. + +[7] Added arithmetic encoding and decoding support (can be disabled with +configure or CMake options) + +[8] Added a TJ_YUV flag to the TurboJPEG API, which causes both the compressor +and decompressor to output planar YUV images. + +[9] Added an extended version of tjDecompressHeader() to the TurboJPEG API, +which allows the caller to determine the type of subsampling used in a JPEG +image. + +[10] Added further protections against invalid Huffman codes. + + +1.0.1 +===== + +[1] The Huffman decoder will now handle erroneous Huffman codes (for instance, +from a corrupt JPEG image.) Previously, these would cause libjpeg-turbo to +crash under certain circumstances. + +[2] Fixed typo in SIMD dispatch routines that was causing 4:2:2 upsampling to +be used instead of 4:2:0 when decompressing JPEG images using SSE2 code. + +[3] configure script will now automatically determine whether the +INCOMPLETE_TYPES_BROKEN macro should be defined. + + +1.0.0 +===== + +[1] 2983700: Further FreeBSD build tweaks (no longer necessary to specify +--host when configuring on a 64-bit system) + +[2] Created symlinks in the Unix/Linux packages so that the TurboJPEG +include file can always be found in /opt/libjpeg-turbo/include, the 32-bit +static libraries can always be found in /opt/libjpeg-turbo/lib32, and the +64-bit static libraries can always be found in /opt/libjpeg-turbo/lib64. + +[3] The Unix/Linux distribution packages now include the libjpeg run-time +programs (cjpeg, etc.) and man pages. + +[4] Created a 32-bit supplementary package for amd64 Debian systems, which +contains just the 32-bit libjpeg-turbo libraries. + +[5] Moved the libraries from */lib32 to */lib in the i386 Debian package. + +[6] Include distribution package for Cygwin + +[7] No longer necessary to specify --without-simd on non-x86 architectures, and +unit tests now work on those architectures. + + +0.0.93 +====== + +[1] 2982659, Fixed x86-64 build on FreeBSD systems + +[2] 2988188: Added support for Windows 64-bit systems + + +0.0.91 +====== + +[1] Added documentation to .deb packages + +[2] 2968313: Fixed data corruption issues when decompressing large JPEG images +and/or using buffered I/O with the libjpeg-turbo decompressor + + +0.0.90 +====== + +Initial release diff --cc Makefile.am index cee54eb,0000000..dad69df mode 100644,000000..100644 --- a/Makefile.am +++ b/Makefile.am @@@ -1,538 -1,0 +1,602 @@@ +lib_LTLIBRARIES = libjpeg.la +libjpeg_la_LDFLAGS = -version-info ${LIBTOOL_CURRENT}:${SO_MINOR_VERSION}:${SO_AGE} -no-undefined +include_HEADERS = jerror.h jmorecfg.h jpeglib.h + +if WITH_TURBOJPEG +lib_LTLIBRARIES += libturbojpeg.la +libturbojpeg_la_LDFLAGS = -version-info 1:0:1 -no-undefined +include_HEADERS += turbojpeg.h +endif + +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 \ + jpeg_nbits_table.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 + + +SUBDIRS = java + + +if WITH_TURBOJPEG + +libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpeg.c turbojpeg.h \ + transupp.c transupp.h jdatadst-tj.c jdatasrc-tj.c + +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) +endif + +endif + + +if VERSION_SCRIPT +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 +noinst_PROGRAMS = jcstest + + +if WITH_TURBOJPEG + +bin_PROGRAMS += tjbench + +noinst_PROGRAMS += tjunittest + +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 + +endif + + - cjpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c cjpeg.c rdbmp.c rdgif.c \ - rdppm.c rdswitch.c rdtarga.c ++cjpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c cjpeg.c rdgif.c rdppm.c rdswitch.c ++if WITH_12BIT ++else ++cjpeg_SOURCES += rdbmp.c rdtarga.c ++endif + +cjpeg_LDADD = libjpeg.la + - cjpeg_CFLAGS = -DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED \ - -DTARGA_SUPPORTED ++cjpeg_CFLAGS = -DGIF_SUPPORTED -DPPM_SUPPORTED ++if WITH_12BIT ++else ++cjpeg_CFLAGS += -DBMP_SUPPORTED -DTARGA_SUPPORTED ++endif + +djpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c djpeg.c rdcolmap.c rdswitch.c \ - wrbmp.c wrgif.c wrppm.c wrtarga.c ++ wrgif.c wrppm.c ++if WITH_12BIT ++else ++djpeg_SOURCES += wrbmp.c wrtarga.c ++endif + +djpeg_LDADD = libjpeg.la + - djpeg_CFLAGS = -DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED \ - -DTARGA_SUPPORTED ++djpeg_CFLAGS = -DGIF_SUPPORTED -DPPM_SUPPORTED ++if WITH_12BIT ++else ++djpeg_CFLAGS += -DBMP_SUPPORTED -DTARGA_SUPPORTED ++endif + +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 + +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= coderules.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 + + +EXTRA_DIST = win release $(DOCS) testimages CMakeLists.txt \ + sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in doc doxygen.config \ + jccolext.c jdcolext.c jdcol565.c jdmrgext.c jstdhuff.c + +dist-hook: + rm -rf `find $(distdir) -name .svn` + + +SUBDIRS += md5 + ++if WITH_12BIT ++ ++TESTORIG = testorig12.jpg ++MD5_JPEG_RGB_ISLOW = 9620f424569594bb9242b48498ad801f ++MD5_PPM_RGB_ISLOW = f3301d2219783b8b3d942b7239fa50c0 ++MD5_JPEG_422_IFAST_OPT = 7322e3bd2f127f7de4b40d4480ce60e4 ++MD5_PPM_422_IFAST = 79807fa552899e66a04708f533e16950 ++MD5_PPM_422M_IFAST = 07737bfe8a7c1c87aaa393a0098d16b0 ++MD5_JPEG_420_IFAST_Q100_PROG = a1da220b5604081863a504297ed59e55 ++MD5_PPM_420_Q100_IFAST = 1b3730122709f53d007255e8dfd3305e ++MD5_PPM_420M_Q100_IFAST = 980a1a3c5bf9510022869d30b7d26566 ++MD5_JPEG_GRAY_ISLOW = 235c90707b16e2e069f37c888b2636d9 ++MD5_PPM_GRAY_ISLOW = 7213c10af507ad467da5578ca5ee1fca ++MD5_PPM_GRAY_ISLOW_RGB = e96ee81c30a6ed422d466338bd3de65d ++MD5_JPEG_420S_IFAST_OPT = 7af8e60be4d9c227ec63ac9b6630855e ++MD5_JPEG_3x2_FLOAT_PROG = a8c17daf77b457725ec929e215b603f8 ++MD5_PPM_3x2_FLOAT = 42876ab9e5c2f76a87d08db5fbd57956 ++MD5_PPM_420M_ISLOW_2_1 = 4ca6be2a6f326ff9eaab63e70a8259c0 ++MD5_PPM_420M_ISLOW_15_8 = 12aa9f9534c1b3d7ba047322226365eb ++MD5_PPM_420M_ISLOW_13_8 = f7e22817c7b25e1393e4ec101e9d4e96 ++MD5_PPM_420M_ISLOW_11_8 = 800a16f9f4dc9b293197bfe11be10a82 ++MD5_PPM_420M_ISLOW_9_8 = 06b7a92a9bc69f4dc36ec40f1937d55c ++MD5_PPM_420M_ISLOW_7_8 = 3ec444a14a4ab4eab88ffc49c48eca43 ++MD5_PPM_420M_ISLOW_3_4 = 3e726b7ea872445b19437d1c1d4f0d93 ++MD5_PPM_420M_ISLOW_5_8 = a8a771abdc94301d20ffac119b2caccd ++MD5_PPM_420M_ISLOW_1_2 = b419124dd5568b085787234866102866 ++MD5_PPM_420M_ISLOW_3_8 = 343d19015531b7bbe746124127244fa8 ++MD5_PPM_420M_ISLOW_1_4 = 35fd59d866e44659edfa3c18db2a3edb ++MD5_PPM_420M_ISLOW_1_8 = ccaed48ac0aedefda5d4abe4013f4ad7 ++MD5_JPEG_CROP = cdb35ff4b4519392690ea040c56ea99c ++ ++else ++ ++TESTORIG = testorig.jpg +MD5_JPEG_RGB_ISLOW = 768e970dd57b340ff1b83c9d3d47c77b +MD5_PPM_RGB_ISLOW = 00a257f5393fef8821f2b88ac7421291 +MD5_BMP_RGB_ISLOW_565 = f07d2e75073e4bb10f6c6f4d36e2e3be +MD5_BMP_RGB_ISLOW_565D = 4cfa0928ef3e6bb626d7728c924cfda4 +MD5_JPEG_422_IFAST_OPT = 2540287b79d913f91665e660303ab2c8 +MD5_PPM_422_IFAST = 35bd6b3f833bad23de82acea847129fa +MD5_PPM_422M_IFAST = 8dbc65323d62cca7c91ba02dd1cfa81d +MD5_BMP_422M_IFAST_565 = 3294bd4d9a1f2b3d08ea6020d0db7065 +MD5_BMP_422M_IFAST_565D = da98c9c7b6039511be4a79a878a9abc1 +MD5_JPEG_420_IFAST_Q100_PROG = 990cbe0329c882420a2094da7e5adade +MD5_PPM_420_Q100_IFAST = 5a732542015c278ff43635e473a8a294 +MD5_PPM_420M_Q100_IFAST = ff692ee9323a3b424894862557c092f1 +MD5_JPEG_GRAY_ISLOW = 72b51f894b8f4a10b3ee3066770aa38d +MD5_PPM_GRAY_ISLOW = 8d3596c56eace32f205deccc229aa5ed +MD5_PPM_GRAY_ISLOW_RGB = 116424ac07b79e5e801f00508eab48ec +MD5_BMP_GRAY_ISLOW_565 = 12f78118e56a2f48b966f792fedf23cc +MD5_BMP_GRAY_ISLOW_565D = bdbbd616441a24354c98553df5dc82db +MD5_JPEG_420S_IFAST_OPT = 388708217ac46273ca33086b22827ed8 +# See README-turbo.txt for more details on why this next bit is necessary. +if WITH_SSE_FLOAT_DCT +MD5_JPEG_3x2_FLOAT_PROG = 343e3f8caf8af5986ebaf0bdc13b5c71 +MD5_PPM_3x2_FLOAT = 1a75f36e5904d6fc3a85a43da9ad89bb +else +MD5_JPEG_3x2_FLOAT_PROG = 9bca803d2042bd1eb03819e2bf92b3e5 +MD5_PPM_3x2_FLOAT = f6bfab038438ed8f5522fbd33595dcdc +endif +MD5_JPEG_420_ISLOW_ARI = e986fb0a637a8d833d96e8a6d6d84ea1 +MD5_JPEG_444_ISLOW_PROGARI = 0a8f1c8f66e113c3cf635df0a475a617 +MD5_PPM_420M_IFAST_ARI = 72b59a99bcf1de24c5b27d151bde2437 +MD5_JPEG_420_ISLOW = 9a68f56bc76e466aa7e52f415d0f4a5f +MD5_PPM_420M_ISLOW_2_1 = 9f9de8c0612f8d06869b960b05abf9c9 +MD5_PPM_420M_ISLOW_15_8 = b6875bc070720b899566cc06459b63b7 +MD5_PPM_420M_ISLOW_13_8 = bc3452573c8152f6ae552939ee19f82f +MD5_PPM_420M_ISLOW_11_8 = d8cc73c0aaacd4556569b59437ba00a5 +MD5_PPM_420M_ISLOW_9_8 = d25e61bc7eac0002f5b393aa223747b6 +MD5_PPM_420M_ISLOW_7_8 = ddb564b7c74a09494016d6cd7502a946 +MD5_PPM_420M_ISLOW_3_4 = 8ed8e68808c3fbc4ea764fc9d2968646 +MD5_PPM_420M_ISLOW_5_8 = a3363274999da2366a024efae6d16c9b +MD5_PPM_420M_ISLOW_1_2 = e692a315cea26b988c8e8b29a5dbcd81 +MD5_PPM_420M_ISLOW_3_8 = 79eca9175652ced755155c90e785a996 +MD5_PPM_420M_ISLOW_1_4 = 79cd778f8bf1a117690052cacdd54eca +MD5_PPM_420M_ISLOW_1_8 = 391b3d4aca640c8567d6f8745eb2142f +MD5_BMP_420_ISLOW_256 = 4980185e3776e89bd931736e1cddeee6 +MD5_BMP_420_ISLOW_565 = bf9d13e16c4923b92e1faa604d7922cb +MD5_BMP_420_ISLOW_565D = 6bde71526acc44bcff76f696df8638d2 +MD5_BMP_420M_ISLOW_565 = 8dc0185245353cfa32ad97027342216f +MD5_BMP_420M_ISLOW_565D =d1be3a3339166255e76fa50a0d70d73e +MD5_JPEG_CROP = b4197f377e621c4e9b1d20471432610d + ++endif ++ +test: testclean all + +if WITH_TURBOJPEG +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 -noyuvpad + $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -bi + $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -bi -noyuvpad +endif + ./tjunittest + ./tjunittest -alloc + ./tjunittest -yuv + ./tjunittest -yuv -alloc + ./tjunittest -yuv -noyuvpad +endif + +# These tests are carefully crafted to provide full coverage of as many of the +# underlying algorithms as possible (including all of the SIMD-accelerated +# ones.) + +# CC: null SAMP: fullsize FDCT: islow ENT: huff + ./cjpeg -rgb -dct int -outfile testout_rgb_islow.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_RGB_ISLOW) testout_rgb_islow.jpg +# CC: null SAMP: fullsize IDCT: islow ENT: huff + ./djpeg -dct int -ppm -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg + md5/md5cmp $(MD5_PPM_RGB_ISLOW) testout_rgb_islow.ppm + rm testout_rgb_islow.ppm ++if WITH_12BIT ++ rm testout_rgb_islow.jpg ++else +# CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff + ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg + md5/md5cmp $(MD5_BMP_RGB_ISLOW_565) testout_rgb_islow_565.bmp + rm testout_rgb_islow_565.bmp +# CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff + ./djpeg -dct int -rgb565 -bmp -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg + md5/md5cmp $(MD5_BMP_RGB_ISLOW_565D) testout_rgb_islow_565D.bmp + rm testout_rgb_islow_565D.bmp testout_rgb_islow.jpg ++endif + +# CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff + ./cjpeg -sample 2x1 -dct fast -opt -outfile testout_422_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_422_IFAST_OPT) testout_422_ifast_opt.jpg +# CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff + ./djpeg -dct fast -outfile testout_422_ifast.ppm testout_422_ifast_opt.jpg + md5/md5cmp $(MD5_PPM_422_IFAST) testout_422_ifast.ppm + rm testout_422_ifast.ppm +# CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff + ./djpeg -dct fast -nosmooth -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg + md5/md5cmp $(MD5_PPM_422M_IFAST) testout_422m_ifast.ppm + rm testout_422m_ifast.ppm ++if WITH_12BIT ++ rm testout_422_ifast_opt.jpg ++else +# CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff + ./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg + md5/md5cmp $(MD5_BMP_422M_IFAST_565) testout_422m_ifast_565.bmp + rm testout_422m_ifast_565.bmp +# CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff + ./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg + md5/md5cmp $(MD5_BMP_422M_IFAST_565D) testout_422m_ifast_565D.bmp + rm testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg ++endif + +# CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff + ./cjpeg -sample 2x2 -quality 100 -dct fast -prog -outfile testout_420_q100_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_420_IFAST_Q100_PROG) testout_420_q100_ifast_prog.jpg +# CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff + ./djpeg -dct fast -outfile testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg + md5/md5cmp $(MD5_PPM_420_Q100_IFAST) testout_420_q100_ifast.ppm + rm testout_420_q100_ifast.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff + ./djpeg -dct fast -nosmooth -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg + md5/md5cmp $(MD5_PPM_420M_Q100_IFAST) testout_420m_q100_ifast.ppm + rm testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg + +# CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff + ./cjpeg -gray -dct int -outfile testout_gray_islow.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_GRAY_ISLOW) testout_gray_islow.jpg +# CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff + ./djpeg -dct int -outfile testout_gray_islow.ppm testout_gray_islow.jpg + md5/md5cmp $(MD5_PPM_GRAY_ISLOW) testout_gray_islow.ppm + rm testout_gray_islow.ppm +# CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff + ./djpeg -dct int -rgb -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg + md5/md5cmp $(MD5_PPM_GRAY_ISLOW_RGB) testout_gray_islow_rgb.ppm + rm testout_gray_islow_rgb.ppm ++if WITH_12BIT ++ rm testout_gray_islow.jpg ++else +# CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff + ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg + md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565) testout_gray_islow_565.bmp + rm testout_gray_islow_565.bmp +# CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff + ./djpeg -dct int -rgb565 -bmp -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg + md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565D) testout_gray_islow_565D.bmp + rm testout_gray_islow_565D.bmp testout_gray_islow.jpg ++endif + +# CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow +# ENT: 2-pass huff + ./cjpeg -sample 2x2 -smooth 1 -dct int -opt -outfile testout_420s_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_420S_IFAST_OPT) testout_420s_ifast_opt.jpg + rm testout_420s_ifast_opt.jpg + +# CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff + ./cjpeg -sample 3x2 -dct float -prog -outfile testout_3x2_float_prog.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG) testout_3x2_float_prog.jpg +# CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff + ./djpeg -dct float -outfile testout_3x2_float.ppm testout_3x2_float_prog.jpg + md5/md5cmp $(MD5_PPM_3x2_FLOAT) testout_3x2_float.ppm + rm testout_3x2_float.ppm testout_3x2_float_prog.jpg + +if WITH_ARITH_ENC +# CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith + ./cjpeg -dct int -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg + rm testout_420_islow_ari.jpg + ./jpegtran -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testimgint.jpg + md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg + rm testout_420_islow_ari.jpg +# CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith + ./cjpeg -sample 1x1 -dct int -progressive -arithmetic -outfile testout_444_islow_progari.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_444_ISLOW_PROGARI) testout_444_islow_progari.jpg + rm testout_444_islow_progari.jpg +endif +if WITH_ARITH_DEC +# CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith + ./djpeg -fast -ppm -outfile testout_420m_ifast_ari.ppm $(srcdir)/testimages/testimgari.jpg + md5/md5cmp $(MD5_PPM_420M_IFAST_ARI) testout_420m_ifast_ari.ppm + rm testout_420m_ifast_ari.ppm + ./jpegtran -outfile testout_420_islow.jpg $(srcdir)/testimages/testimgari.jpg + md5/md5cmp $(MD5_JPEG_420_ISLOW) testout_420_islow.jpg + rm testout_420_islow.jpg +endif + +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff - ./djpeg -dct int -scale 2/1 -nosmooth -ppm -outfile testout_420m_islow_2_1.ppm $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -scale 2/1 -nosmooth -ppm -outfile testout_420m_islow_2_1.ppm $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_PPM_420M_ISLOW_2_1) testout_420m_islow_2_1.ppm + rm testout_420m_islow_2_1.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff - ./djpeg -dct int -scale 15/8 -nosmooth -ppm -outfile testout_420m_islow_15_8.ppm $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -scale 15/8 -nosmooth -ppm -outfile testout_420m_islow_15_8.ppm $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_PPM_420M_ISLOW_15_8) testout_420m_islow_15_8.ppm + rm testout_420m_islow_15_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff - ./djpeg -dct int -scale 13/8 -nosmooth -ppm -outfile testout_420m_islow_13_8.ppm $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -scale 13/8 -nosmooth -ppm -outfile testout_420m_islow_13_8.ppm $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_PPM_420M_ISLOW_13_8) testout_420m_islow_13_8.ppm + rm testout_420m_islow_13_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff - ./djpeg -dct int -scale 11/8 -nosmooth -ppm -outfile testout_420m_islow_11_8.ppm $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -scale 11/8 -nosmooth -ppm -outfile testout_420m_islow_11_8.ppm $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_PPM_420M_ISLOW_11_8) testout_420m_islow_11_8.ppm + rm testout_420m_islow_11_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff - ./djpeg -dct int -scale 9/8 -nosmooth -ppm -outfile testout_420m_islow_9_8.ppm $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -scale 9/8 -nosmooth -ppm -outfile testout_420m_islow_9_8.ppm $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_PPM_420M_ISLOW_9_8) testout_420m_islow_9_8.ppm + rm testout_420m_islow_9_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow ENT: huff - ./djpeg -dct int -scale 7/8 -nosmooth -ppm -outfile testout_420m_islow_7_8.ppm $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -scale 7/8 -nosmooth -ppm -outfile testout_420m_islow_7_8.ppm $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_PPM_420M_ISLOW_7_8) testout_420m_islow_7_8.ppm + rm testout_420m_islow_7_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow ENT: huff - ./djpeg -dct int -scale 3/4 -nosmooth -ppm -outfile testout_420m_islow_3_4.ppm $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -scale 3/4 -nosmooth -ppm -outfile testout_420m_islow_3_4.ppm $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_PPM_420M_ISLOW_3_4) testout_420m_islow_3_4.ppm + rm testout_420m_islow_3_4.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow ENT: huff - ./djpeg -dct int -scale 5/8 -nosmooth -ppm -outfile testout_420m_islow_5_8.ppm $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -scale 5/8 -nosmooth -ppm -outfile testout_420m_islow_5_8.ppm $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_PPM_420M_ISLOW_5_8) testout_420m_islow_5_8.ppm + rm testout_420m_islow_5_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow ENT: huff - ./djpeg -dct int -scale 1/2 -nosmooth -ppm -outfile testout_420m_islow_1_2.ppm $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -scale 1/2 -nosmooth -ppm -outfile testout_420m_islow_1_2.ppm $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_PPM_420M_ISLOW_1_2) testout_420m_islow_1_2.ppm + rm testout_420m_islow_1_2.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow ENT: huff - ./djpeg -dct int -scale 3/8 -nosmooth -ppm -outfile testout_420m_islow_3_8.ppm $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -scale 3/8 -nosmooth -ppm -outfile testout_420m_islow_3_8.ppm $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_PPM_420M_ISLOW_3_8) testout_420m_islow_3_8.ppm + rm testout_420m_islow_3_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow ENT: huff - ./djpeg -dct int -scale 1/4 -nosmooth -ppm -outfile testout_420m_islow_1_4.ppm $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -scale 1/4 -nosmooth -ppm -outfile testout_420m_islow_1_4.ppm $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_PPM_420M_ISLOW_1_4) testout_420m_islow_1_4.ppm + rm testout_420m_islow_1_4.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow ENT: huff - ./djpeg -dct int -scale 1/8 -nosmooth -ppm -outfile testout_420m_islow_1_8.ppm $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -scale 1/8 -nosmooth -ppm -outfile testout_420m_islow_1_8.ppm $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_PPM_420M_ISLOW_1_8) testout_420m_islow_1_8.ppm + rm testout_420m_islow_1_8.ppm ++if WITH_12BIT ++else +# CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff - ./djpeg -dct int -colors 256 -bmp -outfile testout_420_islow_256.bmp $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -colors 256 -bmp -outfile testout_420_islow_256.bmp $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_BMP_420_ISLOW_256) testout_420_islow_256.bmp + rm testout_420_islow_256.bmp +# CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff - ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_420_islow_565.bmp $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_420_islow_565.bmp $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_BMP_420_ISLOW_565) testout_420_islow_565.bmp + rm testout_420_islow_565.bmp +# CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff - ./djpeg -dct int -rgb565 -bmp -outfile testout_420_islow_565D.bmp $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -rgb565 -bmp -outfile testout_420_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_BMP_420_ISLOW_565D) testout_420_islow_565D.bmp + rm testout_420_islow_565D.bmp +# CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff - ./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_420m_islow_565.bmp $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_420m_islow_565.bmp $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_BMP_420M_ISLOW_565) testout_420m_islow_565.bmp + rm testout_420m_islow_565.bmp +# CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff - ./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_420m_islow_565D.bmp $(srcdir)/testimages/testorig.jpg ++ ./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_420m_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_BMP_420M_ISLOW_565D) testout_420m_islow_565D.bmp + rm testout_420m_islow_565D.bmp ++endif + - ./jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testout_crop.jpg $(srcdir)/testimages/testorig.jpg ++ ./jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testout_crop.jpg $(srcdir)/testimages/$(TESTORIG) + md5/md5cmp $(MD5_JPEG_CROP) testout_crop.jpg + rm testout_crop.jpg + + +testclean: + rm -f testout* + 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 + rm -f *_411_*.bmp + rm -f *_411_*.png + rm -f *_411_*.ppm + rm -f *_411_*.jpg + rm -f *_411.yuv + + +tjtest: + sh ./tjbenchtest + sh ./tjbenchtest -yuv +if WITH_JAVA + sh ./tjbenchtest.java + sh ./tjbenchtest.java -yuv +endif + + +pkgscripts/libjpeg-turbo.spec: pkgscripts/libjpeg-turbo.spec.tmpl + cat pkgscripts/libjpeg-turbo.spec.tmpl | sed s@%{__prefix}@$(prefix)@g | \ + sed s@%{__bindir}@$(bindir)@g | sed s@%{__datadir}@$(datadir)@g | \ + sed s@%{__docdir}@$(docdir)@g | sed s@%{__includedir}@$(includedir)@g | \ + sed s@%{__libdir}@$(libdir)@g | sed s@%{__mandir}@$(mandir)@g \ + > pkgscripts/libjpeg-turbo.spec + +rpm: all pkgscripts/libjpeg-turbo.spec + TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \ + mkdir -p $$TMPDIR/RPMS; \ + ln -fs `pwd` $$TMPDIR/BUILD; \ + rm -f ${PKGNAME}-${VERSION}.${RPMARCH}.rpm; \ + rpmbuild -bb --define "_blddir $$TMPDIR/buildroot" \ + --define "_topdir $$TMPDIR" \ + --target ${RPMARCH} pkgscripts/libjpeg-turbo.spec; \ + cp $$TMPDIR/RPMS/${RPMARCH}/${PKGNAME}-${VERSION}-${BUILD}.${RPMARCH}.rpm \ + ${PKGNAME}-${VERSION}.${RPMARCH}.rpm; \ + rm -rf $$TMPDIR + +srpm: dist-gzip pkgscripts/libjpeg-turbo.spec + 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 ${PKGNAME}-${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/${PKGNAME}-${VERSION}-${BUILD}.src.rpm \ + ${PKGNAME}-${VERSION}.src.rpm; \ + rm -rf $$TMPDIR + +pkgscripts/makedpkg: pkgscripts/makedpkg.tmpl + cat pkgscripts/makedpkg.tmpl | sed s@%{__prefix}@$(prefix)@g | \ + sed s@%{__docdir}@$(docdir)@g | sed s@%{__libdir}@$(libdir)@g \ + > pkgscripts/makedpkg + +deb: all pkgscripts/makedpkg + sh pkgscripts/makedpkg + +pkgscripts/uninstall: pkgscripts/uninstall.tmpl + cat pkgscripts/uninstall.tmpl | sed s@%{__prefix}@$(prefix)@g | \ + sed s@%{__bindir}@$(bindir)@g | sed s@%{__datadir}@$(datadir)@g | \ + sed s@%{__includedir}@$(includedir)@g | sed s@%{__libdir}@$(libdir)@g | \ + sed s@%{__mandir}@$(mandir)@g > pkgscripts/uninstall + +pkgscripts/makemacpkg: pkgscripts/makemacpkg.tmpl + cat pkgscripts/makemacpkg.tmpl | sed s@%{__prefix}@$(prefix)@g | \ + sed s@%{__bindir}@$(bindir)@g | sed s@%{__docdir}@$(docdir)@g | \ + sed s@%{__libdir}@$(libdir)@g > pkgscripts/makemacpkg + +if X86_64 + +udmg: all pkgscripts/makemacpkg pkgscripts/uninstall + sh pkgscripts/makemacpkg -build32 ${BUILDDIR32} + +iosdmg: all pkgscripts/makemacpkg pkgscripts/uninstall + sh pkgscripts/makemacpkg -build32 ${BUILDDIR32} -buildarmv6 ${BUILDDIRARMV6} -buildarmv7 ${BUILDDIRARMV7} -buildarmv7s ${BUILDDIRARMV7S} + +else + +iosdmg: all pkgscripts/makemacpkg pkgscripts/uninstall + sh pkgscripts/makemacpkg -buildarmv6 ${BUILDDIRARMV6} -buildarmv7 ${BUILDDIRARMV7} -buildarmv7s ${BUILDDIRARMV7S} + +endif + +dmg: all pkgscripts/makemacpkg pkgscripts/uninstall + sh pkgscripts/makemacpkg + +pkgscripts/makecygwinpkg: pkgscripts/makecygwinpkg.tmpl + cat pkgscripts/makecygwinpkg.tmpl | sed s@%{__prefix}@$(prefix)@g | \ + sed s@%{__docdir}@$(docdir)@g | sed s@%{__libdir}@$(libdir)@g \ + > pkgscripts/makecygwinpkg + +cygwinpkg: all pkgscripts/makecygwinpkg + sh pkgscripts/makecygwinpkg diff --cc configure.ac index d2de185,0000000..64f3265 mode 100644,000000..100644 --- a/configure.ac +++ b/configure.ac @@@ -1,535 -1,0 +1,559 @@@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.56]) +AC_INIT([libjpeg-turbo], [1.3.80]) +BUILD=`date +%Y%m%d` + +AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) +AC_PREFIX_DEFAULT(/opt/libjpeg-turbo) + +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +# Checks for programs. +SAVED_CFLAGS=${CFLAGS} +SAVED_CPPFLAGS=${CPPFLAGS} +AC_PROG_CPP +AC_PROG_CC +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) +AM_PROG_AS +AM_PROG_CC_C_O +AC_PROG_INSTALL +AC_PROG_LIBTOOL +AC_PROG_LN_S + +# When the prefix is /opt/libjpeg-turbo, we assume that an "official" binary is +# being created, and thus we install things into specific locations. + +old_prefix=${prefix} +if test "x$prefix" = "xNONE" -a "x$ac_default_prefix" != "x"; then + prefix=$ac_default_prefix +fi +DATADIR=`eval echo ${datadir}` +DATADIR=`eval echo $DATADIR` +if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then + datadir='${prefix}' +fi +DATADIR=`eval echo ${datarootdir}` +DATADIR=`eval echo $DATADIR` +if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then + datarootdir='${prefix}' +fi + +old_exec_prefix=${exec_prefix} +if test "x$exec_prefix" = "xNONE"; then + exec_prefix=${prefix} +fi + +if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; then + LIBDIR=`eval echo ${libdir}` + LIBDIR=`eval echo $LIBDIR` + if test "$LIBDIR" = "/opt/libjpeg-turbo/lib"; then + case $host_os in + darwin*) + ;; + *) + AC_CHECK_SIZEOF(long) + if test "${ac_cv_sizeof_long}" = "8"; then + libdir='${exec_prefix}/lib64' + elif test "${ac_cv_sizeof_long}" = "4"; then + libdir='${exec_prefix}/lib32' + fi + ;; + esac + fi +fi +exec_prefix=${old_exec_prefix} +prefix=${old_prefix} + +# Check whether compiler supports pointers to undefined structures +AC_MSG_CHECKING(whether compiler supports pointers to undefined structures) +AC_TRY_COMPILE([ typedef struct undefined_structure * undef_struct_ptr; ], , + AC_MSG_RESULT(yes), + [AC_MSG_RESULT(no) + AC_DEFINE([INCOMPLETE_TYPES_BROKEN], [1], + [Compiler does not support pointers to undefined structures.])]) + +if test "x${GCC}" = "xyes"; then + if test "x${SAVED_CFLAGS}" = "x"; then + CFLAGS=-O3 + fi + if test "x${SAVED_CPPFLAGS}" = "x"; then + CPPFLAGS=-Wall + fi +fi + +AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) +if test "x${SUNCC}" = "xyes"; then + if test "x${SAVED_CFLAGS}" = "x"; then + CFLAGS=-xO5 + fi +fi + +# Checks for libraries. + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([stddef.h stdlib.h locale.h string.h]) +AC_CHECK_HEADER([sys/types.h], + AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you need to include to get size_t.])) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_CHAR_UNSIGNED +AC_C_INLINE +AC_TYPE_SIZE_T +AC_CHECK_TYPES([unsigned char, unsigned short]) + +AC_MSG_CHECKING([if right shift is signed]) +AC_TRY_RUN( + [#include + int is_shifting_signed (long arg) { + long res = arg >> 4; + + if (res == -0x7F7E80CL) + return 1; /* right shift is signed */ + + /* see if unsigned-shift hack will fix it. */ + /* we can't just test exact value since it depends on width of long... */ + res |= (~0L) << (32-4); + if (res == -0x7F7E80CL) + return 0; /* right shift is unsigned */ + + printf("Right shift isn't acting as I expect it to.\n"); + printf("I fear the JPEG software will not work at all.\n\n"); + return 0; /* try it with unsigned anyway */ + } + int main (void) { + exit(is_shifting_signed(-0x7F7E80B1L)); + }], + [AC_MSG_RESULT(no) + AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1, + [Define if your (broken) compiler shifts signed values as if they were unsigned.])], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)]) + +# Checks for library functions. +AC_CHECK_FUNCS([memset memcpy], [], + [AC_DEFINE([NEED_BSD_STRINGS], 1, + [Define if you have BSD-like bzero and bcopy in rather than memset/memcpy in .])]) + +AC_MSG_CHECKING([libjpeg API version]) +AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)]) +if test "x$JPEG_LIB_VERSION" = "x"; then + AC_ARG_WITH([jpeg7], + AC_HELP_STRING([--with-jpeg7], + [Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)])) + AC_ARG_WITH([jpeg8], + AC_HELP_STRING([--with-jpeg8], + [Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)])) + if test "x${with_jpeg8}" = "xyes"; then + JPEG_LIB_VERSION=80 + else + if test "x${with_jpeg7}" = "xyes"; then + JPEG_LIB_VERSION=70 + else + JPEG_LIB_VERSION=62 + fi + fi +fi +JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10` +AC_SUBST(JPEG_LIB_VERSION_DECIMAL) +AC_MSG_RESULT([$JPEG_LIB_VERSION_DECIMAL]) +AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION], + [libjpeg API version]) + +AC_ARG_VAR(SO_MAJOR_VERSION, + [Major version of the libjpeg-turbo shared library (default is determined by the API version)]) +AC_ARG_VAR(SO_MINOR_VERSION, + [Minor version of the libjpeg-turbo shared library (default is determined by the API version)]) +if test "x$SO_MAJOR_VERSION" = "x"; then + case "$JPEG_LIB_VERSION" in + 62) SO_MAJOR_VERSION=$JPEG_LIB_VERSION ;; + *) SO_MAJOR_VERSION=`expr $JPEG_LIB_VERSION / 10` ;; + esac +fi +if test "x$SO_MINOR_VERSION" = "x"; then + case "$JPEG_LIB_VERSION" in + 80) SO_MINOR_VERSION=2 ;; + *) SO_MINOR_VERSION=0 ;; + esac +fi + +RPM_CONFIG_ARGS= + +# Memory source/destination managers +SO_AGE=0 +MEM_SRCDST_FUNCTIONS= +if test "x${with_jpeg8}" != "xyes"; then + AC_MSG_CHECKING([whether to include in-memory source/destination managers]) + AC_ARG_WITH([mem-srcdst], + AC_HELP_STRING([--without-mem-srcdst], + [Do not include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI])) + if test "x$with_mem_srcdst" != "xno"; then + AC_MSG_RESULT(yes) + AC_DEFINE([MEM_SRCDST_SUPPORTED], [1], + [Support in-memory source/destination managers]) + SO_AGE=1 + MEM_SRCDST_FUNCTIONS="global: jpeg_mem_dest; jpeg_mem_src;"; + else + AC_MSG_RESULT(no) + RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-mem-srcdst" + fi +fi + +AC_MSG_CHECKING([libjpeg shared library version]) +AC_MSG_RESULT([$SO_MAJOR_VERSION.$SO_AGE.$SO_MINOR_VERSION]) +LIBTOOL_CURRENT=`expr $SO_MAJOR_VERSION + $SO_AGE` +AC_SUBST(LIBTOOL_CURRENT) +AC_SUBST(SO_MAJOR_VERSION) +AC_SUBST(SO_MINOR_VERSION) +AC_SUBST(SO_AGE) +AC_SUBST(MEM_SRCDST_FUNCTIONS) + +AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION, [$VERSION], [libjpeg-turbo version]) + +VERSION_SCRIPT=yes +AC_ARG_ENABLE([ld-version-script], + AS_HELP_STRING([--disable-ld-version-script], + [Disable linker version script for libjpeg-turbo (default is to use linker version script if the linker supports it)]), + [VERSION_SCRIPT=$enableval], []) + +AC_MSG_CHECKING([whether the linker supports version scripts]) +SAVED_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map" +cat > conftest.map < for Cendio AB - * Copyright (C) 2011 D. R. Commander ++ * Copyright (C) 2011, 2014 D. R. Commander * For conditions of distribution and use, see the accompanying README file. * * This file contains the forward-DCT management logic. @@@ -72,131 -41,6 +72,139 @@@ typedef struct typedef my_fdct_controller * my_fdct_ptr; ++#if BITS_IN_JSAMPLE == 8 ++ +/* + * Find the highest bit in an integer through binary search. + */ ++ +LOCAL(int) +flss (UINT16 val) +{ + int bit; + + bit = 16; + + if (!val) + return 0; + + if (!(val & 0xff00)) { + bit -= 8; + val <<= 8; + } + if (!(val & 0xf000)) { + bit -= 4; + val <<= 4; + } + if (!(val & 0xc000)) { + bit -= 2; + val <<= 2; + } + if (!(val & 0x8000)) { + bit -= 1; + val <<= 1; + } + + return bit; +} + ++ +/* + * Compute values to do a division using reciprocal. + * + * This implementation is based on an algorithm described in + * "How to optimize for the Pentium family of microprocessors" + * (http://www.agner.org/assem/). + * More information about the basic algorithm can be found in + * the paper "Integer Division Using Reciprocals" by Robert Alverson. + * + * The basic idea is to replace x/d by x * d^-1. In order to store + * d^-1 with enough precision we shift it left a few places. It turns + * out that this algoright gives just enough precision, and also fits + * into DCTELEM: + * + * b = (the number of significant bits in divisor) - 1 + * r = (word size) + b + * f = 2^r / divisor + * + * f will not be an integer for most cases, so we need to compensate + * for the rounding error introduced: + * + * no fractional part: + * + * result = input >> r + * + * fractional part of f < 0.5: + * + * round f down to nearest integer + * result = ((input + 1) * f) >> r + * + * fractional part of f > 0.5: + * + * round f up to nearest integer + * result = (input * f) >> r + * + * This is the original algorithm that gives truncated results. But we + * want properly rounded results, so we replace "input" with + * "input + divisor/2". + * + * In order to allow SIMD implementations we also tweak the values to + * allow the same calculation to be made at all times: + * + * dctbl[0] = f rounded to nearest integer + * dctbl[1] = divisor / 2 (+ 1 if fractional part of f < 0.5) + * dctbl[2] = 1 << ((word size) * 2 - r) + * dctbl[3] = r - (word size) + * + * dctbl[2] is for stupid instruction sets where the shift operation + * isn't member wise (e.g. MMX). + * + * The reason dctbl[2] and dctbl[3] reduce the shift with (word size) + * is that most SIMD implementations have a "multiply and store top + * half" operation. + * + * Lastly, we store each of the values in their own table instead + * of in a consecutive manner, yet again in order to allow SIMD + * routines. + */ ++ +LOCAL(int) +compute_reciprocal (UINT16 divisor, DCTELEM * dtbl) +{ + UDCTELEM2 fq, fr; + UDCTELEM c; + int b, r; + + b = flss(divisor) - 1; + r = sizeof(DCTELEM) * 8 + b; + + fq = ((UDCTELEM2)1 << r) / divisor; + fr = ((UDCTELEM2)1 << r) % divisor; + + c = divisor / 2; /* for rounding */ + + if (fr == 0) { /* divisor is power of two */ + /* fq will be one bit too large to fit in DCTELEM, so adjust */ + fq >>= 1; + r--; + } else if (fr <= (divisor / 2U)) { /* fractional part is < 0.5 */ + c++; + } else { /* fractional part is > 0.5 */ + fq++; + } + + dtbl[DCTSIZE2 * 0] = (DCTELEM) fq; /* reciprocal */ + dtbl[DCTSIZE2 * 1] = (DCTELEM) c; /* correction + roundfactor */ + dtbl[DCTSIZE2 * 2] = (DCTELEM) (1 << (sizeof(DCTELEM)*8*2 - r)); /* scale */ + dtbl[DCTSIZE2 * 3] = (DCTELEM) r - sizeof(DCTELEM)*8; /* shift */ + + if(r <= 16) return 0; + else return 1; +} + ++#endif ++ ++ /* * Initialize for a processing pass. * Verify that all referenced Q-tables are present, and set up @@@ -238,49 -82,45 +246,60 @@@ start_pass_fdctmgr (j_compress_ptr cinf } dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { - dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3; ++#if BITS_IN_JSAMPLE == 8 + if(!compute_reciprocal(qtbl->quantval[i] << 3, &dtbl[i]) + && fdct->quantize == jsimd_quantize) + fdct->quantize = quantize; ++#else ++ dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3; ++#endif } break; #endif #ifdef DCT_IFAST_SUPPORTED case JDCT_IFAST: { - /* For AA&N IDCT method, divisors are equal to quantization - * coefficients scaled by scalefactor[row]*scalefactor[col], where - * scalefactor[0] = 1 - * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 - * We apply a further scale factor of 8. - */ + /* For AA&N IDCT method, divisors are equal to quantization + * coefficients scaled by scalefactor[row]*scalefactor[col], where + * scalefactor[0] = 1 + * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 + * We apply a further scale factor of 8. + */ #define CONST_BITS 14 - static const INT16 aanscales[DCTSIZE2] = { - /* precomputed values scaled up by 14 bits */ - 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, - 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, - 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, - 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, - 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, - 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, - 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, - 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 - }; - SHIFT_TEMPS - - if (fdct->divisors[qtblno] == NULL) { - fdct->divisors[qtblno] = (DCTELEM *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - DCTSIZE2 * SIZEOF(DCTELEM)); - } - dtbl = fdct->divisors[qtblno]; - for (i = 0; i < DCTSIZE2; i++) { - dtbl[i] = (DCTELEM) - DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], - (INT32) aanscales[i]), - CONST_BITS-3); - } + static const INT16 aanscales[DCTSIZE2] = { + /* precomputed values scaled up by 14 bits */ + 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, + 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, + 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, + 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, + 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, + 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, + 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, + 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 + }; + SHIFT_TEMPS + + if (fdct->divisors[qtblno] == NULL) { + fdct->divisors[qtblno] = (DCTELEM *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (DCTSIZE2 * 4) * sizeof(DCTELEM)); + } + dtbl = fdct->divisors[qtblno]; + for (i = 0; i < DCTSIZE2; i++) { ++#if BITS_IN_JSAMPLE == 8 + if(!compute_reciprocal( + DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], + (INT32) aanscales[i]), + CONST_BITS-3), &dtbl[i]) + && fdct->quantize == jsimd_quantize) + fdct->quantize = quantize; ++#else ++ dtbl[i] = (DCTELEM) ++ DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], ++ (INT32) aanscales[i]), ++ CONST_BITS-3); ++#endif + } } break; #endif @@@ -328,77 -168,6 +347,118 @@@ } +/* + * Load data into workspace, applying unsigned->signed conversion. + */ + +METHODDEF(void) +convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace) +{ + register DCTELEM *workspaceptr; + register JSAMPROW elemptr; + register int elemr; + + workspaceptr = workspace; + for (elemr = 0; elemr < DCTSIZE; elemr++) { + elemptr = sample_data[elemr] + start_col; + +#if DCTSIZE == 8 /* unroll the inner loop */ + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; +#else + { + register int elemc; + for (elemc = DCTSIZE; elemc > 0; elemc--) + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + } +#endif + } +} + + +/* + * Quantize/descale the coefficients, and store into coef_blocks[]. + */ + +METHODDEF(void) +quantize (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace) +{ + int i; + DCTELEM temp; ++ JCOEFPTR output_ptr = coef_block; ++ ++#if BITS_IN_JSAMPLE == 8 ++ + UDCTELEM recip, corr, shift; + UDCTELEM2 product; - JCOEFPTR output_ptr = coef_block; + + for (i = 0; i < DCTSIZE2; i++) { + temp = workspace[i]; + recip = divisors[i + DCTSIZE2 * 0]; + corr = divisors[i + DCTSIZE2 * 1]; + shift = divisors[i + DCTSIZE2 * 3]; + + if (temp < 0) { + temp = -temp; + product = (UDCTELEM2)(temp + corr) * recip; + product >>= shift + sizeof(DCTELEM)*8; + temp = product; + temp = -temp; + } else { + product = (UDCTELEM2)(temp + corr) * recip; + product >>= shift + sizeof(DCTELEM)*8; + temp = product; + } ++ output_ptr[i] = (JCOEF) temp; ++ } ++ ++#else ++ ++ register DCTELEM qval; + ++ for (i = 0; i < DCTSIZE2; i++) { ++ qval = divisors[i]; ++ temp = workspace[i]; ++ /* Divide the coefficient value by qval, ensuring proper rounding. ++ * Since C does not specify the direction of rounding for negative ++ * quotients, we have to force the dividend positive for portability. ++ * ++ * In most files, at least half of the output values will be zero ++ * (at default quantization settings, more like three-quarters...) ++ * so we should ensure that this case is fast. On many machines, ++ * a comparison is enough cheaper than a divide to make a special test ++ * a win. Since both inputs will be nonnegative, we need only test ++ * for a < b to discover whether a/b is 0. ++ * If your machine's division is fast enough, define FAST_DIVIDE. ++ */ ++#ifdef FAST_DIVIDE ++#define DIVIDE_BY(a,b) a /= b ++#else ++#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0 ++#endif ++ if (temp < 0) { ++ temp = -temp; ++ temp += qval>>1; /* for rounding */ ++ DIVIDE_BY(temp, qval); ++ temp = -temp; ++ } else { ++ temp += qval>>1; /* for rounding */ ++ DIVIDE_BY(temp, qval); ++ } + output_ptr[i] = (JCOEF) temp; + } ++ ++#endif ++ +} + + /* * Perform forward DCT on one or more blocks of a component. * diff --cc jconfig.h.in index cdca01f,0000000..42d86f2 mode 100644,000000..100644 --- a/jconfig.h.in +++ b/jconfig.h.in @@@ -1,59 -1,0 +1,70 @@@ +/* Version ID for the JPEG library. + * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". + */ +#define JPEG_LIB_VERSION 62 /* Version 6b */ + +/* libjpeg-turbo version */ +#define LIBJPEG_TURBO_VERSION 0 + +/* Support arithmetic encoding */ +#undef C_ARITH_CODING_SUPPORTED + +/* Support arithmetic decoding */ +#undef D_ARITH_CODING_SUPPORTED + ++/* ++ * Define BITS_IN_JSAMPLE as either ++ * 8 for 8-bit sample values (the usual setting) ++ * 12 for 12-bit sample values ++ * Only 8 and 12 are legal data precisions for lossy JPEG according to the ++ * JPEG standard, and the IJG code does not support anything else! ++ * We do not support run-time selection of data precision, sorry. ++ */ ++ ++#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ ++ +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if the system has the type `unsigned char'. */ +#undef HAVE_UNSIGNED_CHAR + +/* Define to 1 if the system has the type `unsigned short'. */ +#undef HAVE_UNSIGNED_SHORT + +/* Compiler does not support pointers to undefined structures. */ +#undef INCOMPLETE_TYPES_BROKEN + +/* Support in-memory source/destination managers */ +#undef MEM_SRCDST_SUPPORTED + +/* Define if you have BSD-like bzero and bcopy in rather than + memset/memcpy in . */ +#undef NEED_BSD_STRINGS + +/* Define if you need to include to get size_t. */ +#undef NEED_SYS_TYPES_H + +/* Define if your (broken) compiler shifts signed values as if they were + unsigned. */ +#undef RIGHT_SHIFT_IS_UNSIGNED + +/* Use accelerated SIMD routines. */ +#undef WITH_SIMD + +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +# undef __CHAR_UNSIGNED__ +#endif + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `unsigned int' if does not define. */ +#undef size_t diff --cc jdct.h index c06bf9d,04192a2..6f8b159 --- a/jdct.h +++ b/jdct.h @@@ -30,20 -27,13 +30,19 @@@ */ #if BITS_IN_JSAMPLE == 8 -typedef int DCTELEM; /* 16 or 32 bits is fine */ +#ifndef WITH_SIMD +typedef int DCTELEM; /* 16 or 32 bits is fine */ +typedef unsigned int UDCTELEM; +typedef unsigned long long UDCTELEM2; #else -typedef INT32 DCTELEM; /* must have 32 bits */ +typedef short DCTELEM; /* prefer 16 bit with SIMD for parellelism */ +typedef unsigned short UDCTELEM; +typedef unsigned int UDCTELEM2; +#endif +#else +typedef INT32 DCTELEM; /* must have 32 bits */ - typedef UINT32 UDCTELEM; +typedef unsigned long long UDCTELEM2; #endif - -typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data)); -typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data)); /* diff --cc jmorecfg.h index 91fbd15,54a7d1c..36fe971 --- a/jmorecfg.h +++ b/jmorecfg.h @@@ -13,18 -11,18 +13,6 @@@ */ --/* -- * Define BITS_IN_JSAMPLE as either -- * 8 for 8-bit sample values (the usual setting) -- * 12 for 12-bit sample values -- * Only 8 and 12 are legal data precisions for lossy JPEG according to the -- * JPEG standard, and the IJG code does not support anything else! -- * We do not support run-time selection of data precision, sorry. -- */ -- - #define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ -#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ -- -- /* * Maximum number of components (color channels) allowed in JPEG image. * To meet the letter of the JPEG spec, set this to 255. However, darn diff --cc sharedlib/CMakeLists.txt index cd3f268,0000000..d423cce mode 100755,000000..100755 --- a/sharedlib/CMakeLists.txt +++ b/sharedlib/CMakeLists.txt @@@ -1,67 -1,0 +1,73 @@@ +# Anything that must be linked against the shared C library on Windows must +# be built in this subdirectory, because CMake doesn't allow us to override +# the compiler flags for each build type except at directory scope. Note +# to CMake developers: Add a COMPILE_FLAGS_ target property, or +# better yet, provide a friendly way of configuring a Windows target to use the +# static C library. + +if(MSVC) + # Build all configurations against shared C library + foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) + if(${var} MATCHES "/MT") + string(REGEX REPLACE "/MT" "/MD" ${var} "${${var}}") + endif() + endforeach() +endif() + +foreach(src ${JPEG_SOURCES}) + set(JPEG_SRCS ${JPEG_SRCS} ${CMAKE_SOURCE_DIR}/${src}) +endforeach() + +if(WITH_SIMD) + # This tells CMake that the "source" files haven't been generated yet + set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1) +endif() + +if(WITH_MEM_SRCDST AND NOT WITH_JPEG8) + add_library(jpeg SHARED ${JPEG_SRCS} ${SIMD_OBJS} + ${CMAKE_SOURCE_DIR}/win/jpeg${DLL_VERSION}-memsrcdst.def) +else() + add_library(jpeg SHARED ${JPEG_SRCS} ${SIMD_OBJS} + ${CMAKE_SOURCE_DIR}/win/jpeg${DLL_VERSION}.def) +endif() +set_target_properties(jpeg PROPERTIES SOVERSION ${DLL_VERSION} + VERSION ${FULLVERSION}) +if(MSVC) + set_target_properties(jpeg PROPERTIES SUFFIX ${DLL_VERSION}.dll) +elseif(MINGW OR CYGWIN) + set_target_properties(jpeg PROPERTIES SUFFIX -${DLL_VERSION}.dll) +endif(MSVC) +if(WITH_SIMD) + add_dependencies(jpeg simd) +endif() + - add_executable(cjpeg ../cjpeg.c ../cdjpeg.c ../rdbmp.c ../rdgif.c ../rdppm.c - ../rdswitch.c ../rdtarga.c) - set_property(TARGET cjpeg PROPERTY COMPILE_FLAGS - "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") ++if(WITH_12BIT) ++ set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED -DUSE_SETMODE") ++else() ++ set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") ++ set(CJPEG_BMP_SOURCES ../rdbmp.c ../rdtarga.c) ++ set(DJPEG_BMP_SOURCES ../wrbmp.c ../wrtarga.c) ++endif() ++ ++add_executable(cjpeg ../cjpeg.c ../cdjpeg.c ../rdgif.c ../rdppm.c ++ ../rdswitch.c ${CJPEG_BMP_SOURCES}) ++set_property(TARGET cjpeg PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) +target_link_libraries(cjpeg jpeg) + +add_executable(djpeg ../djpeg.c ../cdjpeg.c ../rdcolmap.c ../rdswitch.c - ../wrbmp.c ../wrgif.c ../wrppm.c ../wrtarga.c) - set_property(TARGET djpeg PROPERTY COMPILE_FLAGS - "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") ++ ../wrgif.c ../wrppm.c ${DJPEG_BMP_SOURCES}) ++set_property(TARGET djpeg PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) +target_link_libraries(djpeg jpeg) + +add_executable(jpegtran ../jpegtran.c ../cdjpeg.c ../rdswitch.c ../transupp.c) +target_link_libraries(jpegtran jpeg) +set_property(TARGET jpegtran PROPERTY COMPILE_FLAGS "-DUSE_SETMODE") + +add_executable(jcstest ../jcstest.c) +target_link_libraries(jcstest jpeg) + +install(TARGETS jpeg cjpeg djpeg jpegtran + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) diff --cc testimages/testorig12.jpg index 0000000,0000000..861aff9 new file mode 100644 Binary files differ diff --cc win/jconfig.h.in index 6865faf,0000000..8783900 mode 100644,000000..100644 --- a/win/jconfig.h.in +++ b/win/jconfig.h.in @@@ -1,39 -1,0 +1,50 @@@ +/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ +/* see jconfig.txt for explanations */ + +#define JPEG_LIB_VERSION @JPEG_LIB_VERSION@ +#define LIBJPEG_TURBO_VERSION @VERSION@ +#cmakedefine C_ARITH_CODING_SUPPORTED +#cmakedefine D_ARITH_CODING_SUPPORTED +#cmakedefine MEM_SRCDST_SUPPORTED + ++/* ++ * Define BITS_IN_JSAMPLE as either ++ * 8 for 8-bit sample values (the usual setting) ++ * 12 for 12-bit sample values ++ * Only 8 and 12 are legal data precisions for lossy JPEG according to the ++ * JPEG standard, and the IJG code does not support anything else! ++ * We do not support run-time selection of data precision, sorry. ++ */ ++ ++#define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */ ++ +#define HAVE_UNSIGNED_CHAR +#define HAVE_UNSIGNED_SHORT +/* #define void char */ +/* #define const */ +#undef __CHAR_UNSIGNED__ +#define HAVE_STDDEF_H +#define HAVE_STDLIB_H +#undef NEED_BSD_STRINGS +#undef NEED_SYS_TYPES_H +#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ +#undef INCOMPLETE_TYPES_BROKEN + +/* Define "boolean" as unsigned char, not int, per Windows custom */ +#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ +typedef unsigned char boolean; +#endif +#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ + +/* Define "INT32" as int, not long, per Windows custom */ +#if !(defined(_BASETSD_H_) || defined(_BASETSD_H)) /* don't conflict if basetsd.h already read */ +typedef short INT16; +typedef signed int INT32; +#endif +#define XMD_H /* prevent jmorecfg.h from redefining it */ + +#ifdef JPEG_INTERNALS + +#undef RIGHT_SHIFT_IS_UNSIGNED + +#endif /* JPEG_INTERNALS */