OLD | NEW |
(Empty) | |
| 1 # |
| 2 # Setup |
| 3 # |
| 4 |
| 5 cmake_minimum_required(VERSION 2.8.8) |
| 6 # Use LINK_INTERFACE_LIBRARIES instead of INTERFACE_LINK_LIBRARIES |
| 7 if(POLICY CMP0022) |
| 8 cmake_policy(SET CMP0022 OLD) |
| 9 endif() |
| 10 |
| 11 project(libjpeg-turbo C) |
| 12 set(VERSION 1.4.90) |
| 13 |
| 14 if(CYGWIN OR NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") |
| 15 execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD) |
| 16 string(REGEX REPLACE "\n" "" BUILD ${BUILD}) |
| 17 elseif(WIN32) |
| 18 execute_process(COMMAND "wmic.exe" "os" "get" "LocalDateTime" OUTPUT_VARIABLE |
| 19 BUILD) |
| 20 string(REGEX REPLACE "[^0-9]" "" BUILD "${BUILD}") |
| 21 if (BUILD STREQUAL "") |
| 22 execute_process(COMMAND "cmd.exe" "/C" "DATE" "/T" OUTPUT_VARIABLE BUILD) |
| 23 string(REGEX REPLACE ".*[ ]([0-9]*)[/.]([0-9]*)[/.]([0-9]*).*" "\\3\\2\\1" B
UILD "${BUILD}") |
| 24 else() |
| 25 string(SUBSTRING "${BUILD}" 0 8 BUILD) |
| 26 endif() |
| 27 else() |
| 28 message(FATAL_ERROR "Platform not supported by this build system. Use autotoo
ls instead.") |
| 29 endif() |
| 30 |
| 31 # This does nothing except when using MinGW. CMAKE_BUILD_TYPE has no meaning |
| 32 # in Visual Studio, and it always defaults to Debug when using NMake. |
| 33 if(NOT CMAKE_BUILD_TYPE) |
| 34 set(CMAKE_BUILD_TYPE Release) |
| 35 endif() |
| 36 |
| 37 message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") |
| 38 |
| 39 # This only works if building from the command line. There is currently no way |
| 40 # to set a variable's value based on the build type when using Visual Studio. |
| 41 if(CMAKE_BUILD_TYPE STREQUAL "Debug") |
| 42 set(BUILD "${BUILD}d") |
| 43 endif() |
| 44 |
| 45 message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}") |
| 46 |
| 47 option(WITH_SIMD "Include SIMD extensions" TRUE) |
| 48 option(WITH_ARITH_ENC "Include arithmetic encoding support" TRUE) |
| 49 option(WITH_ARITH_DEC "Include arithmetic decoding support" TRUE) |
| 50 option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward
incompatible with libjpeg v6b)" FALSE) |
| 51 option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward
incompatible with libjpeg v6b)" FALSE) |
| 52 option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions w
hen emulating the libjpeg v6b or v7 API/ABI" TRUE) |
| 53 option(WITH_TURBOJPEG "Include the TurboJPEG wrapper library and associated test
programs" TRUE) |
| 54 option(WITH_JAVA "Build Java wrapper for the TurboJPEG library" FALSE) |
| 55 option(WITH_12BIT "Encode/decode JPEG images with 12-bit samples (implies WITH_S
IMD=0 WITH_TURBOJPEG=0 WITH_ARITH_ENC=0 WITH_ARITH_DEC=0)" FALSE) |
| 56 option(ENABLE_STATIC "Build static libraries" TRUE) |
| 57 option(ENABLE_SHARED "Build shared libraries" TRUE) |
| 58 |
| 59 if(WITH_12BIT) |
| 60 set(WITH_SIMD FALSE) |
| 61 set(WITH_TURBOJPEG FALSE) |
| 62 set(WITH_JAVA FALSE) |
| 63 set(WITH_ARITH_ENC FALSE) |
| 64 set(WITH_ARITH_DEC FALSE) |
| 65 set(BITS_IN_JSAMPLE 12) |
| 66 message(STATUS "12-bit JPEG support enabled") |
| 67 else() |
| 68 set(BITS_IN_JSAMPLE 8) |
| 69 endif() |
| 70 |
| 71 if(WITH_ARITH_ENC) |
| 72 set(C_ARITH_CODING_SUPPORTED 1) |
| 73 message(STATUS "Arithmetic encoding support enabled") |
| 74 else() |
| 75 message(STATUS "Arithmetic encoding support disabled") |
| 76 endif() |
| 77 |
| 78 if(WITH_ARITH_DEC) |
| 79 set(D_ARITH_CODING_SUPPORTED 1) |
| 80 message(STATUS "Arithmetic decoding support enabled") |
| 81 else() |
| 82 message(STATUS "Arithmetic decoding support disabled") |
| 83 endif() |
| 84 |
| 85 if(WITH_TURBOJPEG) |
| 86 message(STATUS "TurboJPEG C wrapper enabled") |
| 87 else() |
| 88 message(STATUS "TurboJPEG C wrapper disabled") |
| 89 endif() |
| 90 |
| 91 if(WITH_JAVA) |
| 92 message(STATUS "TurboJPEG Java wrapper enabled") |
| 93 else() |
| 94 message(STATUS "TurboJPEG Java wrapper disabled") |
| 95 endif() |
| 96 |
| 97 set(SO_AGE 0) |
| 98 if(WITH_MEM_SRCDST) |
| 99 set(SO_AGE 1) |
| 100 endif() |
| 101 |
| 102 set(JPEG_LIB_VERSION 62) |
| 103 set(DLL_VERSION ${JPEG_LIB_VERSION}) |
| 104 set(FULLVERSION ${DLL_VERSION}.${SO_AGE}.0) |
| 105 if(WITH_JPEG8) |
| 106 set(JPEG_LIB_VERSION 80) |
| 107 set(DLL_VERSION 8) |
| 108 set(FULLVERSION ${DLL_VERSION}.0.2) |
| 109 message(STATUS "Emulating libjpeg v8 API/ABI") |
| 110 elseif(WITH_JPEG7) |
| 111 set(JPEG_LIB_VERSION 70) |
| 112 set(DLL_VERSION 7) |
| 113 set(FULLVERSION ${DLL_VERSION}.${SO_AGE}.0) |
| 114 message(STATUS "Emulating libjpeg v7 API/ABI") |
| 115 endif(WITH_JPEG8) |
| 116 |
| 117 if(WITH_MEM_SRCDST) |
| 118 set(MEM_SRCDST_SUPPORTED 1) |
| 119 message(STATUS "In-memory source/destination managers enabled") |
| 120 else() |
| 121 message(STATUS "In-memory source/destination managers disabled") |
| 122 endif() |
| 123 |
| 124 if(MSVC) |
| 125 option(WITH_CRT_DLL |
| 126 "Link all libjpeg-turbo libraries and executables with the C run-time DLL (m
svcr*.dll) instead of the static C run-time library (libcmt*.lib.) The default
is to use the C run-time DLL only with the libraries and executables that need i
t." |
| 127 FALSE) |
| 128 if(NOT WITH_CRT_DLL) |
| 129 # Use the static C library for all build types |
| 130 foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE |
| 131 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) |
| 132 if(${var} MATCHES "/MD") |
| 133 string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") |
| 134 endif() |
| 135 endforeach() |
| 136 endif() |
| 137 add_definitions(-W3 -wd4996) |
| 138 endif() |
| 139 |
| 140 # Detect whether compiler is 64-bit |
| 141 if(MSVC AND CMAKE_CL_64) |
| 142 set(SIMD_X86_64 1) |
| 143 set(64BIT 1) |
| 144 elseif(CMAKE_SIZEOF_VOID_P MATCHES 8) |
| 145 set(SIMD_X86_64 1) |
| 146 set(64BIT 1) |
| 147 endif() |
| 148 |
| 149 if(64BIT) |
| 150 message(STATUS "64-bit build") |
| 151 else() |
| 152 message(STATUS "32-bit build") |
| 153 endif() |
| 154 |
| 155 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 156 if(MSVC) |
| 157 set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME}) |
| 158 else() |
| 159 set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME}-gcc) |
| 160 endif() |
| 161 if(64BIT) |
| 162 set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_INSTALL_PREFIX_DEFAULT}64) |
| 163 endif() |
| 164 set(CMAKE_INSTALL_PREFIX "c:/${CMAKE_INSTALL_PREFIX_DEFAULT}" CACHE PATH |
| 165 "Directory into which to install libjpeg-turbo (default: c:/${CMAKE_INSTALL_
PREFIX_DEFAULT})" |
| 166 FORCE) |
| 167 endif() |
| 168 |
| 169 message(STATUS "Install directory = ${CMAKE_INSTALL_PREFIX}") |
| 170 |
| 171 configure_file(win/jconfig.h.in jconfig.h) |
| 172 configure_file(win/jconfigint.h.in jconfigint.h) |
| 173 |
| 174 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) |
| 175 |
| 176 string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC) |
| 177 |
| 178 set(EFFECTIVE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}"
) |
| 179 message(STATUS "Compiler flags = ${EFFECTIVE_C_FLAGS}") |
| 180 |
| 181 set(EFFECTIVE_LD_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMA
KE_BUILD_TYPE_UC}}") |
| 182 message(STATUS "Linker flags = ${EFFECTIVE_LD_FLAGS}") |
| 183 |
| 184 if(WITH_JAVA) |
| 185 find_package(Java) |
| 186 find_package(JNI) |
| 187 if(DEFINED JAVACFLAGS) |
| 188 message(STATUS "Java compiler flags = ${JAVACFLAGS}") |
| 189 endif() |
| 190 endif() |
| 191 |
| 192 |
| 193 # |
| 194 # Targets |
| 195 # |
| 196 |
| 197 set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c |
| 198 jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c |
| 199 jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c |
| 200 jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c |
| 201 jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c |
| 202 jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c |
| 203 jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c) |
| 204 |
| 205 if(WITH_ARITH_ENC OR WITH_ARITH_DEC) |
| 206 set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c) |
| 207 endif() |
| 208 |
| 209 if(WITH_ARITH_ENC) |
| 210 set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c) |
| 211 endif() |
| 212 |
| 213 if(WITH_ARITH_DEC) |
| 214 set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c) |
| 215 endif() |
| 216 |
| 217 if(WITH_SIMD) |
| 218 add_definitions(-DWITH_SIMD) |
| 219 add_subdirectory(simd) |
| 220 if(SIMD_X86_64) |
| 221 set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_x86_64.c) |
| 222 else() |
| 223 set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_i386.c) |
| 224 endif() |
| 225 # This tells CMake that the "source" files haven't been generated yet |
| 226 set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1) |
| 227 else() |
| 228 set(JPEG_SOURCES ${JPEG_SOURCES} jsimd_none.c) |
| 229 message(STATUS "Not using SIMD acceleration") |
| 230 endif() |
| 231 |
| 232 if(WITH_JAVA) |
| 233 add_subdirectory(java) |
| 234 set(ENABLE_SHARED TRUE) |
| 235 endif() |
| 236 |
| 237 if(ENABLE_SHARED) |
| 238 add_subdirectory(sharedlib) |
| 239 endif() |
| 240 |
| 241 if(ENABLE_STATIC OR WITH_TURBOJPEG) |
| 242 add_library(jpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS}) |
| 243 if(NOT MSVC) |
| 244 set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg) |
| 245 endif() |
| 246 if(WITH_SIMD) |
| 247 add_dependencies(jpeg-static simd) |
| 248 endif() |
| 249 endif() |
| 250 |
| 251 if(WITH_TURBOJPEG) |
| 252 set(TURBOJPEG_SOURCES turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c) |
| 253 if(WITH_JAVA) |
| 254 set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c) |
| 255 include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) |
| 256 endif() |
| 257 |
| 258 if(ENABLE_SHARED) |
| 259 add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES}) |
| 260 set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE) |
| 261 if(MINGW) |
| 262 set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at) |
| 263 endif() |
| 264 target_link_libraries(turbojpeg jpeg-static) |
| 265 set_target_properties(turbojpeg PROPERTIES LINK_INTERFACE_LIBRARIES "") |
| 266 |
| 267 add_executable(tjunittest tjunittest.c tjutil.c) |
| 268 target_link_libraries(tjunittest turbojpeg) |
| 269 |
| 270 add_executable(tjbench tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c |
| 271 wrppm.c) |
| 272 target_link_libraries(tjbench turbojpeg jpeg-static) |
| 273 set_property(TARGET tjbench PROPERTY COMPILE_FLAGS |
| 274 "-DBMP_SUPPORTED -DPPM_SUPPORTED") |
| 275 endif() |
| 276 |
| 277 if(ENABLE_STATIC) |
| 278 add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS} |
| 279 turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c) |
| 280 if(NOT MSVC) |
| 281 set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg) |
| 282 endif() |
| 283 if(WITH_SIMD) |
| 284 add_dependencies(turbojpeg-static simd) |
| 285 endif() |
| 286 |
| 287 add_executable(tjunittest-static tjunittest.c tjutil.c) |
| 288 target_link_libraries(tjunittest-static turbojpeg-static) |
| 289 |
| 290 add_executable(tjbench-static tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c |
| 291 wrbmp.c wrppm.c) |
| 292 target_link_libraries(tjbench-static turbojpeg-static jpeg-static) |
| 293 set_property(TARGET tjbench-static PROPERTY COMPILE_FLAGS |
| 294 "-DBMP_SUPPORTED -DPPM_SUPPORTED") |
| 295 endif() |
| 296 endif() |
| 297 |
| 298 if(WITH_12BIT) |
| 299 set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED -DUSE_SETMODE") |
| 300 else() |
| 301 set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUP
PORTED -DUSE_SETMODE") |
| 302 set(CJPEG_BMP_SOURCES rdbmp.c rdtarga.c) |
| 303 set(DJPEG_BMP_SOURCES wrbmp.c wrtarga.c) |
| 304 endif() |
| 305 |
| 306 if(ENABLE_STATIC) |
| 307 add_executable(cjpeg-static cjpeg.c cdjpeg.c rdgif.c rdppm.c rdswitch.c |
| 308 ${CJPEG_BMP_SOURCES}) |
| 309 set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) |
| 310 target_link_libraries(cjpeg-static jpeg-static) |
| 311 |
| 312 add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrgif.c |
| 313 wrppm.c ${DJPEG_BMP_SOURCES}) |
| 314 set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) |
| 315 target_link_libraries(djpeg-static jpeg-static) |
| 316 |
| 317 add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c) |
| 318 target_link_libraries(jpegtran-static jpeg-static) |
| 319 set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS "-DUSE_SETMODE") |
| 320 endif() |
| 321 |
| 322 add_executable(rdjpgcom rdjpgcom.c) |
| 323 |
| 324 add_executable(wrjpgcom wrjpgcom.c) |
| 325 |
| 326 |
| 327 # |
| 328 # Tests |
| 329 # |
| 330 |
| 331 add_subdirectory(md5) |
| 332 |
| 333 if(MSVC_IDE) |
| 334 set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/") |
| 335 else() |
| 336 set(OBJDIR "") |
| 337 endif() |
| 338 |
| 339 enable_testing() |
| 340 |
| 341 if(WITH_12BIT) |
| 342 set(TESTORIG testorig12.jpg) |
| 343 set(MD5_JPEG_RGB_ISLOW 9620f424569594bb9242b48498ad801f) |
| 344 set(MD5_PPM_RGB_ISLOW f3301d2219783b8b3d942b7239fa50c0) |
| 345 set(MD5_JPEG_422_IFAST_OPT 7322e3bd2f127f7de4b40d4480ce60e4) |
| 346 set(MD5_PPM_422_IFAST 79807fa552899e66a04708f533e16950) |
| 347 set(MD5_PPM_422M_IFAST 07737bfe8a7c1c87aaa393a0098d16b0) |
| 348 set(MD5_JPEG_420_IFAST_Q100_PROG a1da220b5604081863a504297ed59e55) |
| 349 set(MD5_PPM_420_Q100_IFAST 1b3730122709f53d007255e8dfd3305e) |
| 350 set(MD5_PPM_420M_Q100_IFAST 980a1a3c5bf9510022869d30b7d26566) |
| 351 set(MD5_JPEG_GRAY_ISLOW 235c90707b16e2e069f37c888b2636d9) |
| 352 set(MD5_PPM_GRAY_ISLOW 7213c10af507ad467da5578ca5ee1fca) |
| 353 set(MD5_PPM_GRAY_ISLOW_RGB e96ee81c30a6ed422d466338bd3de65d) |
| 354 set(MD5_JPEG_420S_IFAST_OPT 7af8e60be4d9c227ec63ac9b6630855e) |
| 355 set(MD5_JPEG_3x2_FLOAT_PROG a8c17daf77b457725ec929e215b603f8) |
| 356 set(MD5_PPM_3x2_FLOAT 42876ab9e5c2f76a87d08db5fbd57956) |
| 357 set(MD5_PPM_420M_ISLOW_2_1 4ca6be2a6f326ff9eaab63e70a8259c0) |
| 358 set(MD5_PPM_420M_ISLOW_15_8 12aa9f9534c1b3d7ba047322226365eb) |
| 359 set(MD5_PPM_420M_ISLOW_13_8 f7e22817c7b25e1393e4ec101e9d4e96) |
| 360 set(MD5_PPM_420M_ISLOW_11_8 800a16f9f4dc9b293197bfe11be10a82) |
| 361 set(MD5_PPM_420M_ISLOW_9_8 06b7a92a9bc69f4dc36ec40f1937d55c) |
| 362 set(MD5_PPM_420M_ISLOW_7_8 3ec444a14a4ab4eab88ffc49c48eca43) |
| 363 set(MD5_PPM_420M_ISLOW_3_4 3e726b7ea872445b19437d1c1d4f0d93) |
| 364 set(MD5_PPM_420M_ISLOW_5_8 a8a771abdc94301d20ffac119b2caccd) |
| 365 set(MD5_PPM_420M_ISLOW_1_2 b419124dd5568b085787234866102866) |
| 366 set(MD5_PPM_420M_ISLOW_3_8 343d19015531b7bbe746124127244fa8) |
| 367 set(MD5_PPM_420M_ISLOW_1_4 35fd59d866e44659edfa3c18db2a3edb) |
| 368 set(MD5_PPM_420M_ISLOW_1_8 ccaed48ac0aedefda5d4abe4013f4ad7) |
| 369 set(MD5_PPM_420_ISLOW_SKIP15_31 86664cd9dc956536409e44e244d20a97) |
| 370 set(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 452a21656115a163029cfba5c04fa76a) |
| 371 set(MD5_PPM_444_ISLOW_SKIP1_6 ef63901f71ef7a75cd78253fc0914f84) |
| 372 set(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 15b173fb5872d9575572fbcc1b05956f) |
| 373 set(MD5_JPEG_CROP cdb35ff4b4519392690ea040c56ea99c) |
| 374 else() |
| 375 set(TESTORIG testorig.jpg) |
| 376 set(MD5_JPEG_RGB_ISLOW 768e970dd57b340ff1b83c9d3d47c77b) |
| 377 set(MD5_PPM_RGB_ISLOW 00a257f5393fef8821f2b88ac7421291) |
| 378 set(MD5_BMP_RGB_ISLOW_565 f07d2e75073e4bb10f6c6f4d36e2e3be) |
| 379 set(MD5_BMP_RGB_ISLOW_565D 4cfa0928ef3e6bb626d7728c924cfda4) |
| 380 set(MD5_JPEG_422_IFAST_OPT 2540287b79d913f91665e660303ab2c8) |
| 381 set(MD5_PPM_422_IFAST 35bd6b3f833bad23de82acea847129fa) |
| 382 set(MD5_PPM_422M_IFAST 8dbc65323d62cca7c91ba02dd1cfa81d) |
| 383 set(MD5_BMP_422M_IFAST_565 3294bd4d9a1f2b3d08ea6020d0db7065) |
| 384 set(MD5_BMP_422M_IFAST_565D da98c9c7b6039511be4a79a878a9abc1) |
| 385 set(MD5_JPEG_420_IFAST_Q100_PROG 990cbe0329c882420a2094da7e5adade) |
| 386 set(MD5_PPM_420_Q100_IFAST 5a732542015c278ff43635e473a8a294) |
| 387 set(MD5_PPM_420M_Q100_IFAST ff692ee9323a3b424894862557c092f1) |
| 388 set(MD5_JPEG_GRAY_ISLOW 72b51f894b8f4a10b3ee3066770aa38d) |
| 389 set(MD5_PPM_GRAY_ISLOW 8d3596c56eace32f205deccc229aa5ed) |
| 390 set(MD5_PPM_GRAY_ISLOW_RGB 116424ac07b79e5e801f00508eab48ec) |
| 391 set(MD5_BMP_GRAY_ISLOW_565 12f78118e56a2f48b966f792fedf23cc) |
| 392 set(MD5_BMP_GRAY_ISLOW_565D bdbbd616441a24354c98553df5dc82db) |
| 393 set(MD5_JPEG_420S_IFAST_OPT 388708217ac46273ca33086b22827ed8) |
| 394 if(WITH_SIMD) |
| 395 set(MD5_JPEG_3x2_FLOAT_PROG 343e3f8caf8af5986ebaf0bdc13b5c71) |
| 396 set(MD5_PPM_3x2_FLOAT 1a75f36e5904d6fc3a85a43da9ad89bb) |
| 397 else() |
| 398 set(MD5_JPEG_3x2_FLOAT_PROG 9bca803d2042bd1eb03819e2bf92b3e5) |
| 399 set(MD5_PPM_3x2_FLOAT f6bfab038438ed8f5522fbd33595dcdc) |
| 400 endif() |
| 401 set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1) |
| 402 set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617) |
| 403 set(MD5_PPM_420M_IFAST_ARI 72b59a99bcf1de24c5b27d151bde2437) |
| 404 set(MD5_JPEG_420_ISLOW 9a68f56bc76e466aa7e52f415d0f4a5f) |
| 405 set(MD5_PPM_420M_ISLOW_2_1 9f9de8c0612f8d06869b960b05abf9c9) |
| 406 set(MD5_PPM_420M_ISLOW_15_8 b6875bc070720b899566cc06459b63b7) |
| 407 set(MD5_PPM_420M_ISLOW_13_8 bc3452573c8152f6ae552939ee19f82f) |
| 408 set(MD5_PPM_420M_ISLOW_11_8 d8cc73c0aaacd4556569b59437ba00a5) |
| 409 set(MD5_PPM_420M_ISLOW_9_8 d25e61bc7eac0002f5b393aa223747b6) |
| 410 set(MD5_PPM_420M_ISLOW_7_8 ddb564b7c74a09494016d6cd7502a946) |
| 411 set(MD5_PPM_420M_ISLOW_3_4 8ed8e68808c3fbc4ea764fc9d2968646) |
| 412 set(MD5_PPM_420M_ISLOW_5_8 a3363274999da2366a024efae6d16c9b) |
| 413 set(MD5_PPM_420M_ISLOW_1_2 e692a315cea26b988c8e8b29a5dbcd81) |
| 414 set(MD5_PPM_420M_ISLOW_3_8 79eca9175652ced755155c90e785a996) |
| 415 set(MD5_PPM_420M_ISLOW_1_4 79cd778f8bf1a117690052cacdd54eca) |
| 416 set(MD5_PPM_420M_ISLOW_1_8 391b3d4aca640c8567d6f8745eb2142f) |
| 417 set(MD5_BMP_420_ISLOW_256 4980185e3776e89bd931736e1cddeee6) |
| 418 set(MD5_BMP_420_ISLOW_565 bf9d13e16c4923b92e1faa604d7922cb) |
| 419 set(MD5_BMP_420_ISLOW_565D 6bde71526acc44bcff76f696df8638d2) |
| 420 set(MD5_BMP_420M_ISLOW_565 8dc0185245353cfa32ad97027342216f) |
| 421 set(MD5_BMP_420M_ISLOW_565D d1be3a3339166255e76fa50a0d70d73e) |
| 422 set(MD5_PPM_420_ISLOW_SKIP15_31 c4c65c1e43d7275cd50328a61e6534f0) |
| 423 set(MD5_PPM_420_ISLOW_ARI_SKIP16_139 087c6b123db16ac00cb88c5b590bb74a) |
| 424 set(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 26eb36ccc7d1f0cb80cdabb0ac8b5d99) |
| 425 set(MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4 886c6775af22370257122f8b16207e6d) |
| 426 set(MD5_PPM_444_ISLOW_SKIP1_6 5606f86874cf26b8fcee1117a0a436a6) |
| 427 set(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 db87dc7ce26bcdc7a6b56239ce2b9d6c) |
| 428 set(MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0 cb57b32bd6d03e35432362f7bf184b6d) |
| 429 set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d) |
| 430 endif() |
| 431 |
| 432 if(WITH_JAVA) |
| 433 add_test(TJUnitTest |
| 434 ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar |
| 435 -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 436 TJUnitTest) |
| 437 add_test(TJUnitTest-yuv |
| 438 ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar |
| 439 -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 440 TJUnitTest -yuv) |
| 441 add_test(TJUnitTest-yuv-nopad |
| 442 ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar |
| 443 -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 444 TJUnitTest -yuv -noyuvpad) |
| 445 add_test(TJUnitTest-bi |
| 446 ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar |
| 447 -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 448 TJUnitTest -bi) |
| 449 add_test(TJUnitTest-bi-yuv |
| 450 ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar |
| 451 -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 452 TJUnitTest -bi -yuv) |
| 453 add_test(TJUnitTest-bi-yuv-nopad |
| 454 ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar |
| 455 -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 456 TJUnitTest -bi -yuv -noyuvpad) |
| 457 endif() |
| 458 |
| 459 set(TEST_LIBTYPES "") |
| 460 if(ENABLE_SHARED) |
| 461 set(TEST_LIBTYPES ${TEST_LIBTYPES} shared) |
| 462 endif() |
| 463 if(ENABLE_STATIC) |
| 464 set(TEST_LIBTYPES ${TEST_LIBTYPES} static) |
| 465 endif() |
| 466 |
| 467 set(TESTIMAGES ${CMAKE_SOURCE_DIR}/testimages) |
| 468 set(MD5CMP ${CMAKE_CURRENT_BINARY_DIR}/md5/md5cmp) |
| 469 if(CMAKE_CROSSCOMPILING) |
| 470 file(RELATIVE_PATH TESTIMAGES ${CMAKE_CURRENT_BINARY_DIR} ${TESTIMAGES}) |
| 471 file(RELATIVE_PATH MD5CMP ${CMAKE_CURRENT_BINARY_DIR} ${MD5CMP}) |
| 472 endif() |
| 473 |
| 474 foreach(libtype ${TEST_LIBTYPES}) |
| 475 if(libtype STREQUAL "shared") |
| 476 set(dir sharedlib/) |
| 477 else() |
| 478 set(dir "") |
| 479 set(suffix -static) |
| 480 endif() |
| 481 if(WITH_TURBOJPEG) |
| 482 add_test(tjunittest${suffix} tjunittest${suffix}) |
| 483 add_test(tjunittest${suffix}-alloc tjunittest${suffix} -alloc) |
| 484 add_test(tjunittest${suffix}-yuv tjunittest${suffix} -yuv) |
| 485 add_test(tjunittest${suffix}-yuv-alloc tjunittest${suffix} -yuv -alloc) |
| 486 add_test(tjunittest${suffix}-yuv-nopad tjunittest${suffix} -yuv -noyuvpad) |
| 487 endif() |
| 488 |
| 489 # These tests are carefully chosen to provide full coverage of as many of the |
| 490 # underlying algorithms as possible (including all of the SIMD-accelerated |
| 491 # ones.) |
| 492 |
| 493 # CC: null SAMP: fullsize FDCT: islow ENT: huff |
| 494 add_test(cjpeg${suffix}-rgb-islow |
| 495 ${dir}cjpeg${suffix} -rgb -dct int |
| 496 -outfile testout_rgb_islow.jpg ${TESTIMAGES}/testorig.ppm) |
| 497 add_test(cjpeg${suffix}-rgb-islow-cmp |
| 498 ${MD5CMP} ${MD5_JPEG_RGB_ISLOW} testout_rgb_islow.jpg) |
| 499 |
| 500 # CC: null SAMP: fullsize IDCT: islow ENT: huff |
| 501 add_test(djpeg${suffix}-rgb-islow |
| 502 ${dir}djpeg${suffix} -dct int -ppm |
| 503 -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg) |
| 504 add_test(djpeg${suffix}-rgb-islow-cmp |
| 505 ${MD5CMP} ${MD5_PPM_RGB_ISLOW} testout_rgb_islow.ppm) |
| 506 |
| 507 if(NOT WITH_12BIT) |
| 508 # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff |
| 509 add_test(djpeg${suffix}-rgb-islow-565 |
| 510 ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp |
| 511 -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg) |
| 512 add_test(djpeg${suffix}-rgb-islow-565-cmp |
| 513 ${MD5CMP} ${MD5_BMP_RGB_ISLOW_565} testout_rgb_islow_565.bmp) |
| 514 |
| 515 # CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff |
| 516 add_test(djpeg${suffix}-rgb-islow-565D |
| 517 ${dir}djpeg${suffix} -dct int -rgb565 -bmp |
| 518 -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg) |
| 519 add_test(djpeg${suffix}-rgb-islow-565D-cmp |
| 520 ${MD5CMP} ${MD5_BMP_RGB_ISLOW_565D} testout_rgb_islow_565D.bmp) |
| 521 endif() |
| 522 |
| 523 # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff |
| 524 add_test(cjpeg${suffix}-422-ifast-opt |
| 525 ${dir}cjpeg${suffix} -sample 2x1 -dct fast -opt |
| 526 -outfile testout_422_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm) |
| 527 add_test(cjpeg${suffix}-422-ifast-opt-cmp |
| 528 ${MD5CMP} ${MD5_JPEG_422_IFAST_OPT} testout_422_ifast_opt.jpg) |
| 529 |
| 530 # CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff |
| 531 add_test(djpeg${suffix}-422-ifast |
| 532 ${dir}djpeg${suffix} -dct fast |
| 533 -outfile testout_422_ifast.ppm testout_422_ifast_opt.jpg) |
| 534 add_test(djpeg${suffix}-422-ifast-cmp |
| 535 ${MD5CMP} ${MD5_PPM_422_IFAST} testout_422_ifast.ppm) |
| 536 |
| 537 # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff |
| 538 add_test(djpeg${suffix}-422m-ifast |
| 539 ${dir}djpeg${suffix} -dct fast -nosmooth |
| 540 -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg) |
| 541 add_test(djpeg${suffix}-422m-ifast-cmp |
| 542 ${MD5CMP} ${MD5_PPM_422M_IFAST} testout_422m_ifast.ppm) |
| 543 |
| 544 if(NOT WITH_12BIT) |
| 545 # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff |
| 546 add_test(djpeg${suffix}-422m-ifast-565 |
| 547 ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp |
| 548 -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg) |
| 549 add_test(djpeg${suffix}-422m-ifast-565-cmp |
| 550 ${MD5CMP} ${MD5_BMP_422M_IFAST_565} testout_422m_ifast_565.bmp) |
| 551 |
| 552 # CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff |
| 553 add_test(djpeg${suffix}-422m-ifast-565D |
| 554 ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp |
| 555 -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg) |
| 556 add_test(djpeg${suffix}-422m-ifast-565D-cmp |
| 557 ${MD5CMP} ${MD5_BMP_422M_IFAST_565D} testout_422m_ifast_565D.bmp) |
| 558 endif() |
| 559 |
| 560 # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff |
| 561 add_test(cjpeg${suffix}-420-q100-ifast-prog |
| 562 ${dir}cjpeg${suffix} -sample 2x2 -quality 100 -dct fast -prog |
| 563 -outfile testout_420_q100_ifast_prog.jpg ${TESTIMAGES}/testorig.ppm) |
| 564 add_test(cjpeg${suffix}-420-q100-ifast-prog-cmp |
| 565 ${MD5CMP} ${MD5_JPEG_420_IFAST_Q100_PROG} testout_420_q100_ifast_prog.jpg) |
| 566 |
| 567 # CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff |
| 568 add_test(djpeg${suffix}-420-q100-ifast-prog |
| 569 ${dir}djpeg${suffix} -dct fast |
| 570 -outfile testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg) |
| 571 add_test(djpeg${suffix}-420-q100-ifast-prog-cmp |
| 572 ${MD5CMP} ${MD5_PPM_420_Q100_IFAST} testout_420_q100_ifast.ppm) |
| 573 |
| 574 # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff |
| 575 add_test(djpeg${suffix}-420m-q100-ifast-prog |
| 576 ${dir}djpeg${suffix} -dct fast -nosmooth |
| 577 -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg) |
| 578 add_test(djpeg${suffix}-420m-q100-ifast-prog-cmp |
| 579 ${MD5CMP} ${MD5_PPM_420M_Q100_IFAST} testout_420m_q100_ifast.ppm) |
| 580 |
| 581 # CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff |
| 582 add_test(cjpeg${suffix}-gray-islow |
| 583 ${dir}cjpeg${suffix} -gray -dct int |
| 584 -outfile testout_gray_islow.jpg ${TESTIMAGES}/testorig.ppm) |
| 585 add_test(cjpeg${suffix}-gray-islow-cmp |
| 586 ${MD5CMP} ${MD5_JPEG_GRAY_ISLOW} testout_gray_islow.jpg) |
| 587 |
| 588 # CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff |
| 589 add_test(djpeg${suffix}-gray-islow |
| 590 ${dir}djpeg${suffix} -dct int |
| 591 -outfile testout_gray_islow.ppm testout_gray_islow.jpg) |
| 592 add_test(djpeg${suffix}-gray-islow-cmp |
| 593 ${MD5CMP} ${MD5_PPM_GRAY_ISLOW} testout_gray_islow.ppm) |
| 594 |
| 595 # CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff |
| 596 add_test(djpeg${suffix}-gray-islow-rgb |
| 597 ${dir}djpeg${suffix} -dct int -rgb |
| 598 -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg) |
| 599 add_test(djpeg${suffix}-gray-islow-rgb-cmp |
| 600 ${MD5CMP} ${MD5_PPM_GRAY_ISLOW_RGB} testout_gray_islow_rgb.ppm) |
| 601 |
| 602 if(NOT WITH_12BIT) |
| 603 # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff |
| 604 add_test(djpeg${suffix}-gray-islow-565 |
| 605 ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp |
| 606 -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg) |
| 607 add_test(djpeg${suffix}-gray-islow-565-cmp |
| 608 ${MD5CMP} ${MD5_BMP_GRAY_ISLOW_565} testout_gray_islow_565.bmp) |
| 609 |
| 610 # CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff |
| 611 add_test(djpeg${suffix}-gray-islow-565D |
| 612 ${dir}djpeg${suffix} -dct int -rgb565 -bmp |
| 613 -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg) |
| 614 add_test(djpeg${suffix}-gray-islow-565D-cmp |
| 615 ${MD5CMP} ${MD5_BMP_GRAY_ISLOW_565D} testout_gray_islow_565D.bmp) |
| 616 endif() |
| 617 |
| 618 # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow |
| 619 # ENT: 2-pass huff |
| 620 add_test(cjpeg${suffix}-420s-ifast-opt |
| 621 ${dir}cjpeg${suffix} -sample 2x2 -smooth 1 -dct int -opt |
| 622 -outfile testout_420s_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm) |
| 623 add_test(cjpeg${suffix}-420s-ifast-opt-cmp |
| 624 ${MD5CMP} ${MD5_JPEG_420S_IFAST_OPT} testout_420s_ifast_opt.jpg) |
| 625 |
| 626 # CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff |
| 627 add_test(cjpeg${suffix}-3x2-float-prog |
| 628 ${dir}cjpeg${suffix} -sample 3x2 -dct float -prog |
| 629 -outfile testout_3x2_float_prog.jpg ${TESTIMAGES}/testorig.ppm) |
| 630 add_test(cjpeg${suffix}-3x2-float-prog-cmp |
| 631 ${MD5CMP} ${MD5_JPEG_3x2_FLOAT_PROG} testout_3x2_float_prog.jpg) |
| 632 |
| 633 # CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff |
| 634 add_test(djpeg${suffix}-3x2-float-prog |
| 635 ${dir}djpeg${suffix} -dct float |
| 636 -outfile testout_3x2_float.ppm testout_3x2_float_prog.jpg) |
| 637 add_test(djpeg${suffix}-3x2-float-prog-cmp |
| 638 ${MD5CMP} ${MD5_PPM_3x2_FLOAT} testout_3x2_float.ppm) |
| 639 |
| 640 if(WITH_ARITH_ENC) |
| 641 # CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith |
| 642 add_test(cjpeg${suffix}-420-islow-ari |
| 643 ${dir}cjpeg${suffix} -dct int -arithmetic |
| 644 -outfile testout_420_islow_ari.jpg ${TESTIMAGES}/testorig.ppm) |
| 645 add_test(cjpeg${suffix}-420-islow-ari-cmp |
| 646 ${MD5CMP} ${MD5_JPEG_420_ISLOW_ARI} testout_420_islow_ari.jpg) |
| 647 |
| 648 add_test(jpegtran${suffix}-420-islow-ari |
| 649 ${dir}jpegtran${suffix} -arithmetic |
| 650 -outfile testout_420_islow_ari.jpg ${TESTIMAGES}/testimgint.jpg) |
| 651 add_test(jpegtran${suffix}-420-islow-ari-cmp |
| 652 ${MD5CMP} ${MD5_JPEG_420_ISLOW_ARI} testout_420_islow_ari.jpg) |
| 653 |
| 654 # CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith |
| 655 add_test(cjpeg${suffix}-444-islow-progari |
| 656 ${dir}cjpeg${suffix} -sample 1x1 -dct int -prog -arithmetic |
| 657 -outfile testout_444_islow_progari.jpg ${TESTIMAGES}/testorig.ppm) |
| 658 add_test(cjpeg${suffix}-444-islow-progari-cmp |
| 659 ${MD5CMP} ${MD5_JPEG_444_ISLOW_PROGARI} testout_444_islow_progari.jpg) |
| 660 endif() |
| 661 |
| 662 if(WITH_ARITH_DEC) |
| 663 # CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith |
| 664 add_test(djpeg${suffix}-420m-ifast-ari |
| 665 ${dir}djpeg${suffix} -fast -ppm |
| 666 -outfile testout_420m_ifast_ari.ppm ${TESTIMAGES}/testimgari.jpg) |
| 667 add_test(djpeg${suffix}-420m-ifast-ari-cmp |
| 668 ${MD5CMP} ${MD5_PPM_420M_IFAST_ARI} testout_420m_ifast_ari.ppm) |
| 669 |
| 670 add_test(jpegtran${suffix}-420-islow |
| 671 ${dir}jpegtran${suffix} |
| 672 -outfile testout_420_islow.jpg ${TESTIMAGES}/testimgari.jpg) |
| 673 add_test(jpegtran${suffix}-420-islow-cmp |
| 674 ${MD5CMP} ${MD5_JPEG_420_ISLOW} testout_420_islow.jpg) |
| 675 endif() |
| 676 |
| 677 # 2/1-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff |
| 678 # 15/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff |
| 679 # 13/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff |
| 680 # 11/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff |
| 681 # 9/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff |
| 682 # 7/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow |
| 683 # ENT: huff |
| 684 # 3/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow |
| 685 # ENT: huff |
| 686 # 5/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow |
| 687 # ENT: huff |
| 688 # 1/2-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow |
| 689 # ENT: huff |
| 690 # 3/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow |
| 691 # ENT: huff |
| 692 # 1/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow |
| 693 # ENT: huff |
| 694 # 1/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow |
| 695 # ENT: huff |
| 696 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) |
| 697 string(REGEX REPLACE "_" "/" scalearg ${scale}) |
| 698 add_test(djpeg${suffix}-420m-islow-${scale} |
| 699 ${dir}djpeg${suffix} -dct int -scale ${scalearg} -nosmooth -ppm |
| 700 -outfile testout_420m_islow_${scale}.ppm ${TESTIMAGES}/${TESTORIG}) |
| 701 add_test(djpeg${suffix}-420m-islow-${scale}-cmp |
| 702 ${MD5CMP} ${MD5_PPM_420M_ISLOW_${scale}} testout_420m_islow_${scale}.ppm) |
| 703 endforeach() |
| 704 |
| 705 if(NOT WITH_12BIT) |
| 706 # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff |
| 707 add_test(djpeg${suffix}-420-islow-256 |
| 708 ${dir}djpeg${suffix} -dct int -colors 256 -bmp |
| 709 -outfile testout_420_islow_256.bmp ${TESTIMAGES}/${TESTORIG}) |
| 710 add_test(djpeg${suffix}-420-islow-256-cmp |
| 711 ${MD5CMP} ${MD5_BMP_420_ISLOW_256} testout_420_islow_256.bmp) |
| 712 |
| 713 # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff |
| 714 add_test(djpeg${suffix}-420-islow-565 |
| 715 ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp |
| 716 -outfile testout_420_islow_565.bmp ${TESTIMAGES}/${TESTORIG}) |
| 717 add_test(djpeg${suffix}-420-islow-565-cmp |
| 718 ${MD5CMP} ${MD5_BMP_420_ISLOW_565} testout_420_islow_565.bmp) |
| 719 |
| 720 # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff |
| 721 add_test(djpeg${suffix}-420-islow-565D |
| 722 ${dir}djpeg${suffix} -dct int -rgb565 -bmp |
| 723 -outfile testout_420_islow_565D.bmp ${TESTIMAGES}/${TESTORIG}) |
| 724 add_test(djpeg${suffix}-420-islow-565D-cmp |
| 725 ${MD5CMP} ${MD5_BMP_420_ISLOW_565D} testout_420_islow_565D.bmp) |
| 726 |
| 727 # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff |
| 728 add_test(djpeg${suffix}-420m-islow-565 |
| 729 ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp |
| 730 -outfile testout_420m_islow_565.bmp ${TESTIMAGES}/${TESTORIG}) |
| 731 add_test(djpeg${suffix}-420m-islow-565-cmp |
| 732 ${MD5CMP} ${MD5_BMP_420M_ISLOW_565} testout_420m_islow_565.bmp) |
| 733 |
| 734 # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff |
| 735 add_test(djpeg${suffix}-420m-islow-565D |
| 736 ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp |
| 737 -outfile testout_420m_islow_565D.bmp ${TESTIMAGES}/${TESTORIG}) |
| 738 add_test(djpeg${suffix}-420m-islow-565D-cmp |
| 739 ${MD5CMP} ${MD5_BMP_420M_ISLOW_565D} testout_420m_islow_565D.bmp) |
| 740 endif() |
| 741 |
| 742 # Partial decode tests. These tests are designed to cover all of the |
| 743 # possible code paths in jpeg_skip_scanlines(). |
| 744 |
| 745 # Context rows: Yes Intra-iMCU row: Yes iMCU row prefetch: No ENT: huff |
| 746 add_test(djpeg${suffix}-420-islow-skip15_31 |
| 747 ${dir}djpeg${suffix} -dct int -skip 15,31 -ppm |
| 748 -outfile testout_420_islow_skip15,31.ppm ${TESTIMAGES}/${TESTORIG}) |
| 749 add_test(djpeg${suffix}-420-islow-skip15_31-cmp |
| 750 ${MD5CMP} ${MD5_PPM_420_ISLOW_SKIP15_31} testout_420_islow_skip15,31.ppm) |
| 751 |
| 752 # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: Yes ENT: arith |
| 753 if(WITH_ARITH_DEC) |
| 754 add_test(djpeg${suffix}-420-islow-ari-skip16_139 |
| 755 ${dir}djpeg${suffix} -dct int -skip 16,139 -ppm |
| 756 -outfile testout_420_islow_ari_skip16,139.ppm |
| 757 ${TESTIMAGES}/testimgari.jpg) |
| 758 add_test(djpeg${suffix}-420-islow-ari_skip16_139-cmp |
| 759 ${MD5CMP} ${MD5_PPM_420_ISLOW_ARI_SKIP16_139} |
| 760 testout_420_islow_ari_skip16,139.ppm) |
| 761 endif() |
| 762 |
| 763 # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: prog hu
ff |
| 764 add_test(cjpeg${suffix}-420-islow-prog |
| 765 ${dir}cjpeg${suffix} -dct int -prog |
| 766 -outfile testout_420_islow_prog.jpg ${TESTIMAGES}/testorig.ppm) |
| 767 add_test(djpeg${suffix}-420-islow-prog-crop62x62_71_71 |
| 768 ${dir}djpeg${suffix} -dct int -crop 62x62+71+71 -ppm |
| 769 -outfile testout_420_islow_prog_crop62x62,71,71.ppm |
| 770 testout_420_islow_prog.jpg) |
| 771 add_test(djpeg${suffix}-420-islow-prog-crop62x62_71_71-cmp |
| 772 ${MD5CMP} ${MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71} |
| 773 testout_420_islow_prog_crop62x62,71,71.ppm) |
| 774 |
| 775 # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: arith |
| 776 if(WITH_ARITH_DEC) |
| 777 add_test(djpeg${suffix}-420-islow-ari-crop53x53_4_4 |
| 778 ${dir}djpeg${suffix} -dct int -crop 53x53+4+4 -ppm |
| 779 -outfile testout_420_islow_ari_crop53x53,4,4.ppm |
| 780 ${TESTIMAGES}/testimgari.jpg) |
| 781 add_test(djpeg${suffix}-420-islow-ari-crop53x53_4_4-cmp |
| 782 ${MD5CMP} ${MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4} |
| 783 testout_420_islow_ari_crop53x53,4,4.ppm) |
| 784 endif() |
| 785 |
| 786 # Context rows: No Intra-iMCU row: Yes ENT: huff |
| 787 add_test(cjpeg${suffix}-444-islow |
| 788 ${dir}cjpeg${suffix} -dct int -sample 1x1 |
| 789 -outfile testout_444_islow.jpg ${TESTIMAGES}/testorig.ppm) |
| 790 add_test(djpeg${suffix}-444-islow-skip1_6 |
| 791 ${dir}djpeg${suffix} -dct int -skip 1,6 -ppm |
| 792 -outfile testout_444_islow_skip1,6.ppm testout_444_islow.jpg) |
| 793 add_test(djpeg${suffix}-444-islow-skip1_6-cmp |
| 794 ${MD5CMP} ${MD5_PPM_444_ISLOW_SKIP1_6} testout_444_islow_skip1,6.ppm) |
| 795 |
| 796 # Context rows: No Intra-iMCU row: No ENT: prog huff |
| 797 add_test(cjpeg${suffix}-444-islow-prog |
| 798 ${dir}cjpeg${suffix} -dct int -prog -sample 1x1 |
| 799 -outfile testout_444_islow_prog.jpg ${TESTIMAGES}/testorig.ppm) |
| 800 add_test(djpeg${suffix}-444-islow-prog-crop98x98_13_13 |
| 801 ${dir}djpeg${suffix} -dct int -crop 98x98+13+13 -ppm |
| 802 -outfile testout_444_islow_prog_crop98x98,13,13.ppm |
| 803 testout_444_islow_prog.jpg) |
| 804 add_test(djpeg${suffix}-444-islow-prog_crop98x98_13_13-cmp |
| 805 ${MD5CMP} ${MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13} |
| 806 testout_444_islow_prog_crop98x98,13,13.ppm) |
| 807 |
| 808 # Context rows: No Intra-iMCU row: No ENT: arith |
| 809 if(WITH_ARITH_ENC) |
| 810 add_test(cjpeg${suffix}-444-islow-ari |
| 811 ${dir}cjpeg${suffix} -dct int -arithmetic -sample 1x1 |
| 812 -outfile testout_444_islow_ari.jpg ${TESTIMAGES}/testorig.ppm) |
| 813 if(WITH_ARITH_DEC) |
| 814 add_test(djpeg${suffix}-444-islow-ari-crop37x37_0_0 |
| 815 ${dir}djpeg${suffix} -dct int -crop 37x37+0+0 -ppm |
| 816 -outfile testout_444_islow_ari_crop37x37,0,0.ppm |
| 817 testout_444_islow_ari.jpg) |
| 818 add_test(djpeg${suffix}-444-islow-ari-crop37x37_0_0-cmp |
| 819 ${MD5CMP} ${MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0} |
| 820 testout_444_islow_ari_crop37x37,0,0.ppm) |
| 821 endif() |
| 822 endif() |
| 823 |
| 824 add_test(jpegtran${suffix}-crop |
| 825 ${dir}jpegtran${suffix} -crop 120x90+20+50 -transpose -perfect |
| 826 -outfile testout_crop.jpg ${TESTIMAGES}/${TESTORIG}) |
| 827 add_test(jpegtran${suffix}-crop-cmp |
| 828 ${MD5CMP} ${MD5_JPEG_CROP} testout_crop.jpg) |
| 829 |
| 830 endforeach() |
| 831 |
| 832 add_custom_target(testclean COMMAND ${MD5CMP} -P |
| 833 ${CMAKE_SOURCE_DIR}/cmakescripts/testclean.cmake) |
| 834 |
| 835 |
| 836 # |
| 837 # Installer |
| 838 # |
| 839 |
| 840 if(MSVC) |
| 841 set(INST_PLATFORM "Visual C++") |
| 842 set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc) |
| 843 set(INST_REG_NAME ${CMAKE_PROJECT_NAME}) |
| 844 elseif(MINGW) |
| 845 set(INST_PLATFORM GCC) |
| 846 set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc) |
| 847 set(INST_REG_NAME ${CMAKE_PROJECT_NAME}-gcc) |
| 848 set(INST_DEFS -DGCC) |
| 849 endif() |
| 850 |
| 851 if(64BIT) |
| 852 set(INST_PLATFORM "${INST_PLATFORM} 64-bit") |
| 853 set(INST_NAME ${INST_NAME}64) |
| 854 set(INST_REG_NAME ${INST_DIR}64) |
| 855 set(INST_DEFS ${INST_DEFS} -DWIN64) |
| 856 endif() |
| 857 |
| 858 if(WITH_JAVA) |
| 859 set(INST_DEFS ${INST_DEFS} -DJAVA) |
| 860 endif() |
| 861 |
| 862 if(MSVC_IDE) |
| 863 set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\") |
| 864 else() |
| 865 set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=") |
| 866 endif() |
| 867 |
| 868 STRING(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX}) |
| 869 |
| 870 configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY) |
| 871 |
| 872 if(WITH_JAVA) |
| 873 set(JAVA_DEPEND java) |
| 874 endif() |
| 875 add_custom_target(installer |
| 876 makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi |
| 877 DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom |
| 878 cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND} |
| 879 SOURCES libjpeg-turbo.nsi) |
| 880 |
| 881 if(WITH_TURBOJPEG) |
| 882 if(ENABLE_SHARED) |
| 883 install(TARGETS turbojpeg tjbench |
| 884 ARCHIVE DESTINATION lib |
| 885 LIBRARY DESTINATION lib |
| 886 RUNTIME DESTINATION bin) |
| 887 endif() |
| 888 if(ENABLE_STATIC) |
| 889 install(TARGETS turbojpeg-static ARCHIVE DESTINATION lib) |
| 890 if(NOT ENABLE_SHARED) |
| 891 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/tjbench-static.exe |
| 892 DESTINATION bin RENAME tjbench.exe) |
| 893 endif() |
| 894 endif() |
| 895 install(FILES ${CMAKE_SOURCE_DIR}/turbojpeg.h DESTINATION include) |
| 896 endif() |
| 897 |
| 898 if(ENABLE_STATIC) |
| 899 install(TARGETS jpeg-static ARCHIVE DESTINATION lib) |
| 900 if(NOT ENABLE_SHARED) |
| 901 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/cjpeg-static.exe |
| 902 DESTINATION bin RENAME cjpeg.exe) |
| 903 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/djpeg-static.exe |
| 904 DESTINATION bin RENAME djpeg.exe) |
| 905 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/jpegtran-static.exe |
| 906 DESTINATION bin RENAME jpegtran.exe) |
| 907 endif() |
| 908 endif() |
| 909 |
| 910 install(TARGETS rdjpgcom wrjpgcom RUNTIME DESTINATION bin) |
| 911 |
| 912 install(FILES ${CMAKE_SOURCE_DIR}/README.ijg ${CMAKE_SOURCE_DIR}/README.md |
| 913 ${CMAKE_SOURCE_DIR}/example.c ${CMAKE_SOURCE_DIR}/libjpeg.txt |
| 914 ${CMAKE_SOURCE_DIR}/structure.txt ${CMAKE_SOURCE_DIR}/usage.txt |
| 915 ${CMAKE_SOURCE_DIR}/wizard.txt |
| 916 DESTINATION doc) |
| 917 |
| 918 install(FILES ${CMAKE_BINARY_DIR}/jconfig.h ${CMAKE_SOURCE_DIR}/jerror.h |
| 919 ${CMAKE_SOURCE_DIR}/jmorecfg.h ${CMAKE_SOURCE_DIR}/jpeglib.h |
| 920 DESTINATION include) |
OLD | NEW |