Studies show that GCC v5.1.0 performs as well as or better than v4.2, but v4.7.x-v4.9.x do not perform as well as v4.2.

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1571 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2015-06-20 16:20:53 +00:00
22 changed files with 270 additions and 135 deletions

View File

@@ -47,7 +47,7 @@ Build Requirements
code, relative to building libjpeg-turbo with GCC v4.2. If you are
running Snow Leopard or earlier, it is suggested that you continue to use
Xcode v3.2.6, which provides GCC v4.2. If you are using Lion or later, it
is suggested that you install Apple GCC v4.2 through MacPorts.
is suggested that you install Apple GCC v4.2 or GCC v5 through MacPorts.
-- If building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is
required. Some systems, such as Solaris 10 and later and Red Hat Enterprise

View File

@@ -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)

View File

@@ -43,6 +43,31 @@ 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
=====

View File

@@ -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

View File

@@ -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
;;
@@ -537,8 +543,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)

View File

@@ -1000,7 +1000,7 @@ Variables</h2></td></tr>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB, grayscale, or CMYK pixels to be compressed</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB, grayscale, or CMYK pixels to be compressed. This buffer is not modified.</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
<tr><td class="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
@@ -1098,7 +1098,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing a YUV planar image to be compressed. The size of this buffer should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing a YUV planar image to be compressed. The size of this buffer should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) This buffer is not modified.</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
<tr><td class="paramname">pad</td><td>the line padding used in the source image. For instance, if each line in each plane of the YUV image is padded to the nearest multiple of 4 bytes, then <code>pad</code> should be set to 4.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
@@ -1195,7 +1195,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
<tr><td class="paramname">srcPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
<tr><td class="paramname">srcPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details. These image planes are not modified.</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
<tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf" title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
@@ -1293,7 +1293,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) This buffer is not modified.</td></tr>
<tr><td class="paramname">pad</td><td>Use this parameter to specify that the width of each line in each plane of the YUV source image is padded to the nearest multiple of this number of bytes (must be a power of 2.)</td></tr>
<tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling used in the YUV source image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
<tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decoded image. This buffer should normally be <code>pitch * height</code> bytes in size, but the <code>dstBuf</code> pointer can also be used to decode into a specific region of a larger buffer.</td></tr>
@@ -1386,7 +1386,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
<tr><td class="paramname">srcPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
<tr><td class="paramname">srcPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by <a class="el" href="group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details. These image planes are not modified.</td></tr>
<tr><td class="paramname">strides</td><td>an array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.</td></tr>
<tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling used in the YUV source image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
<tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decoded image. This buffer should normally be <code>pitch * height</code> bytes in size, but the <code>dstBuf</code> pointer can also be used to decode into a specific region of a larger buffer.</td></tr>
@@ -1472,7 +1472,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress</td></tr>
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress. This buffer is not modified.</td></tr>
<tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
<tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decompressed image. This buffer should normally be <code>pitch * scaledHeight</code> bytes in size, where <code>scaledHeight</code> can be determined by calling <a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df" title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED()</a> with the JPEG image height and one of the scaling factors returned by <a class="el" href="group___turbo_j_p_e_g.html#ga6449044b9af402999ccf52f401333be8" title="Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of Tur...">tjGetScalingFactors()</a>. The <code>dstBuf</code> pointer may also be used to decompress into a specific region of a larger buffer.</td></tr>
<tr><td class="paramname">width</td><td>desired width (in pixels) of the destination image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size.</td></tr>
@@ -1545,7 +1545,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing a JPEG image</td></tr>
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing a JPEG image. This buffer is not modified.</td></tr>
<tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
<tr><td class="paramname">width</td><td>pointer to an integer variable that will receive the width (in pixels) of the JPEG image</td></tr>
<tr><td class="paramname">height</td><td>pointer to an integer variable that will receive the height (in pixels) of the JPEG image</td></tr>
@@ -1623,7 +1623,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress</td></tr>
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress. This buffer is not modified.</td></tr>
<tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
<tr><td class="paramname">dstBuf</td><td>pointer to an image buffer that will receive the YUV image. Use <a class="el" href="group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> to determine the appropriate size for this buffer based on the image width, height, padding, and level of subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
<tr><td class="paramname">width</td><td>desired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
@@ -1702,7 +1702,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG decompressor or transformer instance</td></tr>
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress</td></tr>
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG image to decompress. This buffer is not modified.</td></tr>
<tr><td class="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
<tr><td class="paramname">dstPlanes</td><td>an array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Use <a class="el" href="group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2" title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> to determine the appropriate size for each plane based on the scaled image width, scaled image height, strides, and level of chrominance subsampling. Refer to <a class="el" href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
<tr><td class="paramname">width</td><td>desired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c" title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
@@ -1818,7 +1818,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be encoded</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be encoded. This buffer is not modified.</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
<tr><td class="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
@@ -1911,7 +1911,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be encoded</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to an image buffer containing RGB or grayscale pixels to be encoded. This buffer is not modified.</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
<tr><td class="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511" title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
@@ -2264,7 +2264,7 @@ If you choose option 1, <code>*jpegSize</code> should be set to the size of your
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>a handle to a TurboJPEG transformer instance</td></tr>
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG source image to transform</td></tr>
<tr><td class="paramname">jpegBuf</td><td>pointer to a buffer containing the JPEG source image to transform. This buffer is not modified.</td></tr>
<tr><td class="paramname">jpegSize</td><td>size of the JPEG source image (in bytes)</td></tr>
<tr><td class="paramname">n</td><td>the number of transformed JPEG images to generate</td></tr>
<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">

