Merge tag '1.5.2'
Tag 1.5.2 release * tag '1.5.2': (54 commits) x86: Fix "short jump is out of range" w/ NASM<2.04 TurboJPEG: Document xform issue w/ big marker data Java TJBench: Fix parsing of -warmup argument Build: Disable warmup in TJBench regression tests TJBench: Improve consistency of results TurboJPEG: C API documentation buglet TJBench: Code formatting tweaks TJBench: Fix errors when decomp. files w/ ICC data BUILDING.md: Include Android/x86 build recipes Travis: Fix OS X build Restore compatibility with older autoconf releases Attribute ARM runtime detection code to Nokia Honor max_memory_to_use/JPEGMEM/-maxmemory AppVeyor: Fix CI build TurboJPEG: Fix potential memory leaks Always tweak EXIF w/h tags w/ lossless transforms Fix error w/ lossless crop & libjpeg v7 emulation Include jpeg_skip/crop_scanlines() in jpeg7.dll libjpeg.txt: Include partial decomp. in TOC Slightly de-confusify cjpeg, jpegtran usage info ...
This commit is contained in:
801
BUILDING.md
801
BUILDING.md
File diff suppressed because it is too large
Load Diff
@@ -349,8 +349,20 @@ if(WITH_12BIT)
|
||||
set(MD5_PPM_GRAY_ISLOW 7213c10af507ad467da5578ca5ee1fca)
|
||||
set(MD5_PPM_GRAY_ISLOW_RGB e96ee81c30a6ed422d466338bd3de65d)
|
||||
set(MD5_JPEG_420S_IFAST_OPT 7af8e60be4d9c227ec63ac9b6630855e)
|
||||
if(64BIT)
|
||||
# Windows/x64 uses SSE for floating point
|
||||
set(MD5_JPEG_3x2_FLOAT_PROG a8c17daf77b457725ec929e215b603f8)
|
||||
set(MD5_PPM_3x2_FLOAT 42876ab9e5c2f76a87d08db5fbd57956)
|
||||
else()
|
||||
# Windows/x86 uses the 387 FPU for floating point
|
||||
if(MSVC)
|
||||
set(MD5_JPEG_3x2_FLOAT_PROG e27840755870fa849872e58aa0cd1400)
|
||||
set(MD5_PPM_3x2_FLOAT 6c2880b83bb1aa41dfe330e7a9768690)
|
||||
else()
|
||||
set(MD5_JPEG_3x2_FLOAT_PROG bc6dbbefac2872f6b9d6c4a0ae60c3c0)
|
||||
set(MD5_PPM_3x2_FLOAT f58119ee294198ac9b4a9f5645a34266)
|
||||
endif()
|
||||
endif()
|
||||
set(MD5_PPM_420M_ISLOW_2_1 4ca6be2a6f326ff9eaab63e70a8259c0)
|
||||
set(MD5_PPM_420M_ISLOW_15_8 12aa9f9534c1b3d7ba047322226365eb)
|
||||
set(MD5_PPM_420M_ISLOW_13_8 f7e22817c7b25e1393e4ec101e9d4e96)
|
||||
@@ -392,8 +404,18 @@ else()
|
||||
set(MD5_JPEG_3x2_FLOAT_PROG 343e3f8caf8af5986ebaf0bdc13b5c71)
|
||||
set(MD5_PPM_3x2_FLOAT 1a75f36e5904d6fc3a85a43da9ad89bb)
|
||||
else()
|
||||
if(64BIT)
|
||||
set(MD5_JPEG_3x2_FLOAT_PROG 9bca803d2042bd1eb03819e2bf92b3e5)
|
||||
set(MD5_PPM_3x2_FLOAT f6bfab038438ed8f5522fbd33595dcdc)
|
||||
else()
|
||||
if(MSVC)
|
||||
set(MD5_JPEG_3x2_FLOAT_PROG 7999ce9cd0ee9b6c7043b7351ab7639d)
|
||||
set(MD5_PPM_3x2_FLOAT 28cdc448a6b75e97892f0e0f8d4b21f3)
|
||||
else()
|
||||
set(MD5_JPEG_3x2_FLOAT_PROG 1657664a410e0822c924b54f6f65e6e9)
|
||||
set(MD5_PPM_3x2_FLOAT cb0a1f027f3d2917c902b5640214e025)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1)
|
||||
set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617)
|
||||
@@ -826,7 +848,7 @@ foreach(libtype ${TEST_LIBTYPES})
|
||||
|
||||
endforeach()
|
||||
|
||||
add_custom_target(testclean COMMAND ${MD5CMP} -P
|
||||
add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P
|
||||
${CMAKE_SOURCE_DIR}/cmakescripts/testclean.cmake)
|
||||
|
||||
|
||||
@@ -915,3 +937,8 @@ install(FILES ${CMAKE_SOURCE_DIR}/README.ijg ${CMAKE_SOURCE_DIR}/README-mozilla.
|
||||
install(FILES ${CMAKE_BINARY_DIR}/jconfig.h ${CMAKE_SOURCE_DIR}/jerror.h
|
||||
${CMAKE_SOURCE_DIR}/jmorecfg.h ${CMAKE_SOURCE_DIR}/jpeglib.h
|
||||
DESTINATION include)
|
||||
|
||||
configure_file("${CMAKE_SOURCE_DIR}/cmakescripts/cmake_uninstall.cmake.in"
|
||||
"cmake_uninstall.cmake" IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P cmake_uninstall.cmake)
|
||||
|
||||
71
ChangeLog.md
71
ChangeLog.md
@@ -1,3 +1,74 @@
|
||||
1.5.2
|
||||
=====
|
||||
|
||||
### Significant changes relative to 1.5.1:
|
||||
|
||||
1. Fixed a regression introduced by 1.5.1[7] that prevented libjpeg-turbo from
|
||||
building with Android NDK platforms prior to android-21 (5.0).
|
||||
|
||||
2. Fixed a regression introduced by 1.5.1[1] that prevented the MIPS DSPR2 SIMD
|
||||
code in libjpeg-turbo from building.
|
||||
|
||||
3. Fixed a regression introduced by 1.5 beta1[11] that prevented the Java
|
||||
version of TJBench from outputting any reference images (the `-nowrite` switch
|
||||
was accidentally enabled by default.)
|
||||
|
||||
4. libjpeg-turbo should now build and run with full AltiVec SIMD acceleration
|
||||
on PowerPC-based AmigaOS 4 and OpenBSD systems.
|
||||
|
||||
5. Fixed build and runtime errors on Windows that occurred when building
|
||||
libjpeg-turbo with libjpeg v7 API/ABI emulation and the in-memory
|
||||
source/destination managers. Due to an oversight, the `jpeg_skip_scanlines()`
|
||||
and `jpeg_crop_scanlines()` functions were not being included in jpeg7.dll when
|
||||
libjpeg-turbo was built with `-DWITH_JPEG7=1` and `-DWITH_MEMSRCDST=1`.
|
||||
|
||||
6. Fixed "Bogus virtual array access" error that occurred when using the
|
||||
lossless crop feature in jpegtran or the TurboJPEG API, if libjpeg-turbo was
|
||||
built with libjpeg v7 API/ABI emulation. This was apparently a long-standing
|
||||
bug that has existed since the introduction of libjpeg v7/v8 API/ABI emulation
|
||||
in libjpeg-turbo v1.1.
|
||||
|
||||
7. The lossless transform features in jpegtran and the TurboJPEG API will now
|
||||
always attempt to adjust the EXIF image width and height tags if the image size
|
||||
changed as a result of the transform. This behavior has always existed when
|
||||
using libjpeg v8 API/ABI emulation. It was supposed to be available with
|
||||
libjpeg v7 API/ABI emulation as well but did not work properly due to a bug.
|
||||
Furthermore, there was never any good reason not to enable it with libjpeg v6b
|
||||
API/ABI emulation, since the behavior is entirely internal. Note that
|
||||
`-copy all` must be passed to jpegtran in order to transfer the EXIF tags from
|
||||
the source image to the destination image.
|
||||
|
||||
8. Fixed several memory leaks in the TurboJPEG API library that could occur
|
||||
if the library was built with certain compilers and optimization levels
|
||||
(known to occur with GCC 4.x and clang with `-O1` and higher but not with
|
||||
GCC 5.x or 6.x) and one of the underlying libjpeg API functions threw an error
|
||||
after a TurboJPEG API function allocated a local buffer.
|
||||
|
||||
9. The libjpeg-turbo memory manager will now honor the `max_memory_to_use`
|
||||
structure member in jpeg\_memory\_mgr, which can be set to the maximum amount
|
||||
of memory (in bytes) that libjpeg-turbo should use during decompression or
|
||||
multi-pass (including progressive) compression. This limit can also be set
|
||||
using the `JPEGMEM` environment variable or using the `-maxmemory` switch in
|
||||
cjpeg/djpeg/jpegtran (refer to the respective man pages for more details.)
|
||||
This has been a documented feature of libjpeg since v5, but the
|
||||
`malloc()`/`free()` implementation of the memory manager (jmemnobs.c) never
|
||||
implemented the feature. Restricting libjpeg-turbo's memory usage is useful
|
||||
for two reasons: it allows testers to more easily work around the 2 GB limit
|
||||
in libFuzzer, and it allows developers of security-sensitive applications to
|
||||
more easily defend against one of the progressive JPEG exploits (LJT-01-004)
|
||||
identified in
|
||||
[this report](http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf).
|
||||
|
||||
10. TJBench will now run each benchmark for 1 second prior to starting the
|
||||
timer, in order to improve the consistency of the results. Furthermore, the
|
||||
`-warmup` option is now used to specify the amount of warmup time rather than
|
||||
the number of warmup iterations.
|
||||
|
||||
11. Fixed an error (`short jump is out of range`) that occurred when assembling
|
||||
the 32-bit x86 SIMD extensions with NASM versions prior to 2.04. This was a
|
||||
regression introduced by 1.5 beta1[12].
|
||||
|
||||
|
||||
1.5.1
|
||||
=====
|
||||
|
||||
|
||||
57
LICENSE.md
57
LICENSE.md
@@ -9,12 +9,11 @@ libjpeg-turbo is covered by three compatible BSD-style open source licenses:
|
||||
This license applies to the libjpeg API library and associated programs
|
||||
(any code inherited from libjpeg, and any modifications to that code.)
|
||||
|
||||
- The Modified (3-clause) BSD License, which is listed in
|
||||
[turbojpeg.c](turbojpeg.c)
|
||||
- The Modified (3-clause) BSD License, which is listed below
|
||||
|
||||
This license covers the TurboJPEG API library and associated programs.
|
||||
|
||||
- The zlib License, which is listed in [simd/jsimdext.inc](simd/jsimdext.inc)
|
||||
- The zlib License, which is listed below
|
||||
|
||||
This license is a subset of the other two, and it covers the libjpeg-turbo
|
||||
SIMD extensions.
|
||||
@@ -86,3 +85,55 @@ best of our understanding.
|
||||
- IJG License
|
||||
- Modified BSD License
|
||||
- zlib License
|
||||
|
||||
|
||||
The Modified (3-clause) BSD License
|
||||
===================================
|
||||
|
||||
Copyright (C)\<YEAR\> \<AUTHOR\>. All Rights Reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
- Neither the name of the libjpeg-turbo Project nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
The zlib License
|
||||
================
|
||||
|
||||
Copyright (C) \<YEAR\>, \<AUTHOR\>.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
15
Makefile.am
15
Makefile.am
@@ -216,6 +216,8 @@ 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_FLOAT_PROG_387 = bc6dbbefac2872f6b9d6c4a0ae60c3c0
|
||||
MD5_PPM_3x2_FLOAT_387 = bcc5723c61560463ac60f772e742d092
|
||||
MD5_JPEG_3x2_IFAST_PROG = 1396cc2b7185cfe943d408c9d305339e
|
||||
MD5_PPM_3x2_IFAST = 3975985ef6eeb0a2cdc58daa651ccc00
|
||||
MD5_PPM_420M_ISLOW_2_1 = 4ca6be2a6f326ff9eaab63e70a8259c0
|
||||
@@ -263,6 +265,8 @@ 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_FLOAT_PROG_387 = 1657664a410e0822c924b54f6f65e6e9
|
||||
MD5_PPM_3x2_FLOAT_387 = cb0a1f027f3d2917c902b5640214e025
|
||||
MD5_JPEG_3x2_IFAST_PROG = 1ee5d2c1a77f2da495f993c8c7cceca5
|
||||
MD5_PPM_3x2_IFAST = fd283664b3b49127984af0a7f118fccd
|
||||
MD5_JPEG_420_ISLOW_ARI = e986fb0a637a8d833d96e8a6d6d84ea1
|
||||
@@ -351,7 +355,7 @@ 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
|
||||
TJ_REVERT=1 ./tjbench testout_tile.ppm 95 -rgb -quiet -tile -benchtime 0.01 >/dev/null 2>&1
|
||||
TJ_REVERT=1 ./tjbench testout_tile.ppm 95 -rgb -quiet -tile -benchtime 0.01 -warmup 0 >/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
|
||||
@@ -370,7 +374,7 @@ MD5_PPM_444_TILE = 7964e41e67cfb8d0a587c0aa4798f9c3
|
||||
done
|
||||
rm -f testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_*
|
||||
|
||||
TJ_REVERT=1 ./tjbench testout_tile.ppm 95 -rgb -fastupsample -quiet -tile -benchtime 0.01 >/dev/null 2>&1
|
||||
TJ_REVERT=1 ./tjbench testout_tile.ppm 95 -rgb -fastupsample -quiet -tile -benchtime 0.01 -warmup 0 >/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; \
|
||||
@@ -495,6 +499,9 @@ endif
|
||||
# x86-64 compilers)
|
||||
# FLOATTEST=64bit validate against the exepected results from the C code
|
||||
# when running on a 64-bit FPU
|
||||
# FLOATTEST=387 validate against the expected results from the C code when
|
||||
# the 387 FPU is being used for floating point math (which is
|
||||
# generally the default with x86 compilers)
|
||||
|
||||
# CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff
|
||||
./cjpeg -revert -sample 3x2 -dct float -prog -outfile testout_3x2_float_prog.jpg $(srcdir)/testimages/testorig.ppm
|
||||
@@ -502,6 +509,8 @@ endif
|
||||
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; \
|
||||
elif [ "${FLOATTEST}" = "387" ]; then \
|
||||
md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG_387) 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
|
||||
@@ -511,6 +520,8 @@ endif
|
||||
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; \
|
||||
elif [ "${FLOATTEST}" = "387" ]; then \
|
||||
md5/md5cmp $(MD5_PPM_3x2_FLOAT_387) testout_3x2_float.ppm; \
|
||||
fi
|
||||
rm -f testout_3x2_float.ppm testout_3x2_float_prog.jpg
|
||||
|
||||
|
||||
4
cjpeg.1
4
cjpeg.1
@@ -1,4 +1,4 @@
|
||||
.TH CJPEG 1 "17 February 2016"
|
||||
.TH CJPEG 1 "18 March 2017"
|
||||
.SH NAME
|
||||
cjpeg \- compress an image file to a JPEG file
|
||||
.SH SYNOPSIS
|
||||
@@ -202,7 +202,7 @@ Set limit for amount of memory to use in processing large images. Value is
|
||||
in thousands of bytes, or millions of bytes if "M" is attached to the
|
||||
number. For example,
|
||||
.B \-max 4m
|
||||
selects 4000000 bytes. If more space is needed, temporary files will be used.
|
||||
selects 4000000 bytes. If more space is needed, an error will occur.
|
||||
.TP
|
||||
.BI \-outfile " name"
|
||||
Send output image to the named file, not to standard output.
|
||||
|
||||
6
cjpeg.c
6
cjpeg.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2003-2011 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2010, 2013-2014, D. R. Commander.
|
||||
* Copyright (C) 2010, 2013-2014, 2017, D. R. Commander.
|
||||
* mozjpeg Modifications:
|
||||
* Copyright (C) 2014, Mozilla Corporation.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
@@ -231,11 +231,11 @@ usage (void)
|
||||
fprintf(stderr, " -verbose or -debug Emit debug output\n");
|
||||
fprintf(stderr, " -version Print version information and exit\n");
|
||||
fprintf(stderr, "Switches for wizards:\n");
|
||||
fprintf(stderr, " -qtables file Use quantization tables given in file\n");
|
||||
fprintf(stderr, " -qtables FILE Use quantization tables given in FILE\n");
|
||||
fprintf(stderr, " -qslots N[,...] Set component quantization tables\n");
|
||||
fprintf(stderr, " -sample HxV[,...] Set component sampling factors\n");
|
||||
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
||||
fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n");
|
||||
fprintf(stderr, " -scans FILE Create multi-scan JPEG per script FILE\n");
|
||||
#endif
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
24
cmakescripts/cmake_uninstall.cmake.in
Normal file
24
cmakescripts/cmake_uninstall.cmake.in
Normal file
@@ -0,0 +1,24 @@
|
||||
# This code is from the CMake FAQ
|
||||
|
||||
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
list(REVERSE files)
|
||||
foreach (file ${files})
|
||||
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
||||
if (EXISTS "$ENV{DESTDIR}${file}")
|
||||
execute_process(
|
||||
COMMAND "@CMAKE_COMMAND@" -E remove "$ENV{DESTDIR}${file}"
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RESULT_VARIABLE rm_retval
|
||||
)
|
||||
if(NOT ${rm_retval} EQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||
endif (NOT ${rm_retval} EQUAL 0)
|
||||
else (EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||
endif (EXISTS "$ENV{DESTDIR}${file}")
|
||||
endforeach(file)
|
||||
@@ -24,7 +24,12 @@ file(GLOB FILES
|
||||
*_440_*.png
|
||||
*_440_*.ppm
|
||||
*_440_*.jpg
|
||||
*_440.yuv)
|
||||
*_440.yuv
|
||||
*_411_*.bmp
|
||||
*_411_*.png
|
||||
*_411_*.ppm
|
||||
*_411_*.jpg
|
||||
*_411.yuv)
|
||||
|
||||
if(NOT FILES STREQUAL "")
|
||||
message(STATUS "Removing test files")
|
||||
|
||||
@@ -233,9 +233,9 @@ AC_SUBST(MEM_SRCDST_FUNCTIONS)
|
||||
AC_DEFINE_UNQUOTED(MOZJPEG_VERSION, [$VERSION], [mozjpeg version])
|
||||
|
||||
m4_define(version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
|
||||
m4_define(version_major,m4_argn(1,version_triplet))
|
||||
m4_define(version_minor,m4_argn(2,version_triplet))
|
||||
m4_define(version_revision,m4_argn(3,version_triplet))
|
||||
m4_define(version_major,m4_car(m4_shiftn(1,[],version_triplet)))
|
||||
m4_define(version_minor,m4_car(m4_shiftn(2,[],version_triplet)))
|
||||
m4_define(version_revision,m4_car(m4_shiftn(3,[],version_triplet)))
|
||||
VERSION_MAJOR=version_major
|
||||
VERSION_MINOR=version_minor
|
||||
VERSION_REVISION=version_revision
|
||||
|
||||
4
djpeg.1
4
djpeg.1
@@ -1,4 +1,4 @@
|
||||
.TH DJPEG 1 "18 February 2016"
|
||||
.TH DJPEG 1 "18 March 2017"
|
||||
.SH NAME
|
||||
djpeg \- decompress a JPEG file to an image file
|
||||
.SH SYNOPSIS
|
||||
@@ -185,7 +185,7 @@ Set limit for amount of memory to use in processing large images. Value is
|
||||
in thousands of bytes, or millions of bytes if "M" is attached to the
|
||||
number. For example,
|
||||
.B \-max 4m
|
||||
selects 4000000 bytes. If more space is needed, temporary files will be used.
|
||||
selects 4000000 bytes. If more space is needed, an error will occur.
|
||||
.TP
|
||||
.BI \-outfile " name"
|
||||
Send output image to the named file, not to standard output.
|
||||
|
||||
@@ -455,7 +455,7 @@ Variables</h2></td></tr>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Disable buffer (re)allocation. </p>
|
||||
<p>If passed to <a class="el" href="group___turbo_j_p_e_g.html#gaf38f2ed44bdc88e730e08b632fa6e88e" title="Compress an RGB, grayscale, or CMYK image into a JPEG image.">tjCompress2()</a> or <a class="el" href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a>, this flag will cause those functions to generate an error if the JPEG image buffer is invalid or too small rather than attempting to allocate or reallocate that buffer. This reproduces the behavior of earlier versions of TurboJPEG. </p>
|
||||
<p>If passed to one of the JPEG compression or transform functions, this flag will cause those functions to generate an error if the JPEG image buffer is invalid or too small rather than attempting to allocate or reallocate that buffer. This reproduces the behavior of earlier versions of TurboJPEG. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -812,7 +812,7 @@ Variables</h2></td></tr>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Allocate an image buffer for use with TurboJPEG. </p>
|
||||
<p>You should always use this function to allocate the JPEG destination buffer(s) for <a class="el" href="group___turbo_j_p_e_g.html#gaf38f2ed44bdc88e730e08b632fa6e88e" title="Compress an RGB, grayscale, or CMYK image into a JPEG image.">tjCompress2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> unless you are disabling automatic buffer (re)allocation (by setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>.)</p>
|
||||
<p>You should always use this function to allocate the JPEG destination buffer(s) for the compression and transform functions unless you are disabling automatic buffer (re)allocation (by setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>.)</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">bytes</td><td>the number of bytes to allocate</td></tr>
|
||||
@@ -1008,7 +1008,7 @@ Variables</h2></td></tr>
|
||||
<tr><td class="paramname">jpegBuf</td><td>address of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<ol type="1">
|
||||
<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
|
||||
<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.)</li>
|
||||
</ol>
|
||||
If you choose option 1, <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
|
||||
@@ -1106,7 +1106,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
<tr><td class="paramname">jpegBuf</td><td>address of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<ol type="1">
|
||||
<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
|
||||
<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.)</li>
|
||||
</ol>
|
||||
If you choose option 1, <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
|
||||
@@ -1203,7 +1203,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
<tr><td class="paramname">jpegBuf</td><td>address of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<ol type="1">
|
||||
<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
|
||||
<li>set <code>*jpegBuf</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.)</li>
|
||||
</ol>
|
||||
If you choose option 1, <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
|
||||
<tr><td class="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
|
||||
@@ -1942,7 +1942,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Free an image buffer previously allocated by TurboJPEG. </p>
|
||||
<p>You should always use this function to free JPEG destination buffer(s) that were automatically (re)allocated by <a class="el" href="group___turbo_j_p_e_g.html#gaf38f2ed44bdc88e730e08b632fa6e88e" title="Compress an RGB, grayscale, or CMYK image into a JPEG image.">tjCompress2()</a> or <a class="el" href="group___turbo_j_p_e_g.html#gad02cd42b69f193a0623a9c801788df3a" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> or that were manually allocated using <a class="el" href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a>.</p>
|
||||
<p>You should always use this function to free JPEG destination buffer(s) that were automatically (re)allocated by the compression and transform functions or that were manually allocated using <a class="el" href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a>.</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">buffer</td><td>address of the buffer to free</td></tr>
|
||||
@@ -2270,7 +2270,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
|
||||
<tr><td class="paramname">dstBufs</td><td>pointer to an array of n image buffers. <code>dstBufs[i]</code> will receive a JPEG image that has been transformed using the parameters in <code>transforms[i]</code>. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<ol type="1">
|
||||
<li>pre-allocate the JPEG buffer with an arbitrary size using <a class="el" href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
|
||||
<li>set <code>dstBufs[i]</code> to NULL to tell TurboJPEG to allocate the buffer for you, or</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a> with the transformed or cropped width and height. This should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees this.)</li>
|
||||
<li>pre-allocate the buffer to a "worst case" size determined by calling <a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b" title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a> with the transformed or cropped width and height. Under normal circumstances, this should ensure that the buffer never has to be re-allocated (setting <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.) Note, however, that there are some rare cases (such as transforming images with a large amount of embedded EXIF or ICC profile data) in which the output image will be larger than the worst-case size, and <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> cannot be used in those cases.</li>
|
||||
</ol>
|
||||
If you choose option 1, <code>dstSizes[i]</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963" title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>dstBufs[i]</code> upon return from this function, as it may have changed.</td></tr>
|
||||
<tr><td class="paramname">dstSizes</td><td>pointer to an array of n unsigned long variables that will receive the actual sizes (in bytes) of each transformed JPEG image. If <code>dstBufs[i]</code> points to a pre-allocated buffer, then <code>dstSizes[i]</code> should be set to the size of the buffer. Upon return, <code>dstSizes[i]</code> will contain the size of the JPEG image (in bytes.)</td></tr>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2009-2014, 2016 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2009-2014, 2016-2017 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:
|
||||
@@ -34,8 +34,8 @@ import org.libjpegturbo.turbojpeg.*;
|
||||
|
||||
class TJBench {
|
||||
|
||||
static int flags = 0, quiet = 0, pf = TJ.PF_BGR, yuvpad = 1, warmup = 1;
|
||||
static boolean compOnly, decompOnly, doTile, doYUV, write;
|
||||
static int flags = 0, quiet = 0, pf = TJ.PF_BGR, yuvpad = 1;
|
||||
static boolean compOnly, decompOnly, doTile, doYUV, write = true;
|
||||
|
||||
static final String[] pixFormatStr = {
|
||||
"RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "GRAY"
|
||||
@@ -55,7 +55,7 @@ class TJBench {
|
||||
|
||||
static TJScalingFactor sf;
|
||||
static int xformOp = TJTransform.OP_NONE, xformOpt = 0;
|
||||
static double benchTime = 5.0;
|
||||
static double benchTime = 5.0, warmup = 1.0;
|
||||
|
||||
|
||||
static final double getTime() {
|
||||
@@ -162,7 +162,7 @@ class TJBench {
|
||||
}
|
||||
|
||||
/* Benchmark */
|
||||
iter -= warmup;
|
||||
iter = -1;
|
||||
elapsed = elapsedDecode = 0.0;
|
||||
while (true) {
|
||||
int tile = 0;
|
||||
@@ -184,11 +184,14 @@ class TJBench {
|
||||
tjd.decompress(dstBuf, x, y, width, pitch, height, pf, flags);
|
||||
}
|
||||
}
|
||||
iter++;
|
||||
if (iter >= 1) {
|
||||
elapsed += getTime() - start;
|
||||
if (iter >= 0) {
|
||||
iter++;
|
||||
if (elapsed >= benchTime)
|
||||
break;
|
||||
} else if (elapsed >= warmup) {
|
||||
iter = 0;
|
||||
elapsed = elapsedDecode = 0.0;
|
||||
}
|
||||
}
|
||||
if(doYUV)
|
||||
@@ -321,7 +324,7 @@ class TJBench {
|
||||
}
|
||||
|
||||
/* Benchmark */
|
||||
iter = -warmup;
|
||||
iter = -1;
|
||||
elapsed = elapsedEncode = 0.0;
|
||||
while (true) {
|
||||
int tile = 0;
|
||||
@@ -346,11 +349,14 @@ class TJBench {
|
||||
totalJpegSize += jpegSize[tile];
|
||||
}
|
||||
}
|
||||
iter++;
|
||||
if (iter >= 1) {
|
||||
elapsed += getTime() - start;
|
||||
if (iter >= 0) {
|
||||
iter++;
|
||||
if (elapsed >= benchTime)
|
||||
break;
|
||||
} else if (elapsed >= warmup) {
|
||||
iter = 0;
|
||||
elapsed = elapsedEncode = 0.0;
|
||||
}
|
||||
}
|
||||
if (doYUV)
|
||||
@@ -541,17 +547,20 @@ class TJBench {
|
||||
}
|
||||
}
|
||||
|
||||
iter = -warmup;
|
||||
iter = -1;
|
||||
elapsed = 0.;
|
||||
while (true) {
|
||||
start = getTime();
|
||||
tjt.transform(jpegBuf, t, flags);
|
||||
jpegSize = tjt.getTransformedSizes();
|
||||
iter++;
|
||||
if (iter >= 1) {
|
||||
elapsed += getTime() - start;
|
||||
if (iter >= 0) {
|
||||
iter++;
|
||||
if (elapsed >= benchTime)
|
||||
break;
|
||||
} else if (elapsed >= warmup) {
|
||||
iter = 0;
|
||||
elapsed = 0.0;
|
||||
}
|
||||
}
|
||||
t = null;
|
||||
@@ -582,8 +591,8 @@ class TJBench {
|
||||
System.out.print("N/A N/A ");
|
||||
jpegBuf = new byte[1][TJ.bufSize(_tilew, _tileh, subsamp)];
|
||||
jpegSize = new int[1];
|
||||
jpegBuf[0] = srcBuf;
|
||||
jpegSize[0] = srcSize;
|
||||
System.arraycopy(srcBuf, 0, jpegBuf[0], 0, srcSize);
|
||||
}
|
||||
|
||||
if (w == tilew)
|
||||
@@ -659,8 +668,9 @@ class TJBench {
|
||||
System.out.println("-grayscale = Perform lossless grayscale conversion prior to decompression");
|
||||
System.out.println(" test (can be combined with the other transforms above)");
|
||||
System.out.println("-benchtime <t> = Run each benchmark for at least <t> seconds (default = 5.0)");
|
||||
System.out.println("-warmup <w> = Execute each benchmark <w> times to prime the cache before");
|
||||
System.out.println(" taking performance measurements (default = 1)");
|
||||
System.out.println("-warmup <t> = Run each benchmark for <t> seconds (default = 1.0) prior to");
|
||||
System.out.println(" starting the timer, in order to prime the caches and thus improve the");
|
||||
System.out.println(" consistency of the results.");
|
||||
System.out.println("-componly = Stop after running compression tests. Do not test decompression.");
|
||||
System.out.println("-nowrite = Do not write reference or output images (improves consistency");
|
||||
System.out.println(" of performance measurements.)\n");
|
||||
@@ -824,14 +834,15 @@ class TJBench {
|
||||
if (argv[i].equalsIgnoreCase("-nowrite"))
|
||||
write = false;
|
||||
if (argv[i].equalsIgnoreCase("-warmup") && i < argv.length - 1) {
|
||||
int temp = -1;
|
||||
double temp = -1;
|
||||
try {
|
||||
temp = Integer.parseInt(argv[++i]);
|
||||
temp = Double.parseDouble(argv[++i]);
|
||||
} catch (NumberFormatException e) {}
|
||||
if (temp >= 0) {
|
||||
if (temp >= 0.0) {
|
||||
warmup = temp;
|
||||
System.out.format("Warmup runs = %d\n\n", warmup);
|
||||
}
|
||||
System.out.format("Warmup time = %.1f seconds\n\n", warmup);
|
||||
} else
|
||||
usage();
|
||||
}
|
||||
if (argv[i].equalsIgnoreCase("-?"))
|
||||
usage();
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
/* libjpeg-turbo build number */
|
||||
#undef BUILD
|
||||
|
||||
/* Compiler's inline keyword */
|
||||
#undef inline
|
||||
|
||||
/* How to obtain function inlining. */
|
||||
#undef INLINE
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
#include "jpeglib.h"
|
||||
|
||||
|
||||
#define NEG_1 ((unsigned int)-1)
|
||||
|
||||
|
||||
/* Expanded entropy decoder object for arithmetic decoding. */
|
||||
|
||||
typedef struct {
|
||||
@@ -450,7 +453,7 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
|
||||
|
||||
p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
|
||||
m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */
|
||||
m1 = (NEG_1) << cinfo->Al; /* -1 in the bit position being coded */
|
||||
|
||||
/* Establish EOBx (previous stage end-of-block) index */
|
||||
for (kex = cinfo->Se; kex > 0; kex--)
|
||||
|
||||
@@ -32,7 +32,10 @@
|
||||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jmemsys.h" /* import the system-dependent declarations */
|
||||
#ifndef _WIN32
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
|
||||
#ifndef NO_GETENV
|
||||
#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare getenv() */
|
||||
|
||||
14
jmemnobs.c
14
jmemnobs.c
@@ -3,8 +3,8 @@
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1992-1996, Thomas G. Lane.
|
||||
* It was modified by The libjpeg-turbo Project to include only code and
|
||||
* information relevant to libjpeg-turbo.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2017, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -15,7 +15,6 @@
|
||||
* This is very portable in the sense that it'll compile on almost anything,
|
||||
* but you'd better have lots of main memory (or virtual memory) if you want
|
||||
* to process big images.
|
||||
* Note that the max_memory_to_use option is ignored by this implementation.
|
||||
*/
|
||||
|
||||
#define JPEG_INTERNALS
|
||||
@@ -66,15 +65,22 @@ jpeg_free_large (j_common_ptr cinfo, void *object, size_t sizeofobject)
|
||||
|
||||
/*
|
||||
* This routine computes the total memory space available for allocation.
|
||||
* Here we always say, "we got all you want bud!"
|
||||
*/
|
||||
|
||||
GLOBAL(size_t)
|
||||
jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed,
|
||||
size_t max_bytes_needed, size_t already_allocated)
|
||||
{
|
||||
if (cinfo->mem->max_memory_to_use) {
|
||||
if (cinfo->mem->max_memory_to_use > already_allocated)
|
||||
return cinfo->mem->max_memory_to_use - already_allocated;
|
||||
else
|
||||
return 0;
|
||||
} else {
|
||||
/* Here we always say, "we got all you want bud!" */
|
||||
return max_bytes_needed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH JPEGTRAN 1 "18 February 2016"
|
||||
.TH JPEGTRAN 1 "18 March 2017"
|
||||
.SH NAME
|
||||
jpegtran \- lossless transformation of JPEG files
|
||||
.SH SYNOPSIS
|
||||
@@ -222,7 +222,7 @@ Set limit for amount of memory to use in processing large images. Value is
|
||||
in thousands of bytes, or millions of bytes if "M" is attached to the
|
||||
number. For example,
|
||||
.B \-max 4m
|
||||
selects 4000000 bytes. If more space is needed, temporary files will be used.
|
||||
selects 4000000 bytes. If more space is needed, an error will occur.
|
||||
.TP
|
||||
.BI \-outfile " name"
|
||||
Send output image to the named file, not to standard output.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1995-2010, Thomas G. Lane, Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2010, 2014, D. R. Commander.
|
||||
* Copyright (C) 2010, 2014, 2017, D. R. Commander.
|
||||
* mozjpeg Modifications:
|
||||
* Copyright (C) 2014, Mozilla Corporation.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
@@ -95,7 +95,7 @@ usage (void)
|
||||
fprintf(stderr, " -version Print version information and exit\n");
|
||||
fprintf(stderr, "Switches for wizards:\n");
|
||||
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
||||
fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n");
|
||||
fprintf(stderr, " -scans FILE Create multi-scan JPEG per script FILE\n");
|
||||
#endif
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -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-2016, D. R. Commander.
|
||||
* Copyright (C) 2010, 2012-2017, D. R. Commander.
|
||||
* mozjpeg Modifications:
|
||||
* Copyright (C) 2014, Mozilla Corporation.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
@@ -36,7 +36,7 @@
|
||||
* their code
|
||||
*/
|
||||
|
||||
#define JCOPYRIGHT "Copyright (C) 2009-2016 D. R. Commander\n" \
|
||||
#define JCOPYRIGHT "Copyright (C) 2009-2017 D. R. Commander\n" \
|
||||
"Copyright (C) 2011-2016 Siarhei Siamashka\n" \
|
||||
"Copyright (C) 2015-2016 Matthieu Darbois\n" \
|
||||
"Copyright (C) 2015 Google, Inc.\n" \
|
||||
@@ -48,4 +48,4 @@
|
||||
"Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
|
||||
"Copyright (C) 1991-2016 Thomas G. Lane, Guido Vollbeding" \
|
||||
|
||||
#define JCOPYRIGHT_SHORT "Copyright (C) 1991-2016 The libjpeg-turbo Project and many others"
|
||||
#define JCOPYRIGHT_SHORT "Copyright (C) 1991-2017 The libjpeg-turbo Project and many others"
|
||||
|
||||
15
libjpeg.txt
15
libjpeg.txt
@@ -3,7 +3,7 @@ USING THE IJG JPEG LIBRARY
|
||||
This file was part of the Independent JPEG Group's software:
|
||||
Copyright (C) 1994-2013, Thomas G. Lane, Guido Vollbeding.
|
||||
libjpeg-turbo Modifications:
|
||||
Copyright (C) 2010, 2014-2016, D. R. Commander.
|
||||
Copyright (C) 2010, 2014-2017, D. R. Commander.
|
||||
Copyright (C) 2015, Google, Inc.
|
||||
For conditions of distribution and use, see the accompanying README.ijg file.
|
||||
|
||||
@@ -34,6 +34,7 @@ Basic library usage:
|
||||
Data formats
|
||||
Compression details
|
||||
Decompression details
|
||||
Partial image decompression
|
||||
Mechanics of usage: include files, linking, etc
|
||||
Advanced features:
|
||||
Compression parameter selection
|
||||
@@ -2941,13 +2942,6 @@ Some operating modes (eg, two-pass color quantization) require full-image
|
||||
buffers. Such buffers are treated as "virtual arrays": only the current strip
|
||||
need be in memory, and the rest can be swapped out to a temporary file.
|
||||
|
||||
If you use the simplest memory manager back end (jmemnobs.c), then no
|
||||
temporary files are used; virtual arrays are simply malloc()'d. Images bigger
|
||||
than memory can be processed only if your system supports virtual memory.
|
||||
The other memory manager back ends support temporary files of various flavors
|
||||
and thus work in machines without virtual memory. They may also be useful on
|
||||
Unix machines if you need to process images that exceed available swap space.
|
||||
|
||||
When using temporary files, the library will make the in-memory buffers for
|
||||
its virtual arrays just big enough to stay within a "maximum memory" setting.
|
||||
Your application can set this limit by setting cinfo->mem->max_memory_to_use
|
||||
@@ -2960,6 +2954,11 @@ that space allocated with alloc_small() is ignored, on the assumption that
|
||||
it's too small to be worth worrying about; so a reasonable safety margin
|
||||
should be left when setting max_memory_to_use.
|
||||
|
||||
NOTE: Unless you develop your own memory manager back end, then temporary files
|
||||
will never be used. The back end provided in libjpeg-turbo (jmemnobs.c) simply
|
||||
malloc()s and free()s virtual arrays, and an error occurs if the required
|
||||
memory exceeds the limit specified in cinfo->mem->max_memory_to_use.
|
||||
|
||||
|
||||
Memory usage
|
||||
------------
|
||||
|
||||
@@ -31,6 +31,15 @@
|
||||
|
||||
#include "./md5.h"
|
||||
|
||||
#ifdef __amigaos4__
|
||||
#include <machine/endian.h>
|
||||
#define le32toh(x) (((x & 0xff) << 24) | \
|
||||
((x & 0xff00) << 8) | \
|
||||
((x & 0xff0000) >> 8) | \
|
||||
((x & 0xff000000) >> 24))
|
||||
#define htole32(x) le32toh(x)
|
||||
#endif
|
||||
|
||||
static void MD5Transform(unsigned int [4], const unsigned char [64]);
|
||||
|
||||
#if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
|
||||
4
rdppm.c
4
rdppm.c
@@ -251,7 +251,7 @@ get_word_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
ptr = source->pub.buffer[0];
|
||||
bufferptr = source->iobuffer;
|
||||
for (col = cinfo->image_width; col > 0; col--) {
|
||||
register int temp;
|
||||
register unsigned int temp;
|
||||
temp = UCH(*bufferptr++) << 8;
|
||||
temp |= UCH(*bufferptr++);
|
||||
if (temp > maxval)
|
||||
@@ -278,7 +278,7 @@ get_word_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
ptr = source->pub.buffer[0];
|
||||
bufferptr = source->iobuffer;
|
||||
for (col = cinfo->image_width; col > 0; col--) {
|
||||
register int temp;
|
||||
register unsigned int temp;
|
||||
temp = UCH(*bufferptr++) << 8;
|
||||
temp |= UCH(*bufferptr++);
|
||||
if (temp > maxval)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
if(NOT DEFINED NASM)
|
||||
set(NASM nasm CACHE FILEPATH "Path to NASM/YASM executable")
|
||||
find_program(NASM NAMES nasm yasm DOC "Path to NASM/YASM executable")
|
||||
endif()
|
||||
message(STATUS "NASM = ${NASM}")
|
||||
|
||||
if(SIMD_X86_64)
|
||||
set(NAFLAGS -fwin64 -DWIN64 -D__x86_64__)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
;
|
||||
; jchuff-sse2.asm - Huffman entropy encoding (SSE2)
|
||||
;
|
||||
; Copyright (C) 2009-2011, 2014-2016, D. R. Commander.
|
||||
; Copyright (C) 2009-2011, 2014-2017, D. R. Commander.
|
||||
; Copyright (C) 2015, Matthieu Darbois.
|
||||
;
|
||||
; Based on the x86 SIMD extension for IJG JPEG library
|
||||
@@ -288,13 +288,13 @@ EXTN(jsimd_huff_encode_one_block_sse2):
|
||||
|
||||
.BLOOP:
|
||||
bsf ecx, edx ; r = __builtin_ctzl(index);
|
||||
jz .ELOOP
|
||||
jz near .ELOOP
|
||||
lea esi, [esi+ecx*2] ; k += r;
|
||||
shr edx, cl ; index >>= r;
|
||||
mov DWORD [esp+temp3], edx
|
||||
.BRLOOP:
|
||||
cmp ecx, 16 ; while (r > 15) {
|
||||
jl .ERLOOP
|
||||
jl near .ERLOOP
|
||||
sub ecx, 16 ; r -= 16;
|
||||
mov DWORD [esp+temp], ecx
|
||||
mov eax, INT [ebp + 240 * 4] ; code_0xf0 = actbl->ehufco[0xf0];
|
||||
@@ -348,7 +348,7 @@ EXTN(jsimd_huff_encode_one_block_sse2):
|
||||
sub eax, esi
|
||||
shr eax, 1
|
||||
bsf ecx, edx ; r = __builtin_ctzl(index);
|
||||
jz .ELOOP2
|
||||
jz near .ELOOP2
|
||||
shr edx, cl ; index >>= r;
|
||||
add ecx, eax
|
||||
lea esi, [esi+ecx*2] ; k += r;
|
||||
@@ -356,13 +356,13 @@ EXTN(jsimd_huff_encode_one_block_sse2):
|
||||
jmp .BRLOOP2
|
||||
.BLOOP2:
|
||||
bsf ecx, edx ; r = __builtin_ctzl(index);
|
||||
jz .ELOOP2
|
||||
jz near .ELOOP2
|
||||
lea esi, [esi+ecx*2] ; k += r;
|
||||
shr edx, cl ; index >>= r;
|
||||
mov DWORD [esp+temp3], edx
|
||||
.BRLOOP2:
|
||||
cmp ecx, 16 ; while (r > 15) {
|
||||
jl .ERLOOP2
|
||||
jl near .ERLOOP2
|
||||
sub ecx, 16 ; r -= 16;
|
||||
mov DWORD [esp+temp], ecx
|
||||
mov eax, INT [ebp + 240 * 4] ; code_0xf0 = actbl->ehufco[0xf0];
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* jsimd_arm.c
|
||||
*
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2011, Nokia Corporation and/or its subsidiary(-ies).
|
||||
* Copyright (C) 2009-2011, 2013-2014, 2016, D. R. Commander.
|
||||
* Copyright (C) 2015-2016, Matthieu Darbois.
|
||||
*
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* jsimd_arm64.c
|
||||
*
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2011, Nokia Corporation and/or its subsidiary(-ies).
|
||||
* Copyright (C) 2009-2011, 2013-2014, 2016, D. R. Commander.
|
||||
* Copyright (C) 2015-2016, Matthieu Darbois.
|
||||
*
|
||||
|
||||
@@ -63,6 +63,8 @@ parse_proc_cpuinfo(const char* search_string)
|
||||
LOCAL(void)
|
||||
init_simd (void)
|
||||
{
|
||||
char *env = NULL;
|
||||
|
||||
if (simd_support != ~0U)
|
||||
return;
|
||||
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
* PowerPC architecture.
|
||||
*/
|
||||
|
||||
#ifdef __amigaos4__
|
||||
/* This must be defined first as it re-defines GLOBAL otherwise */
|
||||
#include <proto/exec.h>
|
||||
#endif
|
||||
|
||||
#define JPEG_INTERNALS
|
||||
#include "../jinclude.h"
|
||||
#include "../jpeglib.h"
|
||||
@@ -26,6 +31,12 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <machine/cpu.h>
|
||||
#endif
|
||||
|
||||
static unsigned int simd_support = ~0;
|
||||
|
||||
#if defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
|
||||
@@ -101,6 +112,12 @@ init_simd (void)
|
||||
char *env = NULL;
|
||||
#if !defined(__ALTIVEC__) && (defined(__linux__) || defined(ANDROID) || defined(__ANDROID__))
|
||||
int bufsize = 1024; /* an initial guess for the line buffer size limit */
|
||||
#elif defined(__amigaos4__)
|
||||
uint32 altivec = 0;
|
||||
#elif defined(__OpenBSD__)
|
||||
int mib[2] = { CTL_MACHDEP, CPU_ALTIVEC };
|
||||
int altivec;
|
||||
size_t len = sizeof(altivec);
|
||||
#endif
|
||||
|
||||
if (simd_support != ~0U)
|
||||
@@ -116,6 +133,13 @@ init_simd (void)
|
||||
if (bufsize > SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT)
|
||||
break;
|
||||
}
|
||||
#elif defined(__amigaos4__)
|
||||
IExec->GetCPUInfoTags(GCIT_VectorUnit, &altivec, TAG_DONE);
|
||||
if(altivec == VECTORTYPE_ALTIVEC)
|
||||
simd_support |= JSIMD_ALTIVEC;
|
||||
#elif defined(__OpenBSD__)
|
||||
if (sysctl(mib, 2, &altivec, &len, NULL, 0) == 0 && altivec != 0)
|
||||
simd_support |= JSIMD_ALTIVEC;
|
||||
#endif
|
||||
|
||||
/* Force different settings through environment variables */
|
||||
|
||||
@@ -832,21 +832,19 @@ read_backing_store, manipulate a backing-store object
|
||||
write_backing_store,
|
||||
close_backing_store
|
||||
|
||||
On some systems there will be more than one type of backing-store object
|
||||
(specifically, in MS-DOS a backing store file might be an area of extended
|
||||
memory as well as a disk file). jpeg_open_backing_store is responsible for
|
||||
choosing how to implement a given object. The read/write/close routines
|
||||
are method pointers in the structure that describes a given object; this
|
||||
lets them be different for different object types.
|
||||
On some systems there will be more than one type of backing-store object.
|
||||
jpeg_open_backing_store is responsible for choosing how to implement a given
|
||||
object. The read/write/close routines are method pointers in the structure
|
||||
that describes a given object; this lets them be different for different object
|
||||
types.
|
||||
|
||||
It may be necessary to ensure that backing store objects are explicitly
|
||||
released upon abnormal program termination. For example, MS-DOS won't free
|
||||
extended memory by itself. To support this, we will expect the main program
|
||||
or surrounding application to arrange to call self_destruct (typically via
|
||||
jpeg_destroy) upon abnormal termination. This may require a SIGINT signal
|
||||
handler or equivalent. We don't want to have the back end module install its
|
||||
own signal handler, because that would pre-empt the surrounding application's
|
||||
ability to control signal handling.
|
||||
released upon abnormal program termination. To support this, we will expect
|
||||
the main program or surrounding application to arrange to call self_destruct
|
||||
(typically via jpeg_destroy) upon abnormal termination. This may require a
|
||||
SIGINT signal handler or equivalent. We don't want to have the back end module
|
||||
install its own signal handler, because that would pre-empt the surrounding
|
||||
application's ability to control signal handling.
|
||||
|
||||
The IJG distribution includes several memory manager back end implementations.
|
||||
Usually the same back end should be suitable for all applications on a given
|
||||
|
||||
65
tjbench.c
65
tjbench.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2009-2016 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2009-2017 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:
|
||||
@@ -46,7 +46,7 @@
|
||||
#define _throwbmp(m) _throw(m, bmpgeterr())
|
||||
|
||||
int flags=TJFLAG_NOREALLOC, componly=0, decomponly=0, doyuv=0, quiet=0,
|
||||
dotile=0, pf=TJPF_BGR, yuvpad=1, warmup=1, dowrite=1;
|
||||
dotile=0, pf=TJPF_BGR, yuvpad=1, dowrite=1;
|
||||
char *ext="ppm";
|
||||
const char *pixFormatStr[TJ_NUMPF]=
|
||||
{
|
||||
@@ -64,7 +64,7 @@ const char *subName[TJ_NUMSAMP]={"444", "422", "420", "GRAY", "440", "411"};
|
||||
tjscalingfactor *scalingfactors=NULL, sf={1, 1}; int nsf=0;
|
||||
int xformop=TJXOP_NONE, xformopt=0;
|
||||
int (*customFilter)(short *, tjregion, tjregion, int, int, tjtransform *);
|
||||
double benchtime=5.0;
|
||||
double benchtime=5.0, warmup=1.0;
|
||||
|
||||
|
||||
char *formatName(int subsamp, int cs, char *buf)
|
||||
@@ -146,7 +146,7 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf,
|
||||
}
|
||||
|
||||
/* Benchmark */
|
||||
iter=-warmup;
|
||||
iter=-1;
|
||||
elapsed=elapsedDecode=0.;
|
||||
while(1)
|
||||
{
|
||||
@@ -176,12 +176,17 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf,
|
||||
_throwtj("executing tjDecompress2()");
|
||||
}
|
||||
}
|
||||
iter++;
|
||||
if(iter>=1)
|
||||
{
|
||||
elapsed+=gettime()-start;
|
||||
if(iter>=0)
|
||||
{
|
||||
iter++;
|
||||
if(elapsed>=benchtime) break;
|
||||
}
|
||||
else if(elapsed>=warmup)
|
||||
{
|
||||
iter=0;
|
||||
elapsed=elapsedDecode=0.;
|
||||
}
|
||||
}
|
||||
if(doyuv) elapsed-=elapsedDecode;
|
||||
|
||||
@@ -207,7 +212,7 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf,
|
||||
(double)(w*h)/1000000.*(double)iter/elapsed);
|
||||
if(doyuv)
|
||||
{
|
||||
printf("YUV Decode --> Frame rate: %f fps\n",
|
||||
printf("YUV Decode --> Frame rate: %f fps\n",
|
||||
(double)iter/elapsedDecode);
|
||||
printf(" Throughput: %f Megapixels/sec\n",
|
||||
(double)(w*h)/1000000.*(double)iter/elapsedDecode);
|
||||
@@ -340,7 +345,7 @@ int fullTest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
|
||||
}
|
||||
|
||||
/* Benchmark */
|
||||
iter=-warmup;
|
||||
iter=-1;
|
||||
elapsed=elapsedEncode=0.;
|
||||
while(1)
|
||||
{
|
||||
@@ -374,12 +379,17 @@ int fullTest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
|
||||
totaljpegsize+=jpegsize[tile];
|
||||
}
|
||||
}
|
||||
iter++;
|
||||
if(iter>=1)
|
||||
{
|
||||
elapsed+=gettime()-start;
|
||||
if(iter>=0)
|
||||
{
|
||||
iter++;
|
||||
if(elapsed>=benchtime) break;
|
||||
}
|
||||
else if(elapsed>=warmup)
|
||||
{
|
||||
iter=0;
|
||||
elapsed=elapsedEncode=0.;
|
||||
}
|
||||
}
|
||||
if(doyuv) elapsed-=elapsedEncode;
|
||||
|
||||
@@ -623,7 +633,7 @@ int decompTest(char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
iter=-warmup;
|
||||
iter=-1;
|
||||
elapsed=0.;
|
||||
while(1)
|
||||
{
|
||||
@@ -631,12 +641,17 @@ int decompTest(char *filename)
|
||||
if(tjTransform(handle, srcbuf, srcsize, _ntilesw*_ntilesh, jpegbuf,
|
||||
jpegsize, t, flags)==-1)
|
||||
_throwtj("executing tjTransform()");
|
||||
iter++;
|
||||
if(iter>=1)
|
||||
{
|
||||
elapsed+=gettime()-start;
|
||||
if(iter>=0)
|
||||
{
|
||||
iter++;
|
||||
if(elapsed>=benchtime) break;
|
||||
}
|
||||
else if(elapsed>=warmup)
|
||||
{
|
||||
iter=0;
|
||||
elapsed=0.;
|
||||
}
|
||||
}
|
||||
|
||||
free(t); t=NULL;
|
||||
@@ -668,7 +683,9 @@ int decompTest(char *filename)
|
||||
{
|
||||
if(quiet==1) printf("N/A N/A ");
|
||||
jpegsize[0]=srcsize;
|
||||
memcpy(jpegbuf[0], srcbuf, srcsize);
|
||||
free(jpegbuf[0]);
|
||||
jpegbuf[0]=srcbuf;
|
||||
srcbuf=NULL;
|
||||
}
|
||||
|
||||
if(w==tilew) _tilew=_w;
|
||||
@@ -763,8 +780,9 @@ void usage(char *progname)
|
||||
printf("-grayscale = Perform lossless grayscale conversion prior to decompression\n");
|
||||
printf(" test (can be combined with the other transforms above)\n");
|
||||
printf("-benchtime <t> = Run each benchmark for at least <t> seconds (default = 5.0)\n");
|
||||
printf("-warmup <w> = Execute each benchmark <w> times to prime the cache before\n");
|
||||
printf(" taking performance measurements (default = 1)\n");
|
||||
printf("-warmup <t> = Run each benchmark for <t> seconds (default = 1.0) prior to\n");
|
||||
printf(" starting the timer, in order to prime the caches and thus improve the\n");
|
||||
printf(" consistency of the results.\n");
|
||||
printf("-componly = Stop after running compression tests. Do not test decompression.\n");
|
||||
printf("-nowrite = Do not write reference or output images (improves consistency of\n");
|
||||
printf(" performance measurements.)\n\n");
|
||||
@@ -878,13 +896,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if(!strcasecmp(argv[i], "-warmup") && i<argc-1)
|
||||
{
|
||||
int temp=atoi(argv[++i]);
|
||||
if(temp>=0)
|
||||
{
|
||||
warmup=temp;
|
||||
printf("Warmup runs = %d\n\n", warmup);
|
||||
}
|
||||
double temp=atof(argv[++i]);
|
||||
if(temp>=0.0) warmup=temp;
|
||||
else usage(argv[0]);
|
||||
printf("Warmup time = %.1f seconds\n\n", warmup);
|
||||
}
|
||||
if(!strcmp(argv[i], "-?")) usage(argv[0]);
|
||||
if(!strcasecmp(argv[i], "-alloc")) flags&=(~TJFLAG_NOREALLOC);
|
||||
|
||||
19
transupp.c
19
transupp.c
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1997-2011, Thomas G. Lane, Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2010, D. R. Commander.
|
||||
* Copyright (C) 2010, 2017, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -1177,7 +1177,6 @@ transpose_critical_parameters (j_compress_ptr dstinfo)
|
||||
* We try to adjust the Tags ExifImageWidth and ExifImageHeight if possible.
|
||||
*/
|
||||
|
||||
#if JPEG_LIB_VERSION >= 70
|
||||
LOCAL(void)
|
||||
adjust_exif_parameters (JOCTET *data, unsigned int length,
|
||||
JDIMENSION new_width, JDIMENSION new_height)
|
||||
@@ -1327,7 +1326,6 @@ adjust_exif_parameters (JOCTET *data, unsigned int length,
|
||||
offset += 12;
|
||||
} while (--number_of_tags);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Adjust output image parameters as needed.
|
||||
@@ -1384,7 +1382,7 @@ jtransform_adjust_parameters (j_decompress_ptr srcinfo,
|
||||
/* Correct the destination's image dimensions as necessary
|
||||
* for rotate/flip, resize, and crop operations.
|
||||
*/
|
||||
#if JPEG_LIB_VERSION >= 70
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
dstinfo->jpeg_width = info->output_width;
|
||||
dstinfo->jpeg_height = info->output_height;
|
||||
#endif
|
||||
@@ -1395,14 +1393,14 @@ jtransform_adjust_parameters (j_decompress_ptr srcinfo,
|
||||
case JXFORM_TRANSVERSE:
|
||||
case JXFORM_ROT_90:
|
||||
case JXFORM_ROT_270:
|
||||
#if JPEG_LIB_VERSION < 70
|
||||
#if JPEG_LIB_VERSION < 80
|
||||
dstinfo->image_width = info->output_height;
|
||||
dstinfo->image_height = info->output_width;
|
||||
#endif
|
||||
transpose_critical_parameters(dstinfo);
|
||||
break;
|
||||
default:
|
||||
#if JPEG_LIB_VERSION < 70
|
||||
#if JPEG_LIB_VERSION < 80
|
||||
dstinfo->image_width = info->output_width;
|
||||
dstinfo->image_height = info->output_height;
|
||||
#endif
|
||||
@@ -1421,14 +1419,21 @@ jtransform_adjust_parameters (j_decompress_ptr srcinfo,
|
||||
GETJOCTET(srcinfo->marker_list->data[5]) == 0) {
|
||||
/* Suppress output of JFIF marker */
|
||||
dstinfo->write_JFIF_header = FALSE;
|
||||
#if JPEG_LIB_VERSION >= 70
|
||||
/* Adjust Exif image parameters */
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
if (dstinfo->jpeg_width != srcinfo->image_width ||
|
||||
dstinfo->jpeg_height != srcinfo->image_height)
|
||||
/* Align data segment to start of TIFF structure for parsing */
|
||||
adjust_exif_parameters(srcinfo->marker_list->data + 6,
|
||||
srcinfo->marker_list->data_length - 6,
|
||||
dstinfo->jpeg_width, dstinfo->jpeg_height);
|
||||
#else
|
||||
if (dstinfo->image_width != srcinfo->image_width ||
|
||||
dstinfo->image_height != srcinfo->image_height)
|
||||
/* Align data segment to start of TIFF structure for parsing */
|
||||
adjust_exif_parameters(srcinfo->marker_list->data + 6,
|
||||
srcinfo->marker_list->data_length - 6,
|
||||
dstinfo->image_width, dstinfo->image_height);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
79
turbojpeg.c
79
turbojpeg.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2009-2016 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2009-2017 D. R. Commander. All Rights Reserved.
|
||||
* mozjpeg Modifications:
|
||||
* Copyright (C) 2014, Mozilla Corporation.
|
||||
*
|
||||
@@ -780,13 +780,6 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, const unsigned char *srcBuf,
|
||||
|| jpegSubsamp<0 || jpegSubsamp>=NUMSUBOPT || jpegQual<0 || jpegQual>100)
|
||||
_throw("tjCompress2(): Invalid argument");
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
if(pitch==0) pitch=width*tjPixelSize[pixelFormat];
|
||||
|
||||
#ifndef JCS_EXTENSIONS
|
||||
@@ -799,6 +792,16 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, const unsigned char *srcBuf,
|
||||
}
|
||||
#endif
|
||||
|
||||
if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*height))==NULL)
|
||||
_throw("tjCompress2(): Memory allocation failure");
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
cinfo->image_width=width;
|
||||
cinfo->image_height=height;
|
||||
|
||||
@@ -815,8 +818,6 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, const unsigned char *srcBuf,
|
||||
return -1;
|
||||
|
||||
jpeg_start_compress(cinfo, TRUE);
|
||||
if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*height))==NULL)
|
||||
_throw("tjCompress2(): Memory allocation failure");
|
||||
for(i=0; i<height; i++)
|
||||
{
|
||||
if(flags&TJFLAG_BOTTOMUP)
|
||||
@@ -896,13 +897,6 @@ DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle,
|
||||
if(subsamp!=TJSAMP_GRAY && (!dstPlanes[1] || !dstPlanes[2]))
|
||||
_throw("tjEncodeYUVPlanes(): Invalid argument");
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
if(pixelFormat==TJPF_CMYK)
|
||||
_throw("tjEncodeYUVPlanes(): Cannot generate YUV images from CMYK pixels");
|
||||
|
||||
@@ -918,6 +912,13 @@ DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle,
|
||||
}
|
||||
#endif
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
cinfo->image_width=width;
|
||||
cinfo->image_height=height;
|
||||
|
||||
@@ -994,6 +995,13 @@ DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle,
|
||||
}
|
||||
}
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
for(row=0; row<ph0; row+=cinfo->max_v_samp_factor)
|
||||
{
|
||||
(*cinfo->cconvert->color_convert)(cinfo, &row_pointer[row], tmpbuf, 0,
|
||||
@@ -1168,6 +1176,13 @@ DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle,
|
||||
}
|
||||
}
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
for(row=0; row<(int)cinfo->image_height;
|
||||
row+=cinfo->max_v_samp_factor*DCTSIZE)
|
||||
{
|
||||
@@ -1446,6 +1461,12 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle,
|
||||
if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)
|
||||
*dinfo->output_height))==NULL)
|
||||
_throw("tjDecompress2(): Memory allocation failure");
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
for(i=0; i<(int)dinfo->output_height; i++)
|
||||
{
|
||||
if(flags&TJFLAG_BOTTOMUP)
|
||||
@@ -1668,6 +1689,13 @@ DLLEXPORT int DLLCALL tjDecodeYUVPlanes(tjhandle handle,
|
||||
}
|
||||
}
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
for(row=0; row<ph0; row+=dinfo->max_v_samp_factor)
|
||||
{
|
||||
JDIMENSION inrow=0, outrow=0;
|
||||
@@ -1848,6 +1876,13 @@ DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle,
|
||||
}
|
||||
}
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
if(flags&TJFLAG_FASTUPSAMPLE) dinfo->do_fancy_upsampling=FALSE;
|
||||
if(flags&TJFLAG_FASTDCT) dinfo->dct_method=JDCT_FASTEST;
|
||||
dinfo->raw_data_out=TRUE;
|
||||
@@ -2025,6 +2060,11 @@ DLLEXPORT int DLLCALL tjTransform(tjhandle handle,
|
||||
else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
|
||||
else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
|
||||
|
||||
if((xinfo=(jpeg_transform_info *)malloc(sizeof(jpeg_transform_info)*n))
|
||||
==NULL)
|
||||
_throw("tjTransform(): Memory allocation failure");
|
||||
MEMZERO(xinfo, sizeof(jpeg_transform_info)*n);
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
@@ -2034,11 +2074,6 @@ DLLEXPORT int DLLCALL tjTransform(tjhandle handle,
|
||||
|
||||
jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize);
|
||||
|
||||
if((xinfo=(jpeg_transform_info *)malloc(sizeof(jpeg_transform_info)*n))
|
||||
==NULL)
|
||||
_throw("tjTransform(): Memory allocation failure");
|
||||
MEMZERO(xinfo, sizeof(jpeg_transform_info)*n);
|
||||
|
||||
for(i=0; i<n; i++)
|
||||
{
|
||||
xinfo[i].transform=xformtypes[t[i].op];
|
||||
|
||||
36
turbojpeg.h
36
turbojpeg.h
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2009-2015 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2009-2015, 2017 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:
|
||||
@@ -358,11 +358,11 @@ enum TJCS
|
||||
*/
|
||||
#define TJFLAG_FASTUPSAMPLE 256
|
||||
/**
|
||||
* Disable buffer (re)allocation. If passed to #tjCompress2() or
|
||||
* #tjTransform(), this flag will cause those functions to generate an error if
|
||||
* the JPEG image buffer is invalid or too small rather than attempting to
|
||||
* allocate or reallocate that buffer. This reproduces the behavior of earlier
|
||||
* versions of TurboJPEG.
|
||||
* Disable buffer (re)allocation. If passed to one of the JPEG compression or
|
||||
* transform functions, this flag will cause those functions to generate an
|
||||
* error if the JPEG image buffer is invalid or too small rather than
|
||||
* attempting to allocate or reallocate that buffer. This reproduces the
|
||||
* behavior of earlier versions of TurboJPEG.
|
||||
*/
|
||||
#define TJFLAG_NOREALLOC 1024
|
||||
/**
|
||||
@@ -645,7 +645,7 @@ DLLEXPORT tjhandle DLLCALL tjInitCompress(void);
|
||||
* for you, or
|
||||
* -# pre-allocate the buffer to a "worst case" size determined by calling
|
||||
* #tjBufSize(). This should ensure that the buffer never has to be
|
||||
* re-allocated (setting #TJFLAG_NOREALLOC guarantees this.)
|
||||
* re-allocated (setting #TJFLAG_NOREALLOC guarantees that it won't be.)
|
||||
* .
|
||||
* If you choose option 1, <tt>*jpegSize</tt> should be set to the size of your
|
||||
* pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC,
|
||||
@@ -713,7 +713,7 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, const unsigned char *srcBuf,
|
||||
* for you, or
|
||||
* -# pre-allocate the buffer to a "worst case" size determined by calling
|
||||
* #tjBufSize(). This should ensure that the buffer never has to be
|
||||
* re-allocated (setting #TJFLAG_NOREALLOC guarantees this.)
|
||||
* re-allocated (setting #TJFLAG_NOREALLOC guarantees that it won't be.)
|
||||
* .
|
||||
* If you choose option 1, <tt>*jpegSize</tt> should be set to the size of your
|
||||
* pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC,
|
||||
@@ -783,7 +783,7 @@ DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle,
|
||||
* for you, or
|
||||
* -# pre-allocate the buffer to a "worst case" size determined by calling
|
||||
* #tjBufSize(). This should ensure that the buffer never has to be
|
||||
* re-allocated (setting #TJFLAG_NOREALLOC guarantees this.)
|
||||
* re-allocated (setting #TJFLAG_NOREALLOC guarantees that it won't be.)
|
||||
* .
|
||||
* If you choose option 1, <tt>*jpegSize</tt> should be set to the size of your
|
||||
* pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC,
|
||||
@@ -1392,9 +1392,13 @@ DLLEXPORT tjhandle DLLCALL tjInitTransform(void);
|
||||
* -# set <tt>dstBufs[i]</tt> to NULL to tell TurboJPEG to allocate the buffer
|
||||
* for you, or
|
||||
* -# pre-allocate the buffer to a "worst case" size determined by calling
|
||||
* #tjBufSize() with the transformed or cropped width and height. This should
|
||||
* ensure that the buffer never has to be re-allocated (setting
|
||||
* #TJFLAG_NOREALLOC guarantees this.)
|
||||
* #tjBufSize() with the transformed or cropped width and height. Under normal
|
||||
* circumstances, this should ensure that the buffer never has to be
|
||||
* re-allocated (setting #TJFLAG_NOREALLOC guarantees that it won't be.) Note,
|
||||
* however, that there are some rare cases (such as transforming images with a
|
||||
* large amount of embedded EXIF or ICC profile data) in which the output image
|
||||
* will be larger than the worst-case size, and #TJFLAG_NOREALLOC cannot be
|
||||
* used in those cases.
|
||||
* .
|
||||
* If you choose option 1, <tt>dstSizes[i]</tt> should be set to the size of
|
||||
* your pre-allocated buffer. In any case, unless you have set
|
||||
@@ -1435,8 +1439,8 @@ DLLEXPORT int DLLCALL tjDestroy(tjhandle handle);
|
||||
|
||||
/**
|
||||
* Allocate an image buffer for use with TurboJPEG. You should always use
|
||||
* this function to allocate the JPEG destination buffer(s) for #tjCompress2()
|
||||
* and #tjTransform() unless you are disabling automatic buffer
|
||||
* this function to allocate the JPEG destination buffer(s) for the compression
|
||||
* and transform functions unless you are disabling automatic buffer
|
||||
* (re)allocation (by setting #TJFLAG_NOREALLOC.)
|
||||
*
|
||||
* @param bytes the number of bytes to allocate
|
||||
@@ -1452,8 +1456,8 @@ DLLEXPORT unsigned char* DLLCALL tjAlloc(int bytes);
|
||||
/**
|
||||
* Free an image buffer previously allocated by TurboJPEG. You should always
|
||||
* use this function to free JPEG destination buffer(s) that were automatically
|
||||
* (re)allocated by #tjCompress2() or #tjTransform() or that were manually
|
||||
* allocated using #tjAlloc().
|
||||
* (re)allocated by the compression and transform functions or that were
|
||||
* manually allocated using #tjAlloc().
|
||||
*
|
||||
* @param buffer address of the buffer to free
|
||||
*
|
||||
|
||||
35
usage.txt
35
usage.txt
@@ -212,7 +212,7 @@ Switches for advanced users:
|
||||
large images. Value is in thousands of bytes, or
|
||||
millions of bytes if "M" is attached to the number.
|
||||
For example, -max 4m selects 4000000 bytes. If more
|
||||
space is needed, temporary files will be used.
|
||||
space is needed, an error will occur.
|
||||
|
||||
-verbose Enable debug printout. More -v's give more printout.
|
||||
or -debug Also, version information is printed at startup.
|
||||
@@ -372,7 +372,7 @@ Switches for advanced users:
|
||||
large images. Value is in thousands of bytes, or
|
||||
millions of bytes if "M" is attached to the number.
|
||||
For example, -max 4m selects 4000000 bytes. If more
|
||||
space is needed, temporary files will be used.
|
||||
space is needed, an error will occur.
|
||||
|
||||
-verbose Enable debug printout. More -v's give more printout.
|
||||
or -debug Also, version information is printed at startup.
|
||||
@@ -418,11 +418,6 @@ When producing a color-quantized image, "-onepass -dither ordered" is fast but
|
||||
much lower quality than the default behavior. "-dither none" may give
|
||||
acceptable results in two-pass mode, but is seldom tolerable in one-pass mode.
|
||||
|
||||
Two-pass color quantization requires a good deal of memory; on MS-DOS machines
|
||||
it may run out of memory even with -maxmemory 0. In that case you can still
|
||||
decompress, with some loss of image quality, by specifying -onepass for
|
||||
one-pass quantization.
|
||||
|
||||
To avoid the Unisys LZW patent (now expired), djpeg produces uncompressed GIF
|
||||
files. These are larger than they should be, but are readable by standard GIF
|
||||
decoders.
|
||||
@@ -430,24 +425,9 @@ decoders.
|
||||
|
||||
HINTS FOR BOTH PROGRAMS
|
||||
|
||||
If more space is needed than will fit in the available main memory (as
|
||||
determined by -maxmemory), temporary files will be used. (MS-DOS versions
|
||||
will try to get extended or expanded memory first.) The temporary files are
|
||||
often rather large: in typical cases they occupy three bytes per pixel, for
|
||||
example 3*800*600 = 1.44Mb for an 800x600 image. If you don't have enough
|
||||
free disk space, leave out -progressive and -optimize (for cjpeg) or specify
|
||||
-onepass (for djpeg).
|
||||
|
||||
On MS-DOS, the temporary files are created in the directory named by the TMP
|
||||
or TEMP environment variable, or in the current directory if neither of those
|
||||
exist. Amiga implementations put the temp files in the directory named by
|
||||
JPEGTMP:, so be sure to assign JPEGTMP: to a disk partition with adequate free
|
||||
space.
|
||||
|
||||
The default memory usage limit (-maxmemory) is set when the software is
|
||||
compiled. If you get an "insufficient memory" error, try specifying a smaller
|
||||
-maxmemory value, even -maxmemory 0 to use the absolute minimum space. You
|
||||
may want to recompile with a smaller default value if this happens often.
|
||||
If the memory needed by cjpeg or djpeg exceeds the limit specified by
|
||||
-maxmemory, an error will occur. You can leave out -progressive and -optimize
|
||||
(for cjpeg) or specify -onepass (for djpeg) to reduce memory usage.
|
||||
|
||||
On machines that have "environment" variables, you can define the environment
|
||||
variable JPEGMEM to set the default memory limit. The value is specified as
|
||||
@@ -455,11 +435,6 @@ described for the -maxmemory switch. JPEGMEM overrides the default value
|
||||
specified when the program was compiled, and itself is overridden by an
|
||||
explicit -maxmemory switch.
|
||||
|
||||
On MS-DOS machines, -maxmemory is the amount of main (conventional) memory to
|
||||
use. (Extended or expanded memory is also used if available.) Most
|
||||
DOS-specific versions of this software do their own memory space estimation
|
||||
and do not need you to specify -maxmemory.
|
||||
|
||||
|
||||
JPEGTRAN
|
||||
|
||||
|
||||
@@ -104,6 +104,8 @@ EXPORTS
|
||||
jzero_far @ 103 ;
|
||||
jpeg_mem_dest @ 104 ;
|
||||
jpeg_mem_src @ 105 ;
|
||||
jpeg_skip_scanlines @ 106 ;
|
||||
jpeg_crop_scanline @ 107 ;
|
||||
jpeg_c_bool_param_supported @ 200 ;
|
||||
jpeg_c_set_bool_param @ 201 ;
|
||||
jpeg_c_get_bool_param @ 202 ;
|
||||
|
||||
Reference in New Issue
Block a user