diff --git a/jpegturbo/BUILDING.txt b/jpegturbo/BUILDING.txt index c800b6e6..ea8d9061 100644 --- a/jpegturbo/BUILDING.txt +++ b/jpegturbo/BUILDING.txt @@ -396,7 +396,7 @@ to the configure command line. ARMv8 64-bit Build (Xcode 5.0.x and later, Clang): -Code will run on iPhone 5S/iPad Mini 2 and newer. +Code will run on iPhone 5S/iPad Mini 2/iPad Air and newer. Set the following shell variables for simplicity: diff --git a/jpegturbo/CMakeLists.txt b/jpegturbo/CMakeLists.txt index 3795d530..3295deaf 100644 --- a/jpegturbo/CMakeLists.txt +++ b/jpegturbo/CMakeLists.txt @@ -9,7 +9,7 @@ if(POLICY CMP0022) endif() project(libjpeg-turbo C) -set(VERSION 1.4.0) +set(VERSION 1.4.1) if(CYGWIN OR NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD) @@ -53,6 +53,8 @@ option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions w 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) +option(ENABLE_STATIC "Build static libraries" TRUE) +option(ENABLE_SHARED "Build shared libraries" TRUE) if(WITH_12BIT) set(WITH_SIMD FALSE) @@ -119,14 +121,18 @@ else() 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() - + option(WITH_CRT_DLL + "Link all libjpeg-turbo libraries and executables with the C run-time DLL (msvcr*.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 it." + FALSE) + if(NOT WITH_CRT_DLL) + # 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() + endif() add_definitions(-W3 -wd4996) endif() @@ -216,16 +222,21 @@ endif() if(WITH_JAVA) add_subdirectory(java) + set(ENABLE_SHARED TRUE) 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) +if(ENABLE_SHARED) + add_subdirectory(sharedlib) endif() -if(WITH_SIMD) - add_dependencies(jpeg-static simd) + +if(ENABLE_STATIC OR WITH_TURBOJPEG) + 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() endif() if(WITH_TURBOJPEG) @@ -235,40 +246,44 @@ if(WITH_TURBOJPEG) 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 "") + if(ENABLE_SHARED) + 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) + add_executable(tjunittest tjunittest.c tjutil.c) + target_link_libraries(tjunittest turbojpeg) + + 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") endif() - add_executable(tjunittest tjunittest.c tjutil.c) - target_link_libraries(tjunittest turbojpeg) + if(ENABLE_STATIC) + 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-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-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() endif() if(WITH_12BIT) @@ -279,19 +294,21 @@ else() 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) +if(ENABLE_STATIC) + 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 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(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(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") +endif() add_executable(rdjpgcom rdjpgcom.c) @@ -417,7 +434,15 @@ if(WITH_JAVA) TJUnitTest -bi -yuv -noyuvpad) endif() -foreach(libtype shared static) +set(TEST_LIBTYPES "") +if(ENABLE_SHARED) + set(TEST_LIBTYPES ${TEST_LIBTYPES} shared) +endif() +if(ENABLE_STATIC) + set(TEST_LIBTYPES ${TEST_LIBTYPES} static) +endif() + +foreach(libtype ${TEST_LIBTYPES}) if(libtype STREQUAL "shared") set(dir sharedlib/) else() @@ -790,13 +815,35 @@ add_custom_target(installer SOURCES libjpeg-turbo.nsi) if(WITH_TURBOJPEG) - set(TURBOJPEG_TARGETS turbojpeg turbojpeg-static tjbench) + if(ENABLE_SHARED) + install(TARGETS turbojpeg tjbench + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) + endif() + if(ENABLE_STATIC) + install(TARGETS turbojpeg-static ARCHIVE DESTINATION lib) + if(NOT ENABLE_SHARED) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/tjbench-static.exe + DESTINATION bin RENAME tjbench.exe) + endif() + endif() + install(FILES ${CMAKE_SOURCE_DIR}/turbojpeg.h DESTINATION include) endif() -install(TARGETS jpeg-static rdjpgcom wrjpgcom ${TURBOJPEG_TARGETS} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin -) + +if(ENABLE_STATIC) + install(TARGETS jpeg-static ARCHIVE DESTINATION lib) + if(NOT ENABLE_SHARED) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/cjpeg-static.exe + DESTINATION bin RENAME cjpeg.exe) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/djpeg-static.exe + DESTINATION bin RENAME djpeg.exe) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/jpegtran-static.exe + DESTINATION bin RENAME jpegtran.exe) + endif() +endif() + +install(TARGETS rdjpgcom wrjpgcom 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 @@ -806,4 +853,4 @@ install(FILES ${CMAKE_SOURCE_DIR}/README ${CMAKE_SOURCE_DIR}/README-turbo.txt 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) + DESTINATION include) diff --git a/jpegturbo/ChangeLog.txt b/jpegturbo/ChangeLog.txt index 0afab584..c3b33164 100644 --- a/jpegturbo/ChangeLog.txt +++ b/jpegturbo/ChangeLog.txt @@ -1,3 +1,63 @@ +1.4.1 +===== + +[1] tjbench now properly handles CMYK/YCCK JPEG files. Passing an argument of +-cmyk (instead of, for instance, -rgb) will cause tjbench to internally convert +the source bitmap to CMYK prior to compression, to generate YCCK JPEG files, +and to internally convert the decompressed CMYK pixels back to RGB after +decompression (the latter is done automatically if a CMYK or YCCK JPEG is +passed to tjbench as a source image.) The CMYK<->RGB conversion operation is +not benchmarked. NOTE: The quick & dirty CMYK<->RGB conversions that tjbench +uses are suitable for testing only. Proper conversion between CMYK and RGB +requires a color management system. + +[2] 'make test' now performs additional bitwise regression tests using tjbench, +mainly for the purpose of testing compression from/decompression to a subregion +of a larger image buffer. + +[3] 'make test' no longer tests the regression of the floating point DCT/IDCT +by default, since the results of those tests can vary if the algorithms in +question are not implemented using SIMD instructions on a particular platform. +See the comments in Makefile.am for information on how to re-enable the tests +and to specify an expected result for them based on the particulars of your +platform. + +[4] The NULL color conversion routines have been significantly optimized, +which speeds up the compression of RGB and CMYK JPEGs by 5-20% when using +64-bit code and 0-3% when using 32-bit code, and the decompression of those +images by 10-30% when using 64-bit code and 3-12% when using 32-bit code. + +[5] Fixed an "illegal instruction" error that occurred when djpeg from a +SIMD-enabled libjpeg-turbo MIPS build was executed with the -nosmooth option on +a MIPS machine that lacked DSPr2 support. The MIPS SIMD routines for h2v1 and +h2v2 merged upsampling were not properly checking for the existence of DSPr2. + +[6] Performance has been improved significantly on 64-bit non-Linux and +non-Windows platforms (generally 10-20% faster compression and 5-10% faster +decompression.) Due to an oversight, the 64-bit version of the accelerated +Huffman codec was not being compiled in when libjpeg-turbo was built on +platforms other than Windows or Linux. Oops. + +[7] Fixed an extremely rare bug in the Huffman encoder that caused 64-bit +builds of libjpeg-turbo to incorrectly encode a few specific test images when +quality=98, an optimized Huffman table, and the slow integer forward DCT were +used. + +[8] The Windows (CMake) build system now supports building only static or only +shared libraries. This is accomplished by adding either -DENABLE_STATIC=0 or +-DENABLE_SHARED=0 to the CMake command line. + +[9] TurboJPEG API functions will now return an error code if a warning is +triggered in the underlying libjpeg API. For instance, if a JPEG file is +corrupt, the TurboJPEG decompression functions will attempt to decompress +as much of the image as possible, but those functions will now return -1 to +indicate that the decompression was not entirely successful. + +[10] Fixed a bug in the MIPS DSPr2 4:2:2 fancy upsampling routine that caused a +buffer overflow (and subsequent segfault) when decompressing a 4:2:2 JPEG image +in which the right-most MCU was 5 or 6 pixels wide. + + 1.4.0 ===== @@ -10,7 +70,7 @@ endian machines. This has been fixed. [3] Fixed an issue in tjPlaneSizeYUV() whereby it would erroneously return 1 instead of -1 if componentID was > 0 and subsamp was TJSAMP_GRAY. -[3] Fixed an issue in tjBufSizeYUV2() wherby it would erroneously return 0 +[3] Fixed an issue in tjBufSizeYUV2() whereby it would erroneously return 0 instead of -1 if width was < 1. [5] The Huffman encoder now uses clz and bsr instructions for bit counting on diff --git a/jpegturbo/Makefile.am b/jpegturbo/Makefile.am index b32a41b2..fe5c3195 100644 --- a/jpegturbo/Makefile.am +++ b/jpegturbo/Makefile.am @@ -158,11 +158,10 @@ 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 +exampledir = $(docdir) dist_example_DATA = example.c @@ -192,8 +191,13 @@ 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_JPEG_3x2_FLOAT_PROG_SSE = a8c17daf77b457725ec929e215b603f8 +MD5_PPM_3x2_FLOAT_SSE = 42876ab9e5c2f76a87d08db5fbd57956 +MD5_JPEG_3x2_FLOAT_PROG_32BIT = a8c17daf77b457725ec929e215b603f8 +MD5_PPM_3x2_FLOAT_32BIT = 42876ab9e5c2f76a87d08db5fbd57956 +MD5_PPM_3x2_FLOAT_64BIT = d6fbc71153b3d8ded484dbc17c7b9cf4 +MD5_JPEG_3x2_IFAST_PROG = 1396cc2b7185cfe943d408c9d305339e +MD5_PPM_3x2_IFAST = 3975985ef6eeb0a2cdc58daa651ccc00 MD5_PPM_420M_ISLOW_2_1 = 4ca6be2a6f326ff9eaab63e70a8259c0 MD5_PPM_420M_ISLOW_15_8 = 12aa9f9534c1b3d7ba047322226365eb MD5_PPM_420M_ISLOW_13_8 = f7e22817c7b25e1393e4ec101e9d4e96 @@ -230,13 +234,13 @@ 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_3x2_FLOAT_PROG_SSE = 343e3f8caf8af5986ebaf0bdc13b5c71 +MD5_PPM_3x2_FLOAT_SSE = 1a75f36e5904d6fc3a85a43da9ad89bb +MD5_JPEG_3x2_FLOAT_PROG_32BIT = 9bca803d2042bd1eb03819e2bf92b3e5 +MD5_PPM_3x2_FLOAT_32BIT = f6bfab038438ed8f5522fbd33595dcdc +MD5_PPM_3x2_FLOAT_64BIT = 0e917a34193ef976b679a6b069b1be26 +MD5_JPEG_3x2_IFAST_PROG = 1ee5d2c1a77f2da495f993c8c7cceca5 +MD5_PPM_3x2_IFAST = fd283664b3b49127984af0a7f118fccd MD5_JPEG_420_ISLOW_ARI = e986fb0a637a8d833d96e8a6d6d84ea1 MD5_JPEG_444_ISLOW_PROGARI = 0a8f1c8f66e113c3cf635df0a475a617 MD5_PPM_420M_IFAST_ARI = 72b59a99bcf1de24c5b27d151bde2437 @@ -262,7 +266,10 @@ MD5_JPEG_CROP = b4197f377e621c4e9b1d20471432610d endif -test: testclean all +.PHONY: test +test: tjquicktest tjbittest bittest + +tjquicktest: testclean all if WITH_TURBOJPEG if WITH_JAVA @@ -279,6 +286,66 @@ endif ./tjunittest -yuv -alloc ./tjunittest -yuv -noyuvpad endif + echo GREAT SUCCESS! + +tjbittest: testclean all + +if WITH_TURBOJPEG + +MD5_PPM_GRAY_TILE = 89d3ca21213d9d864b50b4e4e7de4ca6 +MD5_PPM_420_8x8_TILE = 847fceab15c5b7b911cb986cf0f71de3 +MD5_PPM_420_16x16_TILE = ca45552a93687e078f7137cc4126a7b0 +MD5_PPM_420_32x32_TILE = d8676f1d6b68df358353bba9844f4a00 +MD5_PPM_420_64x64_TILE = 4e4c1a3d7ea4bace4f868bcbe83b7050 +MD5_PPM_420_128x128_TILE = f24c3429c52265832beab9df72a0ceae +MD5_PPM_420M_8x8_TILE = bc25320e1f4c31ce2e610e43e9fd173c +MD5_PPM_420M_TILE = 75ffdf14602258c5c189522af57fa605 +MD5_PPM_422_8x8_TILE = d83dacd9fc73b0a6f10c09acad64eb1e +MD5_PPM_422_16x16_TILE = 35077fb610d72dd743b1eb0cbcfe10fb +MD5_PPM_422_32x32_TILE = e6902ed8a449ecc0f0d6f2bf945f65f7 +MD5_PPM_422_64x64_TILE = 2b4502a8f316cedbde1da7bce3d2231e +MD5_PPM_422_128x128_TILE = f0b5617d578f5e13c8eee215d64d4877 +MD5_PPM_422M_8x8_TILE = 828941d7f41cd6283abd6beffb7fd51d +MD5_PPM_422M_TILE = e877ae1324c4a280b95376f7f018172f +MD5_PPM_444_TILE = 7964e41e67cfb8d0a587c0aa4798f9c3 + +# Test compressing from/decompressing to an arbitrary subregion of a larger +# image buffer + cp $(srcdir)/testimages/testorig.ppm testout_tile.ppm + ./tjbench testout_tile.ppm 95 -rgb -quiet -tile -benchtime 0.01 >/dev/null 2>&1 + for i in 8 16 32 64 128; do \ + md5/md5cmp $(MD5_PPM_GRAY_TILE) testout_tile_GRAY_Q95_$$i\x$$i.ppm; \ + done + md5/md5cmp $(MD5_PPM_420_8x8_TILE) testout_tile_420_Q95_8x8.ppm + md5/md5cmp $(MD5_PPM_420_16x16_TILE) testout_tile_420_Q95_16x16.ppm + md5/md5cmp $(MD5_PPM_420_32x32_TILE) testout_tile_420_Q95_32x32.ppm + md5/md5cmp $(MD5_PPM_420_64x64_TILE) testout_tile_420_Q95_64x64.ppm + md5/md5cmp $(MD5_PPM_420_128x128_TILE) testout_tile_420_Q95_128x128.ppm + md5/md5cmp $(MD5_PPM_422_8x8_TILE) testout_tile_422_Q95_8x8.ppm + md5/md5cmp $(MD5_PPM_422_16x16_TILE) testout_tile_422_Q95_16x16.ppm + md5/md5cmp $(MD5_PPM_422_32x32_TILE) testout_tile_422_Q95_32x32.ppm + md5/md5cmp $(MD5_PPM_422_64x64_TILE) testout_tile_422_Q95_64x64.ppm + md5/md5cmp $(MD5_PPM_422_128x128_TILE) testout_tile_422_Q95_128x128.ppm + for i in 8 16 32 64 128; do \ + md5/md5cmp $(MD5_PPM_444_TILE) testout_tile_444_Q95_$$i\x$$i.ppm; \ + done + rm testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_* + + ./tjbench testout_tile.ppm 95 -rgb -fastupsample -quiet -tile -benchtime 0.01 >/dev/null 2>&1 + md5/md5cmp $(MD5_PPM_420M_8x8_TILE) testout_tile_420_Q95_8x8.ppm + for i in 16 32 64 128; do \ + md5/md5cmp $(MD5_PPM_420M_TILE) testout_tile_420_Q95_$$i\x$$i.ppm; \ + done + md5/md5cmp $(MD5_PPM_422M_8x8_TILE) testout_tile_422_Q95_8x8.ppm + for i in 16 32 64 128; do \ + md5/md5cmp $(MD5_PPM_422M_TILE) testout_tile_422_Q95_$$i\x$$i.ppm; \ + done + rm testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_* testout_tile.ppm + echo GREAT SUCCESS! + +endif + +bittest: testclean all # These tests are carefully crafted to provide full coverage of as many of the # underlying algorithms as possible (including all of the SIMD-accelerated @@ -370,14 +437,47 @@ endif md5/md5cmp $(MD5_JPEG_420S_IFAST_OPT) testout_420s_ifast_opt.jpg rm testout_420s_ifast_opt.jpg +# The output of the floating point tests is not validated by default, because +# the output differs depending on the type of floating point math used, and +# this is only deterministic if the DCT/IDCT are implemented using SIMD +# instructions on a particular platform. Pass one of the following on the make +# command line to validate the floating point tests against one of the expected # results: +# +# FLOATTEST=sse validate against the expected results from the libjpeg-turbo +# SSE SIMD extensions +# FLOATTEST=32bit validate against the expected results from the C code +# when running on a 32-bit FPU (or when SSE is being used for +# floating point math, which is generally the default with +# x86-64 compilers) +# FLOATTEST=64bit validate against the exepected results from the C code +# when running on a 64-bit FPU + # 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 + if [ "${FLOATTEST}" = "sse" ]; then \ + md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG_SSE) testout_3x2_float_prog.jpg; \ + elif [ "${FLOATTEST}" = "32bit" -o "${FLOATTEST}" = "64bit" ]; then \ + md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG_32BIT) testout_3x2_float_prog.jpg; \ + fi # 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 + if [ "${FLOATTEST}" = "sse" ]; then \ + md5/md5cmp $(MD5_PPM_3x2_FLOAT_SSE) testout_3x2_float.ppm; \ + elif [ "${FLOATTEST}" = "32bit" ]; then \ + md5/md5cmp $(MD5_PPM_3x2_FLOAT_32BIT) testout_3x2_float.ppm; \ + elif [ "${FLOATTEST}" = "64bit" ]; then \ + md5/md5cmp $(MD5_PPM_3x2_FLOAT_64BIT) testout_3x2_float.ppm; \ + fi rm testout_3x2_float.ppm testout_3x2_float_prog.jpg +# CC: RGB->YCC SAMP: fullsize/int FDCT: ifast ENT: prog huff + ./cjpeg -sample 3x2 -dct fast -prog -outfile testout_3x2_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_3x2_IFAST_PROG) testout_3x2_ifast_prog.jpg +# CC: YCC->RGB SAMP: fullsize/int IDCT: ifast ENT: prog huff + ./djpeg -dct fast -outfile testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg + md5/md5cmp $(MD5_PPM_3x2_IFAST) testout_3x2_ifast.ppm + rm testout_3x2_ifast.ppm testout_3x2_ifast_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 @@ -476,6 +576,7 @@ endif ./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 + echo GREAT SUCCESS! testclean: diff --git a/jpegturbo/Makefile.in b/jpegturbo/Makefile.in index effc700b..94052937 100644 --- a/jpegturbo/Makefile.in +++ b/jpegturbo/Makefile.in @@ -414,6 +414,7 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ +docdir = @docdir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -494,11 +495,10 @@ 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 +exampledir = $(docdir) dist_example_DATA = example.c EXTRA_DIST = win release $(DOCS) testimages CMakeLists.txt \ sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in doc doxygen.config \ @@ -531,13 +531,21 @@ EXTRA_DIST = win release $(DOCS) testimages CMakeLists.txt \ @WITH_12BIT_TRUE@MD5_PPM_GRAY_ISLOW_RGB = e96ee81c30a6ed422d466338bd3de65d @WITH_12BIT_FALSE@MD5_JPEG_420S_IFAST_OPT = 388708217ac46273ca33086b22827ed8 @WITH_12BIT_TRUE@MD5_JPEG_420S_IFAST_OPT = 7af8e60be4d9c227ec63ac9b6630855e -@WITH_12BIT_FALSE@@WITH_SSE_FLOAT_DCT_FALSE@MD5_JPEG_3x2_FLOAT_PROG = 9bca803d2042bd1eb03819e2bf92b3e5 # See README-turbo.txt for more details on why this next bit is necessary. -@WITH_12BIT_FALSE@@WITH_SSE_FLOAT_DCT_TRUE@MD5_JPEG_3x2_FLOAT_PROG = 343e3f8caf8af5986ebaf0bdc13b5c71 -@WITH_12BIT_TRUE@MD5_JPEG_3x2_FLOAT_PROG = a8c17daf77b457725ec929e215b603f8 -@WITH_12BIT_FALSE@@WITH_SSE_FLOAT_DCT_FALSE@MD5_PPM_3x2_FLOAT = f6bfab038438ed8f5522fbd33595dcdc -@WITH_12BIT_FALSE@@WITH_SSE_FLOAT_DCT_TRUE@MD5_PPM_3x2_FLOAT = 1a75f36e5904d6fc3a85a43da9ad89bb -@WITH_12BIT_TRUE@MD5_PPM_3x2_FLOAT = 42876ab9e5c2f76a87d08db5fbd57956 +@WITH_12BIT_FALSE@MD5_JPEG_3x2_FLOAT_PROG_SSE = 343e3f8caf8af5986ebaf0bdc13b5c71 +@WITH_12BIT_TRUE@MD5_JPEG_3x2_FLOAT_PROG_SSE = a8c17daf77b457725ec929e215b603f8 +@WITH_12BIT_FALSE@MD5_PPM_3x2_FLOAT_SSE = 1a75f36e5904d6fc3a85a43da9ad89bb +@WITH_12BIT_TRUE@MD5_PPM_3x2_FLOAT_SSE = 42876ab9e5c2f76a87d08db5fbd57956 +@WITH_12BIT_FALSE@MD5_JPEG_3x2_FLOAT_PROG_32BIT = 9bca803d2042bd1eb03819e2bf92b3e5 +@WITH_12BIT_TRUE@MD5_JPEG_3x2_FLOAT_PROG_32BIT = a8c17daf77b457725ec929e215b603f8 +@WITH_12BIT_FALSE@MD5_PPM_3x2_FLOAT_32BIT = f6bfab038438ed8f5522fbd33595dcdc +@WITH_12BIT_TRUE@MD5_PPM_3x2_FLOAT_32BIT = 42876ab9e5c2f76a87d08db5fbd57956 +@WITH_12BIT_FALSE@MD5_PPM_3x2_FLOAT_64BIT = 0e917a34193ef976b679a6b069b1be26 +@WITH_12BIT_TRUE@MD5_PPM_3x2_FLOAT_64BIT = d6fbc71153b3d8ded484dbc17c7b9cf4 +@WITH_12BIT_FALSE@MD5_JPEG_3x2_IFAST_PROG = 1ee5d2c1a77f2da495f993c8c7cceca5 +@WITH_12BIT_TRUE@MD5_JPEG_3x2_IFAST_PROG = 1396cc2b7185cfe943d408c9d305339e +@WITH_12BIT_FALSE@MD5_PPM_3x2_IFAST = fd283664b3b49127984af0a7f118fccd +@WITH_12BIT_TRUE@MD5_PPM_3x2_IFAST = 3975985ef6eeb0a2cdc58daa651ccc00 @WITH_12BIT_FALSE@MD5_PPM_420M_ISLOW_2_1 = 9f9de8c0612f8d06869b960b05abf9c9 @WITH_12BIT_TRUE@MD5_PPM_420M_ISLOW_2_1 = 4ca6be2a6f326ff9eaab63e70a8259c0 @WITH_12BIT_FALSE@MD5_PPM_420M_ISLOW_15_8 = b6875bc070720b899566cc06459b63b7 @@ -579,6 +587,22 @@ EXTRA_DIST = win release $(DOCS) testimages CMakeLists.txt \ @WITH_12BIT_FALSE@MD5_BMP_420_ISLOW_565D = 6bde71526acc44bcff76f696df8638d2 @WITH_12BIT_FALSE@MD5_BMP_420M_ISLOW_565 = 8dc0185245353cfa32ad97027342216f @WITH_12BIT_FALSE@MD5_BMP_420M_ISLOW_565D = d1be3a3339166255e76fa50a0d70d73e +@WITH_TURBOJPEG_TRUE@MD5_PPM_GRAY_TILE = 89d3ca21213d9d864b50b4e4e7de4ca6 +@WITH_TURBOJPEG_TRUE@MD5_PPM_420_8x8_TILE = 847fceab15c5b7b911cb986cf0f71de3 +@WITH_TURBOJPEG_TRUE@MD5_PPM_420_16x16_TILE = ca45552a93687e078f7137cc4126a7b0 +@WITH_TURBOJPEG_TRUE@MD5_PPM_420_32x32_TILE = d8676f1d6b68df358353bba9844f4a00 +@WITH_TURBOJPEG_TRUE@MD5_PPM_420_64x64_TILE = 4e4c1a3d7ea4bace4f868bcbe83b7050 +@WITH_TURBOJPEG_TRUE@MD5_PPM_420_128x128_TILE = f24c3429c52265832beab9df72a0ceae +@WITH_TURBOJPEG_TRUE@MD5_PPM_420M_8x8_TILE = bc25320e1f4c31ce2e610e43e9fd173c +@WITH_TURBOJPEG_TRUE@MD5_PPM_420M_TILE = 75ffdf14602258c5c189522af57fa605 +@WITH_TURBOJPEG_TRUE@MD5_PPM_422_8x8_TILE = d83dacd9fc73b0a6f10c09acad64eb1e +@WITH_TURBOJPEG_TRUE@MD5_PPM_422_16x16_TILE = 35077fb610d72dd743b1eb0cbcfe10fb +@WITH_TURBOJPEG_TRUE@MD5_PPM_422_32x32_TILE = e6902ed8a449ecc0f0d6f2bf945f65f7 +@WITH_TURBOJPEG_TRUE@MD5_PPM_422_64x64_TILE = 2b4502a8f316cedbde1da7bce3d2231e +@WITH_TURBOJPEG_TRUE@MD5_PPM_422_128x128_TILE = f0b5617d578f5e13c8eee215d64d4877 +@WITH_TURBOJPEG_TRUE@MD5_PPM_422M_8x8_TILE = 828941d7f41cd6283abd6beffb7fd51d +@WITH_TURBOJPEG_TRUE@MD5_PPM_422M_TILE = e877ae1324c4a280b95376f7f018172f +@WITH_TURBOJPEG_TRUE@MD5_PPM_444_TILE = 7964e41e67cfb8d0a587c0aa4798f9c3 all: config.h jconfig.h jconfigint.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -2134,7 +2158,10 @@ uninstall-man: uninstall-man1 dist-hook: rm -rf `find $(distdir) -name .svn` -test: testclean all +.PHONY: test +test: tjquicktest tjbittest bittest + +tjquicktest: testclean all @WITH_JAVA_TRUE@@WITH_TURBOJPEG_TRUE@ $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest @WITH_JAVA_TRUE@@WITH_TURBOJPEG_TRUE@ $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -bi @@ -2147,6 +2174,45 @@ test: testclean all @WITH_TURBOJPEG_TRUE@ ./tjunittest -yuv @WITH_TURBOJPEG_TRUE@ ./tjunittest -yuv -alloc @WITH_TURBOJPEG_TRUE@ ./tjunittest -yuv -noyuvpad + echo GREAT SUCCESS! + +tjbittest: testclean all + +# Test compressing from/decompressing to an arbitrary subregion of a larger +# image buffer +@WITH_TURBOJPEG_TRUE@ cp $(srcdir)/testimages/testorig.ppm testout_tile.ppm +@WITH_TURBOJPEG_TRUE@ ./tjbench testout_tile.ppm 95 -rgb -quiet -tile -benchtime 0.01 >/dev/null 2>&1 +@WITH_TURBOJPEG_TRUE@ for i in 8 16 32 64 128; do \ +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_GRAY_TILE) testout_tile_GRAY_Q95_$$i\x$$i.ppm; \ +@WITH_TURBOJPEG_TRUE@ done +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_420_8x8_TILE) testout_tile_420_Q95_8x8.ppm +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_420_16x16_TILE) testout_tile_420_Q95_16x16.ppm +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_420_32x32_TILE) testout_tile_420_Q95_32x32.ppm +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_420_64x64_TILE) testout_tile_420_Q95_64x64.ppm +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_420_128x128_TILE) testout_tile_420_Q95_128x128.ppm +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_422_8x8_TILE) testout_tile_422_Q95_8x8.ppm +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_422_16x16_TILE) testout_tile_422_Q95_16x16.ppm +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_422_32x32_TILE) testout_tile_422_Q95_32x32.ppm +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_422_64x64_TILE) testout_tile_422_Q95_64x64.ppm +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_422_128x128_TILE) testout_tile_422_Q95_128x128.ppm +@WITH_TURBOJPEG_TRUE@ for i in 8 16 32 64 128; do \ +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_444_TILE) testout_tile_444_Q95_$$i\x$$i.ppm; \ +@WITH_TURBOJPEG_TRUE@ done +@WITH_TURBOJPEG_TRUE@ rm testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_* + +@WITH_TURBOJPEG_TRUE@ ./tjbench testout_tile.ppm 95 -rgb -fastupsample -quiet -tile -benchtime 0.01 >/dev/null 2>&1 +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_420M_8x8_TILE) testout_tile_420_Q95_8x8.ppm +@WITH_TURBOJPEG_TRUE@ for i in 16 32 64 128; do \ +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_420M_TILE) testout_tile_420_Q95_$$i\x$$i.ppm; \ +@WITH_TURBOJPEG_TRUE@ done +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_422M_8x8_TILE) testout_tile_422_Q95_8x8.ppm +@WITH_TURBOJPEG_TRUE@ for i in 16 32 64 128; do \ +@WITH_TURBOJPEG_TRUE@ md5/md5cmp $(MD5_PPM_422M_TILE) testout_tile_422_Q95_$$i\x$$i.ppm; \ +@WITH_TURBOJPEG_TRUE@ done +@WITH_TURBOJPEG_TRUE@ rm testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_* testout_tile.ppm +@WITH_TURBOJPEG_TRUE@ echo GREAT SUCCESS! + +bittest: testclean all # These tests are carefully crafted to provide full coverage of as many of the # underlying algorithms as possible (including all of the SIMD-accelerated @@ -2229,14 +2295,47 @@ test: testclean all md5/md5cmp $(MD5_JPEG_420S_IFAST_OPT) testout_420s_ifast_opt.jpg rm testout_420s_ifast_opt.jpg +# The output of the floating point tests is not validated by default, because +# the output differs depending on the type of floating point math used, and +# this is only deterministic if the DCT/IDCT are implemented using SIMD +# instructions on a particular platform. Pass one of the following on the make +# command line to validate the floating point tests against one of the expected # results: +# +# FLOATTEST=sse validate against the expected results from the libjpeg-turbo +# SSE SIMD extensions +# FLOATTEST=32bit validate against the expected results from the C code +# when running on a 32-bit FPU (or when SSE is being used for +# floating point math, which is generally the default with +# x86-64 compilers) +# FLOATTEST=64bit validate against the exepected results from the C code +# when running on a 64-bit FPU + # 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 + if [ "${FLOATTEST}" = "sse" ]; then \ + md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG_SSE) testout_3x2_float_prog.jpg; \ + elif [ "${FLOATTEST}" = "32bit" -o "${FLOATTEST}" = "64bit" ]; then \ + md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG_32BIT) testout_3x2_float_prog.jpg; \ + fi # 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 + if [ "${FLOATTEST}" = "sse" ]; then \ + md5/md5cmp $(MD5_PPM_3x2_FLOAT_SSE) testout_3x2_float.ppm; \ + elif [ "${FLOATTEST}" = "32bit" ]; then \ + md5/md5cmp $(MD5_PPM_3x2_FLOAT_32BIT) testout_3x2_float.ppm; \ + elif [ "${FLOATTEST}" = "64bit" ]; then \ + md5/md5cmp $(MD5_PPM_3x2_FLOAT_64BIT) testout_3x2_float.ppm; \ + fi rm testout_3x2_float.ppm testout_3x2_float_prog.jpg +# CC: RGB->YCC SAMP: fullsize/int FDCT: ifast ENT: prog huff + ./cjpeg -sample 3x2 -dct fast -prog -outfile testout_3x2_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_3x2_IFAST_PROG) testout_3x2_ifast_prog.jpg +# CC: YCC->RGB SAMP: fullsize/int IDCT: ifast ENT: prog huff + ./djpeg -dct fast -outfile testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg + md5/md5cmp $(MD5_PPM_3x2_IFAST) testout_3x2_ifast.ppm + rm testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg + # CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith @WITH_ARITH_ENC_TRUE@ ./cjpeg -dct int -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testorig.ppm @WITH_ARITH_ENC_TRUE@ md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg @@ -2328,6 +2427,7 @@ test: testclean all ./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 + echo GREAT SUCCESS! testclean: rm -f testout* diff --git a/jpegturbo/README-turbo.txt b/jpegturbo/README-turbo.txt index f5cd613c..2a779dd0 100755 --- a/jpegturbo/README-turbo.txt +++ b/jpegturbo/README-turbo.txt @@ -311,8 +311,9 @@ following reasons: numbers on this, the typical difference in PNSR between the two algorithms is less than 0.10 dB, whereas changing the quality level by 1 in the upper range of the quality scale is typically more like a 1.0 dB difference.) --- When not using the SIMD extensions, then the accuracy of the floating point - DCT/IDCT can depend on the compiler and compiler settings. +-- If the floating point algorithms in libjpeg-turbo are not implemented using + SIMD instructions on a particular platform, then the accuracy of the + floating point DCT/IDCT can depend on the compiler settings. While libjpeg-turbo does emulate the libjpeg v8 API/ABI, under the hood, it is still using the same algorithms as libjpeg v6b, so there are several specific diff --git a/jpegturbo/bmp.c b/jpegturbo/bmp.c index 4986055c..9fcf7bbd 100644 --- a/jpegturbo/bmp.c +++ b/jpegturbo/bmp.c @@ -1,5 +1,5 @@ /* - * Copyright (C)2011 D. R. Commander. All Rights Reserved. + * Copyright (C)2011, 2015 D. R. Commander. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -75,24 +75,84 @@ static void my_output_message(j_common_ptr cinfo) static void pixelconvert(unsigned char *srcbuf, int srcpf, int srcbottomup, unsigned char *dstbuf, int dstpf, int dstbottomup, int w, int h) { - unsigned char *srcptr=srcbuf, *srcptr2; + unsigned char *srcrowptr=srcbuf, *srccolptr; int srcps=tjPixelSize[srcpf]; int srcstride=srcbottomup? -w*srcps:w*srcps; - unsigned char *dstptr=dstbuf, *dstptr2; + unsigned char *dstrowptr=dstbuf, *dstcolptr; int dstps=tjPixelSize[dstpf]; int dststride=dstbottomup? -w*dstps:w*dstps; int row, col; - if(srcbottomup) srcptr=&srcbuf[w*srcps*(h-1)]; - if(dstbottomup) dstptr=&dstbuf[w*dstps*(h-1)]; - for(row=0; rowRGB conversion routines are for testing + purposes only. Properly converting between CMYK and RGB requires a color + management system. */ + + if(dstpf==TJPF_CMYK) { - for(col=0, srcptr2=srcptr, dstptr2=dstptr; col1.0) c=1.0; if(c<0.) c=0.; + if(m>1.0) m=1.0; if(m<0.) m=0.; + if(y>1.0) y=1.0; if(y<0.) y=0.; + if(k>1.0) k=1.0; if(k<0.) k=0.; + *dstcolptr++=(unsigned char)(255.0-c*255.0+0.5); + *dstcolptr++=(unsigned char)(255.0-m*255.0+0.5); + *dstcolptr++=(unsigned char)(255.0-y*255.0+0.5); + *dstcolptr++=(unsigned char)(255.0-k*255.0+0.5); + } + } + } + else if(srcpf==TJPF_CMYK) + { + for(row=0; row255.0) r=255.0; if(r<0.) r=0.; + if(g>255.0) g=255.0; if(g<0.) g=0.; + if(b>255.0) b=255.0; if(b<0.) b=0.; + dstcolptr[tjRedOffset[dstpf]]=(unsigned char)(r+0.5); + dstcolptr[tjGreenOffset[dstpf]]=(unsigned char)(g+0.5); + dstcolptr[tjBlueOffset[dstpf]]=(unsigned char)(b+0.5); + } + } + } + else + { + for(row=0; row header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_JNI_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define to 1 if you have the `memcpy' function. */ -#undef HAVE_MEMCPY - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDDEF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if the system has the type `unsigned char'. */ -#define HAVE_UNSIGNED_CHAR - -/* Define to 1 if the system has the type `unsigned short'. */ -#define HAVE_UNSIGNED_SHORT - -/* Compiler does not support pointers to undefined structures. */ -#undef INCOMPLETE_TYPES_BROKEN - -/* How to obtain function inlining. */ -#define INLINE __inline - -/* libjpeg API version */ -#define JPEG_LIB_VERSION 80 - -/* libjpeg-turbo version */ -#define LIBJPEG_TURBO_VERSION 0 - -/* Support in-memory source/destination managers */ -#define 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 to 1 if your C compiler doesn't accept -c and -o together. */ -#undef NO_MINUS_C_MINUS_O - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define if your (broken) compiler shifts signed values as if they were - unsigned. */ -#undef RIGHT_SHIFT_IS_UNSIGNED - -/* The size of a `long', as computed by sizeof. */ -#undef SIZEOF_LONG - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION - -/* Use accelerated SIMD routines. */ -#define 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 `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline __inline -#endif - -/* Define to `unsigned' if does not define. */ -#undef size_t diff --git a/jpegturbo/config.h.in b/jpegturbo/config.h.in index 7ada1c1a..bc905076 100644 --- a/jpegturbo/config.h.in +++ b/jpegturbo/config.h.in @@ -110,8 +110,8 @@ unsigned. */ #undef RIGHT_SHIFT_IS_UNSIGNED -/* The size of a `long', as computed by sizeof. */ -#undef SIZEOF_LONG +/* The size of a `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS diff --git a/jpegturbo/configure b/jpegturbo/configure index 7b360681..6f993d22 100755 --- a/jpegturbo/configure +++ b/jpegturbo/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for libjpeg-turbo 1.4.0. +# Generated by GNU Autoconf 2.59 for libjpeg-turbo 1.4.1. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation @@ -421,8 +421,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='libjpeg-turbo' PACKAGE_TARNAME='libjpeg-turbo' -PACKAGE_VERSION='1.4.0' -PACKAGE_STRING='libjpeg-turbo 1.4.0' +PACKAGE_VERSION='1.4.1' +PACKAGE_STRING='libjpeg-turbo 1.4.1' PACKAGE_BUGREPORT='' ac_default_prefix=/opt/libjpeg-turbo @@ -463,7 +463,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP CCAS CCASFLAGS build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL JPEG_LIB_VERSION JPEG_LIB_VERSION_DECIMAL SO_MAJOR_VERSION SO_MINOR_VERSION LIBTOOL_CURRENT SO_AGE MEM_SRCDST_FUNCTIONS VERSION_SCRIPT_TRUE VERSION_SCRIPT_FALSE VERSION_SCRIPT_FLAG WITH_ARITH_ENC_TRUE WITH_ARITH_ENC_FALSE WITH_ARITH_DEC_TRUE WITH_ARITH_DEC_FALSE WITH_ARITH_TRUE WITH_ARITH_FALSE WITH_12BIT_TRUE WITH_12BIT_FALSE JAVAC JAVACFLAGS JAR JAVA JNI_CFLAGS WITH_JAVA_TRUE WITH_JAVA_FALSE WITH_JAVA JAVA_RPM_CONTENTS_1 JAVA_RPM_CONTENTS_2 NASM NAFLAGS WITH_SIMD_TRUE WITH_SIMD_FALSE WITH_SSE_FLOAT_DCT_TRUE WITH_SSE_FLOAT_DCT_FALSE SIMD_I386_TRUE SIMD_I386_FALSE SIMD_X86_64_TRUE SIMD_X86_64_FALSE SIMD_ARM_TRUE SIMD_ARM_FALSE SIMD_ARM_64_TRUE SIMD_ARM_64_FALSE SIMD_MIPS_TRUE SIMD_MIPS_FALSE X86_64_TRUE X86_64_FALSE WITH_TURBOJPEG_TRUE WITH_TURBOJPEG_FALSE PKGNAME RPMARCH RPM_CONFIG_ARGS DEBARCH BUILD LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP CCAS CCASFLAGS build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL JPEG_LIB_VERSION JPEG_LIB_VERSION_DECIMAL SO_MAJOR_VERSION SO_MINOR_VERSION LIBTOOL_CURRENT SO_AGE MEM_SRCDST_FUNCTIONS VERSION_SCRIPT_TRUE VERSION_SCRIPT_FALSE VERSION_SCRIPT_FLAG WITH_ARITH_ENC_TRUE WITH_ARITH_ENC_FALSE WITH_ARITH_DEC_TRUE WITH_ARITH_DEC_FALSE WITH_ARITH_TRUE WITH_ARITH_FALSE WITH_12BIT_TRUE WITH_12BIT_FALSE JAVAC JAVACFLAGS JAR JAVA JNI_CFLAGS WITH_JAVA_TRUE WITH_JAVA_FALSE WITH_JAVA JAVA_RPM_CONTENTS_1 JAVA_RPM_CONTENTS_2 NASM NAFLAGS WITH_SIMD_TRUE WITH_SIMD_FALSE WITH_SSE_FLOAT_DCT_TRUE WITH_SSE_FLOAT_DCT_FALSE SIMD_I386_TRUE SIMD_I386_FALSE SIMD_X86_64_TRUE SIMD_X86_64_FALSE SIMD_ARM_TRUE SIMD_ARM_FALSE SIMD_ARM_64_TRUE SIMD_ARM_64_FALSE SIMD_MIPS_TRUE SIMD_MIPS_FALSE X86_64_TRUE X86_64_FALSE WITH_TURBOJPEG_TRUE WITH_TURBOJPEG_FALSE PKGNAME docdir RPMARCH RPM_CONFIG_ARGS DEBARCH BUILD LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -996,7 +996,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libjpeg-turbo 1.4.0 to adapt to many kinds of systems. +\`configure' configures libjpeg-turbo 1.4.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1062,7 +1062,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libjpeg-turbo 1.4.0:";; + short | recursive ) echo "Configuration of libjpeg-turbo 1.4.1:";; esac cat <<\_ACEOF @@ -1241,7 +1241,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -libjpeg-turbo configure 1.4.0 +libjpeg-turbo configure 1.4.1 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1255,7 +1255,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libjpeg-turbo $as_me 1.4.0, which was +It was created by libjpeg-turbo $as_me 1.4.1, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1900,7 +1900,7 @@ fi # Define the identity of the package. PACKAGE='libjpeg-turbo' - VERSION='1.4.0' + VERSION='1.4.1' cat >>confdefs.h <<_ACEOF @@ -20279,23 +20279,20 @@ DATADIR=`eval echo $DATADIR` if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then datarootdir='${prefix}' fi +DOCDIR=`eval echo ${docdir}` +DOCDIR=`eval echo $DOCDIR` +if test "$DOCDIR" = "/opt/libjpeg-turbo/doc/libjpeg-turbo"; then + docdir='${datadir}/doc' +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*) - ;; - *) - echo "$as_me:$LINENO: checking for long" >&5 -echo $ECHO_N "checking for long... $ECHO_C" >&6 -if test "${ac_cv_type_long+set}" = set; then +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -20308,9 +20305,9 @@ $ac_includes_default int main () { -if ((long *) 0) +if ((size_t *) 0) return 0; -if (sizeof (long)) +if (sizeof (size_t)) return 0; ; return 0; @@ -20338,24 +20335,24 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_long=yes + ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_long=no +ac_cv_type_size_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 -echo "${ECHO_T}$ac_cv_type_long" >&6 +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 -echo "$as_me:$LINENO: checking size of long" >&5 -echo $ECHO_N "checking size of long... $ECHO_C" >&6 -if test "${ac_cv_sizeof_long+set}" = set; then +echo "$as_me:$LINENO: checking size of size_t" >&5 +echo $ECHO_N "checking size of size_t... $ECHO_C" >&6 +if test "${ac_cv_sizeof_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$ac_cv_type_long" = yes; then + if test "$ac_cv_type_size_t" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -20372,7 +20369,7 @@ $ac_includes_default int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) >= 0)]; test_array [0] = 0 ; @@ -20413,7 +20410,7 @@ $ac_includes_default int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) <= $ac_mid)]; test_array [0] = 0 ; @@ -20470,7 +20467,7 @@ $ac_includes_default int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) < 0)]; test_array [0] = 0 ; @@ -20511,7 +20508,7 @@ $ac_includes_default int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) >= $ac_mid)]; test_array [0] = 0 ; @@ -20576,7 +20573,7 @@ $ac_includes_default int main () { -static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) <= $ac_mid)]; test_array [0] = 0 ; @@ -20615,10 +20612,10 @@ fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in -?*) ac_cv_sizeof_long=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +?*) ac_cv_sizeof_size_t=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long), 77 +echo "$as_me: error: cannot compute sizeof (size_t), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac @@ -20637,8 +20634,8 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -long longval () { return (long) (sizeof (long)); } -unsigned long ulongval () { return (long) (sizeof (long)); } +long longval () { return (long) (sizeof (size_t)); } +unsigned long ulongval () { return (long) (sizeof (size_t)); } #include #include int @@ -20648,17 +20645,17 @@ main () FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); - if (((long) (sizeof (long))) < 0) + if (((long) (sizeof (size_t))) < 0) { long i = longval (); - if (i != ((long) (sizeof (long)))) + if (i != ((long) (sizeof (size_t)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); - if (i != ((long) (sizeof (long)))) + if (i != ((long) (sizeof (size_t)))) exit (1); fprintf (f, "%lu\n", i); } @@ -20679,16 +20676,16 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof_long=`cat conftest.val` + ac_cv_sizeof_size_t=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t), 77 See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long), 77 +echo "$as_me: error: cannot compute sizeof (size_t), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -20697,19 +20694,28 @@ fi fi rm -f conftest.val else - ac_cv_sizeof_long=0 + ac_cv_sizeof_size_t=0 fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 -echo "${ECHO_T}$ac_cv_sizeof_long" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_size_t" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG $ac_cv_sizeof_long +#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t _ACEOF - if test "${ac_cv_sizeof_long}" = "8"; then + +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*) + ;; + *) + if test "${ac_cv_sizeof_size_t}" = "8"; then libdir='${exec_prefix}/lib64' - elif test "${ac_cv_sizeof_long}" = "4"; then + elif test "${ac_cv_sizeof_size_t}" = "4"; then libdir='${exec_prefix}/lib32' fi ;; @@ -22920,7 +22926,7 @@ echo "${ECHO_T}$NAFLAGS" >&6 echo "$as_me:$LINENO: checking whether the assembler ($NASM $NAFLAGS) works" >&5 echo $ECHO_N "checking whether the assembler ($NASM $NAFLAGS) works... $ECHO_C" >&6 cat > conftest.asm <&6 echo "$as_me:$LINENO: checking whether the assembler ($NASM $NAFLAGS) works" >&5 echo $ECHO_N "checking whether the assembler ($NASM $NAFLAGS) works... $ECHO_C" >&6 cat > conftest.asm <&5 cat >&5 <<_CSEOF -This file was extended by libjpeg-turbo $as_me 1.4.0, which was +This file was extended by libjpeg-turbo $as_me 1.4.1, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -24264,7 +24279,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -libjpeg-turbo config.status 1.4.0 +libjpeg-turbo config.status 1.4.1 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -24592,6 +24607,7 @@ s,@X86_64_FALSE@,$X86_64_FALSE,;t t s,@WITH_TURBOJPEG_TRUE@,$WITH_TURBOJPEG_TRUE,;t t s,@WITH_TURBOJPEG_FALSE@,$WITH_TURBOJPEG_FALSE,;t t s,@PKGNAME@,$PKGNAME,;t t +s,@docdir@,$docdir,;t t s,@RPMARCH@,$RPMARCH,;t t s,@RPM_CONFIG_ARGS@,$RPM_CONFIG_ARGS,;t t s,@DEBARCH@,$DEBARCH,;t t diff --git a/jpegturbo/configure.ac b/jpegturbo/configure.ac index 39344ba6..6ef4b5c6 100644 --- a/jpegturbo/configure.ac +++ b/jpegturbo/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.56]) -AC_INIT([libjpeg-turbo], [1.4.0]) +AC_INIT([libjpeg-turbo], [1.4.1]) BUILD=`date +%Y%m%d` AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) @@ -39,12 +39,19 @@ DATADIR=`eval echo $DATADIR` if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then datarootdir='${prefix}' fi +DOCDIR=`eval echo ${docdir}` +DOCDIR=`eval echo $DOCDIR` +if test "$DOCDIR" = "/opt/libjpeg-turbo/doc/libjpeg-turbo"; then + docdir='${datadir}/doc' +fi old_exec_prefix=${exec_prefix} if test "x$exec_prefix" = "xNONE"; then exec_prefix=${prefix} fi +AC_CHECK_SIZEOF(size_t) + if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; then LIBDIR=`eval echo ${libdir}` LIBDIR=`eval echo $LIBDIR` @@ -53,10 +60,9 @@ if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; darwin*) ;; *) - AC_CHECK_SIZEOF(long) - if test "${ac_cv_sizeof_long}" = "8"; then + if test "${ac_cv_sizeof_size_t}" = "8"; then libdir='${exec_prefix}/lib64' - elif test "${ac_cv_sizeof_long}" = "4"; then + elif test "${ac_cv_sizeof_size_t}" = "4"; then libdir='${exec_prefix}/lib32' fi ;; @@ -532,8 +538,17 @@ case "$host_cpu" in RPMARCH=i386 DEBARCH=i386 ;; + *) + RPMARCH=`uname -m` + DEBARCH=$RPMARCH + ;; esac +if test "${docdir}" = ""; then + docdir=${datadir}/doc + AC_SUBST(docdir) +fi + AC_SUBST(RPMARCH) AC_SUBST(RPM_CONFIG_ARGS) AC_SUBST(DEBARCH) diff --git a/jpegturbo/java/Makefile.in b/jpegturbo/java/Makefile.in index b5df0ae7..9a668862 100644 --- a/jpegturbo/java/Makefile.in +++ b/jpegturbo/java/Makefile.in @@ -180,6 +180,7 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ +docdir = @docdir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ diff --git a/jpegturbo/java/TJUnitTest.java b/jpegturbo/java/TJUnitTest.java index ab539c4f..d4726b39 100644 --- a/jpegturbo/java/TJUnitTest.java +++ b/jpegturbo/java/TJUnitTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C)2011-2014 D. R. Commander. All Rights Reserved. + * Copyright (C)2011-2015 D. R. Commander. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -105,7 +105,7 @@ public class TJUnitTest { return TJ.PF_BGR; case BufferedImage.TYPE_4BYTE_ABGR: case BufferedImage.TYPE_4BYTE_ABGR_PRE: - return TJ.PF_XBGR; + return TJ.PF_ABGR; case BufferedImage.TYPE_BYTE_GRAY: return TJ.PF_GRAY; case BufferedImage.TYPE_INT_BGR: diff --git a/jpegturbo/jccolor.c b/jpegturbo/jccolor.c index 4be75f71..34ea23b8 100644 --- a/jpegturbo/jccolor.c +++ b/jpegturbo/jccolor.c @@ -5,7 +5,7 @@ * Copyright (C) 1991-1996, Thomas G. Lane. * libjpeg-turbo Modifications: * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright (C) 2009-2012, D. R. Commander. + * Copyright (C) 2009-2012, 2015 D. R. Commander. * Copyright (C) 2014, MIPS Technologies, Inc., California * For conditions of distribution and use, see the accompanying README file. * @@ -464,24 +464,54 @@ null_convert (j_compress_ptr cinfo, JDIMENSION output_row, int num_rows) { register JSAMPROW inptr; - register JSAMPROW outptr; + register JSAMPROW outptr, outptr0, outptr1, outptr2, outptr3; register JDIMENSION col; register int ci; int nc = cinfo->num_components; JDIMENSION num_cols = cinfo->image_width; - while (--num_rows >= 0) { - /* It seems fastest to make a separate pass for each component. */ - for (ci = 0; ci < nc; ci++) { - inptr = *input_buf; - outptr = output_buf[ci][output_row]; + if (nc == 3) { + while (--num_rows >= 0) { + inptr = *input_buf++; + outptr0 = output_buf[0][output_row]; + outptr1 = output_buf[1][output_row]; + outptr2 = output_buf[2][output_row]; + output_row++; for (col = 0; col < num_cols; col++) { - outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */ - inptr += nc; + outptr0[col] = *inptr++; + outptr1[col] = *inptr++; + outptr2[col] = *inptr++; } } - input_buf++; - output_row++; + } else if (nc == 4) { + while (--num_rows >= 0) { + inptr = *input_buf++; + outptr0 = output_buf[0][output_row]; + outptr1 = output_buf[1][output_row]; + outptr2 = output_buf[2][output_row]; + outptr3 = output_buf[3][output_row]; + output_row++; + for (col = 0; col < num_cols; col++) { + outptr0[col] = *inptr++; + outptr1[col] = *inptr++; + outptr2[col] = *inptr++; + outptr3[col] = *inptr++; + } + } + } else { + while (--num_rows >= 0) { + /* It seems fastest to make a separate pass for each component. */ + for (ci = 0; ci < nc; ci++) { + inptr = *input_buf; + outptr = output_buf[ci][output_row]; + for (col = 0; col < num_cols; col++) { + outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */ + inptr += nc; + } + } + input_buf++; + output_row++; + } } } diff --git a/jpegturbo/jchuff.c b/jpegturbo/jchuff.c index a5c0a1fd..4ecc18d6 100644 --- a/jpegturbo/jchuff.c +++ b/jpegturbo/jchuff.c @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. * libjpeg-turbo Modifications: - * Copyright (C) 2009-2011, 2014 D. R. Commander. + * Copyright (C) 2009-2011, 2014-2015 D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * * This file contains Huffman entropy encoding routines. @@ -376,7 +376,11 @@ dump_buffer (working_state * state) } \ } -#if __WORDSIZE==64 || defined(_WIN64) +#if !defined(_WIN32) && !defined(SIZEOF_SIZE_T) +#error Cannot determine word size +#endif + +#if SIZEOF_SIZE_T==8 || defined(_WIN64) #define EMIT_BITS(code, size) { \ CHECKBUF47() \ @@ -513,16 +517,14 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, /* Emit the Huffman-coded symbol for the number of bits */ code = dctbl->ehufco[nbits]; size = dctbl->ehufsi[nbits]; - PUT_BITS(code, size) - CHECKBUF15() + EMIT_BITS(code, size) /* Mask off any extra bits in code */ temp2 &= (((INT32) 1)<= 60". - */ -#define JPEG_LIB_VERSION 80 - -/* libjpeg-turbo version */ -#define LIBJPEG_TURBO_VERSION 0 - -/* Support arithmetic encoding */ -#define C_ARITH_CODING_SUPPORTED - -/* Support arithmetic decoding */ -#define 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. */ -#cmakedefine HAVE_STDDEF_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDLIB_H - -/* Define to 1 if the system has the type `unsigned char'. */ -#define HAVE_UNSIGNED_CHAR - -/* Define to 1 if the system has the type `unsigned short'. */ -#define HAVE_UNSIGNED_SHORT - -/* Compiler does not support pointers to undefined structures. */ -#undef INCOMPLETE_TYPES_BROKEN - -/* Support in-memory source/destination managers */ -#define 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. */ -#define 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 --git a/jpegturbo/jconfig.h.in b/jpegturbo/jconfig.h.in index 42d86f24..b99a87e1 100644 --- a/jpegturbo/jconfig.h.in +++ b/jpegturbo/jconfig.h.in @@ -68,3 +68,6 @@ /* Define to `unsigned int' if does not define. */ #undef size_t + +/* The size of `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T diff --git a/jpegturbo/jconfigint.h.cmake b/jpegturbo/jconfigint.h.cmake deleted file mode 100644 index ef4e194d..00000000 --- a/jpegturbo/jconfigint.h.cmake +++ /dev/null @@ -1,11 +0,0 @@ -/* libjpeg-turbo build number */ -#undef BUILD - -/* How to obtain function inlining. */ -#define INLINE __inline - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Version number of package */ -#undef VERSION diff --git a/jpegturbo/jdcolor.c b/jpegturbo/jdcolor.c index 779fa51f..38db90f2 100644 --- a/jpegturbo/jdcolor.c +++ b/jpegturbo/jdcolor.c @@ -6,7 +6,7 @@ * Modified 2011 by Guido Vollbeding. * libjpeg-turbo Modifications: * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright (C) 2009, 2011-2012, 2014, D. R. Commander. + * Copyright (C) 2009, 2011-2012, 2014-2015, D. R. Commander. * Copyright (C) 2013, Linaro Limited. * For conditions of distribution and use, see the accompanying README file. * @@ -364,23 +364,53 @@ null_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) { - register JSAMPROW inptr, outptr; - register JDIMENSION count; + register JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr; + register JDIMENSION col; register int num_components = cinfo->num_components; JDIMENSION num_cols = cinfo->output_width; int ci; - while (--num_rows >= 0) { - for (ci = 0; ci < num_components; ci++) { - inptr = input_buf[ci][input_row]; - outptr = output_buf[0] + ci; - for (count = num_cols; count > 0; count--) { - *outptr = *inptr++; /* needn't bother with GETJSAMPLE() here */ - outptr += num_components; + if (num_components == 3) { + while (--num_rows >= 0) { + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + input_row++; + outptr = *output_buf++; + for (col = 0; col < num_cols; col++) { + *outptr++ = inptr0[col]; + *outptr++ = inptr1[col]; + *outptr++ = inptr2[col]; } } - input_row++; - output_buf++; + } else if (num_components == 4) { + while (--num_rows >= 0) { + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + inptr3 = input_buf[3][input_row]; + input_row++; + outptr = *output_buf++; + for (col = 0; col < num_cols; col++) { + *outptr++ = inptr0[col]; + *outptr++ = inptr1[col]; + *outptr++ = inptr2[col]; + *outptr++ = inptr3[col]; + } + } + } else { + while (--num_rows >= 0) { + for (ci = 0; ci < num_components; ci++) { + inptr = input_buf[ci][input_row]; + outptr = *output_buf; + for (col = 0; col < num_cols; col++) { + outptr[ci] = inptr[col]; + outptr += num_components; + } + } + output_buf++; + input_row++; + } } } diff --git a/jpegturbo/jdhuff.c b/jpegturbo/jdhuff.c index 7dc13289..cbdce7d4 100644 --- a/jpegturbo/jdhuff.c +++ b/jpegturbo/jdhuff.c @@ -419,7 +419,7 @@ jpeg_fill_bit_buffer (bitread_working_state * state, } \ } -#if __WORDSIZE == 64 || defined(_WIN64) +#if SIZEOF_SIZE_T==8 || defined(_WIN64) /* Pre-fetch 48 bytes, because the holding register is 64-bit */ #define FILL_BIT_BUFFER_FAST \ diff --git a/jpegturbo/jdhuff.h b/jpegturbo/jdhuff.h index f2805e46..c7f3d500 100644 --- a/jpegturbo/jdhuff.h +++ b/jpegturbo/jdhuff.h @@ -67,7 +67,11 @@ EXTERN(void) jpeg_make_d_derived_tbl * necessary. */ -#if __WORDSIZE == 64 || defined(_WIN64) +#if !defined(_WIN32) && !defined(SIZEOF_SIZE_T) +#error Cannot determine word size +#endif + +#if SIZEOF_SIZE_T==8 || defined(_WIN64) typedef size_t bit_buf_type; /* type of bit-extraction buffer */ #define BIT_BUF_SIZE 64 /* size of buffer in bits */ diff --git a/jpegturbo/jversion.h b/jpegturbo/jversion.h index 25c3cf0b..949b4f4d 100644 --- a/jpegturbo/jversion.h +++ b/jpegturbo/jversion.h @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding. * libjpeg-turbo Modifications: - * Copyright (C) 2010, 2012-2014, D. R. Commander. + * Copyright (C) 2010, 2012-2015, D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * * This file contains software version identification. @@ -28,9 +28,9 @@ #define JCOPYRIGHT "Copyright (C) 1991-2012 Thomas G. Lane, Guido Vollbeding\n" \ "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \ "Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \ - "Copyright (C) 2009-2014 D. R. Commander\n" \ + "Copyright (C) 2009-2015 D. R. Commander\n" \ "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \ "Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \ "Copyright (C) 2013 Linaro Limited" -#define JCOPYRIGHT_SHORT "Copyright (C) 1991-2014 The libjpeg-turbo Project and many others" +#define JCOPYRIGHT_SHORT "Copyright (C) 1991-2015 The libjpeg-turbo Project and many others" diff --git a/jpegturbo/md5/Makefile.in b/jpegturbo/md5/Makefile.in index 2fec2d25..3e16406d 100644 --- a/jpegturbo/md5/Makefile.in +++ b/jpegturbo/md5/Makefile.in @@ -201,6 +201,7 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ +docdir = @docdir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ diff --git a/jpegturbo/simd/Makefile.am b/jpegturbo/simd/Makefile.am index 9605e68d..3029f1c9 100644 --- a/jpegturbo/simd/Makefile.am +++ b/jpegturbo/simd/Makefile.am @@ -73,7 +73,7 @@ endif AM_CPPFLAGS = -I$(top_srcdir) .asm.lo: - $(LIBTOOL) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(NASM) $(NAFLAGS) -I$(srcdir) -I. $< -o $@ + $(AM_V_GEN) $(LIBTOOL) $(AM_V_lt) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(AM_V_lt) $(NASM) $(NAFLAGS) -I$(srcdir) -I. $< -o $@ jsimdcfg.inc: $(srcdir)/jsimdcfg.inc.h ../jpeglib.h ../jconfig.h ../jmorecfg.h - $(CPP) -I$(top_builddir) -I$(top_builddir)/simd $(srcdir)/jsimdcfg.inc.h | $(EGREP) "^[\;%]|^\ %" | sed 's%_cpp_protection_%%' | sed 's@% define@%define@g' > $@ + $(AM_V_GEN) $(CPP) -I$(top_builddir) -I$(top_builddir)/simd $(srcdir)/jsimdcfg.inc.h | $(EGREP) "^[\;%]|^\ %" | sed 's%_cpp_protection_%%' | sed 's@% define@%define@g' > $@ diff --git a/jpegturbo/simd/Makefile.in b/jpegturbo/simd/Makefile.in index c6587db0..7849c617 100644 --- a/jpegturbo/simd/Makefile.in +++ b/jpegturbo/simd/Makefile.in @@ -278,6 +278,7 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ +docdir = @docdir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -616,10 +617,10 @@ uninstall-am: uninstall-info-am @SIMD_I386_TRUE@jdmerge-sse2.lo: jdmrgext-sse2.asm .asm.lo: - $(LIBTOOL) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(NASM) $(NAFLAGS) -I$(srcdir) -I. $< -o $@ + $(AM_V_GEN) $(LIBTOOL) $(AM_V_lt) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(AM_V_lt) $(NASM) $(NAFLAGS) -I$(srcdir) -I. $< -o $@ jsimdcfg.inc: $(srcdir)/jsimdcfg.inc.h ../jpeglib.h ../jconfig.h ../jmorecfg.h - $(CPP) -I$(top_builddir) -I$(top_builddir)/simd $(srcdir)/jsimdcfg.inc.h | $(EGREP) "^[\;%]|^\ %" | sed 's%_cpp_protection_%%' | sed 's@% define@%define@g' > $@ + $(AM_V_GEN) $(CPP) -I$(top_builddir) -I$(top_builddir)/simd $(srcdir)/jsimdcfg.inc.h | $(EGREP) "^[\;%]|^\ %" | sed 's%_cpp_protection_%%' | sed 's@% define@%define@g' > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/jpegturbo/simd/jsimd_mips.c b/jpegturbo/simd/jsimd_mips.c index abcd19f5..cf87b32b 100644 --- a/jpegturbo/simd/jsimd_mips.c +++ b/jpegturbo/simd/jsimd_mips.c @@ -562,6 +562,8 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, GLOBAL(int) jsimd_can_h2v2_merged_upsample (void) { + init_simd(); + if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) @@ -576,6 +578,8 @@ jsimd_can_h2v2_merged_upsample (void) GLOBAL(int) jsimd_can_h2v1_merged_upsample (void) { + init_simd(); + if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) diff --git a/jpegturbo/simd/jsimd_mips_dspr2.S b/jpegturbo/simd/jsimd_mips_dspr2.S index 4572a51f..c5990965 100644 --- a/jpegturbo/simd/jsimd_mips_dspr2.S +++ b/jpegturbo/simd/jsimd_mips_dspr2.S @@ -916,7 +916,8 @@ LEAF_MIPS_DSPR2(jsimd_h2v2_fancy_upsample_mips_dspr2) srl t1, t1, 4 sb t0, 0(s3) sb t1, 1(s3) - addiu s3, 2 + beq t8, s0, 22f // skip to final iteration if width == 3 + addiu s3, 2 2: lh t0, 0(s0) // t0 = A3|A2 lh t2, 0(s1) // t2 = B3|B2 @@ -949,6 +950,7 @@ LEAF_MIPS_DSPR2(jsimd_h2v2_fancy_upsample_mips_dspr2) sb t2, 3(s3) bne t8, s0, 2b addiu s3, 4 +22: beqz s5, 4f addu t8, s0, s5 3: diff --git a/jpegturbo/simd/nasm_lt.sh b/jpegturbo/simd/nasm_lt.sh index 6cd73294..817be161 100755 --- a/jpegturbo/simd/nasm_lt.sh +++ b/jpegturbo/simd/nasm_lt.sh @@ -5,6 +5,9 @@ o_opt=no pic=no while [ $# -gt 0 ]; do case "$1" in + --silent) + exec > /dev/null + ;; -DPIC|-fPIC|-fpic|-Kpic|-KPIC) if [ "$pic" != "yes" ] ; then command="$command -DPIC" diff --git a/jpegturbo/tjbench.c b/jpegturbo/tjbench.c index 741dc7e7..29ed3d0f 100644 --- a/jpegturbo/tjbench.c +++ b/jpegturbo/tjbench.c @@ -1,5 +1,5 @@ /* - * Copyright (C)2009-2014 D. R. Commander. All Rights Reserved. + * Copyright (C)2009-2015 D. R. Commander. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -50,7 +50,7 @@ int flags=TJFLAG_NOREALLOC, componly=0, decomponly=0, doyuv=0, quiet=0, char *ext="ppm"; const char *pixFormatStr[TJ_NUMPF]= { - "RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "GRAY" + "RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "GRAY", "", "", "", "", "CMYK" }; const char *subNameLong[TJ_NUMSAMP]= { @@ -506,6 +506,10 @@ int decompTest(char *filename) _throwtj("executing tjInitTransform()"); if(tjDecompressHeader3(handle, srcbuf, srcsize, &w, &h, &subsamp, &cs)==-1) _throwtj("executing tjDecompressHeader3()"); + if(cs==TJCS_YCCK || cs==TJCS_CMYK) + { + pf=TJPF_CMYK; ps=tjPixelSize[pf]; + } if(quiet==1) { @@ -712,6 +716,9 @@ void usage(char *progname) printf(" tiles of varying sizes.\n"); printf("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb =\n"); printf(" Test the specified color conversion path in the codec (default = BGR)\n"); + printf("-cmyk = Indirectly test YCCK JPEG compression/decompression (the source\n"); + printf(" and destination bitmaps are still RGB. The conversion is done\n"); + printf(" internally prior to compression or after decompression.)\n"); printf("-fastupsample = Use the fastest chrominance upsampling algorithm available in\n"); printf(" the underlying codec\n"); printf("-fastdct = Use the fastest DCT/IDCT algorithms available in the underlying\n"); @@ -820,6 +827,7 @@ int main(int argc, char *argv[]) if(!strcasecmp(argv[i], "-bgrx")) pf=TJPF_BGRX; if(!strcasecmp(argv[i], "-xbgr")) pf=TJPF_XBGR; if(!strcasecmp(argv[i], "-xrgb")) pf=TJPF_XRGB; + if(!strcasecmp(argv[i], "-cmyk")) pf=TJPF_CMYK; if(!strcasecmp(argv[i], "-bottomup")) flags|=TJFLAG_BOTTOMUP; if(!strcasecmp(argv[i], "-quiet")) quiet=1; if(!strcasecmp(argv[i], "-qq")) quiet=2; @@ -953,9 +961,12 @@ int main(int argc, char *argv[]) } else { - for(i=maxqual; i>=minqual; i--) - fullTest(srcbuf, w, h, TJSAMP_GRAY, i, argv[1]); - printf("\n"); + if(pf!=TJPF_CMYK) + { + for(i=maxqual; i>=minqual; i--) + fullTest(srcbuf, w, h, TJSAMP_GRAY, i, argv[1]); + printf("\n"); + } for(i=maxqual; i>=minqual; i--) fullTest(srcbuf, w, h, TJSAMP_420, i, argv[1]); printf("\n"); diff --git a/jpegturbo/turbojpeg.c b/jpegturbo/turbojpeg.c index bc153da9..5ba9a19b 100644 --- a/jpegturbo/turbojpeg.c +++ b/jpegturbo/turbojpeg.c @@ -1,5 +1,5 @@ /* - * Copyright (C)2009-2014 D. R. Commander. All Rights Reserved. + * Copyright (C)2009-2015 D. R. Commander. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -58,6 +58,8 @@ struct my_error_mgr { struct jpeg_error_mgr pub; jmp_buf setjmp_buffer; + void (*emit_message)(j_common_ptr, int); + boolean warning; }; typedef struct my_error_mgr *my_error_ptr; @@ -75,6 +77,13 @@ static void my_output_message(j_common_ptr cinfo) (*cinfo->err->format_message)(cinfo, errStr); } +static void my_emit_message(j_common_ptr cinfo, int msg_level) +{ + my_error_ptr myerr=(my_error_ptr)cinfo->err; + myerr->emit_message(cinfo, msg_level); + if(msg_level<0) myerr->warning=TRUE; +} + /* Global structures, macros, etc. */ @@ -122,17 +131,20 @@ static const tjscalingfactor sf[NUMSF]={ j_compress_ptr cinfo=NULL; j_decompress_ptr dinfo=NULL; \ if(!this) {snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \ return -1;} \ - cinfo=&this->cinfo; dinfo=&this->dinfo; + cinfo=&this->cinfo; dinfo=&this->dinfo; \ + this->jerr.warning=FALSE; #define getcinstance(handle) tjinstance *this=(tjinstance *)handle; \ j_compress_ptr cinfo=NULL; \ if(!this) {snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \ return -1;} \ - cinfo=&this->cinfo; + cinfo=&this->cinfo; \ + this->jerr.warning=FALSE; #define getdinstance(handle) tjinstance *this=(tjinstance *)handle; \ j_decompress_ptr dinfo=NULL; \ if(!this) {snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \ return -1;} \ - dinfo=&this->dinfo; + dinfo=&this->dinfo; \ + this->jerr.warning=FALSE; static int getPixelFormat(int pixelSize, int flags) { @@ -206,6 +218,7 @@ static int setCompDefaults(struct jpeg_compress_struct *cinfo, cinfo->input_components=tjPixelSize[pixelFormat]; jpeg_set_defaults(cinfo); +#ifndef NO_GETENV if((env=getenv("TJ_OPTIMIZE"))!=NULL && strlen(env)>0 && !strcmp(env, "1")) cinfo->optimize_coding=TRUE; if((env=getenv("TJ_ARITHMETIC"))!=NULL && strlen(env)>0 && !strcmp(env, "1")) @@ -224,6 +237,7 @@ static int setCompDefaults(struct jpeg_compress_struct *cinfo, cinfo->restart_in_rows=temp; } } +#endif if(jpegQual>=0) { @@ -237,9 +251,11 @@ static int setCompDefaults(struct jpeg_compress_struct *cinfo, jpeg_set_colorspace(cinfo, JCS_YCCK); else jpeg_set_colorspace(cinfo, JCS_YCbCr); +#ifndef NO_GETENV if((env=getenv("TJ_PROGRESSIVE"))!=NULL && strlen(env)>0 && !strcmp(env, "1")) jpeg_simple_progression(cinfo); +#endif cinfo->comp_info[0].h_samp_factor=tjMCUWidth[subsamp]/8; cinfo->comp_info[1].h_samp_factor=1; @@ -546,6 +562,8 @@ static tjhandle _tjInitCompress(tjinstance *this) this->cinfo.err=jpeg_std_error(&this->jerr.pub); this->jerr.pub.error_exit=my_error_exit; this->jerr.pub.output_message=my_output_message; + this->jerr.emit_message=this->jerr.pub.emit_message; + this->jerr.pub.emit_message=my_emit_message; if(setjmp(this->jerr.setjmp_buffer)) { @@ -783,6 +801,7 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, if(rgbBuf) free(rgbBuf); #endif if(row_pointer) free(row_pointer); + if(this->jerr.warning) retval=-1; return retval; } @@ -965,6 +984,7 @@ DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle, unsigned char *srcBuf, if(_tmpbuf2[i]!=NULL) free(_tmpbuf2[i]); if(outbuf[i]!=NULL) free(outbuf[i]); } + if(this->jerr.warning) retval=-1; return retval; } @@ -1148,6 +1168,7 @@ DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle, if(inbuf[i]) free(inbuf[i]); } if(_tmpbuf) free(_tmpbuf); + if(this->jerr.warning) retval=-1; return retval; } @@ -1198,6 +1219,8 @@ static tjhandle _tjInitDecompress(tjinstance *this) this->dinfo.err=jpeg_std_error(&this->jerr.pub); this->jerr.pub.error_exit=my_error_exit; this->jerr.pub.output_message=my_output_message; + this->jerr.emit_message=this->jerr.pub.emit_message; + this->jerr.pub.emit_message=my_emit_message; if(setjmp(this->jerr.setjmp_buffer)) { @@ -1273,6 +1296,7 @@ DLLEXPORT int DLLCALL tjDecompressHeader3(tjhandle handle, _throw("tjDecompressHeader3(): Invalid data returned in header"); bailout: + if(this->jerr.warning) retval=-1; return retval; } @@ -1406,6 +1430,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf, if(rgbBuf) free(rgbBuf); #endif if(row_pointer) free(row_pointer); + if(this->jerr.warning) retval=-1; return retval; } @@ -1543,6 +1568,7 @@ DLLEXPORT int DLLCALL tjDecodeYUVPlanes(tjhandle handle, retval=-1; goto bailout; } dinfo->do_fancy_upsampling=FALSE; + dinfo->Se=DCTSIZE2-1; jinit_master_decompress(dinfo); (*dinfo->upsample->start_pass)(dinfo); @@ -1631,6 +1657,7 @@ DLLEXPORT int DLLCALL tjDecodeYUVPlanes(tjhandle handle, if(_tmpbuf[i]!=NULL) free(_tmpbuf[i]); if(inbuf[i]!=NULL) free(inbuf[i]); } + if(this->jerr.warning) retval=-1; return retval; } @@ -1840,6 +1867,7 @@ DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle, if(outbuf[i]) free(outbuf[i]); } if(_tmpbuf) free(_tmpbuf); + if(this->jerr.warning) retval=-1; return retval; } @@ -2081,5 +2109,6 @@ DLLEXPORT int DLLCALL tjTransform(tjhandle handle, unsigned char *jpegBuf, if(cinfo->global_state>CSTATE_START) jpeg_abort_compress(cinfo); if(dinfo->global_state>DSTATE_START) jpeg_abort_decompress(dinfo); if(xinfo) free(xinfo); + if(this->jerr.warning) retval=-1; return retval; }