View File

@@ -474,7 +474,7 @@ public&nbsp;TJCompressor(byte[]&nbsp;srcImage,
<div class="block">Associate an uncompressed RGB, grayscale, or CMYK source image with this
compressor instance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - image buffer containing RGB, grayscale, or CMYK pixels to
be compressed or encoded</dd><dd><code>x</code> - x offset (in pixels) of the region in the source image from which
be compressed or encoded. This buffer is not modified.</dd><dd><code>x</code> - x offset (in pixels) of the region in the source image from which
the JPEG or YUV image should be compressed/encoded</dd><dd><code>y</code> - y offset (in pixels) of the region in the source image from which
the JPEG or YUV image should be compressed/encoded</dd><dd><code>width</code> - width (in pixels) of the region in the source image from
which the JPEG or YUV image should be compressed/encoded</dd><dd><code>pitch</code> - bytes per line of the source image. Normally, this should be
@@ -525,7 +525,7 @@ public&nbsp;void&nbsp;setSourceImage(byte[]&nbsp;srcImage,
<div class="block">Associate an uncompressed RGB or grayscale source image with this
compressor instance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - a <code>BufferedImage</code> instance containing RGB or
grayscale pixels to be compressed or encoded</dd><dd><code>x</code> - x offset (in pixels) of the region in the source image from which
grayscale pixels to be compressed or encoded. This image is not modified.</dd><dd><code>x</code> - x offset (in pixels) of the region in the source image from which
the JPEG or YUV image should be compressed/encoded</dd><dd><code>y</code> - y offset (in pixels) of the region in the source image from which
the JPEG or YUV image should be compressed/encoded</dd><dd><code>width</code> - width (in pixels) of the region in the source image from
which the JPEG or YUV image should be compressed/encoded (0 = use the
@@ -546,7 +546,8 @@ public&nbsp;void&nbsp;setSourceImage(byte[]&nbsp;srcImage,
throws java.lang.Exception</pre>
<div class="block">Associate an uncompressed YUV planar source image with this compressor
instance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - YUV planar image to be compressed</dd>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - YUV planar image to be compressed. This image is not
modified.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>

View File

@@ -546,7 +546,7 @@ extends java.lang.Object</pre>
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
image stored in <code>jpegImage</code> with the newly created instance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer (size of the JPEG image is assumed to
be the length of the array)</dd>
be the length of the array.) This buffer is not modified.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
@@ -563,7 +563,7 @@ extends java.lang.Object</pre>
<div class="block">Create a TurboJPEG decompressor instance and associate the JPEG source
image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with the newly created instance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer. This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
@@ -580,7 +580,7 @@ extends java.lang.Object</pre>
source image stored in <code>yuvImage</code> with the newly created
instance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>yuvImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing a YUV planar
image to be decoded</dd>
image to be decoded. This image is not modified.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
@@ -605,7 +605,7 @@ extends java.lang.Object</pre>
<div class="block">Associate the JPEG image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with this decompressor instance. This image will
be used as the source image for subsequent decompress operations.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer. This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
@@ -637,7 +637,7 @@ public&nbsp;void&nbsp;setJPEGImage(byte[]&nbsp;jpegImage,
instance. Subsequent decompress operations will decode this image into an
RGB or grayscale destination image.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing a YUV planar image to
be decoded</dd>
be decoded. This image is not modified.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>

View File

@@ -245,7 +245,7 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
image stored in <code>jpegImage</code> with the newly created instance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer (size of the JPEG image is assumed to
be the length of the array)</dd>
be the length of the array.) This buffer is not modified.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
@@ -262,7 +262,7 @@ extends <a href="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title=
<div class="block">Create a TurboJPEG lossless transformer instance and associate the JPEG
image of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with the newly created instance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>jpegImage</code> - JPEG image buffer. This buffer is not modified.</dd><dd><code>imageSize</code> - size of the JPEG image (in bytes)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>

View File

@@ -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:
@@ -111,7 +111,7 @@ public class TJCompressor {
* compressor instance.
*
* @param srcImage image buffer containing RGB, grayscale, or CMYK pixels to
* be compressed or encoded
* be compressed or encoded. This buffer is not modified.
*
* @param x x offset (in pixels) of the region in the source image from which
* the JPEG or YUV image should be compressed/encoded
@@ -174,7 +174,7 @@ public class TJCompressor {
* compressor instance.
*
* @param srcImage a <code>BufferedImage</code> instance containing RGB or
* grayscale pixels to be compressed or encoded
* grayscale pixels to be compressed or encoded. This image is not modified.
*
* @param x x offset (in pixels) of the region in the source image from which
* the JPEG or YUV image should be compressed/encoded
@@ -259,7 +259,8 @@ public class TJCompressor {
* Associate an uncompressed YUV planar source image with this compressor
* instance.
*
* @param srcImage YUV planar image to be compressed
* @param srcImage YUV planar image to be compressed. This image is not
* modified.
*/
public void setSourceImage(YUVImage srcImage) throws Exception {
if (handle == 0) init();

View File

@@ -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:
@@ -51,7 +51,7 @@ public class TJDecompressor {
* image stored in <code>jpegImage</code> with the newly created instance.
*
* @param jpegImage JPEG image buffer (size of the JPEG image is assumed to
* be the length of the array)
* be the length of the array.) This buffer is not modified.
*/
public TJDecompressor(byte[] jpegImage) throws Exception {
init();
@@ -63,7 +63,7 @@ public class TJDecompressor {
* image of length <code>imageSize</code> bytes stored in
* <code>jpegImage</code> with the newly created instance.
*
* @param jpegImage JPEG image buffer
* @param jpegImage JPEG image buffer. This buffer is not modified.
*
* @param imageSize size of the JPEG image (in bytes)
*/
@@ -78,7 +78,7 @@ public class TJDecompressor {
* instance.
*
* @param yuvImage {@link YUVImage} instance containing a YUV planar
* image to be decoded
* image to be decoded. This image is not modified.
*/
public TJDecompressor(YUVImage yuvImage) throws Exception {
init();
@@ -90,7 +90,7 @@ public class TJDecompressor {
* <code>jpegImage</code> with this decompressor instance. This image will
* be used as the source image for subsequent decompress operations.
*
* @param jpegImage JPEG image buffer
* @param jpegImage JPEG image buffer. This buffer is not modified.
*
* @param imageSize size of the JPEG image (in bytes)
*/
@@ -118,7 +118,7 @@ public class TJDecompressor {
* RGB or grayscale destination image.
*
* @param srcImage {@link YUVImage} instance containing a YUV planar image to
* be decoded
* be decoded. This image is not modified.
*/
public void setSourceImage(YUVImage srcImage) throws Exception {
if (srcImage == null)

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011, 2013-2014 D. R. Commander. All Rights Reserved.
* Copyright (C)2011, 2013-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:
@@ -45,7 +45,7 @@ public class TJTransformer extends TJDecompressor {
* image stored in <code>jpegImage</code> with the newly created instance.
*
* @param jpegImage JPEG image buffer (size of the JPEG image is assumed to
* be the length of the array)
* be the length of the array.) This buffer is not modified.
*/
public TJTransformer(byte[] jpegImage) throws Exception {
init();
@@ -57,7 +57,7 @@ public class TJTransformer extends TJDecompressor {
* image of length <code>imageSize</code> bytes stored in
* <code>jpegImage</code> with the newly created instance.
*
* @param jpegImage JPEG image buffer
* @param jpegImage JPEG image buffer. This buffer is not modified.
*
* @param imageSize size of the JPEG image (in bytes)
*/

View File

@@ -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)<<nbits) - 1;
/* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */
PUT_BITS(temp2, nbits)
CHECKBUF15()
EMIT_BITS(temp2, nbits)
/* Encode the AC coefficients per section F.1.2.2 */

View File

@@ -68,3 +68,6 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* The size of `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T

View File

@@ -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 \

View File

@@ -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 */

View File

@@ -88,7 +88,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' > $@

View File

@@ -13,7 +13,7 @@
; can *not* be assembled with Microsoft's MASM or any compatible
; assembler (including Borland's Turbo Assembler).
; NASM is available from http://nasm.sourceforge.net/ or
; http://sourceforge.net/projecpt/showfiles.php?group_id=6208
; http://sourceforge.net/project/showfiles.php?group_id=6208
;
; This file contains a fast, not so accurate integer implementation of
; the inverse DCT (Discrete Cosine Transform). The following code is

View File

@@ -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:

View File

@@ -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"

View File

@@ -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;
}

View File

@@ -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:
@@ -619,7 +619,7 @@ DLLEXPORT tjhandle DLLCALL tjInitCompress(void);
* @param handle a handle to a TurboJPEG compressor or transformer instance
*
* @param srcBuf pointer to an image buffer containing RGB, grayscale, or
* CMYK pixels to be compressed
* CMYK pixels to be compressed. This buffer is not modified.
*
* @param width width (in pixels) of the source image
*
@@ -687,7 +687,7 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf,
* #tjBufSizeYUV2() for the given image width, height, padding, and level of
* chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be
* stored sequentially in the source buffer (refer to @ref YUVnotes
* "YUV Image Format Notes".)
* "YUV Image Format Notes".) This buffer is not modified.
*
* @param width width (in pixels) of the source image. If the width is not an
* even multiple of the MCU block width (see #tjMCUWidth), then an intermediate
@@ -752,7 +752,7 @@ DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle, unsigned char *srcBuf,
* memory. The size of each plane should match the value returned by
* #tjPlaneSizeYUV() for the given image width, height, strides, and level of
* chrominance subsampling. Refer to @ref YUVnotes "YUV Image Format Notes"
* for more details.
* for more details. These image planes are not modified.
*
* @param width width (in pixels) of the source image. If the width is not an
* even multiple of the MCU block width (see #tjMCUWidth), then an intermediate
@@ -762,7 +762,7 @@ DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle, unsigned char *srcBuf,
* line in the corresponding plane of the YUV source image. Setting the stride
* for any plane to 0 is the same as setting it to the plane width (see
* @ref YUVnotes "YUV Image Format Notes".) If <tt>strides</tt> is NULL, then
* the strides for all planes will be set to their respective plane widths.
* the strides for all planes will be set to their respective plane widths.
* You can adjust the strides in order to specify an arbitrary amount of line
* padding in each plane or to create a JPEG image from a subregion of a larger
* YUV planar image.
@@ -921,12 +921,12 @@ DLLEXPORT int tjPlaneHeight(int componentID, int height, int subsamp);
* Encode an RGB or grayscale image into a YUV planar image. This function
* uses the accelerated color conversion routines in the underlying
* codec but does not execute any of the other steps in the JPEG compression
* process.
* process.
*
* @param handle a handle to a TurboJPEG compressor or transformer instance
*
* @param srcBuf pointer to an image buffer containing RGB or grayscale pixels
* to be encoded
* to be encoded. This buffer is not modified.
*
* @param width width (in pixels) of the source image
*
@@ -979,7 +979,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle,
* @param handle a handle to a TurboJPEG compressor or transformer instance
*
* @param srcBuf pointer to an image buffer containing RGB or grayscale pixels
* to be encoded
* to be encoded. This buffer is not modified.
*
* @param width width (in pixels) of the source image
*
@@ -1042,7 +1042,8 @@ DLLEXPORT tjhandle DLLCALL tjInitDecompress(void);
*
* @param handle a handle to a TurboJPEG decompressor or transformer instance
*
* @param jpegBuf pointer to a buffer containing a JPEG image
* @param jpegBuf pointer to a buffer containing a JPEG image. This buffer is
* not modified.
*
* @param jpegSize size of the JPEG image (in bytes)
*
@@ -1085,7 +1086,8 @@ DLLEXPORT tjscalingfactor* DLLCALL tjGetScalingFactors(int *numscalingfactors);
*
* @param handle a handle to a TurboJPEG decompressor or transformer instance
*
* @param jpegBuf pointer to a buffer containing the JPEG image to decompress
* @param jpegBuf pointer to a buffer containing the JPEG image to decompress.
* This buffer is not modified.
*
* @param jpegSize size of the JPEG image (in bytes)
*
@@ -1141,7 +1143,8 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle,
*
* @param handle a handle to a TurboJPEG decompressor or transformer instance
*
* @param jpegBuf pointer to a buffer containing the JPEG image to decompress
* @param jpegBuf pointer to a buffer containing the JPEG image to decompress.
* This buffer is not modified.
*
* @param jpegSize size of the JPEG image (in bytes)
*
@@ -1191,7 +1194,8 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle,
*
* @param handle a handle to a TurboJPEG decompressor or transformer instance
*
* @param jpegBuf pointer to a buffer containing the JPEG image to decompress
* @param jpegBuf pointer to a buffer containing the JPEG image to decompress.
* This buffer is not modified.
*
* @param jpegSize size of the JPEG image (in bytes)
*
@@ -1253,7 +1257,7 @@ DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle,
* #tjBufSizeYUV2() for the given image width, height, padding, and level of
* chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be
* stored sequentially in the source buffer (refer to @ref YUVnotes
* "YUV Image Format Notes".)
* "YUV Image Format Notes".) This buffer is not modified.
*
* @param pad Use this parameter to specify that the width of each line in each
* plane of the YUV source image is padded to the nearest multiple of this
@@ -1306,7 +1310,7 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf,
* The size of each plane should match the value returned by #tjPlaneSizeYUV()
* for the given image width, height, strides, and level of chrominance
* subsampling. Refer to @ref YUVnotes "YUV Image Format Notes" for more
* details.
* details. These image planes are not modified.
*
* @param strides an array of integers, each specifying the number of bytes per
* line in the corresponding plane of the YUV source image. Setting the stride
@@ -1374,7 +1378,7 @@ DLLEXPORT tjhandle DLLCALL tjInitTransform(void);
* @param handle a handle to a TurboJPEG transformer instance
*
* @param jpegBuf pointer to a buffer containing the JPEG source image to
* transform
* transform. This buffer is not modified.
*
* @param jpegSize size of the JPEG source image (in bytes)
*