@@ -5,7 +5,7 @@ if(CMAKE_EXECUTABLE_SUFFIX)
5
5
endif ()
6
6
7
7
project (mozjpeg C)
8
- set (VERSION 4.0.0 )
8
+ set (VERSION 4.0.1 )
9
9
string (REPLACE "." ";" VERSION_TRIPLET ${VERSION} )
10
10
list (GET VERSION_TRIPLET 0 VERSION_MAJOR)
11
11
list (GET VERSION_TRIPLET 1 VERSION_MINOR)
@@ -453,6 +453,21 @@ if(NOT INLINE_WORKS)
453
453
endif ()
454
454
message (STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE} )" )
455
455
456
+ if (WITH_TURBOJPEG)
457
+ if (MSVC )
458
+ set (THREAD_LOCAL "__declspec(thread)" )
459
+ else ()
460
+ set (THREAD_LOCAL "__thread" )
461
+ endif ()
462
+ check_c_source_compiles("${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" HAVE_THREAD_LOCAL)
463
+ if (HAVE_THREAD_LOCAL)
464
+ message (STATUS "THREAD_LOCAL = ${THREAD_LOCAL} " )
465
+ else ()
466
+ message (WARNING "Thread-local storage is not available. The TurboJPEG API library's global error handler will not be thread-safe." )
467
+ unset (THREAD_LOCAL)
468
+ endif ()
469
+ endif ()
470
+
456
471
if (UNIX AND NOT APPLE )
457
472
file (WRITE ${CMAKE_CURRENT_BINARY_DIR} /conftest.map "VERS_1 { global: *; };" )
458
473
set (CMAKE_REQUIRED_FLAGS
@@ -923,12 +938,18 @@ foreach(libtype ${TEST_LIBTYPES})
923
938
set (suffix -static )
924
939
endif ()
925
940
if (WITH_TURBOJPEG)
926
- add_test (tjunittest-${libtype} tjunittest${suffix} )
927
- add_test (tjunittest-${libtype} -alloc tjunittest${suffix} -alloc)
928
- add_test (tjunittest-${libtype} -yuv tjunittest${suffix} -yuv)
929
- add_test (tjunittest-${libtype} -yuv-alloc tjunittest${suffix} -yuv -alloc)
930
- add_test (tjunittest-${libtype} -yuv-nopad tjunittest${suffix} -yuv -noyuvpad)
931
- add_test (tjunittest-${libtype} -bmp tjunittest${suffix} -bmp)
941
+ add_test (tjunittest-${libtype}
942
+ ${CMAKE_CROSSCOMPILING_EMULATOR} tjunittest${suffix} )
943
+ add_test (tjunittest-${libtype} -alloc
944
+ ${CMAKE_CROSSCOMPILING_EMULATOR} tjunittest${suffix} -alloc)
945
+ add_test (tjunittest-${libtype} -yuv
946
+ ${CMAKE_CROSSCOMPILING_EMULATOR} tjunittest${suffix} -yuv)
947
+ add_test (tjunittest-${libtype} -yuv-alloc
948
+ ${CMAKE_CROSSCOMPILING_EMULATOR} tjunittest${suffix} -yuv -alloc)
949
+ add_test (tjunittest-${libtype} -yuv-nopad
950
+ ${CMAKE_CROSSCOMPILING_EMULATOR} tjunittest${suffix} -yuv -noyuvpad)
951
+ add_test (tjunittest-${libtype} -bmp
952
+ ${CMAKE_CROSSCOMPILING_EMULATOR} tjunittest${suffix} -bmp)
932
953
933
954
set (MD5_PPM_GRAY_TILE 89d3ca21213d9d864b50b4e4e7de4ca6)
934
955
set (MD5_PPM_420_8x8_TILE 847fceab15c5b7b911cb986cf0f71de3)
@@ -953,22 +974,23 @@ foreach(libtype ${TEST_LIBTYPES})
953
974
${CMAKE_COMMAND} -E copy_if_different ${TESTIMAGES} /testorig.ppm
954
975
testout_tile.ppm)
955
976
add_test (tjbench-${libtype} -tile
956
- tjbench${suffix} testout_tile.ppm 95 -rgb - quiet -tile -benchtime 0.01
957
- -warmup 0)
977
+ ${CMAKE_CROSSCOMPILING_EMULATOR} tjbench${suffix} testout_tile.ppm 95
978
+ -rgb - quiet -tile -benchtime 0.01 - warmup 0)
958
979
set_tests_properties (tjbench-${libtype} -tile
959
980
PROPERTIES DEPENDS tjbench-${libtype} -tile-cp)
960
981
961
982
foreach (tile 8 16 32 64 128)
962
983
add_test (tjbench-${libtype} -tile-gray-${tile} x${tile} -cmp
963
- ${MD5CMP} ${MD5_PPM_GRAY_TILE}
984
+ ${CMAKE_CROSSCOMPILING_EMULATOR} ${ MD5CMP} ${MD5_PPM_GRAY_TILE}
964
985
testout_tile_GRAY_Q95_${tile} x${tile} .ppm)
965
986
foreach (subsamp 420 422)
966
987
add_test (tjbench-${libtype} -tile-${subsamp} -${tile} x${tile} -cmp
967
- ${MD5CMP} ${MD5_PPM_${subsamp} _${tile} x${tile} _TILE}
988
+ ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP}
989
+ ${MD5_PPM_${subsamp} _${tile} x${tile} _TILE}
968
990
testout_tile_${subsamp} _Q95_${tile} x${tile} .ppm)
969
991
endforeach ()
970
992
add_test (tjbench-${libtype} -tile-444-${tile} x${tile} -cmp
971
- ${MD5CMP} ${MD5_PPM_444_TILE}
993
+ ${CMAKE_CROSSCOMPILING_EMULATOR} ${ MD5CMP} ${MD5_PPM_444_TILE}
972
994
testout_tile_444_Q95_${tile} x${tile} .ppm)
973
995
foreach (subsamp gray 420 422 444)
974
996
set_tests_properties (tjbench-${libtype} -tile-${subsamp} -${tile} x${tile} -cmp
@@ -980,19 +1002,22 @@ foreach(libtype ${TEST_LIBTYPES})
980
1002
${CMAKE_COMMAND} -E copy_if_different ${TESTIMAGES} /testorig.ppm
981
1003
testout_tilem.ppm)
982
1004
add_test (tjbench-${libtype} -tilem
983
- tjbench${suffix} testout_tilem.ppm 95 -rgb -fastupsample - quiet -tile
984
- -benchtime 0.01 -warmup 0)
1005
+ ${CMAKE_CROSSCOMPILING_EMULATOR} tjbench${suffix} testout_tilem.ppm 95
1006
+ -rgb -fastupsample - quiet -tile - benchtime 0.01 -warmup 0)
985
1007
set_tests_properties (tjbench-${libtype} -tilem
986
1008
PROPERTIES DEPENDS tjbench-${libtype} -tilem-cp)
987
1009
988
1010
add_test (tjbench-${libtype} -tile-420m-8x8-cmp
989
- ${MD5CMP} ${MD5_PPM_420M_8x8_TILE} testout_tilem_420_Q95_8x8.ppm)
1011
+ ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} ${MD5_PPM_420M_8x8_TILE}
1012
+ testout_tilem_420_Q95_8x8.ppm)
990
1013
add_test (tjbench-${libtype} -tile-422m-8x8-cmp
991
- ${MD5CMP} ${MD5_PPM_422M_8x8_TILE} testout_tilem_422_Q95_8x8.ppm)
1014
+ ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} ${MD5_PPM_422M_8x8_TILE}
1015
+ testout_tilem_422_Q95_8x8.ppm)
992
1016
foreach (tile 16 32 64 128)
993
1017
foreach (subsamp 420 422)
994
1018
add_test (tjbench-${libtype} -tile-${subsamp} m-${tile} x${tile} -cmp
995
- ${MD5CMP} ${MD5_PPM_${subsamp} M_TILE}
1019
+ ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP}
1020
+ ${MD5_PPM_${subsamp} M_TILE}
996
1021
testout_tilem_${subsamp} _Q95_${tile} x${tile} .ppm)
997
1022
endforeach ()
998
1023
endforeach ()
@@ -1010,9 +1035,10 @@ foreach(libtype ${TEST_LIBTYPES})
1010
1035
1011
1036
macro (add_bittest PROG NAME ARGS OUTFILE INFILE MD5SUM)
1012
1037
add_test (${PROG} -${libtype} -${NAME}
1013
- ${PROG}${suffix} ${ARGS} -outfile ${OUTFILE} ${INFILE} )
1038
+ ${CMAKE_CROSSCOMPILING_EMULATOR} ${PROG}${suffix} ${ARGS}
1039
+ -outfile ${OUTFILE} ${INFILE} )
1014
1040
add_test (${PROG} -${libtype} -${NAME} -cmp
1015
- ${MD5CMP} ${MD5SUM} ${OUTFILE} )
1041
+ ${CMAKE_CROSSCOMPILING_EMULATOR} ${ MD5CMP} ${MD5SUM} ${OUTFILE} )
1016
1042
set_tests_properties (${PROG} -${libtype} -${NAME} -cmp PROPERTIES
1017
1043
DEPENDS ${PROG} -${libtype} -${NAME} )
1018
1044
if (${ARGC} GREATER 6)
@@ -1033,12 +1059,14 @@ foreach(libtype ${TEST_LIBTYPES})
1033
1059
${MD5_PPM_RGB_ISLOW} cjpeg-${libtype} -rgb-islow)
1034
1060
1035
1061
add_test (djpeg-${libtype} -rgb-islow-icc-cmp
1036
- ${MD5CMP} b06a39d730129122e85c1363ed1bbc9e testout_rgb_islow.icc)
1062
+ ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP}
1063
+ b06a39d730129122e85c1363ed1bbc9e testout_rgb_islow.icc)
1037
1064
set_tests_properties (djpeg-${libtype} -rgb-islow-icc-cmp PROPERTIES
1038
1065
DEPENDS djpeg-${libtype} -rgb-islow)
1039
1066
1040
1067
add_bittest(jpegtran icc "-copy;all;-icc;${TESTIMAGES} /test2.icc"
1041
- testout_rgb_islow2.jpg testout_rgb_islow.jpg ${MD5_JPEG_RGB_ISLOW2} )
1068
+ testout_rgb_islow2.jpg testout_rgb_islow.jpg
1069
+ ${MD5_JPEG_RGB_ISLOW2} cjpeg-${libtype} -rgb-islow)
1042
1070
1043
1071
if (NOT WITH_12BIT)
1044
1072
# CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff
@@ -1251,7 +1279,7 @@ foreach(libtype ${TEST_LIBTYPES})
1251
1279
1252
1280
# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: prog huff
1253
1281
add_test (cjpeg-${libtype} -420-islow-prog
1254
- cjpeg${suffix} -dct int -prog
1282
+ ${CMAKE_CROSSCOMPILING_EMULATOR} cjpeg${suffix} -dct int -prog
1255
1283
-outfile testout_420_islow_prog.jpg ${TESTIMAGES} /testorig.ppm)
1256
1284
add_bittest(djpeg 420-islow-prog-crop62x62_71_71
1257
1285
"-dct;int;-crop;62x62+71+71;-ppm"
@@ -1268,15 +1296,15 @@ foreach(libtype ${TEST_LIBTYPES})
1268
1296
1269
1297
# Context rows: No Intra-iMCU row: Yes ENT: huff
1270
1298
add_test (cjpeg-${libtype} -444-islow
1271
- cjpeg${suffix} -dct int -sample 1x1
1299
+ ${CMAKE_CROSSCOMPILING_EMULATOR} cjpeg${suffix} -dct int -sample 1x1
1272
1300
-outfile testout_444_islow.jpg ${TESTIMAGES} /testorig.ppm)
1273
1301
add_bittest(djpeg 444-islow-skip1_6 "-dct;int;-skip;1,6;-ppm"
1274
1302
testout_444_islow_skip1,6.ppm testout_444_islow.jpg
1275
1303
${MD5_PPM_444_ISLOW_SKIP1_6} cjpeg-${libtype} -444-islow)
1276
1304
1277
1305
# Context rows: No Intra-iMCU row: No ENT: prog huff
1278
1306
add_test (cjpeg-${libtype} -444-islow-prog
1279
- cjpeg${suffix} -dct int -prog -sample 1x1
1307
+ ${CMAKE_CROSSCOMPILING_EMULATOR} cjpeg${suffix} -dct int -prog -sample 1x1
1280
1308
-outfile testout_444_islow_prog.jpg ${TESTIMAGES} /testorig.ppm)
1281
1309
add_bittest(djpeg 444-islow-prog-crop98x98_13_13
1282
1310
"-dct;int;-crop;98x98+13+13;-ppm"
@@ -1286,8 +1314,9 @@ foreach(libtype ${TEST_LIBTYPES})
1286
1314
# Context rows: No Intra-iMCU row: No ENT: arith
1287
1315
if (WITH_ARITH_ENC)
1288
1316
add_test (cjpeg-${libtype} -444-islow-ari
1289
- cjpeg${suffix} -dct int -arithmetic -sample 1x1
1290
- -outfile testout_444_islow_ari.jpg ${TESTIMAGES} /testorig.ppm)
1317
+ ${CMAKE_CROSSCOMPILING_EMULATOR} cjpeg${suffix} -dct int -arithmetic
1318
+ -sample 1x1 -outfile testout_444_islow_ari.jpg
1319
+ ${TESTIMAGES} /testorig.ppm)
1291
1320
if (WITH_ARITH_DEC)
1292
1321
add_bittest(djpeg 444-islow-ari-crop37x37_0_0
1293
1322
"-dct;int;-crop;37x37+0+0;-ppm"
0 commit comments